claude.symlink/skills/python/SKILL.md
Write idiomatic Python with advanced features. Use for Python development, refactoring, or optimization.
npx skillsauth add htlin222/dotfiles pythonInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write clean, performant, idiomatic Python code.
# Type hints
def process(data: list[dict]) -> dict[str, int]:
...
# Dataclasses
from dataclasses import dataclass
@dataclass
class User:
name: str
email: str
active: bool = True
# Context managers
from contextlib import contextmanager
@contextmanager
def timer():
start = time.time()
yield
print(f"Elapsed: {time.time() - start:.2f}s")
# Generators for memory efficiency
def read_large_file(path):
with open(path) as f:
yield from f
# Custom exceptions
class ValidationError(Exception):
def __init__(self, field: str, message: str):
self.field = field
self.message = message
super().__init__(f"{field}: {message}")
# Proper exception chaining
try:
process()
except ValueError as e:
raise ProcessingError("Failed to process") from e
project/
├── src/
│ └── package/
│ ├── __init__.py
│ └── module.py
├── tests/
│ └── test_module.py
├── pyproject.toml
└── README.md
# pyproject.toml
[tool.ruff]
line-length = 88
select = ["E", "F", "I", "UP"]
[tool.mypy]
strict = true
[tool.pytest.ini_options]
testpaths = ["tests"]
import pytest
@pytest.fixture
def sample_data():
return {"key": "value"}
def test_process(sample_data):
result = process(sample_data)
assert result["status"] == "success"
Input: "Refactor this Python code" Action: Apply PEP 8, add type hints, simplify logic, improve error handling
Input: "Make this faster" Action: Profile, identify bottlenecks, use generators/caching, verify improvement
testing
Converts narrative medical text into Pocket Medicine bullet-style notes with proper abbreviations, then modularizes sections exceeding 20 lines into linked standalone files.
devops
Use when deploying Docker services on the local VM (hostname: vm, Pop!_OS) with Traefik reverse proxy and Homepage dashboard. Covers crane image workflow, Traefik file-provider registration, Homepage services.yaml entries, and compose templates on the traefik-proxy network.
development
Use when reviewing a data visualization or figure for clarity, checking if a graph communicates its message without additional context, or iterating on R/Python plot scripts until a naive reader can fully understand the figure.
development
Runs Vale prose linter on markdown/text files and auto-fixes issues. Use when the user asks to lint, proofread, or improve writing quality of markdown or text files.