ruff
ruff combines linting, formatting, and dependency analysis into a single Rust-based tool for Python projects. It replaces multiple tools like Flake8, Black, and isort while offering a built-in language server, configurable rule selection, and both safe and unsafe fix modes. Configure via ruff.toml or pyproject.toml to control which rules run, how code formats, and which violations auto-fix.
ruff is a Rust-based Python linter, formatter, and analyzer that replaces Flake8, Black, and isort in a single tool.
AI-generated summary based on this skill's SKILL.md
Install
hyperb1iss/hyperskills/ruff · repository language: Makefile
git clone https://github.com/hyperb1iss/hyperskills
cp -r hyperskills/skills/ruff ~/.claude/skills/ruffnpx skillfed install hyperb1iss/hyperskills/ruffFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I lint Python code with ruff?
ruff provides linting through its `ruff check` command, which analyzes your Python files against hundreds of rules across multiple rule sets (Flake8, isort, Black compatibility, and more). Run `ruff check .` to scan your project, or `ruff check path/to/file.py` for a specific file. ruff reports violations with rule codes (e.g., E501 for line length) and their locations. You can configure which rules run via ruff.toml or pyproject.toml using `select` and `extend-select` to enable rule families, and `ignore` to suppress unwanted checks.
Can ruff replace Flake8, Black, and isort in my workflow?
Yes—ruff is designed as a unified replacement for Flake8, Black, and isort. Use `ruff check` for linting (replacing Flake8), `ruff format` for code formatting (replacing Black), and ruff's isort-compatible rules for import sorting. This consolidation eliminates tool conflicts, reduces configuration overhead, and speeds up CI/CD since ruff is written in Rust and runs much faster. Migrate by updating your pyproject.toml or ruff.toml with equivalent rule selections and formatting preferences, then run `ruff check --fix` and `ruff format` instead of invoking three separate tools.
What's the difference between ruff safe fixes and unsafe fixes?
ruff categorizes auto-fixes into safe and unsafe modes. Safe fixes are applied by default with `ruff check --fix` and preserve code semantics—ruff is certain the change won't alter behavior. Unsafe fixes may change logic or require human review; enable them with `--unsafe-fixes` flag. For example, removing an unused import is safe, but simplifying a complex expression might be unsafe. Check the rule documentation to see which fixes fall into each category. Use `--show-fixes` to preview what ruff will change before applying fixes.
How do I configure ruff rules in pyproject.toml?
ruff configuration lives in a `[tool.ruff]` section in pyproject.toml (or in a dedicated ruff.toml file). Use `select` to enable specific rule codes or families (e.g., `select = ["E", "F", "I"]` for errors, Pyflakes, and isort), `extend-select` to add rules to defaults, and `ignore` to suppress rules. Set `line-length` for formatting, `target-version` for Python compatibility, and `per-file-ignores` for file-specific exceptions. Example: `[tool.ruff]` with `line-length = 100`, `select = ["E501", "F"]`, and `per-file-ignores = {"__init__.py" = ["F401"]}` to ignore unused imports in init files.
How do I suppress specific linting violations with ruff?
ruff supports `noqa` comments to suppress violations inline. Add `# noqa` at the end of a line to ignore all violations on that line, or `# noqa: E501` to suppress only rule E501. Use `# noqa: E501, F401` for multiple rules. For entire files, add `# ruff: noqa` at the top. You can also configure per-file ignores in pyproject.toml under `per-file-ignores` (e.g., `{"tests/*" = ["F841"]}` to ignore unused variables in test files). ruff respects these comments during both `ruff check` and `ruff format` operations.
What is ruff server and how do I use it for IDE integration?
ruff server is a language server protocol (LSP) implementation that integrates ruff into IDEs like VS Code, PyCharm, and Neovim for real-time linting and formatting feedback. Start it with `ruff server` and configure your editor to connect to it. The server provides on-the-fly diagnostics, code actions (quick fixes), and formatting on save. This gives you instant feedback without running separate CLI commands. Install the Pylance or ruff-lsp extension in your IDE, point it to the ruff server, and you'll see violations highlighted inline with suggestions to auto-fix them.
SKILL.md
rendered from the published skill — quoted content, verbatim
ruff: Python Linter & Formatter
ruff (v0.15.12, Apr 2026) is three tools in one Rust binary: linter (ruff check), formatter (ruff format), and dependency analyzer (ruff analyze graph). It replaces Flake8, Black, isort, pyupgrade, and dozens more.
The built-in language server (ruff server) replaces the deprecated ruff-lsp package (archived Dec 2025).
Invocation
uv run ruff ... # Project dependency (pinned version)
uvx ruff ... # One-off (latest)
ruff ... # Global install
Rule Selection: The Critical Decision
Default rules are minimal: only ["E4", "E7", "E9", "F"], catches syntax errors and undefined names but misses most quality rules. You almost certainly need to extend this.
select vs extend-select
|
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 3 files
skills/ruff/SKILL.md
skills/ruff/references/configuration.md
skills/ruff/references/rules.md