Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
astral-sh avatar

Ruff

  • 897 installs
  • 294 repo stars
  • Updated February 27, 2026
  • astral-sh/claude-code-plugins

ruff is a Claude Code plugin skill that guides developers to run the project's pinned Ruff linter and formatter on changed Python only, replacing Flake8, isort, Black, and dozens of other tools without reformatting untou

About

ruff is an Astral-sh Claude Code plugin skill for the extremely fast Python linter and formatter that consolidates Flake8, isort, Black, pyupgrade, autoflake, and dozens of other tools into one binary. The skill activates when pyproject.toml contains a [tool.ruff] section or when ruff.toml or .ruff.toml is present, and it instructs agents to lint and fix only Python the developer is actively changing. Developers reach for ruff during Python edits to run ruff check and ruff format on scoped diffs rather than reformatting entire legacy files where ruff format --diff would rewrite the whole module. The skill explicitly warns against unnecessary wholesale formatting when a project has not adopted Ruff project-wide, keeping pull requests focused on intentional changes while still enforcing modern Python style on touched code.

  • Replaces Flake8, isort, Black, pyupgrade, autoflake, and many other tools in one CLI
  • Invocation patterns: `uv run ruff`, `uvx ruff`, or global `ruff` depending on project deps
  • Lint with `ruff check`, auto-fix with `--fix` / `--unsafe-fixes`, format with `ruff format`
  • Respects `[tool.ruff]`, `ruff.toml`, and `.ruff.toml` when present
  • Explicit guardrails: skip whole-file format when `--diff` shows the repo is not on Ruff format; scope fixes to edited co

Ruff by the numbers

  • 897 all-time installs (skills.sh)
  • +27 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #25 of 290 Python skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/astral-sh/claude-code-plugins --skill ruff

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs897
repo stars294
Security audit3 / 3 scanners passed
Last updatedFebruary 27, 2026
Repositoryastral-sh/claude-code-plugins

How do you lint changed Python with Ruff only?

Run the project’s pinned Ruff linter and formatter on Python you are changing without reformatting entire untouched files.

Who is it for?

Python developers on Ruff-configured projects who want fast lint-and-format on changed code without mass-reformatting untouched files.

Skip if: Projects without [tool.ruff] or ruff.toml config, or developers who need to bulk-reformat an entire legacy codebase in one pass.

When should I use this skill?

A developer edits Python and the repo has pyproject.toml [tool.ruff], ruff.toml, or asks to lint or format Python changes.

What you get

Ruff-fixed lint violations and formatted diffs limited to edited Python lines.

  • lint-clean changed Python
  • scoped format diffs

By the numbers

  • Consolidates Flake8, isort, Black, pyupgrade, autoflake, and dozens of other Python tools

Files

SKILL.mdMarkdownGitHub ↗

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 in pyproject.toml
  • A ruff.toml or .ruff.toml configuration file

However, avoid making unnecessary changes:

  • Don't format unformatted code - If ruff format --diff shows 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 --diff to 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 version

  • uvx ruff ... - Use when ruff is not a project dependency, or for quick

one-off checks

  • ruff ... - Use if ruff is installed globally

Commands

Linting

ruff check .                  # Check all files in current directory
ruff check path/to/file.py    # Check specific file
ruff check --fix .            # Auto-fix fixable violations
ruff check --fix --unsafe-fixes .  # Include unsafe fixes (review changes!)
ruff check --watch .          # Watch for changes and re-lint
ruff check --select E,F .     # Only check specific rules
ruff check --ignore E501 .    # Ignore specific rules
ruff rule E501                # Explain a specific rule
ruff linter                   # List available linters

Formatting

ruff format .                 # Format all files
ruff format path/to/file.py   # Format specific file
ruff format --check .         # Check if files are formatted (no changes)
ruff format --diff .          # Show formatting diff without applying

Configuration

Ruff is configured in pyproject.toml or ruff.toml:

# pyproject.toml
[tool.ruff.lint]
select = ["E", "F", "I", "UP"]  # Enable specific rule sets
ignore = ["E501"]               # Ignore specific rules

[tool.ruff.lint.isort]
known-first-party = ["myproject"]

Migrating from other tools

Black → ruff format

black .                       → ruff format .
black --check .               → ruff format --check .
black --diff .                → ruff format --diff .

Flake8 → ruff check

flake8 .                      → ruff check .
flake8 --select E,F .         → ruff check --select E,F .
flake8 --ignore E501 .        → ruff check --ignore E501 .

isort → ruff check

isort .                       → ruff check --select I --fix .
isort --check .               → ruff check --select I .
isort --diff .                → ruff check --select I --diff .

Common patterns

Apply lint fixes before formatting

Run ruff check --fix before ruff format. Lint fixes can change code structure (e.g., reordering imports), which formatting then cleans up.

ruff check --fix .
ruff format .

Applying and reviewing unsafe fixes

Ruff categorizes some auto-fixes as "unsafe" because they may change code behavior, not just style. For example, removing unused imports could break code that relies on side effects.

ruff check --fix --unsafe-fixes --diff .  # Preview changes first
ruff check --fix --unsafe-fixes .         # Apply changes

Always review changes before applying `--unsafe-fixes`:

  • Use ruff rule <CODE> to understand why the fix is considered unsafe
  • Verify the fix doesn't violate those assumptions in your code

Documentation

For detailed information, read the official documentation:

  • https://docs.astral.sh/ruff/

Related skills

How it compares

Pick ruff over separate Flake8-plus-Black workflows when the repo already pins Ruff and you need scoped lint fixes on active edits.

FAQ

When should ruff skill run?

The ruff skill should run when linting, formatting, or fixing Python code in a project with [tool.ruff] in pyproject.toml or a ruff.toml file, focusing changes on edited lines rather than entire untouched files.

What tools does Ruff replace?

Ruff replaces Flake8, isort, Black, pyupgrade, autoflake, and dozens of other Python linting and formatting tools in a single extremely fast binary invoked via ruff check and ruff format.

Is Ruff safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Pythonbackendtesting

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.