ruff-recursive-fix
github/awesome-copilot
Iteratively enforce code quality with Ruff, applying safe/unsafe fixes and manual remediation with full review control.
What is ruff-recursive-fix?
Run Ruff checks with optional scope and rule overrides, apply safe and unsafe autofixes iteratively, review each change, and resolve remaining findings with targeted edits or user decisions. Use this when you need controlled, auditable code quality enforcement across a Python project.
- Detect code quality issues using Ruff with configurable scope and rule selection
- Apply safe autofixes automatically, then unsafe fixes if enabled, with diff review after each pass
- Recursively iterate through fix passes until all findings are resolved or require user decisions
- Support flexible Ruff invocation methods (uv, direct ruff, python -m ruff, pipx)
- Format code with Ruff formatter between fix passes to maintain consistency
- Use judicious inline # noqa suppression only when justified by required behavior or framework conventions
How to install ruff-recursive-fix
npx skills add https://github.com/github/awesome-copilot --skill ruff-recursive-fix- Ruff installed and available (via uv, direct installation, Python environment, or pipx)
- Python project with optional pyproject.toml for Ruff configuration
How to use ruff-recursive-fix
- 1.Provide target_path (optional folder/file), ruff_runner (optional command prefix), and rule overrides (optional)
- 2.Run baseline Ruff check to classify findings as safe-fixable, unsafe-fixable, or manual
- 3.Execute safe autofix pass, review diff, format, and re-check
- 4.If findings remain and allow_unsafe_fixes is true, execute unsafe autofix pass with careful review
- 5.Manually fix remaining findings with minimal, local edits
- 6.For ambiguous situations, ask user to choose between valid options
- 7.Repeat fix and format passes until clean or blocked on architectural decisions
- 8.Report final summary: scope, iterations, fixed findings, manual fixes, suppressions, and remaining issues
Use cases
- Enforce consistent code style and catch common errors across a large Python codebase
- Gradually migrate a project to stricter linting rules by applying fixes iteratively
- Audit and review all code quality changes before committing them to version control
- Fix specific rule violations in a targeted folder without affecting the rest of the project
- Balance automatic fixes with manual review to ensure semantic correctness and readability
- Python developers maintaining code quality standards
- Teams adopting or upgrading Ruff linting in existing projects
- Code reviewers who need auditable, reviewable fix workflows
- DevOps and platform engineers enforcing project-wide code standards
ruff-recursive-fix FAQ
The skill resolves the Ruff runner in order: explicit ruff_runner input, uv run ruff, ruff on PATH, python -m ruff, or project-specific equivalent like pipx run ruff. If none work, it stops and asks you.
Yes. Use rules_select to enforce only certain rules, or rules_ignore to skip rules. You can also use extend_select and extend_ignore to add/remove rules without replacing pyproject.toml defaults.
Safe fixes are guaranteed not to change code behavior. Unsafe fixes may alter semantics and require careful review. The skill applies safe fixes first, then unsafe fixes only if allow_unsafe_fixes=true and you review the diff.
Only when the rule conflicts with required behavior, public API, framework conventions, or readability, and refactoring is disproportionate. Always use specific rule codes (# noqa: RULE) and add a reason comment for non-obvious cases.
The skill detects when no progress is made, summarizes blocked rules and affected files, presents valid options and trade-offs, and asks you to choose the next step.
Full instructions (SKILL.md)
Source of truth, from github/awesome-copilot.
name: ruff-recursive-fix description: Run Ruff checks with optional scope and rule overrides, apply safe and unsafe autofixes iteratively, review each change, and resolve remaining findings with targeted edits or user decisions.
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, directruff,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
# noqaonly 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 exampleuv 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:
- If
ruff_runneris provided, use it as-is. - Else if
uvis available and Ruff is managed throughuv, useuv run ruff. - Else if
ruffis available onPATH, useruff. - Else if Python is available and Ruff is installed in that environment, use
python -m ruff. - 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:
<ruff_cmd> check
Formatter command:
<ruff_cmd> format
With optional target:
<ruff_cmd> format <target_path>
Add optional target:
<ruff_cmd> check <target_path>
Add optional overrides as needed:
--select <codes>
--ignore <codes>
--extend-select <codes>
--extend-ignore <codes>
Examples:
# 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
- Run
<ruff_cmd> checkwith the selected scope and options. - Classify findings by type:
- Autofixable safe.
- Autofixable unsafe.
- Not autofixable.
- If no findings remain, stop.
2. Safe Autofix Pass
- Run Ruff with
--fixusing the same scope/options. - Review resulting diff carefully for semantic correctness and style consistency.
- Run
<ruff_cmd> formaton the same scope. - Re-run
<ruff_cmd> checkto refresh remaining findings.
3. Unsafe Autofix Pass
Run only if findings remain and allow_unsafe_fixes=true.
- Run Ruff with
--fix --unsafe-fixesusing the same scope/options. - Review resulting diff carefully, prioritizing behavior-sensitive edits.
- Run
<ruff_cmd> formaton the same scope. - Re-run
<ruff_cmd> check.
4. Manual Remediation Pass
For remaining findings:
- Fix directly in code when there is a clear, safe correction.
- Keep edits minimal and local.
- Run
<ruff_cmd> formaton the same scope. - Re-run
<ruff_cmd> check.
5. Ambiguity Policy
If there are multiple valid solutions at any step, always ask the user before proceeding. Do not choose silently between equivalent options.
6. Suppression Decision (# noqa)
Use suppression only when all conditions are true:
- The rule conflicts with required behavior, public API, framework conventions, or readability goals.
- Refactoring would be disproportionate to the value of the rule.
- The suppression is narrow and specific (single line, explicit code when possible).
Guidelines:
- Prefer
# noqa: <RULE>over broad# noqa. - Add a brief reason comment for non-obvious suppressions.
- If two or more valid outcomes exist, always ask the user which option to prefer.
7. Recursive Loop and Stop Criteria
Repeat steps 2 to 6 until one of these outcomes:
<ruff_cmd> checkreturns clean.- Remaining findings require architectural/product decisions.
- Remaining findings are intentionally suppressed with documented rationale.
- Repeated loop makes no progress.
Each loop iteration must include <ruff_cmd> format before the next <ruff_cmd> check.
When no progress is detected:
- Summarize blocked rules and affected files.
- Present valid options and trade-offs.
- Ask the user to choose.
Quality Gates
Before declaring completion:
- Ruff returns no unexpected findings for the chosen scope/options.
- All autofix diffs are reviewed for correctness.
- No suppression is added without explicit justification.
- Any unsafe fix with possible behavioral impact is highlighted to the user.
- Ruff formatting is executed in every iteration.
Output Contract
At the end of execution, report:
- Scope and Ruff options used.
- Number of iterations performed.
- Summary of fixed findings.
- List of manual fixes.
- List of suppressions with rationale.
- Remaining findings, if any, and required user decisions.
Suggested Prompt Starters
- "Run ruff-recursive-fix on the whole repo with default config."
- "Run ruff-recursive-fix only on src/models, ignore DOC rules."
- "Run ruff-recursive-fix on tests with select F,E9,I and no unsafe fixes."
- "Run ruff-recursive-fix on src/data and ask me before adding any noqa."
Related skills
More from github/awesome-copilot and the wider catalog.

rust-mcp-server-generator
Generate production-ready Rust MCP servers with tools, prompts, resources, and tests using the official rmcp SDK.

salesforce-apex-quality
Apex code quality guardrails for Salesforce development. Enforces bulk-safety rules (no SOQL/DML in loops), sharing model requirements, CRUD/FLS security, SOQL injection prevention, PNB test coverage (Positive / Negative / Bulk), and modern Apex idioms. Use this skill when reviewing or generating Apex classes, trigger handlers, batch jobs, or test classes to catch governor limit risks, security gaps, and quality issues before deployment.

salesforce-component-standards
Quality standards for Salesforce Lightning Web Components (LWC), Aura components, and Visualforce pages. Covers SLDS 2 compliance, accessibility (WCAG 2.1 AA), data access pattern selection, component communication rules, XSS prevention, CSRF enforcement, FLS/CRUD in AuraEnabled methods, view state management, and Jest test requirements. Use this skill when building or reviewing any Salesforce UI component to enforce platform-specific security and quality standards.

salesforce-flow-design
Salesforce Flow architecture decisions, flow type selection, bulk safety validation, and fault handling standards. Use this skill when designing or reviewing Record-Triggered, Screen, Autolaunched, Scheduled, or Platform Event flows to ensure correct type selection, no DML/Get Records in loops, proper fault connectors on all data-changing elements, and appropriate automation density checks before deployment.

sandbox-npm-install
Install npm packages in Docker sandbox via ext4 symlink to avoid native binary crashes on virtiofs.

scaffolding-oracle-to-postgres-migration-test-project
Scaffold xUnit integration test infrastructure for Oracle-to-PostgreSQL migration projects in .NET.