Skip to content

Coding Standards

This document establishes the authoritative coding standards for the project.

  • Context is King: Write code that explains itself. Generative AI relies on clear variable names and explicit types.
  • Explicit over Implicit: Avoid “magic” logic.
  • Small Blast Radius: Keep functions and components focused.
  • Sanity over Speed: We prefer verbose, type-safe code.
  • Zero Warnings: The main branch must be warning-free.
  • No any: Strictly forbidden. Use unknown + Zod.
  • No ts-ignore: Fix the underlying issue.
  • Explicit Returns: All exported functions MUST have an explicit return type.

All public methods in Services and Actions MUST return a ServiceResponse<T> object:

interface ServiceResponse<T> {
success: boolean;
data: T | null;
error: string | null;
}
  • @/ refers to src/.
  • @modules/ refers to modules/.
  • @tests/ refers to tests/.
  • Deep relative imports that traverse up the tree (e.g., ../../components).

We use a utility-first approach powered by Tailwind CSS.

  • No Arbitrary Values: Use theme tokens (w-32), not arbitrary strings (w-[123px]).
  • Semantic Colors: Use bg-destructive, not bg-red-500.
  • JSDoc: All exported members must have JSDoc explaining why it exists.