Official agent skill

Ruff

by astral-sh in astral-sh/claude-code-plugins

Guide for using ruff, the extremely fast Python linter and formatter.

OfficialApache-2.0Auto-check passedDevelopment

Install Ruff

skills CLI
$ npx skills add astral-sh/claude-code-plugins --skill ruff -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install astral-sh/claude-code-plugins ruff --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/astral-sh/claude-code-plugins.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/astral/skills/ruff .claude/skills/ruff && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ruff
GitHub stars
313
Token cost
~992 tokens
SKILL.md length
283 words
Files
1
Skills in repo
3
Repo updated
First seen
Licence
Apache-2.0

At a glance

Guide for using ruff, the extremely fast Python linter and formatter.

  • Tasks that involve Linting and formatting
  • SKILL.md covers When to use ruff, How to invoke ruff, Commands and Configuration, plus 3 more sections
  • Calls ruff, black and uv

What it does

Ruff is an agent skill from astral-sh/claude-code-plugins, published by the product's own GitHub organization. Guide for using ruff, the extremely fast Python linter and formatter. Use this when linting, formatting, or fixing Python code.

Its SKILL.md is about 990 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Linting and formatting. It works with Ruff and Python. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Linting and formatting

Example prompts

  • “/ruff”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit f3ce88a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • ruff
    • black
    • uv
    • uvx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.astral.sh

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Ruff loads about 992 tokens when it runs. Until then it costs about 33 tokens; SKILL.md has 283 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~33
When it runs · the whole SKILL.md, loaded when a task matches
~992

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from astral-sh/claude-code-plugins at commit f3ce88a, republished under its Apache-2.0 licence (© astral-sh). 283 words, ~992 tokens.

Download SKILL.mdSave it as .claude/skills/ruff/SKILL.md (or your agent's skills folder).
name
ruff
description
Guide for using ruff, the extremely fast Python linter and formatter. Use this when linting, formatting, or fixing Python code.

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
bash
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
bash
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:

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
bash
black .                       → ruff format .
black --check .               → ruff format --check .
black --diff .                → ruff format --diff .
Flake8 → ruff check
bash
flake8 .                      → ruff check .
flake8 --select E,F .         → ruff check --select E,F .
flake8 --ignore E501 .        → ruff check --ignore E501 .
isort → ruff check
bash
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.

bash
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.

bash
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:

© astral-sh, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/astral/skills/ruff of astral-sh/claude-code-plugins.

Open the folder on GitHubat commit f3ce88a

Compare with similar skills

Ruff next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Ruff compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ruff this skillastral-sh/claude-code-plugins313—~992Automated safety check: PassApache-2.0
Summarise Ecosystem Resultsastral-sh/ruff50k1 repos~2.2kAutomated safety check: PassMIT
Minimizing Ty Ecosystem Changesastral-sh/ruff50k—~4.6kAutomated safety check: PassMIT
Kedro Babysitkedro-org/kedro11k—~4kAutomated safety check: PassCustom licence
Saleor Commit Workflowsaleor/saleor23k—~575Automated safety check: PassBSD-3-Clause
Adding Ty Diagnosticsastral-sh/ruff50k—~556Automated safety check: PassMIT

Similar skills

  • Official

    A skill your agent uses when a user says "summarise ecosystem results", "summarize this ty ecosystem report", "what changed in this ecosystem run?", or asks to summarise or summarize ty ecosystem…

    50k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Official

    A skill your agent uses when a user says "minimize this ty ecosystem change", "reproduce this ecosystem result", "investigate a primer difference", "investigate a mypyprimer difference"…

    50k GitHub stars~4.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Kedro Babysit

    kedro-org/kedro

    Run Kedro's local lint / format / type-check / tests on changed files (uses the project's pre-commit hooks, ruff, mypy, pytest, lint-imports, detect-secrets, Make targets — in the right venv), or…

    11k GitHub stars~4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Commits changes in the Saleor codebase and works through pre-commit hook failures from ruff, mypy, the GraphQL schema check and the migrations check.

    23k GitHub stars~575 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Adding Ty Diagnostics

    astral-sh/ruff

    Official

    A skill your agent uses when a user says "add a ty rule", "add a ty diagnostic", "write this new ty diagnostic", "change a ty error message", "review ty diagnostics", or asks to add, update, or…

    50k GitHub stars~556 tokensUpdated today
    DevelopmentAuto-check passed
  • Update Dependencies

    alorence/django-modern-rpc

    Routine update of all project dependencies — uv itself, uv.lock (all groups), tool versions pinned in GitHub workflows and .pre-commit-config.yaml (uv, ruff, mypy...), and SHA-pinned GitHub Actions.

    111 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed

More from astral-sh/claude-code-plugins

  • Uv

    astral-sh/claude-code-plugins

    Official

    Guide for using uv, the Python package and project manager. An agent skill from astral-sh/claude-code-plugins.

    313 GitHub starsUsed in 2 repos~980 tokens
    Auto-check passed
  • Ty

    astral-sh/claude-code-plugins

    Official

    Guide for using ty, the extremely fast Python type checker and language server.

    313 GitHub stars~792 tokensUpdated 7 mo ago
    Auto-check passed

Works with

Categories

Questions about Ruff

What does Ruff do?

Guide for using ruff, the extremely fast Python linter and formatter. Ruff is an agent skill from astral-sh/claude-code-plugins, published by the product's own GitHub organization. Guide for using ruff, the extremely fast Python linter and formatter.

When should I use Ruff?

Ruff fits situations like: tasks that involve Linting and formatting.

How do I install Ruff in Claude Code?

Run `npx skills add astral-sh/claude-code-plugins --skill ruff -a claude-code`. Or copy the skill folder (plugins/astral/skills/ruff in astral-sh/claude-code-plugins) into .claude/skills/ruff in your project. Claude Code loads it when a task matches its description.

How do I install Ruff in Codex?

Run `npx skills add astral-sh/claude-code-plugins --skill ruff -a codex`. Or copy the skill folder (plugins/astral/skills/ruff in astral-sh/claude-code-plugins) into .agents/skills/ruff in your project. Codex loads it when a task matches its description.

Can I use Ruff in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add astral-sh/claude-code-plugins --skill ruff -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ruff, .gemini/skills/ruff, .github/skills/ruff and .opencode/skills/ruff in your project.

What does Ruff need to run?

Going by SKILL.md and its folder, Ruff needs the command-line tools its instructions call (ruff, black, uv and uvx). Our summary lists: Python 3.

Does Ruff access the network?

SKILL.md names 1 domain. As links in the text: docs.astral.sh. This is read from the text; nothing was executed.

Is Ruff safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ruff use?

Ruff is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ruff use?

About 992 tokens (SKILL.md is roughly 4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ruff?

Skills that share tags, products or a category with Ruff: Summarise Ecosystem Results (astral-sh/ruff, 50k stars), Minimizing Ty Ecosystem Changes (astral-sh/ruff, 50k stars), Kedro Babysit (kedro-org/kedro, 11k stars) and Saleor Commit Workflow (saleor/saleor, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ruff?

astral-sh (a GitHub organization, an official publisher) maintains it in astral-sh/claude-code-plugins, which has 313 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on February 27, 2026.

Source: astral-sh/claude-code-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.