ruff
Ruff is an exceptionally fast Python linter and formatter that consolidates the functionality of Flake8, Black, isort, pyupgrade, and autoflake into a single tool. It detects code violations and applies automatic fixes, with options to scope changes to specific files or review unsafe fixes before applying them.
Ruff lints and auto-fixes Python code violations with extreme speed, replacing multiple legacy tools.
AI-generated summary based on this skill's SKILL.md
Install
astral-sh/claude-code-plugins/ruff
git clone https://github.com/astral-sh/claude-code-plugins
cp -r claude-code-plugins/plugins/astral/skills/ruff ~/.claude/skills/ruffnpx skillfed install astral-sh/claude-code-plugins/ruffFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I lint Python code with ruff?
Ruff lints Python code by running the `ruff check` command on your files or directories. Ruff detects violations across multiple rule categories and displays them with file locations and line numbers. You can lint a single file with `ruff check myfile.py` or an entire project with `ruff check .`. Ruff integrates rules from Flake8, pyupgrade, and other tools into one fast linter.
Can ruff auto-fix violations, and how do I use that?
Ruff can automatically fix many violations using the `ruff check --fix` command. This applies safe fixes directly to your files. For potentially unsafe fixes, use `ruff check --fix --unsafe-fixes` to enable them, or review changes first before committing. Ruff's auto-fix capability eliminates manual correction of common style and logic issues.
What is ruff format and how does it compare to Black?
Ruff format is ruff's built-in code formatter that serves as a Black replacement. Run `ruff format` to automatically format your Python files with consistent style. Ruff format offers similar functionality to Black but integrates seamlessly with ruff's linter, eliminating the need for separate formatting tools. Both enforce opinionated style rules, but ruff does both linting and formatting in one tool.
How do I migrate from Flake8, Black, or isort to ruff?
Ruff consolidates Flake8, Black, isort, pyupgrade, and autoflake into a single tool, making migration straightforward. Replace your linting workflow with `ruff check --fix`, your formatting with `ruff format`, and your import sorting with ruff's built-in isort rules. Configure ruff in `pyproject.toml` under `[tool.ruff]` to match your existing rule preferences, then remove your old tool configurations.
How do I configure ruff linting rules in pyproject.toml?
Ruff configuration goes in your `pyproject.toml` file under the `[tool.ruff]` section. Specify which rule codes to enable or ignore, set line length, exclude directories, and customize other linting behavior. For example, use `select = ["E", "F"]` to enable specific rule categories or `ignore = ["E501"]` to skip rules. Ruff reads this configuration automatically when you run `ruff check` or `ruff format`.
Is ruff a fast Python code quality tool compared to alternatives?
Ruff is exceptionally fast compared to Flake8, Black, and isort because it's written in Rust and optimized for performance. It processes large codebases significantly faster than traditional Python-based tools while maintaining compatibility with their rule sets. Ruff's speed makes it practical for real-time linting in editors and as part of continuous integration pipelines without slowing development workflows.
SKILL.md
rendered from the published skill — quoted content, verbatim
ruff
Ruff is an extremely fast Python linter and code formatter. It replaces Flake8, isort, Black, pyupgrade, autoflake, and dozens of other tools.
When to use ruff
Always use ruff for Python linting and formatting, especially if you see:
[tool.ruff]section inpyproject.toml- A
ruff.tomlor.ruff.tomlconfiguration file
However, avoid making unnecessary changes:
- Don't format unformatted code - If
ruff format --diffshows changes throughout an entire file, the project likely isn't using ruff for formatting. Skip formatting to avoid obscuring actual changes. - Scope fixes to code being edited - Use
ruff check --diffto see fixes relevant to the code you're changing. Only apply fixes to files you're modifying unless the user explicitly asks for broader fixes.
How to invoke ruff
uv run ruff ...- Use when ruff is in the project's dependencies to ensure you use the pinned versionuvx ruff ...- Use when ruff is not a project dependency, or for quick one-off
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
plugins/astral/skills/ruff/SKILL.md