ruff-recursive-fix
Helps your agent fix code automatically. It checks for errors, applies safe fixes, and lets you review and decide on remaining issues.
What it does
This tool helps organize and automatically fix your programming code using a tool called Ruff. It tries to fix issues safely first, then more riskily, and shows you the changes for approval.
When to use it
- ✓When your code has many quality warnings.
- ✓Before submitting your code for review.
- ✓To ensure the code follows a consistent standard.
Example of what to ask your AI
“Fix my code in the 'src' folder and show me the changes.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool runs quality checks on your code, applies safe automatic fixes, then riskier ones. It repeats the process and asks for your approval at each step.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add github/awesome-copilot --skill ruff-recursive-fixOr download just the file:
curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/ruff-recursive-fix/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
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.
…
FAQ
What are 'safe fixes' and 'unsafe fixes'?
Safe fixes usually only change code style. Unsafe fixes might alter code behavior and require more attention.
What is 'Ruff'?
Ruff is a program that checks your programming code for quality and style, helping to find and fix errors.
Can I choose which rules to ignore?
Yes, you can specify rules you want to ignore or select only specific rules to check.
Details
Original description by the author
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.
repo: github/awesome-copilot
Popularity
- GitHub stars
- 40k
- Ranking position
- #5353
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
acquire-codebase-knowledge
Helps your agent understand and document an existing code project. It's useful for onboarding new people or getting an overview of the architecture.
github/awesome-copilot
acreadiness-assess
Enables your agent to assess a project's readiness for AI and generate a report. It's useful for understanding how well a project is prepared to use AI tools.
github/awesome-copilot
acreadiness-generate-instructions
Helps your agent create instructions for AI tools based on an assessment. It's useful for improving how AI interacts with code and closing identified gaps.
github/awesome-copilot
acreadiness-policy
Enables your agent to help define or apply policies for AI project assessment. It's useful for standardizing how projects are evaluated and ensuring compliance.
github/awesome-copilot
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC