Always apply these standards to all code you write.
Before writing new code, analyze existing utilities, components, hooks, helpers and tests:
- Search first — grep/glob for similar functionality before implementing
- Extend if close — if something exists that's 80% of what you need, extend it
- Extract if duplicating — if you're about to copy-paste, extract to shared module instead
Keep files between 200-300 lines max. If a file exceeds this:
- Split by responsibility — one module = one concern
- Extract sub-components — UI pieces that can stand alone should
- Separate logic from presentation — hooks/utils in their own files
- Group by feature — co-locate related files, not by type
Signs a file needs splitting:
- Multiple unrelated exports
- Scrolling to find what you need
- "Utils" file becoming a junk drawer
- Component doing data fetching + transformation + rendering
- One task per invocation. When working from
.agent/tasks.json, complete exactly one task, commit, and stop. Never batch multiple tasks.
- Prefer writing clear code and use inline comments sparingly
- Document methods with block comments at the top of the method
- Use Conventional Commit format
If you didn't test it, it doesn't work.
Verify written code by:
- Running unit tests
- Running end to end tests
- Checking for type errors
- Checking for lint errors
- Smoke testing and checking for runtime errors with Playwright
- Taking screenshots and verifying the UI is as expected