Conventions Catalog
|
|
| Status |
Draft for review; the seed for CONVENTIONS.md |
| Last updated |
2026-12-04 |
| Related |
Vision · Architecture |
This catalog lists every convention category with draft rules. Each rule has an ID, a short statement and an enforcement class. The language appendices (to be written) will map each rule to concrete tool rules and thresholds for each language.
Thresholds are draft defaults; the pilot will tune them.
Enforcement classes
| Class |
Meaning |
Blocks merge? |
| F: Formatter |
Fixed automatically by a formatter. Never a review topic. |
Yes (an unformatted file fails) |
| L: Linter |
Checked deterministically by a linter or type checker. |
Yes |
| S: Structural check |
Deterministic check on the repository or the diff (layout, dependency graph, coverage, required files). |
Yes |
| A: AI review |
Needs judgment. An advisory AI reviewer comments on the MR. |
No |
| H: Human review |
An item on the MR template checklist for the human reviewer. |
No (but the reviewer approves) |
A rule can have more than one class, e.g. L/A: the mechanical part is linted, and the judgment part goes to review.
Summary
| # |
Category |
Prefix |
Main classes |
| 1 |
Formatting & layout |
FMT |
F |
| 2 |
Naming |
NAM |
L, A |
| 3 |
Project & file structure |
STR |
S, H |
| 4 |
Module organization & dependencies |
DEP |
L, S |
| 5 |
Size & complexity |
CPX |
L, S |
| 6 |
Function & code design |
DES |
L, A |
| 7 |
Types & data contracts |
TYP |
L |
| 8 |
Error handling |
ERR |
L, A |
| 9 |
Comments & documentation |
DOC |
L, S, A |
| 10 |
Logging & observability |
LOG |
L, A |
| 11 |
Configuration & environment |
CFG |
L, S, A |
| 12 |
Dead code |
DEAD |
L, S |
| 13 |
Duplication & reuse |
DUP |
S, A |
| 14 |
Language idioms & framework conventions |
IDM |
L |
| 15 |
Styling (CSS/SCSS) |
CSS |
L |
| 16 |
Testing |
TST |
L, S, A |
| 17 |
Security & secrets |
SEC |
L, S |
| 18 |
Accessibility (web & email) |
A11Y |
L, S |
| 19 |
Generated, vendored & AI-specific |
GEN |
L, S, A |
| — |
Process |
PR |
GitLab settings |
| ID |
Rule |
Class |
| FMT-01 |
Every file is formatted by the language’s standard formatter with the shared config. Hand-formatting is not reviewed. |
F |
| FMT-02 |
UTF-8, LF line endings, final newline, no trailing whitespace (EditorConfig). |
F |
| FMT-03 |
Indentation and maximum line length per the language appendix (default 2 spaces web / 4 spaces Python, PHP, C#; tabs in Go; 100-column limit). |
F |
Tools: Prettier (JS/TS/Svelte/Astro/CSS/SCSS/HTML/JSON/YAML/Markdown), ruff format, gofmt/goimports, shfmt, phpcbf, dotnet format, PSScriptAnalyzer Invoke-Formatter, sqlfluff fix.
2. Naming (NAM)
| ID |
Rule |
Class |
| NAM-01 |
Identifier casing follows the language standard for each kind (variables, functions, types, constants, components, files). |
L |
| NAM-02 |
Boolean names read as predicates: is, has, can, should. |
L |
| NAM-03 |
Quantities with units include the unit: timeoutMs, sizeBytes, widthPx. |
A |
| NAM-04 |
No unclear abbreviations. Single-letter names only for loop indices and short lambdas. |
L (minimum length) / A |
| NAM-05 |
Names describe intent, not type or implementation (activeUsers, not userList2). |
A |
| NAM-06 |
One term per concept within a domain (don’t mix fetch/get/retrieve for the same thing). |
A |
| NAM-07 |
File and directory names follow the per-language casing rule (e.g. kebab-case.ts, PascalCase.svelte, snake_case.py). |
S |
Tools: typescript-eslint naming-convention, id-length, ruff N, revive var-naming, WPCS naming sniffs, Roslyn IDE1006, ls-lint.
3. Project & file structure (STR)
| ID |
Rule |
Class |
| STR-01 |
Projects follow the standard layout for their type (SvelteKit, WordPress theme/plugin, Go cmd/ + internal/, Python src/ layout, email build). |
S |
| STR-02 |
One main concept per file (one component, one class, one module of related functions). |
A |
| STR-03 |
Entry points, configuration and scripts live in the standard places for their project type. |
S |
| STR-04 |
Each repo has a README with: Purpose, Setup, Run, Test, Deploy, Owners. |
S |
| STR-05 |
Each repo has .editorconfig, the .conventions/ folder and agent pointers (AGENTS.md/CLAUDE.md). |
S |
| STR-06 |
Deviations from the standard layout are documented in the README. |
H |
Tools: ls-lint, bin/readme-sections-check, required-files check.
4. Module organization & dependencies (DEP)
| ID |
Rule |
Class |
| DEP-01 |
Imports are grouped and ordered: built-in, external, internal, relative. |
F/L |
| DEP-02 |
No import cycles. |
L/S |
| DEP-03 |
Layer and boundary rules hold where a project defines them (e.g. UI must not import data access directly). |
S |
| DEP-04 |
No deep relative imports (../../../). Use the configured path aliases. |
L |
| DEP-05 |
Modules expose a deliberate public API. Don’t import another module’s internals. |
L/S |
| DEP-06 |
No unused or unlisted dependencies. The lockfile is committed. |
S |
| DEP-07 |
New third-party dependencies are justified in the MR description. |
H |
Tools: eslint-plugin-import (order, no-cycle, no-relative-parent-imports), dependency-cruiser, knip, ruff I, import-linter, goimports, go mod tidy check.
5. Size & complexity (CPX)
| ID |
Rule |
Default threshold |
Class |
| CPX-01 |
Cyclomatic complexity per function |
≤ 10 |
L |
| CPX-02 |
Cognitive complexity per function |
≤ 15 |
L |
| CPX-03 |
Nesting depth |
≤ 3 |
L |
| CPX-04 |
Function length |
≤ 60 lines |
L |
| CPX-05 |
File length |
≤ 400 lines |
L/S |
| CPX-06 |
Parameters per function (use an options object beyond this) |
≤ 4 |
L |
| CPX-07 |
Component size (Svelte/Astro): script block + markup |
≤ 250 lines |
S |
Tools: ESLint complexity/max-depth/max-lines/max-lines-per-function/max-params, sonarjs cognitive-complexity, ruff C90/PLR, golangci gocyclo/gocognit/funlen, phpcs complexity sniffs, Roslyn CA1502, PSScriptAnalyzer; Lizard as a backstop across languages.
6. Function & code design (DES)
| ID |
Rule |
Class |
| DES-01 |
Each function does one thing (single responsibility). |
A |
| DES-02 |
Prefer early returns and guard clauses over nested conditionals. |
L (no-else-return) / A |
| DES-03 |
No boolean “flag” parameters that switch behavior. Use separate functions or an options object. |
L |
| DES-04 |
No magic numbers or strings. Use named constants. |
L |
| DES-05 |
Prefer immutability: const, no parameter reassignment, no mutation of inputs. |
L |
| DES-06 |
No mutable module-level or global state. |
L/A |
| DES-07 |
Separate pure logic from I/O where practical. |
A |
Tools: ESLint no-magic-numbers, prefer-const, no-param-reassign, sonarjs, ruff FBT/PLW/RET, gocritic, phpcs.
7. Types & data contracts (TYP)
| ID |
Rule |
Class |
| TYP-01 |
TypeScript runs in strict mode. No any (use unknown and narrow). |
L |
| TYP-02 |
Exported functions declare return types. |
L |
| TYP-03 |
Public Python functions have type hints and pass mypy/pyright. |
L |
| TYP-04 |
External data (API responses, form input, env, files) is validated at the boundary (schema validation). |
A |
| TYP-05 |
Consistent null/undefined handling. No non-null assertions (!) without a guard. |
L |
| TYP-06 |
Svelte components type their props. |
L |
Tools: tsc --strict, typescript-eslint (no-explicit-any, explicit-module-boundary-types, no-non-null-assertion), svelte-check, mypy, go vet, Roslyn nullable warnings as errors.
8. Error handling (ERR)
| ID |
Rule |
Class |
| ERR-01 |
No empty catch blocks and no swallowed errors. |
L |
| ERR-02 |
Throw only Error objects (no strings or plain objects). |
L |
| ERR-03 |
Every promise is awaited or explicitly handled. |
L |
| ERR-04 |
Every Go error is checked. |
L |
| ERR-05 |
Errors carry context (wrap with a cause and a message). |
L (Go wrapcheck) / A |
| ERR-06 |
Messages shown to users are separate from internal error details. |
A |
| ERR-07 |
Shell scripts use set -euo pipefail (or an equivalent explicit strict mode). |
L |
Tools: ESLint no-empty, typescript-eslint no-floating-promises/only-throw-error, ruff BLE/S110/TRY, errcheck, wrapcheck, ShellCheck, PSScriptAnalyzer.
| ID |
Rule |
Class |
| DOC-01 |
Public and exported APIs have doc comments (JSDoc/TSDoc, docstrings, Go doc, PHPDoc, XML docs). |
L |
| DOC-02 |
Comments explain why (intent, constraints, trade-offs), not what the code does. |
A |
| DOC-03 |
No commented-out code. |
L |
| DOC-04 |
TODO/FIXME must cite a ticket: TODO(ABC-123): …. |
L |
| DOC-05 |
No AI “narration” comments (// Now we loop over the items, # Step 1: …). |
A (+ L pattern list) |
| DOC-06 |
READMEs stay current when behavior, setup or deployment changes. |
H |
| DOC-07 |
Significant architectural decisions are recorded as ADRs. |
H |
Tools: eslint-plugin-jsdoc, sonarjs no-commented-code, ESLint no-warning-comments (pattern), ruff D/ERA/TD, revive exported, Roslyn CS1591, WPCS docs sniffs, markdownlint.
10. Logging & observability (LOG)
| ID |
Rule |
Class |
| LOG-01 |
Use the project logger. No leftover console.log, print, var_dump or fmt.Println debugging. |
L |
| LOG-02 |
Log levels are used consistently (debug, info, warn, error). |
A |
| LOG-03 |
Logs use structured fields, not concatenated strings, where the logger supports them. |
A |
| LOG-04 |
No secrets, tokens or personal data in logs. |
A + S (gitleaks patterns) |
Tools: ESLint no-console, ruff T20, forbidigo (Go), phpcs Generic.PHP.ForbiddenFunctions.
11. Configuration & environment (CFG)
| ID |
Rule |
Class |
| CFG-01 |
No hard-coded environment-specific values (hosts, URLs, account IDs, API keys). |
L (restricted patterns) / A |
| CFG-02 |
Every environment variable the code reads is listed in .env.example with a description. |
S |
| CFG-03 |
Configuration is read and validated in one place, not scattered through the code. |
A |
| CFG-04 |
.env and other secret-bearing files are git-ignored and never committed. |
S |
| CFG-05 |
Feature flags are named, documented and have a removal plan. |
H |
Tools: ESLint no-restricted-syntax patterns, gitleaks, an .env.example sync check.
12. Dead code (DEAD)
| ID |
Rule |
Class |
| DEAD-01 |
No unused variables, parameters or imports. |
L |
| DEAD-02 |
No unused exports, files or dependencies. |
S |
| DEAD-03 |
No unreachable code. |
L |
| DEAD-04 |
No unused CSS selectors in component-scoped styles. |
L (Svelte) / advisory elsewhere |
Tools: typescript-eslint no-unused-vars, knip, ruff F, vulture, staticcheck unused, svelte-check.
13. Duplication & reuse (DUP)
| ID |
Rule |
Class |
| DUP-01 |
No copy-pasted blocks over the threshold (default: 50 tokens / 10 lines) in changed code. |
S |
| DUP-02 |
Reuse existing shared utilities, components and design tokens instead of re-implementing them. |
A |
Tools: jscpd.
14. Language idioms & framework conventions (IDM)
| ID |
Rule |
Class |
| IDM-01 |
Use modern language syntax (e.g. optional chaining, const/let, f-strings, pattern matching where idiomatic). |
L |
| IDM-02 |
No deprecated APIs. |
L |
| IDM-03 |
Follow framework conventions: Svelte 5 runes, SvelteKit load functions, WordPress hooks/escaping/enqueueing, Go idioms, Pythonic constructs. |
L/A |
Tools: eslint-plugin-unicorn, eslint-plugin-svelte, @typescript-eslint/no-deprecated, ruff UP/SIM, gocritic, staticcheck, WPCS.
15. Styling: CSS/SCSS (CSS)
| ID |
Rule |
Class |
| CSS-01 |
Class names follow BEM (or the project’s documented methodology). |
L |
| CSS-02 |
Colors, spacing, typography and breakpoints use design tokens or variables, not literal values. |
L |
| CSS-03 |
No !important (except approved utility overrides). |
L |
| CSS-04 |
No ID selectors. Specificity ≤ 0,3,0. |
L |
| CSS-05 |
SCSS nesting depth ≤ 3. |
L |
| CSS-06 |
Consistent property order. |
F/L |
| CSS-07 |
Email CSS follows the email profile (inline-able, no unsupported properties). |
L |
Tools: Stylelint + stylelint-config-standard-scss (selector-class-pattern, declaration-no-important, selector-max-id, selector-max-specificity, max-nesting-depth), stylelint-declaration-strict-value, stylelint-order.
16. Testing (TST)
| ID |
Rule |
Class |
| TST-01 |
Tests live next to the code or in a mirrored tests/ tree, named by the language standard (*.test.ts, test_*.py, *_test.go). |
S |
| TST-02 |
New or changed modules with logic have tests. |
S (tests-exist) / H |
| TST-03 |
Changed lines meet the diff-coverage floor (default 80%) in projects with a test job. |
S |
| TST-04 |
Tests follow Arrange/Act/Assert. No conditionals or loops in test bodies. |
L/A |
| TST-05 |
Tests are deterministic: no real network, clock or randomness without fakes or seeds. |
A |
| TST-06 |
No focused (.only) or skipped tests committed without a ticket. |
L |
| TST-07 |
Test names describe the behavior under test. |
A |
Tools: eslint-plugin-vitest / eslint-plugin-jest (no-focused-tests, no-disabled-tests, no-conditional-in-test), ruff PT, bin/tests-exist-check, GitLab coverage report + diff-coverage job.
17. Security & secrets (SEC)
| ID |
Rule |
Class |
| SEC-01 |
No secrets in code or history (keys, tokens, passwords, private URLs with credentials). |
S |
| SEC-02 |
No dangerous APIs: eval, new Function, unescaped innerHTML / {@html} with untrusted data, shell built from strings. |
L |
| SEC-03 |
SQL is parameterized, never built by concatenation. |
L |
| SEC-04 |
WordPress output is escaped (esc_html, esc_attr, esc_url) and input is sanitized and nonce-checked. |
L |
| SEC-05 |
No dependencies with known high or critical vulnerabilities. |
S |
| SEC-06 |
Security-sensitive changes (auth, crypto, payments, PII handling) are flagged for review. |
H |
Tools: gitleaks, Semgrep (OSS rulesets), eslint-plugin-security, eslint-plugin-svelte (no-at-html-tags), ruff S (bandit), gosec, WPCS security sniffs, osv-scanner; plus GitLab SAST, Secret Detection and Dependency Scanning on Ultimate.
18. Accessibility: web & email (A11Y)
| ID |
Rule |
Class |
| A11Y-01 |
Images have meaningful alt text, or alt="" if decorative. |
L |
| A11Y-02 |
Form controls have associated labels. |
L |
| A11Y-03 |
Semantic elements and landmarks are used. Headings don’t skip levels. |
L |
| A11Y-04 |
Interactive elements are keyboard-operable and focus is visible. No click handlers on non-interactive elements without a role and key handler. |
L |
| A11Y-05 |
Color contrast meets WCAG 2.2 AA (checked through approved token pairs). |
S/A |
| A11Y-06 |
Email: layout tables have role="presentation"; the <html> element has lang and dir; key content is live text, not only images. |
L |
| A11Y-07 |
Full-page checks (axe/pa11y) on preview deploys where a project has them. |
S (optional) |
Tools: eslint-plugin-svelte a11y rules, html-validate (wcag/* rules; web and email presets), axe-core / pa11y-ci (optional).
19. Generated, vendored & AI-specific (GEN)
| ID |
Rule |
Class |
| GEN-01 |
Generated and vendored code lives in marked paths (.gitattributes linguist-generated / linguist-vendored) and is excluded from checks. |
S |
| GEN-02 |
Generated code is never hand-edited. Change the generator or source instead. |
H |
| GEN-03 |
No placeholders or stubs in merged code (TODO: implement, pass-only bodies, throw new Error("not implemented"), ... placeholders). |
L/S |
| GEN-04 |
No invented dependencies: every import resolves to a declared dependency and lockfile entry. |
S |
| GEN-05 |
No unrequested reformatting or churn outside the change’s scope. |
A |
| GEN-06 |
No inline suppression comments. Exceptions go through .conventions/ (see Architecture §6). |
S |
Tools: bin/placeholder-check, bin/inline-directive-check, knip (unlisted dependencies), tsc/import resolution, mypy/go build.
Process (PR)
| ID |
Rule |
Enforced by |
| PR-01 |
All code reaches protected branches through an approved merge request (no direct pushes; ≥ 1 non-author approval; human approval for agent-authored MRs; pipelines must succeed; threads resolved). |
GitLab protected branches and MR settings (group level) |
| PR-02 |
Changes to .conventions/ require approval from a conventions owner. |
CODEOWNERS + required code-owner approval |
Language coverage matrix
✓ = rules apply · ○ = partial or advisory · — = not applicable
| Category |
JS/TS |
Svelte/Astro |
CSS/SCSS |
HTML web |
HTML email |
PHP |
Python |
Go |
Shell |
PowerShell |
C# |
Config/infra |
| FMT |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
| NAM |
✓ |
✓ |
✓ |
○ |
○ |
✓ |
✓ |
✓ |
○ |
✓ |
✓ |
○ |
| STR |
✓ |
✓ |
○ |
○ |
✓ |
✓ |
✓ |
✓ |
○ |
○ |
✓ |
○ |
| DEP |
✓ |
✓ |
○ |
— |
— |
○ |
✓ |
✓ |
— |
— |
○ |
— |
| CPX |
✓ |
✓ |
○ |
— |
— |
✓ |
✓ |
✓ |
○ |
✓ |
✓ |
— |
| DES |
✓ |
✓ |
— |
— |
— |
✓ |
✓ |
✓ |
○ |
○ |
✓ |
— |
| TYP |
✓ |
✓ |
— |
— |
— |
○ |
✓ |
✓ |
— |
○ |
✓ |
— |
| ERR |
✓ |
✓ |
— |
— |
— |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
— |
| DOC |
✓ |
✓ |
○ |
○ |
○ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ (Markdown) |
| LOG |
✓ |
✓ |
— |
— |
— |
✓ |
✓ |
✓ |
○ |
○ |
○ |
— |
| CFG |
✓ |
✓ |
— |
○ |
○ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
| DEAD |
✓ |
✓ |
○ |
— |
— |
○ |
✓ |
✓ |
○ |
○ |
✓ |
— |
| DUP |
✓ |
✓ |
✓ |
○ |
○ |
✓ |
✓ |
✓ |
○ |
○ |
✓ |
— |
| IDM |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ (Dockerfile, YAML) |
| CSS |
— |
✓ |
✓ |
— |
✓ (email profile) |
— |
— |
— |
— |
— |
— |
— |
| TST |
✓ |
✓ |
— |
— |
— |
○ |
✓ |
✓ |
○ |
○ |
✓ |
— |
| SEC |
✓ |
✓ |
— |
○ |
○ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
| A11Y |
○ |
✓ |
○ |
✓ |
✓ |
○ |
— |
— |
— |
— |
— |
— |
| GEN |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |
✓ |