Add id convention

From brabos-ai/code-addiction · View interactive version

Add id convention is an AI agent skill from the GitHub repository brabos-ai/code-addiction. Use when allocating feature/hotfix/refactor/chore/docs IDs or creating branches — canonical `[NNNN][L]` format that the scripts (next-id.cjs, get-branch-metadata.cjs, build-setup.cjs, done.cjs) expect

How to use this skill

Skill file

ID & Branch Naming Convention

<!-- uses:

-->

Overview

Scripts enforce this format; commands that diverge (e.g., letter-first H0001 instead of 0001H) produce branches that done.cjs cannot parse.

When to Use

When NOT to Use

Canonical Format

[NNNN][L]

Letter suffixes

| Letter | Type |

|--------|------|

| F | feature |

| H | hotfix |

| R | refactor |

| C | chore |

| D | docs |

| P | perf |

| T | test |

Must match the regex in .codeadd/scripts/get-branch-metadata.cjs ([0-9]{4}[A-Z]).

B is retired: nothing allocates it any more (status.cjs next-id B exits 2). Folders and branches

already named with an old B id stay valid — a reader of an EXISTING id accepts any letter. Only

allocation is closed.

⛔ A report that names a feature prints <id>-<slug>, never the bare id. The person reading it does

not remember what 0042F was; 0042F-login-timeout tells them.

Branch format

[type]/[NNNN][L]-[kebab-slug]

Examples:

Usage in docs

Frontmatter id: and {{doc:...}} references both use the canonical format:

id: 0001H
{{doc:0001H}}

Allocation (MANDATORY)

Always via:

node .codeadd/scripts/status.cjs next-id <LETTER>

Examples: status.cjs next-id F → 0001F, status.cjs next-id H → 0001H.

Never hand-roll IDs. Never reuse an ID from another namespace.

One counter, one source, one implementation

The number is global across every letter. It is the max over the

.codeadd/docs/features/[NNNN][L]-*/ directories of the docs root — nothing else is counted.

feature-id.cjs is the one allocator, and it is native. Every route delegates to it:

next-id.cjs (one uppercase A-Z letter, exit 1 on a bad argument), status.cjs next-id (named

prefixes F|H|PRD|CHG, exit 2 on a bad prefix), and the init.cjs seed are thin adapters that retain

their public argument validation, exit codes and exhaustion policy. The core's calculate refuses at

9999 (id-exhausted); the public next-id, status next-id and init adapters preserve the

minimum-width formatting and can emit a five-digit number (10000F) at the boundary.

IF CHANGING HOW AN ID IS ALLOCATED:
  ⛔ DO NOT: Copy the scan into an entry — the old `next-id.sh` / `status.sh` pair did, and they
             diverged
  ✅ DO: Change the scan only in `feature-id.cjs`; every entry delegates there
  ✅ DO: Run the native allocator contract tests — `cli/tests/feature-id.test.js` pins the
         canonical core, and `scripts/tests/status.test.cjs` pins `status next-id` against it

An absent .codeadd/docs/features is a no-op: a fresh project gets 0001. An existing one that cannot be read

is an explicit failure.

Per-Scope Sequence IDs (qa-validation-NNN)

Not every artefact uses the global [NNNN][L] convention. QA validation reports (written by the QA judgement qa-pipeline adds to /add-review) use a per-scope sequence so each scope keeps its own local regression history.

Distinct from [NNNN][L]: NNN is a 3-digit per-scope run number, no letter suffix, NOT globally unique. See the qa-validation schema in {{skill:add--doc-schemas/SKILL.md}}.

SF-Qualified IDs (subfeature-scoped docs)

An epic feature holds N subfeatures, and some docs are written per subfeature — notably design.md, which /add-plan STEP 7.1 writes into ${FEATURE_DIR}/subfeatures/SFxx-<slug>/. All N files would otherwise carry the same id: [NNNN]F, so single-path ID resolution (grep -rE "^id: <ID>$" .codeadd/docs/, the validation gate's {{doc:}} reverse lookup) returns N hits and cannot name one document.

id: 0042F-SF03         # .codeadd/docs/features/0042F-billing/subfeatures/SF03-invoices/design.md
type: feature-design
related: [0042F]

Forbidden Patterns

| Wrong | Right | Why |

|-------|-------|-----|

| H0001 | 0001H | Letter-first breaks get-branch-metadata.cjs regex |

| F42 | 0042F | Must be zero-padded to 4 digits |

| 0001h | 0001H | Letter must be uppercase |

| hotfix/H0001-x | hotfix/0001H-x | Branch format follows ID format |

| F[NNNN] (in docs) | [NNNN]F | Placeholder follows canonical order |

| 0042F-sf3 | 0042F-SF03 | SF key is uppercase and 2-digit zero-padded |

| Same 0042F on every subfeature design.md | 0042F-SF01, 0042F-SF02, … | N docs with one ID break single-path ID resolution |

Validation Checklist

[ ] ID matches /^[0-9]{4}[A-Z]$/ (or /^[0-9]{4}F-SF[0-9]{2}$/ for a subfeature-scoped doc)
[ ] Branch matches /^[a-z]+\/[0-9]{4}[A-Z]-[a-z0-9-]+$/
[ ] ID allocated via `status.cjs next-id <LETTER>` (not hand-rolled)
[ ] Frontmatter `id:` uses the same format (no `L[NNNN]` variant)
[ ] `{{doc:...}}` references use `[NNNN][L]` order
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.