optimize-codebase

📁 row0902/agents 📅 Jan 1, 1970
0
总安装量
0
周安装量
安装命令
npx skills add https://github.com/row0902/agents --skill 'Optimize Codebase'

Skill 文档

🧹 Optimize Codebase (The Mechanic)

Context

Entropy increases over time. This skill proactively fights it.

1. Complexity Scan (Cyclomatic Complexity)

  • Tool: ruff (mccabe plugin) or mental check.
  • Rule: If if/else/for nesting is > 3 levels, Refactor.
  • Action: Extract method.

2. Dead Code Removal

  • Unused Imports: Run uv run ruff check --select F401 --fix.
  • Unused Variables: Rename to _ or remove.
  • Commented Out Code: DELETE IT. Git history remembers.

3. Type Health

  • Any: Search for Any. Can we make it a TypedDict or Protocol?
  • Optional: specific types str | None are better than implicit None.

4. Optimization Routine (Run this)

# 1. Sort Imports
uv run ruff check --select I --fix .

# 2. Fix Formatting
uv run ruff format .

# 3. Check for specific complexity (C901)
uv run ruff check --select C901 .