code
SKILL.md
- Prefer libraries to writing code. Prefer popular, modern, minimal, fast libraries
- Write readable code. Keep happy path linear and obvious. Write flow first, then fill in code. Name intuitively
- Keep code short
- Data over code: Structures beat conditionals. Prefer config.{json|yaml|toml|...} if >= 30 lines
- DRY: Helpers for repeated logic, precompute shared intermediates
- Early returns fail fast and reduce nesting. Skip defensive fallbacks, existence checks, ... unless essential
- YAGNI: Skip unused imports, variables, and code
- Change existing code minimally. Retain existing comments. Follow existing style
- Use type hints and docstrings (document contracts and surprises, not mechanics)
- Only comment non-obvious stuff that'll trip future maintainers: why, why not alternatives, pitfalls, invariants, input/output shape, ...
- When tests exist, or writing new code, add new failing tests first (including edge cases). Keep tests fast
- For UI/image tasks, capture and inspect screenshots before finalizing
- Replace PII in committed code, tests, docs with similar REALISTIC dummy data
- Show status & progress for long tasks (>5s)
- Make re-runs efficient for long tasks (>1min). Restarting should resume. Log state, cache & flush data and LLM/API/HTTP requests, etc.
- Read latest docs for fast moving packages: GitHub README,
npm view package-name readme, https://context7.com/$ORG/$REPO/llms.txt, ...