Thanks to visit codestin.com
Credit goes to docs.skylos.dev

Skip to main content

CLI Reference

Basic Usage

skylos <path> [options]

The <path> argument can be a directory (scans recursively) or a single file.

Commands

skylos init

Initialize Skylos configuration in the current directory.

skylos init

Creates or appends a [tool.skylos] section to pyproject.toml with default settings.

skylos run

Start the local analysis server with a web UI.

skylos run [--exclude-folder <folder>] [--include-folder <folder>] [--no-default-excludes]

Launches a Flask server at http://localhost:5000 for interactive analysis. Requires flask and flask-cors.

skylos whitelist

Manage the whitelist for suppressing false positives.

# Add a glob pattern
skylos whitelist 'handle_*'

# Add with reason (recommended for teams)
skylos whitelist my_func --reason "Called via registry lookup"

# View current whitelist
skylos whitelist --show
FlagDescription
--reason, -rAdd reason/documentation for the whitelist entry
--show, -sDisplay all current whitelist entries

Patterns are saved to [tool.skylos.whitelist] in pyproject.toml.

skylos <path>

Run static analysis on the specified path.

skylos . --danger --quality

Output Options

FlagDescription
--jsonOutput raw JSON to stdout
--output, -o <file>Write results to a file
--treeDisplay findings in a hierarchical tree format
--table(Deprecated) Display findings in table format

Analysis Flags

FlagDescription
--dangerEnable security vulnerability scanning
--secretsEnable API key and secret detection
--qualityEnable code quality checks (complexity, nesting, etc.)
--traceRun tests with call tracing to capture dynamic dispatch (visitor patterns, getattr, plugins)
--confidenceConfidence threshold (0-100). Lower values include more uncertain findings. Default: 60

Folder Exclusion

FlagDescription
--exclude-folder <folder>Exclude a folder from analysis. Can be used multiple times.
--include-folder <folder>Force include a folder that would otherwise be excluded.
--no-default-excludesDo not exclude default folders (__pycache__, .git, venv, etc.)
--list-default-excludesPrint the default excluded folders and exit

Example:

# Exclude tests and migrations, but include venv
skylos . --exclude-folder tests --exclude-folder migrations --include-folder venv

Interactive Mode

FlagDescription
--interactive, -iInteractively select which findings to act on
--dry-runShow what would be removed without making changes
--comment-outComment out dead code instead of deleting it

Interactive mode requires the inquirer package.

AI-Powered Features

FeatureCommandDescription
AI-Powered Analysisskylos agent analyze . --model gpt-4.1Hybrid static + LLM analysis with project context
AI Auditskylos agent security-audit .Deep LLM review with interactive file selection
Automated Repairskylos agent analyze . --fixLet the LLM fix what it found
PR Reviewskylos agent reviewAnalyze only git-changed files
Local LLMskylos agent analyze . --base-url http://localhost:11434/v1 --model codellamaUse Ollama/LM Studio (no API key needed)

You can use the --model flag to specify the model that you want. We support Gemini, Groq, Anthropic, ChatGPT and Mistral.

Credits

skylos credits

Check your credit balance, plan, and recent transactions.

skylos credits

Output:

[My Org] (pro plan)
Balance: 1,500 credits

Recent activity:
+10000 Purchased 10000 credits (team pack)
-1 Scan upload
-10 AI code remediation

Buy credits: https://skylos.dev/dashboard/billing

Requires skylos login first. See Billing & Credits for pricing.

CI/CD Commands

skylos cicd init

Generate a GitHub Actions workflow file for automated scanning.

skylos cicd init
FlagDefaultDescription
--python-version3.12Python version for the workflow
--triggerspull_request pushGitHub event triggers
--analysisdead-code security quality secretsAnalysis types to enable
--no-baselinefalseSkip baseline comparison
--llmfalseInclude LLM-enhanced analysis
--modelLLM model to use with --llm
--output, -o.github/workflows/skylos.ymlOutput file path

skylos cicd gate

Run the quality gate (exit code 0 = pass, 1 = fail). Use in CI to block merges.

skylos cicd gate --input skylos-report.json
FlagDescription
--input, -iRead results from a JSON report file
--strictFail on any issues found
--summaryWrite markdown summary to $GITHUB_STEP_SUMMARY

skylos cicd annotate

Emit GitHub Actions annotations (inline warnings/errors on PR diffs).

skylos cicd annotate --input skylos-report.json
FlagDescription
--input, -iJSON report file
--maxMaximum annotations (default: 50)
--severityFilter by severity: critical, high, medium, low

skylos cicd review

Post inline review comments on a pull request via the gh CLI.

skylos cicd review --input skylos-report.json --pr 42
FlagDescription
--input, -iJSON report file
--prPR number (auto-detected in CI)
--repoowner/repo (auto-detected in CI)
--summary-onlyPost only a summary comment, no inline comments
--max-commentsMaximum inline comments (default: 25)
--diff-baseBase branch for diff (default: origin/main)

Cloud & CI Flags

FlagDescription
--uploadUpload scan results to Skylos Cloud (requires skylos login first). Costs 1 credit.
--strictExit with code 1 if quality gate fails (use in CI to block merges)
--force, -fBypass quality gate locally (still uploads if --upload is set)

Runtime Analysis

FlagDescription
--traceRun pytest with sys.settrace() to record all function calls, reducing false positives from dynamic code

When to Use --trace

Use --trace when static analysis flags code you know is used:

  • Visitor patterns (visit_FunctionDef called via getattr)
  • Plugin hooks (pytest_configure, pytest_addoption)
  • Dynamic dispatch (getattr(obj, method_name)())
skylos . --trace
note

The .skylos_trace file is saved in your project root. Commit it to skip re-running tests on subsequent scans.

Quality Gate

skylos <path> --gate [command...]
FlagDescription
--gateRun as a quality gate. Blocks if thresholds are exceeded.

If the gate passes, Skylos either runs the provided command or launches the deployment wizard. If the gate fails, it shows reasons and (unless strict = true) offers a bypass prompt.

Example:

skylos . --danger --gate

Other Options

FlagDescription
--versionPrint version and exit
--verbose, -vEnable verbose logging

Exit Codes

CodeMeaning
0Success (no issues or gate passed)
1Failure (analysis error or gate failed)

AI-Powered Features (Deprecated)

FlagDescription
--fixUse AI to automatically fix detected issues
--auditDeep scan files using AI for logic and security review

These features require an API key. Skylos checks:

  1. Environment variables (OPENAI_API_KEY or ANTHROPIC_API_KEY)
  2. System keyring (saved from previous sessions)
  3. Interactive prompt (if neither is found)

Examples

Basic dead code scan:

skylos .

Full analysis with JSON output:

skylos . --danger --secrets --quality --json -o report.json

Interactive cleanup:

skylos . -i --dry-run

CI/CD gate that blocks on critical issues:

skylos . --danger --quality --gate

AI-powered audit of changed files:

skylos . --audit --model claude-sonnet-4-20250514

Whitelist a dynamic pattern:

skylos whitelist 'handle_*'
skylos whitelist --show