Agent skill
python-analyzer
Format and analyze Python code using ruff (formatting/linting) and ty (static type checking). Use when the user asks to format Python code, run linting, check types, fix code style issues, or analyze Python code quality.
Install this agent skill to your Project
npx add-skill https://github.com/jurabek/claude-code/tree/main/skills/python-analyzer
SKILL.md
Python Code Analyzer
Format and analyze Python code using ruff and ty.
Tools
- ruff: Fast Python linter and formatter (replaces black, isort, flake8)
- ty: Static type checker for Python
Workflow
1. Format Code
Format Python files with ruff:
# Format single file
ruff format path/to/file.py
# Format directory
ruff format .
# Check formatting without applying changes
ruff format --check .
2. Lint Code
Run linter to find issues:
# Lint and show issues
ruff check .
# Auto-fix fixable issues
ruff check --fix .
# Show all fixable issues
ruff check --fix --unsafe-fixes .
3. Type Check
Run static type analysis with ty:
# Check types in current directory
ty check .
# Check specific file
ty check path/to/file.py
Full Analysis Command
Run complete analysis (format + lint + type check):
ruff format . && ruff check --fix . && ty check .
Common Issues and Fixes
Ruff
- Import sorting: Auto-fixed with
ruff check --fix - Unused imports: Auto-fixed with
ruff check --fix - Line length: Configure in
pyproject.tomlunder[tool.ruff]
Ty
- Missing type annotations: Add type hints to function signatures
- Type mismatches: Review and correct variable/return types
- Import errors: Ensure all dependencies are installed
Configuration
Both tools read from pyproject.toml:
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
select = ["E", "F", "I", "UP"]
[tool.ty]
python-version = "3.11"
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
reddit-fetch
Fetch content from Reddit using Gemini CLI when WebFetch is blocked. Use when accessing Reddit URLs, researching topics on Reddit, or when Reddit returns 403/blocked errors. (user)
skill-creator
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
setup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
edit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
obsidian-vault
Search, create, and manage notes in the Obsidian vault with wikilinks and index notes. Use when user wants to find, create, or organize notes in Obsidian.
handoff
Compact the current conversation into a handoff document for another agent to pick up.
Didn't find tool you were looking for?