@nurix/etna 0.19.32 → 0.19.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/data/harness-index.json +5 -1
  2. package/data/harnesses/code/harness.json +2 -2
  3. package/data/harnesses/code/rules/changelog.md +5 -23
  4. package/data/harnesses/code/rules/database.md +77 -20
  5. package/data/harnesses/code/rules/express.md +7 -2
  6. package/data/harnesses/code/rules/frontend.md +14 -17
  7. package/data/harnesses/code/rules/general.md +47 -47
  8. package/data/harnesses/code/rules/nomenclature.md +25 -25
  9. package/data/harnesses/code/rules/pnpm.md +31 -28
  10. package/data/harnesses/code/rules/testing.md +11 -13
  11. package/data/harnesses/delivery/.prettierignore +29 -0
  12. package/data/harnesses/delivery/.prettierrc.json +3 -0
  13. package/data/harnesses/delivery/.vscode/settings.json +19 -0
  14. package/data/harnesses/delivery/CLAUDE.md +123 -0
  15. package/data/harnesses/delivery/agents/brainstorm.md +144 -0
  16. package/data/harnesses/delivery/agents/data-generator.md +23 -0
  17. package/data/harnesses/delivery/agents/eval-runner.md +23 -0
  18. package/data/harnesses/delivery/agents/judge.md +23 -0
  19. package/data/harnesses/delivery/agents/lld-mode.md +56 -0
  20. package/data/harnesses/delivery/agents/maintenance.md +229 -0
  21. package/data/harnesses/delivery/agents/prompt-iterator.md +23 -0
  22. package/data/harnesses/delivery/agents/red-team.md +23 -0
  23. package/data/harnesses/delivery/agents/regression-runner.md +28 -0
  24. package/data/harnesses/delivery/agents/retro.md +46 -0
  25. package/data/harnesses/delivery/codex/agents/brainstorm.toml +142 -0
  26. package/data/harnesses/delivery/codex/agents/data-generator.toml +22 -0
  27. package/data/harnesses/delivery/codex/agents/eval-runner.toml +22 -0
  28. package/data/harnesses/delivery/codex/agents/judge.toml +22 -0
  29. package/data/harnesses/delivery/codex/agents/lld-mode.toml +52 -0
  30. package/data/harnesses/delivery/codex/agents/maintenance.toml +228 -0
  31. package/data/harnesses/delivery/codex/agents/prompt-iterator.toml +22 -0
  32. package/data/harnesses/delivery/codex/agents/red-team.toml +22 -0
  33. package/data/harnesses/delivery/codex/agents/regression-runner.toml +27 -0
  34. package/data/harnesses/delivery/codex/agents/retro.toml +45 -0
  35. package/data/harnesses/delivery/harness.json +11 -0
  36. package/data/harnesses/delivery/hooks/generate-ownership-index.mjs +148 -0
  37. package/data/harnesses/delivery/hooks/hooks.json +16 -0
  38. package/data/harnesses/delivery/rules/changelog.md +19 -0
  39. package/data/harnesses/delivery/rules/evals.md +23 -0
  40. package/data/harnesses/delivery/rules/model-tiers.md +18 -0
  41. package/data/harnesses/delivery/rules/nomenclature.md +34 -0
  42. package/data/harnesses/delivery/rules/prompting.md +23 -0
  43. package/data/harnesses/delivery/skills/brainstorm/README.md +56 -0
  44. package/data/harnesses/delivery/skills/brainstorm/SKILL.md +173 -0
  45. package/data/harnesses/delivery/skills/brainstorm/references/doctrine.md +98 -0
  46. package/data/harnesses/delivery/skills/brainstorm/references/harvest.md +86 -0
  47. package/data/harnesses/delivery/skills/brainstorm/references/session-schema.md +186 -0
  48. package/data/harnesses/delivery/skills/brainstorm/scripts/detector.mjs +460 -0
  49. package/data/harnesses/delivery/skills/cost-report/SKILL.md +24 -0
  50. package/data/harnesses/delivery/skills/documentation/SKILL.md +129 -0
  51. package/data/harnesses/delivery/skills/documentation/references/examples.md +279 -0
  52. package/data/harnesses/delivery/skills/documentation/references/frontmatter.md +44 -0
  53. package/data/harnesses/delivery/skills/documentation/references/style-guide.md +340 -0
  54. package/data/harnesses/delivery/skills/documentation/references/untemplated.md +38 -0
  55. package/data/harnesses/delivery/skills/documentation/scripts/doc-lint.mjs +140 -0
  56. package/data/harnesses/delivery/skills/documentation/templates/Readme.md +31 -0
  57. package/data/harnesses/delivery/skills/documentation/templates/api-reference.md +20 -0
  58. package/data/harnesses/delivery/skills/documentation/templates/architecture-decision.md +121 -0
  59. package/data/harnesses/delivery/skills/documentation/templates/backlog.md +33 -0
  60. package/data/harnesses/delivery/skills/documentation/templates/changelog-entry.md +57 -0
  61. package/data/harnesses/delivery/skills/documentation/templates/changelog-index.md +41 -0
  62. package/data/harnesses/delivery/skills/documentation/templates/docs-readme.md +72 -0
  63. package/data/harnesses/delivery/skills/documentation/templates/domain-model.md +30 -0
  64. package/data/harnesses/delivery/skills/documentation/templates/environment-registry.md +15 -0
  65. package/data/harnesses/delivery/skills/documentation/templates/feature.md +149 -0
  66. package/data/harnesses/delivery/skills/documentation/templates/glossary.md +11 -0
  67. package/data/harnesses/delivery/skills/documentation/templates/memory-main.md +25 -0
  68. package/data/harnesses/delivery/skills/documentation/templates/migration-runbook.md +34 -0
  69. package/data/harnesses/delivery/skills/documentation/templates/non-goals.md +11 -0
  70. package/data/harnesses/delivery/skills/documentation/templates/operations-procedure.md +36 -0
  71. package/data/harnesses/delivery/skills/documentation/templates/plan.md +64 -0
  72. package/data/harnesses/delivery/skills/documentation/templates/protected-files.md +37 -0
  73. package/data/harnesses/delivery/skills/documentation/templates/root-readme.md +104 -0
  74. package/data/harnesses/delivery/skills/documentation/templates/security-overview.md +27 -0
  75. package/data/harnesses/delivery/skills/documentation/templates/structure.md +65 -0
  76. package/data/harnesses/delivery/skills/documentation/templates/system-overview.md +32 -0
  77. package/data/harnesses/delivery/skills/documentation/templates/testing-strategy.md +29 -0
  78. package/data/harnesses/delivery/skills/escalate/SKILL.md +25 -0
  79. package/data/harnesses/delivery/skills/prompt-eval/SKILL.md +22 -0
  80. package/data/harnesses/delivery/skills/prompt-library/SKILL.md +36 -0
  81. package/data/harnesses/delivery/skills/route/SKILL.md +21 -0
  82. package/data/harnesses/etna/harness.json +2 -2
  83. package/data/harnesses/etna/rules/changelog.md +5 -23
  84. package/data/harnesses/etna/rules/general.md +47 -47
  85. package/data/harnesses/etna/rules/kb.md +4 -11
  86. package/data/harnesses/etna/rules/nomenclature.md +25 -25
  87. package/data/harnesses/etna/rules/testing.md +11 -13
  88. package/data/harnesses/hr/harness.json +2 -2
  89. package/data/harnesses/hr/rules/code-eval-batcher.md +24 -28
  90. package/package.json +1 -1
@@ -1,10 +1,14 @@
1
1
  {
2
- "fingerprint": "1830b233ceb6",
2
+ "fingerprint": "e3c1231e3373",
3
3
  "harnesses": {
4
4
  "code": {
5
5
  "plugin": "code",
6
6
  "description": "the foundation every Nurix project starts with"
7
7
  },
8
+ "delivery": {
9
+ "plugin": "delivery",
10
+ "description": "cost-governed prompt engineering"
11
+ },
8
12
  "discover": {
9
13
  "plugin": "discover",
10
14
  "description": "Product Discovery harness"
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "harness": "code",
3
3
  "name": "code",
4
- "version": "3.5.1",
4
+ "version": "3.5.3",
5
5
  "files": [
6
6
  ".prettierignore",
7
7
  ".prettierrc.json",
8
8
  ".vscode/settings.json"
9
9
  ],
10
- "digest": "b786c10a8e0a"
10
+ "digest": "ca685ff63d77"
11
11
  }
@@ -1,8 +1,6 @@
1
1
  # Changelog
2
2
 
3
- Every unit of work leaves one record: `docs/history/changelog/YYYY-MM-DD-{three-words}.md`. The three words name the work, not the commit. Format, field rules, and the closed exemption list are the `documentation` skill's `templates/changelog-entry.md`.
4
-
5
- An entry is not a summary line. It carries the refinement context only the working session holds — the ask in the user's own words, what was rejected, which skills survived or were overridden, what running the thing taught, what now guards it.
3
+ Every unit of work leaves one record — `docs/history/changelog/YYYY-MM-DD-{three-words}.md` (the three words name the work, not the commit) — plus its row in `docs/history/CHANGELOG.md`, appended in the same pass so the index never trails the folder. Entry format, field rules, and the closed exemption list are the `documentation` skill's `templates/changelog-entry.md`; this rule owns when an entry is owed and how it lives. An entry is never a commit summary — it carries the refinement context only the working session holds, which no diff reconstructs.
6
4
 
7
5
  ## When an entry is owed
8
6
 
@@ -10,28 +8,12 @@ An entry is not a summary line. It carries the refinement context only the worki
10
8
  | --- | --- |
11
9
  | A plan reaches `Status: Complete` | A draft entry for that plan, linked to it — written now, while the session still holds the context |
12
10
  | The user asks for a changelog | The entry for the work in hand. No commit required |
13
- | A commit is made | Every non-exempt commit is covered by an entry — the commit skill writes or completes it |
14
-
15
- **Exempt** (closed list): release and bot commits, harness installs and bumps, lockfile-only changes, pure renames and moves, and changelog housekeeping itself.
11
+ | A commit is made | Every non-exempt commit is covered by an entry — the `commit` skill writes or completes it |
16
12
 
17
- ## The entry's life
18
-
19
- | State | Meaning |
20
- | --- | --- |
21
- | **Draft** | Created before its commit exists. Mutable — fields filled as far as the session can |
22
- | **Complete** | Missing fields filled in from the diff and the session |
23
- | **Frozen** | The moment it rides in a commit. Never edited again |
13
+ ## Lifecycle
24
14
 
25
- **Immutability begins at commit, not at creation.** A draft in the working tree is meant to be edited — that is what lets a completed plan record its context before anything is committed. Once an entry is committed it is history: a correction is a new entry linking back, never an edit.
15
+ Draft (created before its commit exists) → complete (missing fields filled from the diff and the session) → frozen the moment it rides in a commit. **Immutability begins at commit, not at creation** — a draft is meant to be edited, which is what lets a completed plan record its context before anything is committed; a committed entry is history, and a correction is a new entry linking back, **never** an edit.
26
16
 
27
17
  ## Granularity
28
18
 
29
- A commit is the smallest unit an entry may describe. Above that the mapping is judgment — four commits may be four entries or one, whichever reads better as history.
30
-
31
- An entry spanning several commits rides in the **last** of them and names the earlier ones in `Commits:`. An entry can never carry its own commit's SHA, so that field lists predecessors only and is omitted when one entry maps to one commit.
32
-
33
- When the work done exceeds what a draft describes, do not stretch the draft — write a second entry. The first stays an honest account of the plan; the second records the work beyond it.
34
-
35
- ## The index
36
-
37
- Every entry appends one row to `docs/history/CHANGELOG.md` — date, link, one-line summary — in the same pass that writes the entry, so the table never trails the folder.
19
+ A commit is the smallest unit an entry may describe; above that the mapping is judgment — four commits may be four entries or one, whichever reads better as history. An entry spanning several commits rides in the **last** of them, naming the predecessors in `Commits:`. When work exceeds what a draft describes, write a second entry rather than stretching the draft — the first stays an honest account of the plan.
@@ -1,12 +1,12 @@
1
1
  # Database
2
2
 
3
- Fixed conventions for relational schemas — table/column/index **names**, the **key vocabulary** (`id` / `slug` / `label`), column types, and Drizzle mirrors — so the same concept carries the same name in **every** Nurix project. This is a cross-project consistency rule: **one concept, one name, everywhere** — never `slug` in one repo and `handle` / `key` / `code` in another. General code naming (variables, files, casing) is [`nomenclature.md`](nomenclature.md); this rule owns the database.
3
+ Fixed conventions for relational schemas in **every** Nurix project — what earns a table, the key vocabulary, foreign-key doctrine, naming, and column types. A cross-project consistency rule: **one concept, one name, everywhere**. General code naming (variables, files, casing) is [`nomenclature.md`](nomenclature.md); this rule owns the database.
4
4
 
5
- Written for SQLite / Cloudflare D1 + Drizzle (the concrete types below). The **names and key vocabulary are engine-agnostic** — a Postgres project keeps the same column names and semantics with native types (`uuid`, `timestamptz`, `boolean`).
5
+ Written for SQLite / Cloudflare D1 + Drizzle (the concrete types below). The names and key vocabulary are engine-agnostic — a Postgres project keeps the same column names and semantics with native types (`uuid`, `timestamptz`, `boolean`).
6
6
 
7
7
  ## What earns a table
8
8
 
9
- A table is the most expensive home for data — it costs a migration to change its shape, a join to read, and a mirror to keep in sync. Default to **not** a table. A concept earns its own table only when it needs at least one property in the left column; lacking all of them, the data belongs in the cheaper home on the right.
9
+ A table is the most expensive home for data — a migration to change its shape, a join to read, a mirror to keep in sync. Default to **not** a table — a concept earns one only with at least one property in the left column.
10
10
 
11
11
  | A table is earned by… | Lacking all of these, the data belongs in… |
12
12
  | -------------------------------------------------------------------------- | ------------------------------------------------------- |
@@ -20,47 +20,104 @@ A table is the most expensive home for data — it costs a migration to change i
20
20
  | process state that is dead once the request completes | a **log or workflow engine**, never the domain DB |
21
21
  | owned by another system-of-record | a **reference column** — store the id, not the data |
22
22
 
23
- Each routing rule is one question:
23
+ Each right-column route is one test: process state — would a product feature break if this vanished the instant the request finished?; derived output — exactly recomputable from other rows + code?; un-addressed detail — is the row ever `SELECT`ed / `JOIN`ed / FK'd alone?; another system's record — does a specialized service (chat, telemetry, object store) already own it?
24
24
 
25
- - **Static vocabulary or a fixed graph → config, not a table.** Dev-authored, same for every tenant, never FK'd at runtime ⇒ a constants file validated at build, surfaced in code as a constant/type. Reifying it into tables plus a seed makes the file and the tables a two-copy sync problem. The refined boundary is § Vocabulary / lookup tables.
26
- - **History → one immutable log + a mutable head.** Never shatter versioning into per-entity `*_revisions` / `*_revision_sections` tables. Snapshot the coherent set once into an append-only versions table; current state is a derived projection of the newest entry. _Test: is this table just "old rows of that table"? → collapse it into the snapshot._
27
- - **Process state is not domain state.** _Test: if it were deleted the instant the request finished, would a product feature break? No ⇒ it is a log line or a workflow-engine concern._
28
- - **Derived output is a cache, not truth.** _Test: is it exactly recomputable from other rows + code? Yes ⇒ recompute and cache; never persist as first-class state._
29
- - **Un-addressed detail is a column.** _Test: is this row ever SELECTed / JOINed / FK'd alone? No ⇒ it is a JSON field on its parent._
30
- - **Another system's record → keep the pointer.** _Test: does a specialized service already own this — chat, telemetry, object store? ⇒ store its id, not a copy._
31
- - **A surviving table names the invariant it buys.** Each kept structure pays for one guarantee — content-addressed immutable rows buy reproducibility, a monotonic sequence buys ordering/sync, an atomic write boundary buys multi-row atomicity. Drop the requirement and the table drops with it; keep the requirement and the structure is the price a blob cannot pay.
25
+ - **Static vocabulary or a fixed graph → config, not a table.** Surface it in code as a constant/type; reifying it into tables plus a seed makes the file and the tables a two-copy sync problem. The refined boundary is § Vocabulary / lookup tables.
26
+ - **History → one immutable log + a mutable head.** Never shatter versioning into per-entity `*_revisions` / `*_revision_sections` tables — snapshot the coherent set into one append-only versions table; current state is a projection of the newest entry. A table that is just "old rows of another table" collapses into the snapshot.
27
+ - **A surviving table names the invariant it buys** — content-addressed immutable rows buy reproducibility, a monotonic sequence buys ordering/sync, an atomic write boundary buys multi-row atomicity. Drop the requirement and the table drops with it.
32
28
 
33
- Table count tracks **requirements, not domain richness** — a rich domain does not entitle a schema to a table per noun.
29
+ Table count tracks **requirements, not domain richness** — a rich domain is not entitled to a table per noun.
30
+
31
+ ## Scope, not parallel tables
32
+
33
+ One entity that exists at several scopes is **one table with a nullable scope column** — never one table per scope, and never one table shared across entity families.
34
+
35
+ - **A table shared by several families carries the union of their columns** — almost nothing can be `NOT NULL`, the payload lands in JSON beyond every constraint, index, and FK, and a new family widens a table other features already depend on. One table per family.
36
+ - **Two tables declared to have "the same columns" are two schemas maintained by hand** — the drift is silent, surfacing as an incomplete copy, never as an error. Collapse them and discriminate by column.
37
+ - **The scope column is the discriminator** (`app_id IS NULL` = parent scope, set = child scope). Copying a scope is then `INSERT … SELECT` over one table with one column rewritten, so source and target cannot disagree about shape.
38
+ - **A nullable owner column is how a row exists before its owner does** — a pending enrolment or unclaimed record is creatable before the owner is known, which is what lets a `pending_*` / `*_requests` table collapse into the real one.
39
+ - **A reserved row can own the shipped defaults.** A fixed-id "system" parent makes the defaults and a tenant's copy the same kind of row, through the same code. It must then be excluded from every tenant-scoped query — state that invariant where the id is defined.
40
+
41
+ ## Copying rows between scopes
42
+
43
+ - **A copied junction row is already correct with no remapping** — its endpoints are `slug` references (§ Keys & the shared vocabulary), and a slug means the same thing in every scope. Rewriting ids through a source→copy map is the most error-prone step in a multi-level copy, and a partial failure leaves wiring pointed into another scope rather than raising.
44
+ - **Provenance is a soft reference — no FK.** `source_id` must outlive its referent; an FK would either block the source's deletion or erase the lineage.
45
+ - **Store the source's version at copy time** — `version` + `source_version` make "is an upgrade available" a comparison of two stored values, not a content diff.
46
+ - **A copy is a row, never a live read.** Nothing at the child scope reads the parent's row at runtime; propagation happens only through an explicit re-copy, so a local edit is never silently overwritten.
34
47
 
35
48
  ## Keys & the shared vocabulary
36
49
 
37
50
  Three column roles are fixed across every table and every project:
38
51
 
39
- - **`id`** — the primary key, **always a UUID** (`TEXT PRIMARY KEY` on D1, `uuid` on Postgres). Never a synthetic or natural key (`type_page_button`, `human:default` are ❌). Runtime rows mint a UUIDv7; seed rows derive a deterministic UUIDv5 of the natural key so re-seeds stay stable. Never mix synthetic and UUID ids in one table.
40
- - **`slug`** — the **stable key other rows reference**: `UNIQUE`, lowercase `snake_case`. **Foreign keys point at `slug`, not `id`.** One concept = one slug name across every table and repo. ❌ Never rename this role `handle`, `key`, `code`, or `name` in a different project — it is always `slug`.
41
- - **`label`** — the **human display name**. Always `label` — ❌ never `name`, `title`, or `display_name`.
52
+ - **`id`** — the primary key, **always a UUID** (`TEXT PRIMARY KEY` on D1, `uuid` on Postgres), never a synthetic or natural key (❌ `type_page_button`, `human:default`). Runtime rows mint a UUIDv7; seed rows derive a deterministic UUIDv5 of the natural key so re-seeds stay stable. **Never** mix synthetic and UUID ids in one table.
53
+ - **`slug`** — the **stable key rows in another scope reference**: `UNIQUE`, lowercase `snake_case`. A slug means the same thing in every scope, so a slug reference survives a copy with no remapping (§ Copying rows between scopes). ❌ Never rename this role `handle`, `key`, `code`, or `name` in another project.
54
+ - **`label`** — the **human display name** — ❌ never `name`, `title`, or `display_name`.
42
55
 
43
56
  Reference columns name what they point at: `<entity>_id` for a UUID-PK reference (`user_id`, `app_id`), `<entity>_slug` for a slug reference (`source_slug`).
44
57
 
45
- - **Enforced** (the referenced row must exist) → a real `FOREIGN KEY (<x>_slug) REFERENCES <table>(slug)`.
58
+ - **Enforced, same scope** (the referenced row must exist) → a real `FOREIGN KEY (<x>_id) REFERENCES <table>(id)`.
59
+ - **Cross-scope** (the reference must survive being copied) → `<x>_slug` as a plain column, **no** FK — an FK would bind the row to one scope's copy of the target, which is the remapping the slug exists to avoid.
46
60
  - **Drift-tolerant** (a controlled-vocabulary value that may fall off-list) → a plain value column, **no** FK, paired with an `is_*` boolean recording whether the value is in the canonical set.
47
61
 
62
+ **Every inbound FK to a hub table declares a deliberate `ON DELETE`.** A hub (`users`, `devices`, anything several modules point at) collects edges from teams that never meet, and a single `NO ACTION` among them turns deleting the parent into a constraint error naming neither table. Decide per edge: the child dies with the row (`CASCADE`) or survives it (`SET NULL`, which needs a nullable column) — `NO ACTION` on a hub is a deferred outage, not a default.
63
+
64
+ ## A junction spells many-to-many — nothing else
65
+
66
+ **A `_map` table is the schema's notation for M:N. Using it for 1:M is a category error** — the junction's own uniqueness admits many parents per child, so the "one parent" rule stops being enforced the moment it is written this way. Cardinality decides between the only two shapes:
67
+
68
+ | Relationship | Shape |
69
+ | --- | --- |
70
+ | **1:M** — the child has exactly one parent | a **reference column on the child** (`agents.routing_slug`), plus an index |
71
+ | **M:N** — both sides have many | a **`<a>_<b>_map` junction** with a composite unique |
72
+
73
+ - **The test is one question about the child**: can this row ever belong to two parents at once? No ⇒ column. A junction "in case it becomes M:N later" ships the unenforced model today to buy a migration you may never run.
74
+ - **A junction for a 1:M also** makes the association a row that can go missing independently of the child — a child can exist correctly while its wiring does not — and forces a join onto the most common read in the system.
75
+ - **A junction carrying only its two endpoints and timestamps is the tell** — a real M:N junction usually earns its own columns (a role, an order, a status); one that never does is a 1:M waiting to be collapsed into a column.
76
+ - **Collapsing deletes a copy step** — the association travels inside the row it belongs to: no second pass to remap, no copy landing with its wiring half-applied.
77
+ - **A pair already recorded elsewhere needs no table at all.** If an append-only log stores `(parent, child)` on every write, the association table is `SELECT DISTINCT` over that log — a cache free to disagree with the log it derives from (§ What earns a table).
78
+
79
+ ## Foreign keys into and out of append-only tables
80
+
81
+ **An append-only table can afford no `ON DELETE` action at all, so its references to mutable tables are soft — no FK.** Every option is closed to it:
82
+
83
+ | Action | Why it fails on an append-only table |
84
+ | --- | --- |
85
+ | `SET NULL` | It is an **UPDATE**. An append-only trigger aborts it, so the parent's deletion fails — with an error naming the trigger, not the constraint. |
86
+ | `CASCADE` | Deletes history to delete a person. The log exists precisely to outlive its subjects. |
87
+ | `NO ACTION` | Makes anyone who ever appeared in the log undeletable — the hub defect above. |
88
+
89
+ - **`SET NULL` is the trap** — it reads like a safe relaxation of `NO ACTION` and passes review as one.
90
+ - **Record the actor as a plain column** — the same soft-reference treatment provenance gets (`source_id`, `thread_id`). The log keeps naming who acted after the account is gone, which is what an audit trail is for.
91
+ - **`CASCADE` from the append-only side's own parent is still fine** — a cascade is a DELETE, so a `BEFORE UPDATE` trigger never sees it: an App's log dying with the App is legitimate, distinct from erasing a log to delete a person.
92
+ - **State the exemption where it exists.** A catalog whose rows must not disappear under a referencing row (a service definition, a vocabulary) keeps `NO ACTION` deliberately — that guarantee is worth one line saying so.
93
+
48
94
  ## Naming
49
95
 
50
96
  - **Tables** — `snake_case`, plural noun for what they hold (`users`, `apps`, `devices`).
51
- - **Junction (M:N) tables** — `<entityA>_<entityB>_map`, **always**, even when the join carries its own columns; singular stems, owning/anchor entity first (`app_user_map`, `app_device_map`). ❌ Never a "nice" noun (`members`, `installs`, `memberships`, `enrolments`) — the name must read as a join, and a reviewer should know both sides from it.
97
+ - **Junction (M:N) tables** — `<entityA>_<entityB>_map`, **always**, even when the join carries its own columns; singular stems, owning/anchor entity first (`app_user_map`, `app_device_map`). ❌ Never a "nice" noun (`members`, `installs`, `memberships`, `enrolments`) — the name must read as a join, and a reviewer should know both sides from it. The `_map` suffix is reserved for genuine M:N (§ A junction spells many-to-many).
52
98
  - **Columns** — `snake_case`; booleans `is_*` / `has_*`; timestamps `created_at` / `updated_at`; foreign keys `<entity>_id`.
53
99
  - **Indexes** — `<table>_<col(s)>_idx`; unique `<table>_<col(s)>_unique`; a junction's composite unique reads `<table>_<colA>_<colB>_unique` (`app_user_map_app_user_unique`).
54
100
  - **Drizzle mirror** — the exported object is the camelCase table name (`app_user_map` → `appUserMap`); column props are the camelCase of the column (`created_at` → `createdAt`). The `sqliteTable("…")` string and every index name must match the DDL (`init.sql`) exactly — the schema-parity boundary.
55
101
 
102
+ ## Uniqueness with a nullable column
103
+
104
+ **`UNIQUE (a, b)` does not constrain rows where `b` is `NULL`** — SQL treats every `NULL` as distinct, so a composite unique over a nullable discriminator silently permits exactly the duplicates it was introduced to keep apart. Write one partial index per scope instead:
105
+
106
+ ```sql
107
+ CREATE UNIQUE INDEX <t>_parent_slug_unique ON <t> (parent_id, slug) WHERE child_id IS NULL;
108
+ CREATE UNIQUE INDEX <t>_child_slug_unique ON <t> (child_id, slug) WHERE child_id IS NOT NULL;
109
+ ```
110
+
111
+ **Prove a uniqueness claim by inserting the duplicate it forbids** — a schema review cannot tell a firing index from a silent one by reading.
112
+
56
113
  ## Column types (SQLite / D1)
57
114
 
58
115
  - **Timestamps** — `created_at` + `updated_at`, both `TEXT NOT NULL DEFAULT (datetime('now'))`, on **every** table — except append-only logs, which carry only `created_at`.
59
- - **Booleans** — `INTEGER`, named `is_*` / `has_*` (Drizzle `integer(…, { mode: "boolean" })`).
116
+ - **Booleans** — `INTEGER` (Drizzle `integer(…, { mode: "boolean" })`); the `is_*` / `has_*` names are § Naming.
60
117
  - **JSON** — `TEXT` (Drizzle `text(…, { mode: "json" })`).
61
118
 
62
119
  ## Vocabulary / lookup tables
63
120
 
64
- A controlled vocabulary earns a **table** only when a user row FKs into it and reads its `label` / `description` at runtime; a controlled vocabulary that is static, dev-authored config nobody references by FK stays **config** (§ What earns a table) — enumerable is not the same as tabular, and a `type`-style column validated against the constants file is preferred over an FK to a seeded mirror. When a table is earned, it follows a fixed shape: `id` (UUID) · `slug` (UNIQUE) · `label` · optional `description` · `status` · timestamps.
121
+ A controlled vocabulary earns a **table** only when a user row FKs into it and reads its `label` / `description` at runtime; static dev-authored config nobody references by FK stays **config** (§ What earns a table) — enumerable is not tabular, and a `type`-style column validated against the constants file beats an FK to a seeded mirror. An earned table has a fixed shape: `id` (UUID) · `slug` (UNIQUE) · `label` · optional `description` · `status` · timestamps.
65
122
 
66
- - **Seeds are generated, never hand-written** — the source of truth is a CSV or a shared package; a generator emits the `*.seed.sql` with UUIDv5 ids and an idempotent `ON CONFLICT(slug)` upsert that preserves live counts / admin-tuned columns. Hand-editing seed SQL is ❌ — regenerate it.
123
+ - **Seeds are generated, never hand-written** — the source of truth is a CSV or a shared package; a generator emits the `*.seed.sql` with UUIDv5 ids and an idempotent `ON CONFLICT(slug)` upsert that preserves live counts / admin-tuned columns. ❌ Hand-editing seed SQL — regenerate it.
@@ -4,6 +4,8 @@ Express 5.x server setup and the JSON response envelope every Nurix HTTP service
4
4
 
5
5
  ## Express 5.x
6
6
 
7
+ Canonical middleware stack:
8
+
7
9
  ```javascript
8
10
  app.use(cors({ origin: process.env.FRONTEND_URL }));
9
11
  app.use(compression());
@@ -11,10 +13,13 @@ app.use(express.json({ limit: '10mb' }));
11
13
  app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }));
12
14
  ```
13
15
 
14
- - Middleware order: body parsers → custom middleware → routes → error handlers (centralized, last). Auth via middleware. Use Express Router for modular routes.
16
+ - **Middleware order is fixed**: body parsers → custom middleware → routes → error handlers (centralized, **always** last) — no ad-hoc per-route error responses.
17
+ - Auth is middleware, not inline route checks. Routes are modular via Express Router.
15
18
 
16
19
  ## API Response Format
17
20
 
21
+ Success and error share **one** envelope — a cross-service contract clients branch on, so a per-service "improvement" (`success: true`, a boolean `status`, a bare payload) breaks every consumer:
22
+
18
23
  ```json
19
24
  {
20
25
  "status": 1,
@@ -25,4 +30,4 @@ app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }));
25
30
 
26
31
  Error: `{ "status": 0, "message": "Error description", "data": null }`
27
32
 
28
- HTTP codes: `200`, `201` (created), `400`, `401` (not authenticated), `403` (not authorized), `404`, `500`
33
+ HTTP codes, **closed list**: `200`, `201` (created), `400`, `401` (not authenticated), `403` (not authorized), `404`, `500`.
@@ -1,35 +1,32 @@
1
1
  # Frontend
2
2
 
3
- Tailwind v4 + shadcn-based UI conventions for **web** apps — styling, the `@nurix/components` library, the design.md token artifact, and design-skill routing — plus the TypeScript conventions every package compiles under. Package versions live in [`general.md`](general.md); the Express server and API envelope in [`express.md`](express.md); workspace layout and installing/consuming `@nurix/*` packages in [`pnpm.md`](pnpm.md); React Native styling is out of scope — that's [`react-native.md`](react-native.md).
3
+ Tailwind v4 + shadcn-based UI conventions for **web** apps — styling, the `@nurix/components` library, the `design.md` token artifact, and design-skill routing — plus the TypeScript conventions every package compiles under. Package versions live in [`general.md`](general.md); the Express server and API envelope in [`express.md`](express.md); workspace layout and consuming `@nurix/*` packages in [`pnpm.md`](pnpm.md); React Native styling is [`react-native.md`](react-native.md).
4
4
 
5
- - **Build every UI through the `design` skill** — route the brief through it instead of hand-rolling layouts; it owns the page archetypes, the design.md identity system and its derived token artifact (`design.tokens.css`), and chrome wiring — `@nurix/components` or the incumbent stack's components, behind its one-line primitives switch.
5
+ - **Build every UI through the `design` skill** — never hand-roll layouts; the page archetypes, the `design.md` identity system with its token artifact (`design.tokens.css`), and chrome wiring live in the skill.
6
6
  - **The brief's stated theme binds** — dark boots dark when the brief says so (recorded in the project's `design.md`); light is the default only when the brief is silent.
7
- - **@nurix/components** — the UI component library, a restricted-scope npm package (install, auth, and the no-substitutes guard are [`pnpm.md`](pnpm.md) §3); import by subpath, e.g. `@nurix/components/button`.
8
- - No components.json / shadcn CLI scaffold (.tsx, not .jsx) — consume the prebuilt library; never `npx shadcn add`.
9
- - Vite: `@tailwindcss/vite` + `@vitejs/plugin-react-swc`. Pin react / react-dom / react/jsx-runtime / react/jsx-dev-runtime to the app's single copy via `resolve.alias` (@nurix/\* ship nested react — keep one hook dispatcher).
10
- - Tailwind v4, CSS-only (no tailwind.config.js, no PostCSS): styling runs through the `@tailwindcss/vite` plugin.
11
- - CSS entry `globals.css`, imports in order — `@import "./fonts.css"` (@fontsource registrations, first) → the project's `design.tokens.css` (token source — derived from the repo-base `design.md` by the design skill's validator, never hand-edited) → `@import "tailwindcss"` → the library's `styles.css` — then `@theme inline {…}` mapping vars to tokens.
12
- - Tokens: CSS vars in `:root, :root[data-theme="light"]` and `:root[data-theme="dark"]` (both specificity 0,2,0 — the armor a later bare `:root` can't defeat), consumed as semantic Tailwind tokens (bg-card, text-foreground). `globals.css` carries the active `@custom-variant dark` line; the theme attribute convention is `data-theme`. The library bundles class-variance-authority, clsx, tailwind-merge.
13
- - Plus general styling rules (spacing in 2/4/6/8, object-cover, truncate, motion, color tokens — never hardcoded hex in components).
7
+ - **`@nurix/components`** is the UI library — import by subpath (`@nurix/components/button`); install, auth, and the no-substitutes guard are [`pnpm.md`](pnpm.md) §3. **Never** `npx shadcn add`, no `components.json` scaffold — consume the prebuilt library (`.tsx`, not `.jsx`).
8
+ - Vite: `@tailwindcss/vite` + `@vitejs/plugin-react-swc`. Pin `react` / `react-dom` / `react/jsx-runtime` / `react/jsx-dev-runtime` to the app's single copy via `resolve.alias` — `@nurix/*` ship nested react, and two copies means two hook dispatchers.
9
+ - Tailwind v4 is CSS-only — no `tailwind.config.js`, no PostCSS.
10
+ - CSS entry `globals.css`, imports in order: `@import "./fonts.css"` (`@fontsource` registrations) → the project's `design.tokens.css` (derived from the repo-base `design.md` by the design skill's validator — **never** hand-edited) → `@import "tailwindcss"` → the library's `styles.css` — then `@theme inline {…}` mapping vars to tokens.
11
+ - Tokens: CSS vars in `:root, :root[data-theme="light"]` and `:root[data-theme="dark"]` (both specificity 0,2,0 — armor a later bare `:root` can't defeat), consumed as semantic Tailwind tokens (`bg-card`, `text-foreground`). `globals.css` carries the active `@custom-variant dark` line; the theme attribute is `data-theme`. The library bundles `class-variance-authority`, `clsx`, `tailwind-merge` — don't re-add them.
12
+ - Spacing in 2/4/6/8; `object-cover`; `truncate`; color through tokens — **never** hardcoded hex in components.
14
13
 
15
14
  ## TypeScript
16
15
 
17
- TypeScript conventions. Compiles under `strict: true` and `noUncheckedIndexedAccess: true`.
16
+ Every package compiles under `strict: true` and `noUncheckedIndexedAccess: true`.
18
17
 
19
18
  ### Type Safety
20
19
 
21
- - Never `any` to silence the checker. Unknown value → type `unknown`, then narrow (type guard / `zod` parse).
22
- - Never weaken strictness. No `// @ts-nocheck`; `// @ts-expect-error` only with a same-line reason.
23
- - Infer locals & return types; annotate at boundaries (exports, props, contracts).
20
+ - **Never** `any` to silence the checker. Unknown value → type `unknown`, then narrow (type guard / `zod` parse).
21
+ - **Never** weaken strictness: no `// @ts-nocheck`; `// @ts-expect-error` only with a same-line reason.
22
+ - Infer locals and return types; annotate at boundaries (exports, props, contracts).
24
23
 
25
24
  ### Generics
26
25
 
27
- Shared libraries (`@nurix/components`, etc.) are generic on purpose — that's what types `cell(row)`, checks `slug` against `keyof TData`, and ties `data`/`columns` together. Keep the safety; never widen to `any` to dodge it. State the row type **once per file**, then let inference carry it:
26
+ Shared libraries (`@nurix/components`, etc.) are generic on purpose — that's what types `cell(row)`, checks `slug` against `keyof TData`, and ties `data`/`columns` together; **never** widen to `any` to dodge it. State the row type **once per file** and let inference carry it — repeating `fn<Type>(…)` / `<Comp<Type>>` per call site is cosmetic (same safety, same emitted JS):
28
27
 
29
- - **Bind a repeated factory once** (preferred): `const col = defineColumn<BriefRow>;` → `col({...})`. No `<T>` per call; `row` stays typed. Canonical: `modules/briefs/BriefsListPage.tsx`.
28
+ - **Bind a repeated factory once** (preferred): `const col = defineColumn<BriefRow>;` → `col({...})`. Canonical: `modules/briefs/BriefsListPage.tsx`.
30
29
  - **Infer JSX type args from props:** `<Table data={rows} columns={columns} />`, not `<Table<BriefRow> …>`.
31
30
  - **Anchor with a collection annotation** when nothing else can: `const columns: ColumnDefinition<BriefRow>[] = [...]`.
32
31
 
33
- Don't repeat `fn<Type>(…)` / `<Comp<Type>>` at every call site — cosmetic only (same safety, same emitted JS).
34
-
35
32
  > Monorepo TS policy (`tsconfig.base.json` + thin per-package `extends`, source-first internal packages, `peerDependencies`, pnpm `catalog:`) lives in [`pnpm.md`](pnpm.md) §2 — it travels with package boundaries.
@@ -1,61 +1,61 @@
1
1
  # General Standards
2
2
 
3
- Runtime versions and the canonical package list — the workspace baseline every Nurix code harness loads. Web-frontend/styling conventions are [`frontend.md`](frontend.md); the Express server and the API response envelope are [`express.md`](express.md).
3
+ Runtime versions, the canonical package list, and GitHub Actions pins — the workspace baseline. Web-frontend/styling conventions are [`frontend.md`](frontend.md); the Express server and the API response envelope are [`express.md`](express.md).
4
4
 
5
5
  ## Runtime Versions
6
6
 
7
7
  - **Node.js:** 24 LTS
8
- - **Package manager:** detect from lockfile (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `package-lock.json` → npm). Don't hardcode one.
8
+ - **Package manager:** detect from the lockfile — **never** hardcode one.
9
9
  - **PostgreSQL:** 17 · **Redis:** 7.x (latest)
10
10
 
11
- ## Recommended Packages
12
-
13
- No alternatives. Just use these.
14
-
15
- | Package | Version | Use | Don't use |
16
- | ------------------------ | --------- | ---------------------- | -------------------------- |
17
- | react | ^19.2.3 | UI components | - |
18
- | vite | ^8.0.0 | Build tool, dev server | webpack, CRA |
19
- | tailwindcss | ^4.1.18 | Styling | styled-components |
20
- | @vitejs/plugin-react-swc | ^4.2.2 | JSX compilation | @vitejs/plugin-react |
21
- | react-router-dom | ^7.11.0 | Routing | - |
22
- | @reduxjs/toolkit | ^2.11.2 | State management | zustand, jotai |
23
- | react-redux | ^9.2.0 | Redux React bindings | - |
24
- | axios | ^1.13.2 | HTTP requests | fetch |
25
- | date-fns | ^4.1.0 | Date formatting | moment, dayjs |
26
- | @dnd-kit/core | ^6.3.1 | Drag and drop | react-beautiful-dnd |
27
- | @xyflow/react | ^12.11.0 | Node-based flow charts | reactflow, react-flow-renderer |
28
- | motion | ^12.23.26 | Animations | react-spring |
29
- | sonner | ^2.0.7 | Toast notifications | react-toastify |
30
- | react-window | ^2.2.3 | List virtualization | react-virtualized |
31
- | nanoid | ^6.0.0 | ID generation | uuid |
32
- | express | ^5.2.1 | HTTP server | fastify, koa |
33
- | drizzle-orm | ^0.45.2 | Database ORM | prisma, sequelize, typeorm |
34
- | drizzle-kit | ^0.31.10 | Schema tooling | - |
35
- | zod | ^4.2.1 | Schema validation | yup, joi |
36
- | jose | ^6.1.3 | JWT handling | jsonwebtoken |
37
- | microdiff | ^1.5.0 | JSON object diffing | deep-diff, just-diff |
38
- | react18-json-view | ^0.2.9 | JSON tree view | react-json-view |
39
- | @tiptap/react | ^3.11.1 | Rich text editor | slate, quill, draft-js |
40
- | shiki | ^4.3.1 | Syntax highlighting | prism, highlight.js |
41
- | lucide-react | ^1.26.0 | Icons | react-icons, heroicons |
42
- | @pdfme/generator | ^6.1.12 | PDF generation | jspdf, pdfkit |
43
- | cmdk | ^1.1.1 | Command palette | kbar, ninja-keys |
44
- | @monaco-editor/react | ^4.7.0 | Code editor | codemirror, ace |
45
- | localforage | ^1.10.0 | Client-side storage | idb, dexie |
46
- | react-markdown | ^10.1.0 | Markdown rendering | marked, markdown-it |
47
- | remark-gfm | ^4.0.1 | GFM (tables, tasklists) | remark-github, custom |
48
- | fast-deep-equal | ^3.1.3 | Deep equality checks | lodash.isEqual |
49
- | @ngneat/falso | latest | Fake data generation | @faker-js/faker, chance |
50
- | pino | ^10.1.0 | Logging | winston |
11
+ ## Packages
12
+
13
+ **Only** these — no alternatives.
14
+
15
+ | Package | Version | Use | Don't use |
16
+ | --- | --- | --- | --- |
17
+ | `react` | ^19.2.3 | UI components | — |
18
+ | `vite` | ^8.0.0 | Build tool, dev server | `webpack`, CRA |
19
+ | `tailwindcss` | ^4.1.18 | Styling | `styled-components` |
20
+ | `@vitejs/plugin-react-swc` | ^4.2.2 | JSX compilation | `@vitejs/plugin-react` |
21
+ | `react-router-dom` | ^7.11.0 | Routing | — |
22
+ | `@reduxjs/toolkit` | ^2.11.2 | State management | `zustand`, `jotai` |
23
+ | `react-redux` | ^9.2.0 | Redux React bindings | — |
24
+ | `axios` | ^1.13.2 | HTTP requests | `fetch` |
25
+ | `date-fns` | ^4.1.0 | Date formatting | `moment`, `dayjs` |
26
+ | `@dnd-kit/core` | ^6.3.1 | Drag and drop | `react-beautiful-dnd` |
27
+ | `@xyflow/react` | ^12.11.0 | Node-based flow charts | `reactflow`, `react-flow-renderer` |
28
+ | `motion` | ^12.23.26 | Animations | `react-spring` |
29
+ | `sonner` | ^2.0.7 | Toast notifications | `react-toastify` |
30
+ | `react-window` | ^2.2.3 | List virtualization | `react-virtualized` |
31
+ | `nanoid` | ^6.0.0 | ID generation | `uuid` |
32
+ | `express` | ^5.2.1 | HTTP server | `fastify`, `koa` |
33
+ | `drizzle-orm` | ^0.45.2 | Database ORM | `prisma`, `sequelize`, `typeorm` |
34
+ | `drizzle-kit` | ^0.31.10 | Schema tooling | — |
35
+ | `zod` | ^4.2.1 | Schema validation | `yup`, `joi` |
36
+ | `jose` | ^6.1.3 | JWT handling | `jsonwebtoken` |
37
+ | `microdiff` | ^1.5.0 | JSON object diffing | `deep-diff`, `just-diff` |
38
+ | `react18-json-view` | ^0.2.9 | JSON tree view | `react-json-view` |
39
+ | `@tiptap/react` | ^3.11.1 | Rich text editor | `slate`, `quill`, `draft-js` |
40
+ | `shiki` | ^4.3.1 | Syntax highlighting | `prism`, `highlight.js` |
41
+ | `lucide-react` | ^1.26.0 | Icons | `react-icons`, `heroicons` |
42
+ | `@pdfme/generator` | ^6.1.12 | PDF generation | `jspdf`, `pdfkit` |
43
+ | `cmdk` | ^1.1.1 | Command palette | `kbar`, `ninja-keys` |
44
+ | `@monaco-editor/react` | ^4.7.0 | Code editor | `codemirror`, `ace` |
45
+ | `localforage` | ^1.10.0 | Client-side storage | `idb`, `dexie` |
46
+ | `react-markdown` | ^10.1.0 | Markdown rendering | `marked`, `markdown-it` |
47
+ | `remark-gfm` | ^4.0.1 | GFM (tables, tasklists) | `remark-github`, custom |
48
+ | `fast-deep-equal` | ^3.1.3 | Deep equality checks | `lodash.isEqual` |
49
+ | `@ngneat/falso` | latest | Fake data generation | `@faker-js/faker`, `chance` |
50
+ | `pino` | ^10.1.0 | Logging | `winston` |
51
51
 
52
52
  ## GitHub Actions
53
53
 
54
54
  Pin the major, and check it against the action's releases — a major behind still runs, so a stale pin never fails, it only warns.
55
55
 
56
- | Action | Version | Use |
57
- | -------------------------- | ------- | -------------------------- |
58
- | actions/checkout | v7 | Repo checkout |
59
- | actions/setup-node | v7 | Node toolchain + npm cache |
56
+ | Action | Version | Use |
57
+ | --- | --- | --- |
58
+ | `actions/checkout` | v7 | Repo checkout |
59
+ | `actions/setup-node` | v7 | Node toolchain + npm cache |
60
60
 
61
- Set `node-version` from the Runtime Versions block above, not from whatever the runner defaults to.
61
+ Set `node-version` from the Runtime Versions block above, **never** from the runner's default.
@@ -1,34 +1,34 @@
1
- # Nomenclature Guidelines
1
+ # Nomenclature
2
2
 
3
- ## Naming Guidelines
3
+ Naming and casing for code — identifiers, files, folders. The rationale throughout is consistency: one concept, one name, one casing shape, in every repo that loads this rule. Database naming is not here — see § Database.
4
4
 
5
- - Use descriptive names that reveal intent, purpose, and usage
6
- - Names should explain why something exists and how it's used
7
- - Favor clarity over brevity
8
- - Maintain consistency within the codebase
9
- - Avoid abbreviations unless they're universally understood
5
+ Names state intent in full words — clarity over brevity; no abbreviations unless universally understood (`id`, `url` ✅ · `cfg`, `btn`, `idx` ❌).
10
6
 
11
- ## Naming Styles
7
+ ## Casing
12
8
 
13
- - Variables : Use nouns or noun phrases. Examples: `userData`, `firstName`, `paymentStatus`, `configOptions`
14
- - Functions & Methods : Use verbs or verb phrases that describe the action. Examples: `calculateTotal`, `getUserInfo`, `validateInput`, `sendNotification`
15
- - Boolean Variables : Prefix with is**, has**, can**, or should**. Examples: `isValid`, `hasPermission`, `canEdit`, `shouldRefresh`
16
- - Arrays : Use plural nouns. Examples: `users`, `productList`, `errorMessages`, `activeConnections`
17
- - Classes & Components : Use singular nouns or noun phrases. Examples: `RequestHandler`, `UserProfile`, `PaymentProcessor`, `DataValidator`
18
- - Constants : Use uppercase with meaningful names. Examples: `DEFAULT_TIMEOUT`, `API_BASE_URL`, `MAX_RETRY_COUNT`, `COLOR_PRIMARY`
19
- - Event Handlers : Use Prefix with handle or on. Examples: `handleSubmit`, `onUserLogin`, `handleInputChange`, `onPageLoad`
20
- - Interfaces & Types : Use Consider prefixing with I for interfaces (if preferred). Examples: `IUserData`, `IConfigOptions`, `AuthResponse`, `RequestParams`
21
- - Promises & Async Functions : Use Consider using future tense or suffixes like Async. Examples: `fetchUserData`, `getUserProfileAsync`, `loadConfigAsync`, `processPayment`
22
- - File & Folder Structure : Use lowercase with descriptive names. Group by feature or function type. Example: `auth/login_service.js`
9
+ | Casing | Used for | Example |
10
+ | --- | --- | --- |
11
+ | `camelCase` | variables, functions, methods, properties; a module file exporting no component | `calculateTotal`, `sessionClient.ts` |
12
+ | `PascalCase` | classes, type definitions, components; the file exporting one | `PaymentProcessor`, `AppsListPage.tsx` |
13
+ | `UPPER_SNAKE_CASE` | constants, environment variables | `MAX_RETRY_COUNT` |
14
+ | `kebab-case` | URLs, CSS class names, HTML IDs, multi-word folders | `user-profile`, `workspace-provisioning/` |
15
+ | `snake_case` | database tables, columns, indexes — § Database | `created_at` |
23
16
 
24
- ## Casing Styles
17
+ **A file exporting one component carries that component's name exactly**, so an import names the file it came from; a single-word folder is plain lowercase (`lib`, `surfaces`). ❌ Never `snake_case` a file or folder — that casing belongs to the database.
25
18
 
26
- - camelCase : Used in Variables, function names, method names, property names. Examples: `userData`, `calculateTotal`, `firstName`, `isValidEmail`
27
- - PascalCase : Used in Class names, component names, type definitions. Examples: `UserProfile`, `DataService`, `AuthProvider`, `RequestHandler`
28
- - snake_case : Used in File names, folder names. Examples: `user_service`, `api_utils`, `auth_middleware`, `data_models`
29
- - UPPER_SNAKE_CASE : Used in Constants, environment variables. Examples: `MAX_RETRY_COUNT`, `API_KEY`, `DEFAULT_TIMEOUT`, `COLOR_PRIMARY`
30
- - kebab-case : Used in URLs, CSS class names, HTML IDs. Examples: `nav-container`, `user-profile`, `button-primary`, `form-wrapper`
19
+ ## Identifier shape
20
+
21
+ | Identifier | Shape | Example |
22
+ | --- | --- | --- |
23
+ | Variable | noun phrase | `paymentStatus` |
24
+ | Function / method | verb phrase naming the action | `validateInput` |
25
+ | Boolean | `is` / `has` / `can` / `should` prefix — **never** a bare adjective | `hasPermission` |
26
+ | Array / collection | plural noun | `errorMessages` |
27
+ | Class / component | singular noun phrase | `RequestHandler` |
28
+ | Event handler | `handle` or `on` prefix | `handleSubmit`, `onPageLoad` |
29
+ | Interface | `I` prefix acceptable; type aliases stay plain | `IConfigOptions`, `AuthResponse` |
30
+ | Async function | verb phrase; `Async` suffix acceptable | `loadConfigAsync` |
31
31
 
32
32
  ## Database
33
33
 
34
- Table, column, index, and key naming for relational schemas — the `id` / `slug` / `label` vocabulary, junction `_map` tables, and Drizzle mirrors — lives in [`database.md`](database.md), the cross-project database conventions rule. Kept there, not here, so there is one canonical home and the same concept carries the same name in every project.
34
+ Table, column, index, and key naming for relational schemas — the `id` / `slug` / `label` vocabulary, junction `_map` tables, and Drizzle mirrors — lives in [`database.md`](database.md), which routes general code naming back here.