ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format\n\n# Format files in specific directory\nruff format src/core/ src/utils/\n```\n\n## Configuration\n\n### pyproject.toml\n```toml\n[tool.ruff]\nline-length = 88\ntarget-version = \"py39\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\nline-ending = \"auto\"\ndocstring-code-format = true\ndocstring-code-line-length = \"dynamic\"\nexclude = [\n \"*.pyi\",\n \"**/__pycache__\",\n \"**/node_modules\",\n \".venv\",\n]\n```\n\n### ruff.toml (standalone)\n```toml\nline-length = 88\n\n[format]\nquote-style = \"single\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\ndocstring-code-format = true\n```\n\n### Black Compatibility\n```toml\n[tool.ruff]\nline-length = 88\nindent-width = 4\ntarget-version = \"py39\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\nline-ending = \"auto\"\n```\n\n## Format Workflow\n\n1. **Preview**: `ruff format --diff` (see changes)\n2. **Check**: `ruff format --check` (CI validation)\n3. **Apply**: `ruff format` (modify files)\n4. **Verify**: `ruff format --check` (confirm)\n\n## Best Practices\n\n- Pass directory parameter directly: `ruff format src/`\n- Preview changes first with `--diff`\n- Use one formatter per project (ruff format replaces Black)\n- Exclude generated files in `pyproject.toml`\n- Keep pre-commit config in sync with formatter choice\n- Enable `docstring-code-format` for better docs\n\n## Agentic Optimizations\n\n| Context | Command |\n|---------|---------|\n| Format directory | `ruff format src/` |\n| Check formatting | `ruff format --check` |\n| Show diff | `ruff format --diff` |\n| CI check + diff | `ruff format --check --diff` |\n| Format + lint | `ruff format && ruff check` |\n| Format changed files | `git diff --name-only --diff-filter=d \\| grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

\\| xargs ruff format` |\n\n## Quick Reference\n\n### Essential Commands\n\n```bash\nruff format # Format current directory\nruff format path/to/dir # Format specific directory\nruff format --check # Check if formatted\nruff format --diff # Show formatting changes\nruff format file1.py file2.py # Format specific files\nruff format --exclude tests/ # Exclude directory\nruff format --line-length 100 # Override line length\n```\n\n### Format vs Check\n\n| Command | Purpose | Exit Code | Modifies Files |\n|---------|---------|-----------|----------------|\n| `ruff format` | Format files | 0 | Yes |\n| `ruff format --check` | Validate formatting | 1 if unformatted | No |\n| `ruff format --diff` | Show changes | 0 | No |\n| `ruff format --check --diff` | Validate + show | 1 if unformatted | No |\n\n### Configuration Quick Start\n\n**Minimal (Black-compatible)**\n```toml\n[tool.ruff]\nline-length = 88\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\n```\n\n**Recommended**\n```toml\n[tool.ruff]\nline-length = 88\ntarget-version = \"py311\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\ndocstring-code-format = true\nline-ending = \"auto\"\nexclude = [\n \"*.pyi\",\n \"migrations/**/*.py\",\n]\n```\n\nFor detailed examples, advanced patterns, integration guides, and migration checklists, see [REFERENCE.md](REFERENCE.md).\n---","attachment_filenames":["REFERENCE.md"],"attachments":[{"filename":"REFERENCE.md","content":"# ruff Formatting - Reference\n\nDetailed reference material for ruff format advanced features, integrations, and patterns.\n\n## Advanced Features\n\n### Quote Styles\n\n```bash\n# Use single quotes\nruff format --config '[format]\\nquote-style = \"single\"'\n\n# Use double quotes (Black default)\nruff format --config '[format]\\nquote-style = \"double\"'\n\n# Ruff enforces consistent quote style — pick one above\n```\n\n**Quote Style Behavior**\n```python\n# double quotes (default)\ngreeting = \"Hello, world!\"\nname = \"Alice\"\n\n# single quotes\ngreeting = 'Hello, world!'\nname = 'Alice'\n\n# Triple quotes always use double (Black compatibility)\ndocstring = \"\"\"\nThis is a docstring.\nAlways uses double quotes.\n\"\"\"\n```\n\n### Indentation Styles\n\n```toml\n[tool.ruff.format]\n# Space indentation (default, recommended)\nindent-style = \"space\"\n\n# Tab indentation (space is the default and most common)\nindent-style = \"tab\"\n```\n\n### Line Endings\n\n```toml\n[tool.ruff.format]\n# Auto-detect from existing files (default)\nline-ending = \"auto\"\n\n# Force Unix line endings (LF)\nline-ending = \"lf\"\n\n# Force Windows line endings (CRLF)\nline-ending = \"cr-lf\"\n\n# Use platform native\nline-ending = \"native\"\n```\n\n### Docstring Code Formatting\n\n```toml\n[tool.ruff.format]\n# Format code in docstrings (default: false)\ndocstring-code-format = true\n\n# Control line length for docstring code\ndocstring-code-line-length = \"dynamic\" # Uses main line-length\n# or\ndocstring-code-line-length = 80 # Fixed length\n```\n\n**Example**\n```python\ndef example():\n \"\"\"\n Example function.\n\n ```python\n # This code will be formatted when docstring-code-format = true\n result = calculate(\n x=1,\n y=2,\n z=3,\n )\n ```\n \"\"\"\n pass\n```\n\n### Magic Trailing Comma\n\n```python\n# When skip-magic-trailing-comma = false (default)\n# Trailing comma forces multi-line\nitems = [\n \"apple\",\n \"banana\",\n \"cherry\", # ← This comma forces expansion\n]\n\n# Without trailing comma, can be single-line\nitems = [\"apple\", \"banana\", \"cherry\"]\n\n# When skip-magic-trailing-comma = true\n# Trailing comma is ignored, formatter decides layout\n```\n\n## Integration Patterns\n\n### Pre-commit Hook\n\n```yaml\n# .pre-commit-config.yaml\nrepos:\n - repo: https://github.com/astral-sh/ruff-pre-commit\n rev: v0.14.0\n hooks:\n # Formatter\n - id: ruff-format\n types_or: [python, pyi]\n\n # Advanced configuration\n - id: ruff-format\n args:\n - --config=pyproject.toml\n types_or: [python, pyi]\n```\n\n### GitHub Actions\n\n```yaml\n# .github/workflows/format.yml\nname: Format Check\n\non: [push, pull_request]\n\njobs:\n format:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n\n - name: Install ruff\n run: pip install ruff\n\n - name: Check formatting\n run: ruff format --check\n\n # Or with auto-commit\n - name: Format code\n run: ruff format\n\n - name: Commit changes\n if: failure()\n run: |\n git config user.name \"github-actions\"\n git config user.email \"[email protected]\"\n git add .\n git commit -m \"Auto-format with ruff\"\n git push\n```\n\n### GitLab CI\n\n```yaml\n# .gitlab-ci.yml\nRuff Format:\n stage: build\n image: ghcr.io/astral-sh/ruff:0.14.0-alpine\n script:\n - ruff format --check --diff\n allow_failure: false\n```\n\n### Editor Integration\n\n#### VS Code\n\n```json\n// .vscode/settings.json\n{\n \"[python]\": {\n \"editor.formatOnSave\": true,\n \"editor.defaultFormatter\": \"charliermarsh.ruff\"\n },\n \"ruff.format.args\": [\n \"--line-length=100\"\n ]\n}\n```\n\n#### Neovim\n\n```lua\n-- Using nvimf-lint and conform.nvim\nrequire(\"conform\").setup({\n formatters_by_ft = {\n python = { \"ruff_format\" },\n },\n format_on_save = {\n timeout_ms = 500,\n lsp_fallback = true,\n },\n})\n```\n\n## Common Patterns\n\n### Format Check in CI\n\n```bash\n# Exit with error if not formatted\nruff format --check\n\n# Show what would change\nruff format --diff\n\n# Both check and show diff\nruff format --check --diff\n```\n\n### Format Only Changed Files\n\n```bash\n# Git: Format only modified files\ngit diff --name-only --diff-filter=d | grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format\n\n# Git: Format files in current branch\ngit diff --name-only main...HEAD | grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format\n\n# Git: Format staged files\ngit diff --cached --name-only --diff-filter=d | grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format\n```\n\n### Parallel Formatting\n\n```bash\n# Format multiple directories in parallel\nruff format src/ &\nruff format tests/ &\nruff format scripts/ &\nwait\n\n# Or use find with parallel\nfind src tests -name \"*.py\" -print0 | xargs -0 -P 4 ruff format\n```\n\n### Combined with Linting\n\n```bash\n# Format first, then lint\nruff format && ruff check\n\n# Format and lint with fixes\nruff format && ruff check --fix\n\n# Check both without modifying\nruff format --check && ruff check\n```\n\n### Migration from Black\n\n```bash\n# 1. Update dependencies\npip uninstall black\npip install ruff\n\n# 2. Keep Black configuration\n# ruff respects [tool.black] in pyproject.toml\n\n# 3. Test formatting\nruff format --diff\n\n# 4. Format entire codebase\nruff format .\n\n# 5. Update pre-commit config\n# Replace black with ruff-format\n```\n\n## Excluding Files\n\n### Configuration-based\n\n```toml\n[tool.ruff.format]\nexclude = [\n \"*.pyi\", # Type stubs\n \"**/node_modules\", # Dependencies\n \".venv\", # Virtual environment\n \"**/__pycache__\", # Cache\n \"**/migrations/*.py\", # Django migrations\n \"generated/**/*.py\", # Generated code\n]\n```\n\n### Command-line\n\n```bash\n# Exclude patterns\nruff format --exclude \"migrations\" --exclude \"*.pyi\"\n\n# Multiple patterns\nruff format --exclude \"{migrations,node_modules,generated}\"\n\n# Using extend-exclude (add to defaults)\nruff format --extend-exclude \"legacy/\"\n```\n\n## Notebook Support\n\n### Jupyter Notebooks\n\n```bash\n# Format Jupyter notebooks\nruff format notebook.ipynb\n\n# Check notebook formatting\nruff format --check *.ipynb\n\n# Exclude notebooks\nruff format --exclude \"*.ipynb\"\n```\n\n**Configuration**\n```toml\n[tool.ruff.format]\n# Include notebooks by default\n# Exclude if needed:\nexclude = [\"*.ipynb\"]\n\n[tool.ruff.lint.per-file-ignores]\n\"*.ipynb\" = [\"E501\"] # Ignore line length in notebooks\n```\n\n## Black Migration Checklist\n\n- [ ] Remove Black from dependencies\n- [ ] Add ruff to dependencies\n- [ ] Update pre-commit config (black -> ruff-format)\n- [ ] Update CI/CD pipelines\n- [ ] Test with `ruff format --diff`\n- [ ] Format entire codebase\n- [ ] Update editor configuration\n- [ ] Document in team guidelines\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":6565,"content_sha256":"9119cb53101dd98d8dfa5f43d7b71ba8b13e819ebadb0e1c30c8c97d505fe604"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"ruff Formatting","type":"text"}]},{"type":"paragraph","content":[{"text":"Expert knowledge for using ","type":"text"},{"text":"ruff format","type":"text","marks":[{"type":"code_inline"}]},{"text":" as an extremely fast Python code formatter with Black compatibility.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use This Skill","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use this skill when...","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Use another tool instead when...","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Formatting Python files","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Linting for code issues (use ruff check)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Checking format compliance in CI","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Type checking (use basedpyright)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Migrating from Black","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Detecting dead code (use vulture/deadcode)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Setting up format-on-save","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Running tests (use pytest)","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Expertise","type":"text"}]},{"type":"paragraph","content":[{"text":"ruff format Advantages","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"10-30x faster than Black","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Drop-in Black replacement (99.9% compatible)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Written in Rust for performance","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Supports Black's configuration options","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Format checking and diff preview","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Respects ","type":"text"},{"text":".gitignore","type":"text","marks":[{"type":"code_inline"}]},{"text":" automatically","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Basic Usage","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Simple Formatting","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Format current directory\nruff format\n\n# Format specific files or directories\nruff format path/to/file.py\nruff format src/ tests/\n\n# IMPORTANT: Pass directory as parameter to stay in repo root\nruff format services/orchestrator","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Format Checking","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Check if files are formatted (exit code 1 if not)\nruff format --check\n\n# Show diff without modifying files\nruff format --diff\n\n# Check specific files\nruff format --check src/ tests/\n\n# Preview changes before applying\nruff format --diff services/orchestrator\nruff format services/orchestrator # Apply after review","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Selective Formatting","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Format only Python files\nruff format src/**/*.py\n\n# Format excluding tests\nruff format --exclude tests/\n\n# Format only changed files (git)\ngit diff --name-only --diff-filter=d | grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format\n\n# Format files in specific directory\nruff format src/core/ src/utils/","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Configuration","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"pyproject.toml","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"toml"},"content":[{"text":"[tool.ruff]\nline-length = 88\ntarget-version = \"py39\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\nline-ending = \"auto\"\ndocstring-code-format = true\ndocstring-code-line-length = \"dynamic\"\nexclude = [\n \"*.pyi\",\n \"**/__pycache__\",\n \"**/node_modules\",\n \".venv\",\n]","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"ruff.toml (standalone)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"toml"},"content":[{"text":"line-length = 88\n\n[format]\nquote-style = \"single\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\ndocstring-code-format = true","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Black Compatibility","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"toml"},"content":[{"text":"[tool.ruff]\nline-length = 88\nindent-width = 4\ntarget-version = \"py39\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\nline-ending = \"auto\"","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Format Workflow","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preview","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"ruff format --diff","type":"text","marks":[{"type":"code_inline"}]},{"text":" (see changes)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Check","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"ruff format --check","type":"text","marks":[{"type":"code_inline"}]},{"text":" (CI validation)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Apply","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"ruff format","type":"text","marks":[{"type":"code_inline"}]},{"text":" (modify files)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Verify","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"ruff format --check","type":"text","marks":[{"type":"code_inline"}]},{"text":" (confirm)","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Pass directory parameter directly: ","type":"text"},{"text":"ruff format src/","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Preview changes first with ","type":"text"},{"text":"--diff","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use one formatter per project (ruff format replaces Black)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Exclude generated files in ","type":"text"},{"text":"pyproject.toml","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep pre-commit config in sync with formatter choice","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Enable ","type":"text"},{"text":"docstring-code-format","type":"text","marks":[{"type":"code_inline"}]},{"text":" for better docs","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Agentic Optimizations","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Context","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Format directory","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format src/","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Check formatting","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --check","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Show diff","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --diff","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"CI check + diff","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --check --diff","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Format + lint","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format && ruff check","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Format changed files","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"git diff --name-only --diff-filter=d | grep '\\.py

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…

| xargs ruff format","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Reference","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Essential Commands","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"ruff format # Format current directory\nruff format path/to/dir # Format specific directory\nruff format --check # Check if formatted\nruff format --diff # Show formatting changes\nruff format file1.py file2.py # Format specific files\nruff format --exclude tests/ # Exclude directory\nruff format --line-length 100 # Override line length","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Format vs Check","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Command","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Purpose","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Exit Code","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Modifies Files","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Format files","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"0","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Yes","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --check","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Validate formatting","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1 if unformatted","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --diff","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Show changes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"0","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"ruff format --check --diff","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Validate + show","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1 if unformatted","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Configuration Quick Start","type":"text"}]},{"type":"paragraph","content":[{"text":"Minimal (Black-compatible)","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"toml"},"content":[{"text":"[tool.ruff]\nline-length = 88\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"","type":"text"}]},{"type":"paragraph","content":[{"text":"Recommended","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"toml"},"content":[{"text":"[tool.ruff]\nline-length = 88\ntarget-version = \"py311\"\n\n[tool.ruff.format]\nquote-style = \"double\"\nindent-style = \"space\"\nskip-magic-trailing-comma = false\ndocstring-code-format = true\nline-ending = \"auto\"\nexclude = [\n \"*.pyi\",\n \"migrations/**/*.py\",\n]","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"For detailed examples, advanced patterns, integration guides, and migration checklists, see ","type":"text"},{"text":"REFERENCE.md","type":"text","marks":[{"type":"link","attrs":{"href":"REFERENCE.md","title":null}}]},{"text":".","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"ruff-formatting","author":"@skillopedia","source":{"stars":35,"repo_name":"claude-plugins","origin_url":"https://github.com/laurigates/claude-plugins/blob/HEAD/python-plugin/skills/ruff-formatting/SKILL.md","repo_owner":"laurigates","body_sha256":"537421b7bd34c0e0e729abd3e0720985dadccaf1e1a459a16af4e6b7706e9791","cluster_key":"a3ea74260dab57ad654356f564d1917f3f655d1e22659a31cf6caecb68a37924","clean_bundle":{"format":"clean-skill-bundle-v1","source":"laurigates/claude-plugins/python-plugin/skills/ruff-formatting/SKILL.md","attachments":[{"id":"c1b6ce05-1d14-543d-a480-d67a0cb573eb","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/c1b6ce05-1d14-543d-a480-d67a0cb573eb/attachment.md","path":"REFERENCE.md","size":6565,"sha256":"9119cb53101dd98d8dfa5f43d7b71ba8b13e819ebadb0e1c30c8c97d505fe604","contentType":"text/markdown; charset=utf-8"}],"bundle_sha256":"717e0a552970f0bcfd15b948521725a10ff89f6c599323fc8411f8c06d2a33f2","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"python-plugin/skills/ruff-formatting/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"finance-legal-compliance","category_label":"Finance"},"exact_dupes_collapsed_into_this":0},"created":"2025-12-16T00:00:00.000Z","version":"v1","category":"finance-legal-compliance","modified":"2026-02-14T00:00:00.000Z","reviewed":"2025-12-16T00:00:00.000Z","import_tag":"clean-skills-v1","description":"Python code formatting with ruff format. Fast, Black-compatible formatter. Use when formatting Python files, enforcing style, or checking format compliance.","allowed-tools":"Bash(ruff *), Bash(python *), Bash(uv *), Read, Edit, Write, Grep, Glob","user-invocable":false}},"renderedAt":1782987139298}

ruff Formatting Expert knowledge for using as an extremely fast Python code formatter with Black compatibility. When to Use This Skill | 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) | Core Expertise ruff format Advantages - 10-30x faster than Black - D…