willyd61/nautobot-v2-custom-metrics-old/ruff

Claude Code and agent skill by willyd61/nautobot-v2-custom-metrics-old

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

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

Install

npx vskill@latest install willyd61/nautobot-v2-custom-metrics-old/ruff

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as claude-dev-suite/claude-dev-suite/ruff.

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

SetCodeWhat It Checks
pycodestyleE, WPEP 8 style (spacing, indentation)
pyflakesFUndefined/unused names, imports
isortIImport order and grouping
bugbearBCommon Python bugs and anti-patterns
pyupgradeUPUpgrade to modern Python syntax
flake8-comprehensionsC4Unnecessary comprehensions
banditSSecurity vulnerabilities
flake8-simplifySIMCode simplification
McCabe complexityC90Function complexity
Ruff-specificRUFRuff'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 ToolRuff EquivalentNotes
flake8ruff check10-100x faster
isortruff check --select IBuilt-in
blackruff formatCompatible formatting
banditruff check --select SSubset of bandit rules
pyupgraderuff check --select UPBuilt-in
autoflakeruff check --select F401 --fixRemove 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

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/willyd61/nautobot-v2-custom-metrics-old/ruff/badge)](https://verified-skill.com/skills/willyd61/nautobot-v2-custom-metrics-old/ruff)

Something wrong with this skill or its page? Tell us.