Skip to content
Skills Library
Programming · Tool integration

ruff

/ruff

Ruff Python linter and formatter. Covers configuration in pyproject.toml, rule selection, auto-fix, and integration with editors and CI. Use when configuring or troubleshooting Python code quality tooling. USE WHEN: user mentions "ruff", "ruff check", "ruff format", "python linting", "pyproject.toml linting", "isort alternative", "black alternative", "flake8 replacement", "python formatter" DO NOT USE FOR: ESLint/Prettier (JavaScript), mypy type checking

Licence
MIT
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Ruff Python linter and formatter. Covers configuration in pyproject.toml, rule selection, auto-fix, and integration with editors and CI. Use when configuring or troubleshooting Python code quality tooling. USE WHEN: user mentions "ruff", "ruff check", "ruff format", "python linting", "pyproject.toml linting", "isort alternative", "black alternative", "flake8 replacement", "python formatter" DO NOT USE FOR: ESLint/Prettier (JavaScript), mypy type checking

Triggers from the description

ruffruff checkruff formatpython lintingpyproject.toml lintingisort alternativeblack alternativeflake8 replacement
Original author description

Ruff Python linter and formatter. Covers configuration in pyproject.toml, rule selection, auto-fix, and integration with editors and CI. Use when configuring or troubleshooting Python code quality tooling. USE WHEN: user mentions "ruff", "ruff check", "ruff format", "python linting", "pyproject.toml linting", "isort alternative", "black alternative", "flake8 replacement", "python formatter" DO NOT USE FOR: ESLint/Prettier (JavaScript), mypy type checking

How it works

  1. Installation
  2. CLI Usage
  3. pyproject.toml Configuration
  4. Common Rule Sets
  5. Frequently Needed Rules
  6. Integration with pyproject.toml (full example for Python 3.10+ project)
  7. Pre-commit Integration
  8. CI/CD (GitHub Actions)
  9. Ruff vs Legacy Tools
  10. Quick Fixes Reference
Original SKILL.md headings · 196 lines, 703 words
SKILL.md preview
---
name: ruff
description: |
  Ruff Python linter and formatter. Covers configuration in pyproject.toml,
  rule selection, auto-fix, and integration with editors and CI.
  Use when configuring or troubleshooting Python code quality tooling.

  USE WHEN: user mentions "ruff", "ruff check", "ruff format", "python linting",
  "pyproject.toml linting", "isort alternative", "black alternative",
  "flake8 replacement", "python formatter"

  DO NOT USE FOR: ESLint/Prettier (JavaScript), mypy type checking
allowed-tools: Read, Grep, Glob, Write, Edit
---
# Ruff: Python Linter & Formatter

## Installation

```bash
pip install ruff>=0.4.0
# or
uv add --dev ruff
```

## CLI Usage

```bash
# Lint
ruff check .                    # check all Python files
ruff check src/ tests/          # specific directories
ruff check --fix .              # auto-fix fixable issues
ruff check --fix --unsafe-fixes . # also apply unsafe fixes

# Format
ruff format .                   # format all files
ruff format --check .           # check only (no write)
ruff format --diff .            # show diff

# Combined (typical workflow)
ruff check --fix . && ruff format .

# Check single file
ruff check src/main.py
```

## pyproject.toml Configuration

```toml
[tool.ruff]
line-length = 100
target-version = "py310"
# Directories to exclude
exclude = [
    ".git", ".venv", "__pycache__", "dist", "build",
    "*.egg-info", ".mypy_cache",
]

[tool.ruff.lint]
# Rule sets to enable
select = [
    "E",   # pycodestyle errors
    "W",   # pycodestyle warnings
    "F",   # pyflakes (undefined names, unused imports)
    "I",   # isort (import ordering)
    "B",   # bugbear (common bugs)
    "C4",  # flake8-comprehensions
    "UP",  # pyupgrade (modern Python syntax)
    "S",   # bandit (security)
    "RUF", # Ruff-specific rules
]

# Rules to ignore globally
ignore = [
    "E501",  # line too long (handled by formatter)
    "S101",  # assert statements (fine in tests)
    "B008",  # do not perform function calls in default args
]

# Per-file ignores
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101", "S105", "S106"]  # allow assert + hardcoded passwords in tests
"scripts/**/*.py" = ["S603", "S607"]         # allow subprocess in scripts

[tool.ruff.lint.isort]
known-first-party = ["driftwire", "mypackage"]
force-sort-within-sections = true

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
```

## Common Rule Sets

| Set | Code | What It Checks |
|-----|------|----------------|
| pycodestyle | E, W | PEP 8 style (spacing, indentation) |
| pyflakes | F | Undefined/unused names, imports |
| isort | I | Import order and grouping |
| bugbear | B | Common Python bugs and anti-patterns |
| pyupgrade | UP | Upgrade to modern Python syntax |
| flake8-comprehensions | C4 | Unnecessary comprehensions |
| bandit | S | Security vulnerabilities |
| flake8-simplify | SIM | Code simplification |
| McCabe complexity | C90 | Function complexity |
| Ruff-specific | RUF | Ruff's own rules |

## Frequently Needed Rules

```toml
# Ignore specific rules
[tool.ruff.lint]
ignore = [
    "E501",   # line length (let formatter handle it)
    "S101",   # assert usage
    "S603",   # subprocess without shell=True
    "S607",   # subprocess partial executable path
    "B904",   # raise ... from err (too strict sometimes)
    "UP007",  # use X | Y instead of Optional[X] (if on Python <3.10)
]
```

## Integration with pyproject.toml (full example for Python 3.10+ project)

```toml
[project]
name = "driftwire"
version = "0.1.0"
requires-python = ">=3.10"

[project.optional-dependencies]
dev = ["ruff>=0.4.0", "pytest>=8.0.0"]

[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "C4", "UP", "RUF"]
ignore = ["E501", "B008"]

[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101"]

[tool.ruff.format]
quote-style = "double"
```

## Pre-commit Integration

```yaml
# .pre-commit-config.yaml
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.4.0
    hooks:
      - id: ruff
        args: [--fix]
      - id: ruff-format
```

## CI/CD (GitHub Actions)

```yaml
- name: Lint with ruff
  run: |
    pip install ruff
    ruff check . --output-format=github
    ruff format --check .
```

## Ruff vs Legacy Tools

| Old Tool | Ruff Equivalent | Notes |
|----------|----------------|-------|
| flake8 | `ruff check` | 10-100x faster |
| isort | `ruff check --select I` | Built-in |
| black | `ruff format` | Compatible formatting |
| bandit | `ruff check --select S` | Subset of bandit rules |
| pyupgrade | `ruff check --select UP` | Built-in |
| autoflake | `ruff check --select F401 --fix` | Remove unused imports |

## Quick Fixes Reference

```bash
# Remove unused imports
ruff check --select F401 --fix .

# Sort imports
ruff check --select I --fix .

# Upgrade old-style type hints (Optional[X] -> X | None)
ruff check --select UP007 --fix .

# All auto-fixable issues
ruff check --fix .
```

## noqa Comments

```python
import os  # noqa: F401          # ignore specific rule on this line
import sys  # noqa                # ignore all rules on this line

def f(x=datetime.now()):  # noqa: B008  # allow function call in default
    pass
```

Versions

RepositoryScoreLicence
This page · claude-dev-suite/claude-dev-suite100MIT
TerminalSkills/skills100Apache-2.0

Database snapshot: 13.11.2026 · package version ef5bf3c667f2 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100python-project-setup
    Sets up Python projects with modern tooling including pyproject.toml, linting with ruff, formatting, type checking with mypy or pyright, testing with pytest, and pre-commit hooks. Triggers on: "setup Python project", "create Python package", "python project structure", "pyproject.toml".
  • 90modern-python
    Modern Python tooling and best practices using uv, ruff, ty, and pytest. Covers project setup with pyproject.toml (PEP 735), src layout, linting/formatting with ruff, type checking with ty, testing with pytest and coverage, pre-commit with prek, and security (pip-audit,…
  • 100python-code-quality
    Python code quality with ruff and ty. Use when the user mentions ruff, ty, linting, formatting, type checking, or Python code style.
  • 95setting-up-python-libraries
    Sets up professional Python library projects with modern tooling (pyproject.toml, uv, ruff, pytest, pre-commit, GitHub Actions). Use when creating new Python libraries, modernizing existing projects to pyproject.toml, configuring linting/testing/CI, or setting up Makefiles and pre-commit hooks.
  • 95python-tooling
    Python project tooling: pyproject.toml as the single source of truth, package managers (pip, Poetry, uv, pipenv), virtual environments, lockfiles, ruff (lint + format), mypy (type checking), and console scripts / entry points. Stack-agnostic — referenced by every Python plugin…
  • 100python-conventions
    Enforce Python tooling conventions for uv, ty, Ruff, pytest, and pyproject.toml. Use when working on .py files or Python project config. NOT for JS/TS, shell scripts, CI design, profiling, or test architecture.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.