coding-standards
Applies to: **/*.{js,ts,jsx,tsx,py,go,rs,java,rb,sh}, **/*.{test,spec}.*
Coding Standards
Section titled “Coding Standards”Principles
Section titled “Principles”- DRY — Don’t Repeat Yourself
- YAGNI — You Aren’t Gonna Need It
- TDD — See
discipline.mdfor full TDD mandate and commit order
Workflow
Section titled “Workflow”- One question at a time
- Verify before claiming done
- Frequent commits
Background Execution
Section titled “Background Execution”Use run_in_background: true selectively:
- Task (agent dispatch) calls — always background subagent dispatches
- Long-running Bash (test suites, builds, installs, dev servers, watchers) — background and poll with
TaskOutput - Quick Bash (git status, git log, file validation, JSON checks, single-file operations) — run synchronously
Skills
Section titled “Skills”EnterPlanModeis BLOCKED by hook (exit 2) — use thewriting-plansskill for all planning- Plan/Explore agents are BLOCKED by hook (exit 2) — use skills via the Skill tool instead
- Invoke skills immediately — no narration (“I’m going to use…”), no deliberation, just
Skilltool call
Selective Test Execution
Section titled “Selective Test Execution”- Local development: run only tests related to changed files
- Vitest:
--changedflag or filename patterns - Playwright:
--grepor specific test file - Jest:
--findRelatedTests
- Vitest:
- CI: full suite always — no shortcuts
- Pre-commit: affected tests only
- Pre-push: full suite
Caching
Section titled “Caching”- Dependencies: cache
node_modulesbetween installs (npm ci, lockfile hash) - Browsers: cache Playwright browsers (~500MB) —
npx playwright installonly on miss - Build artifacts: cache
.next/,dist/,.astro/between builds where safe - Test results: Vitest
--cachefor incremental runs
Parallel Work Decomposition
Section titled “Parallel Work Decomposition”When task spans backend + frontend + tests:
- Decompose into independent workstreams
- Backend API → subagent A (
isolation: "worktree") - Frontend UI → subagent B (
isolation: "worktree") - Test infrastructure → subagent C (
isolation: "worktree") - Integration after all complete
Use dispatching-parallel-agents for 3+ independent streams.
Use subagent-driven-development for sequential-with-review.
Timeout Budgets
Section titled “Timeout Budgets”- Subagent tasks: 10 min max before status check
- If no progress after 2 checks: escalate to user
- Background Bash: 5 min max for builds, 10 min for full test suites