| name | code-standards-en |
| description | Specifies English identifiers, casing conventions, verb-led functions, parameterized objects over long arg lists, CQS separation, guarded early returns, split boolean-flag behaviors, sizing limits for methods and classes, minimal comments. Do not use when localized naming is required by product policy. |
Code standards (English source)
Procedures
When naming, structuring functions, or reviewing pull requests
- Author identifiers, literals exposed to collaborators, and user-facing constants in English within source files.
- Apply
camelCase to methods, functions, variables; PascalCase to classes and interfaces; kebab-case to file and directory names mirroring symbols when applicable.
- Avoid cryptic abbreviations while keeping identifiers under roughly 30 characters.
- Extract magic numbers into named constants so conditional logic expresses intent (
MAX_LOGIN_ATTEMPTS).
- Name operations with leading verbs signaling behavior (
calculateTotal, sendEmail) rather than bare nouns.
- Prefer object parameters instead of arity greater than three for functions and methods unless low-level hotspots demand positional arguments.
- Apply Command Query Separation: pure readers do not mutate; mutators avoid returning incidental state snapshots except through explicit complementary methods.
- Replace deep
if / else trees with guarded early returns; avoid gratuitous final else blocks once main path is isolated.
- Split boolean-flag behavior into separately named procedures instead of
doThing(..., true).
- Keep methods shorter than roughly 50 lines; split cohesive classes exceeding ~300 lines.
- Minimize explanatory comments relying on expressive naming and decomposition first.
- Declare one binding per statement; declare variables adjacent to initial use.
Error Handling
- When localized product copy conflicts with English-only source identifiers, escalate policy trade-offs rather than mixing languages silently.
- When boolean parameters reappear despite guidance, refactor to strategy objects or dedicated methods aligning with bounded contexts.