Development
Coding Rules
Project conventions and anti-patterns from AGENTS.md.
Coding Rules
File size
Hard limit: 200 lines per file. Split by responsibility if approaching the limit.
Naming conventions
| Type | Convention | Example |
|---|---|---|
| Components | PascalCase | UserCard.js |
| Hooks | useCamelCase | useAuthState.js |
| Utils / lib | camelCase | formatDate.js |
| API routes | kebab-case | user-profile/route.js |
| Docs | kebab-case | user-auth.md |
Anti-patterns (never do)
- No wrapper functions that only return their parameters
- No over-engineering or premature abstraction
- No business logic inside
ui/components - No inline styles unless dynamic
Atomic todos
- 1 todo = 1 file or 1 function
- Each todo must be independently testable and reversible
- Multi-file changes → split into separate todos
Shared utilities
Use existing helpers instead of reimplementing:
| Need | Use |
|---|---|
| Display KV values | getDisplayKv1Values() from lib/utils/adConfig.js |
| Interstitial KV values | getInterstitialKv1Values() |
| Ad timing check | useAdThemeTiming hook |
| Screen size | useScreenSize hook |
| Content blur | useContentBlur hook |
Documentation rule
Every new or updated feature → create or update documentation/content/docs/<section>/<feature>.mdx
Memory comments
Add // @memory comments on non-obvious decisions. Search with:
grep -r "@memory" components/ lib/Next.js warning
This project uses Next.js 16 with breaking changes. Read node_modules/next/dist/docs/ before writing Next.js code.