| name | code-standards |
| description | Use when establishing or enforcing how code is written in a project — naming, conventions, file structure, error handling — so the agent stays consistent across sessions instead of drifting into its own style by week two. |
code-standards
Overview
Left unstated, an agent invents its own conventions and drifts session to session. This file pins every convention once so the code reads like one author wrote it.
Lives at context/code-standards.md.
When to use
- Setting up a project.
- When you notice style drift (mixed naming, inconsistent error handling, ad-hoc file layout).
What goes in it
- Language rules — TypeScript strictness,
any policy, type-at-boundaries.
- Naming conventions — files, components, functions, booleans, constants.
- Framework conventions — version-specific patterns (e.g. Next.js 16 App Router rules).
- File + folder naming — case, structure, one-concern-per-file.
- Component structure — how a component file is laid out.
- Error handling — errors-as-values vs throw, where validation lives, server-action patterns.
How to maintain
Every time you correct the agent's style, write the rule here so you never correct it twice.
Common mistakes
- Vague rules ("write clean code") → useless. Be specific: "booleans start with is/has/can".
- Letting it go stale → a convention you enforce in chat but not in this file gets re-violated next session.