National Cyber Warfare Foundation (NCWF)login

skylos for local-first dead code, security and AI-defect scanning of Python pull requests


0 user ratings
2026-10-23 13:28:04
milo
Red Team (CNA)
"skylos

skylos is an open-source, account-free CLI and PR gate that finds dead code, security bugs, secrets and AI-generated code mistakes, built for authorized maintainers reviewing agent-written branches.








Toolduriantaco/skylos — local-first CLI and pull-request gate for dead code, security, secrets, dependency and AI-code checks
CategoryStatic analysis / SAST and code-quality tooling
Primary UseRunning skylos . -a for dead-code, security, secrets, CVE and AI-defect findings, and skylos done --base main to verify agent branches before merge
Safe UseAnalyzing your own repositories or projects you are authorized to assess, as part of CI review, maintenance and defensive code audits
Telemetry NoteRuns locally by default; suite does not upload unless --upload is set, but dependency scanning can query OSV, and image scan reaches remote registries via Trivy; receipts are written to .skylos/receipts/

skylos is an Apache-2.0 Python project, around 840 stars at the time of this writing, that positions itself as a local-first static analysis CLI and pull-request gate requiring no account. The core invocation skylos . scans a source tree for dead code — unused functions, classes, imports and empty files — while adding -a extends the run to security bugs, hard-coded secrets, vulnerable dependencies, code-quality regressions and AI-generated code mistakes. Every finding is reported with source locations and supporting analysis, and the project deliberately brands itself around the idea of checks that "show their work." What makes it interesting to a security audience is not just the SAST surface but the explicit targeting of a very modern workflow: teams merging pull requests written by AI coding agents like Claude Code, Codex and Cursor.


The flagship command for that workflow is skylos done --base main. It answers a question most CI gates cannot: did the agent actually finish the branch? It compares the branch against its merge base on main, runs the project's tests (pytest is detected automatically; other runners need a test_command line under [tool.skylos.done]), and flags a pattern of shortcuts that agent-authored code is notorious for — deleted or skipped tests, loosened CI test steps, silenced lint or type checks, and test-only special cases. It also advises on code the branch left without callers, including in files it never touched, and writes a receipt to .skylos/receipts/ so the gate leaves an auditable trace. When tests fail, it reruns them on the merge base and labels each failure as "introduced" or "already failing," which is a genuinely thoughtful distinction that prevents blaming a branch for pre-existing breakage while still blocking on every failure by default.


A subtle anti-tampering detail deserves attention: skylos done reads its settings from the base commit rather than the branch, so an agent cannot loosen its own gate by editing configuration in the PR. That is exactly the kind of adversarial thinking a review tool needs when the code under review may have been generated by a process optimizing for "make the check pass." The exit-code contract is also well specified: 0 on pass, 1 when a blocking check fails or does not finish, and 2 when skylos could not run at all, for example when the base ref is not fetched.


Language coverage is tiered and honestly documented. Python gets the deepest analysis across dead code, security, quality and AI defects. TypeScript/JavaScript and Java receive dead-code, security and quality checks; PHP and Dart get dead-code and security; Rust security checks are stable while Rust dead code is experimental and hidden below the default confidence threshold, surfaced with --confidence 40. Go support requires the native skylos-go engine, which from version 4.50 ships inside the PyPI wheels for Linux, macOS and Windows on x86_64 and arm64, in the container image, and is built by the GitHub Action; elsewhere skylos doctor prints the build command and SKYLOS_GO_BIN can point at a separately compiled engine. C# is partial, Kotlin is dead-code-only, C++ covers unused file-local functions, and Shell gets security checks only — a refreshingly precise support matrix.


The output model is one of the more unusual design decisions. Instead of a blended A–F grade, newer scans produce four readouts the README summarizes as Risk, Maintainability, Dead code and Gate. Risk reports the highest unresolved severity with counts, and critically, one critical finding stays critical regardless of repository size — no dilution by volume. Finding type is deliberately separated from severity: a Defect is a concrete correctness pattern, Review needs human context, and Advice concerns maintainability or tooling, and the README is explicit that a Review finding can still be critical. Grouping of advice cannot improve the assessment or bypass the gate, which again reads like a defense against output that flatters the code it just analyzed.


On evidence quality, skylos is careful in ways that matter to professionals. Security findings include recorded source-to-sink evidence where available, with partial static analysis labeled as such, and the tool explicitly does not claim runtime exploitability or a complete installed environment. Dependency scanning names unresolved versions and the inputs it would need to check them; for uv.lock, Git, URL, path and private-index dependencies are reported as not checked rather than silently passed, and that coverage gap alone does not cause exit 2. The image scan subcommand delegates to a separately installed Trivy on trusted PATH, scans a remote registry image referenced by digest (IMAGE@sha256: with optional --platform os/arch), and only becomes a gate with --fail-on — otherwise a completed scan exits 0 even while reporting vulnerabilities.


The AI-defect surface is where skylos departs from traditional linters. skylos . --ai-defects runs only the evidence-backed checks for common machine-generated mistakes: missing guards, fake helper functions, invented package APIs and impossible dependency versions. skylos verify adds a separate behavior comparison that models supported Python working-tree changes against git HEAD, and skylos agent verify optionally routes dead-code findings to an LLM or a hybrid Jev-only / Jev-plus-LLM review. For teams shipping LLM applications, skylos defend inspects recognized Python and TypeScript/JavaScript LLM integrations for deployment guardrails such as unsafe tool use and missing output validation — notable given the repo's own tagging with prompt-injection, a topic relevant to defensive analysis of agentic systems. The related preflight command checks whether a local GPU build fits deployment targets described in .skylos/gpu-targets.yml.


There is also a remediation path, not just detection: skylos clean [PATH] --dry-run proposes Python import and function removals, with --dry-run guaranteed to never write; without it the command is interactive and requires final confirmation, and the README warns that an apply pass still exits 0 if an individual edit fails, so the completion output should be reviewed. Installation is straightforward via pip install skylos, with skylos[dart] as an optional extra since 4.47.2 (earlier installs pulled a Dart parser needing a C compiler), optional Rust acceleration built from source with Python fallbacks in the standard install, plus a GitHub Action, a container image, and a VS Code extension on the marketplace.


Credibility is addressed with an unusually transparent ledger: the README points to REAL_WORLD_RESULTS.md documenting 26 cleanup and quality-fix PRs, including 10 dead-code cleanups merged into the default branches of nine open-source projects — Black, NetworkX, Optuna, mitmproxy and pypdf among them — and, importantly, the ones that were closed, reverted or never merged. The project calls these accepted cleanup PRs rather than endorsements, and publishing the failures alongside the wins is a good sign of engineering honesty. Internationalization into German and Simplified Chinese, a public roadmap, benchmarks and a repo map round out a well-maintained documentation posture.


For an authorized workflow, the natural placement is as a pre-merge gate in CI: skylos . -a for the source tree, skylos done --base main for agent branches, and skylos suite when you want static analysis, technical debt, AI defense and provenance in one report-only view that stays local unless --upload is passed. Things to watch: dependency checks can query OSV, image scan requires registry network access, defend only becomes enforcing with --fail-on, --min-score or an explicit policy, and dead-code candidates should always be reviewed against dynamic calls and public APIs before deletion — the README says so itself. As a defensive and quality instrument for maintainers drowning in machine-generated pull requests, skylos earns its spot in the toolbox.



Official project repository for duriantaco/skylos.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/10/skylos-for-local-first-dead-code.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.