
Ruff Recursive Fix
Run Ruff in a scoped, iterative loop with safe and unsafe autofixes, diff review, and minimal noqa only when justified.
Overview
ruff-recursive-fix is an agent skill most often used in Ship (also Build) that iteratively runs Ruff checks, autofixes, and diff review until lint findings are resolved or escalated.
Install
npx skills add https://github.com/github/awesome-copilot --skill ruff-recursive-fixWhat is this skill?
- Optional scope to a folder or file; default reads rules from pyproject.toml
- Flexible runners: uv, ruff, python -m ruff, or pipx equivalents
- Per-run rule overrides via --select, --ignore, extend-select, and extend-ignore
- Automatic safe then optional unsafe autofix passes with diff review each iteration
- Recursive repeats until clean or user decision; judicious inline noqa when suppression is justified
- Supports safe then unsafe autofix passes per iteration
- Optional per-run rule overrides via select/ignore/extend flags
Adoption & trust: 1.1k installs on skills.sh; 34.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Python repo has dozens of Ruff violations and a single --fix pass either misses unsafe rules or changes too much without review.
Who is it for?
Indie Python maintainers who want agent-driven Ruff cleanup with scoped paths and rule overrides before merge.
Skip if: Non-Python codebases, teams that forbid unsafe autofixes entirely without agent supervision, or one-line typos better fixed manually.
When should I use this skill?
Python Ruff findings need controlled, iterative autofix with diff review and optional scope or rule overrides.
What do I get? / Deliverables
You get a reviewed sequence of autofix diffs, resolved violations, and only justified noqa suppressions left for explicit decisions.
- Iterative diff-reviewed autofix changes
- Resolved or explicitly escalated Ruff finding list
- Minimal justified # noqa annotations when needed
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Pre-merge quality enforcement sits in Ship review—the gate before customers see Python changes. Review captures controlled lint remediation with human-in-the-loop decisions after each autofix pass.
Where it fits
Scope Ruff to apps/api/ and loop autofixes until CI lint job passes.
Extend-select a new rule category after upgrading Ruff without touching unrelated packages.
Clean legacy violations in a maintenance branch with explicit noqa decisions only.
How it compares
Structured recursive Ruff workflow with diff gates—not a substitute for pytest or type-checking skills.
Common Questions / FAQ
Who is ruff-recursive-fix for?
Solo builders shipping Python apps who want their agent to run Ruff iteratively with reviewable diffs instead of one bulk autofix.
When should I use ruff-recursive-fix?
In Ship review before opening a PR; in Build backend when tightening lint after a feature branch; in Operate iterate when cleaning tech debt in a hotfix branch.
Is ruff-recursive-fix safe to install?
It edits source files on disk when autofix runs—review the Security Audits panel on this page and use version control so you can revert unsafe-fix passes.
SKILL.md
READMESKILL.md - Ruff Recursive Fix
# Ruff Recursive Fix ## Overview Use this skill to enforce code quality with Ruff in a controlled, iterative workflow. It supports: - Optional scope limitation to a specific folder. - Default project settings from `pyproject.toml`. - Flexible Ruff invocation (`uv`, direct `ruff`, `python -m ruff`, or equivalent). - Optional per-run rule overrides (`--select`, `--ignore`, `--extend-select`, `--extend-ignore`). - Automatic safe then unsafe autofixes. - Diff review after each fix pass. - Recursive repetition until findings are resolved or require a decision. - Judicious use of inline `# noqa` only when suppression is justified. ## Inputs Collect these inputs before running: - `target_path` (optional): folder or file to check. Empty means whole repository. - `ruff_runner` (optional): explicit Ruff command prefix (for example `uv run`, `ruff`, `python -m ruff`, `pipx run ruff`). - `rules_select` (optional): comma-separated rule codes to enforce. - `rules_ignore` (optional): comma-separated rule codes to ignore. - `extend_select` (optional): extra rules to add without replacing configured defaults. - `extend_ignore` (optional): extra ignored rules without replacing configured defaults. - `allow_unsafe_fixes` (default: true): whether to run Ruff unsafe fixes. - `ask_on_ambiguity` (default: true): always ask the user when multiple valid choices exist. ## Command Construction Build Ruff commands from inputs. ### 0. Resolve Ruff Runner Determine a reusable `ruff_cmd` prefix before building commands. Resolution order: 1. If `ruff_runner` is provided, use it as-is. 2. Else if `uv` is available and Ruff is managed through `uv`, use `uv run ruff`. 3. Else if `ruff` is available on `PATH`, use `ruff`. 4. Else if Python is available and Ruff is installed in that environment, use `python -m ruff`. 5. Else use any project-specific equivalent that invokes installed Ruff (for example `pipx run ruff`), or stop and ask the user. Use the same resolved `ruff_cmd` for all `check` and `format` commands in the workflow. Base command: ```bash <ruff_cmd> check ``` Formatter command: ```bash <ruff_cmd> format ``` With optional target: ```bash <ruff_cmd> format <target_path> ``` Add optional target: ```bash <ruff_cmd> check <target_path> ``` Add optional overrides as needed: ```bash --select <codes> --ignore <codes> --extend-select <codes> --extend-ignore <codes> ``` Examples: ```bash # Full project with defaults from pyproject.toml ruff check # One folder with defaults python -m ruff check src/models # Override to skip docs and TODO-like rules for this run uv run ruff check src --extend-ignore D,TD # Check only selected rules in a folder ruff check src/data --select F,E9,I ``` ## Workflow ### 1. Baseline Analysis 1. Run `<ruff_cmd> check` with the selected scope and options. 2. Classify findings by type: - Autofixable safe. - Autofixable unsafe. - Not autofixable. 3. If no findings remain, stop. ### 2. Safe Autofix Pass 1. Run Ruff with `--fix` using the same scope/options. 2. Review resulting diff carefully for semantic correctness and style consistency. 3. Run `<ruff_cmd> format` on the same scope. 4. Re-run `<ruff_cmd> check` to refresh remaining findings. ### 3. Unsafe Autofix Pass Run only if findings remain and `allow_unsafe_fixes=true`. 1. Run Ruff with `--fix --unsafe-fixes` using the same scope/options. 2. Review resulting diff carefully, prioritizing behavior-sensitive edits. 3. Run `<ruff_cmd> format` on the same scope. 4. Re-run `<ruff_cmd> check`. ### 4. Manual Remediation Pass For remaining findings: 1. Fix directly in code when there is a clear, safe correction. 2. Keep edits minimal and local. 3. Run `<ruff_cmd> format` on the same scope. 4. Re-run `<ruff_cmd> check