From python-plugin
Formats Python code using ruff format, a fast Black-compatible formatter. Checks compliance, previews diffs, supports selective formatting and pyproject.toml config.
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-plugin:ruff-formattinghaikuThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert knowledge for using `ruff format` as an extremely fast Python code formatter with Black compatibility.
Expert knowledge for using ruff format as an extremely fast Python code formatter with Black compatibility.
| Use this skill when... | Use another tool instead when... |
|---|---|
| Formatting Python files | Linting for code issues (use ruff check) |
| Checking format compliance in CI | Type checking (use basedpyright) |
| Migrating from Black | Detecting dead code (use vulture/deadcode) |
| Setting up format-on-save | Running tests (use pytest) |
ruff format Advantages
.gitignore automatically# Format current directory
ruff format
# Format specific files or directories
ruff format path/to/file.py
ruff format src/ tests/
# IMPORTANT: Pass directory as parameter to stay in repo root
ruff format services/orchestrator
# Check if files are formatted (exit code 1 if not)
ruff format --check
# Show diff without modifying files
ruff format --diff
# Check specific files
ruff format --check src/ tests/
# Preview changes before applying
ruff format --diff services/orchestrator
ruff format services/orchestrator # Apply after review
# Format only Python files
ruff format src/**/*.py
# Format excluding tests
ruff format --exclude tests/
# Format only changed files (git)
git diff --name-only --diff-filter=d | grep '\.py$' | xargs ruff format
# Format files in specific directory
ruff format src/core/ src/utils/
[tool.ruff]
line-length = 88
target-version = "py39"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
exclude = [
"*.pyi",
"**/__pycache__",
"**/node_modules",
".venv",
]
line-length = 88
[format]
quote-style = "single"
indent-style = "space"
skip-magic-trailing-comma = false
docstring-code-format = true
[tool.ruff]
line-length = 88
indent-width = 4
target-version = "py39"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
ruff format --diff (see changes)ruff format --check (CI validation)ruff format (modify files)ruff format --check (confirm)ruff format src/--diffpyproject.tomldocstring-code-format for better docs| Context | Command |
|---|---|
| Format directory | ruff format src/ |
| Check formatting | ruff format --check |
| Show diff | ruff format --diff |
| CI check + diff | ruff format --check --diff |
| Format + lint | ruff format && ruff check |
| Format changed files | git diff --name-only --diff-filter=d | grep '\.py$' | xargs ruff format |
ruff format # Format current directory
ruff format path/to/dir # Format specific directory
ruff format --check # Check if formatted
ruff format --diff # Show formatting changes
ruff format file1.py file2.py # Format specific files
ruff format --exclude tests/ # Exclude directory
ruff format --line-length 100 # Override line length
| Command | Purpose | Exit Code | Modifies Files |
|---|---|---|---|
ruff format | Format files | 0 | Yes |
ruff format --check | Validate formatting | 1 if unformatted | No |
ruff format --diff | Show changes | 0 | No |
ruff format --check --diff | Validate + show | 1 if unformatted | No |
Minimal (Black-compatible)
[tool.ruff]
line-length = 88
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
Recommended
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
docstring-code-format = true
line-ending = "auto"
exclude = [
"*.pyi",
"migrations/**/*.py",
]
For detailed examples, advanced patterns, integration guides, and migration checklists, see REFERENCE.md.
npx claudepluginhub laurigates/claude-plugins --plugin python-pluginLints, formats, and analyzes Python code with ruff. Covers rule selection, config, and migration from flake8/black/isort.
Lints Python code with ruff: fast checks, rule selection, auto-fixing, output formats, configuration. Use for code quality, bug detection, standards enforcement.