@lab43/q 0.5.0 → 0.6.1

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 (48) hide show
  1. package/README.md +66 -41
  2. package/package.json +7 -4
  3. package/{.claude-plugin → q-extension/.claude-plugin}/plugin.json +1 -1
  4. package/q-extension/agents/adversarial-reviewer.md +98 -0
  5. package/q-extension/conventions/conventions.md +49 -0
  6. package/q-extension/conventions/documentation.md +79 -0
  7. package/q-extension/conventions/extensions.md +70 -0
  8. package/q-extension/conventions/issue-tracking.md +56 -0
  9. package/{conventions → q-extension/conventions}/plans.md +8 -4
  10. package/{conventions → q-extension/conventions}/principles.md +2 -0
  11. package/{conventions → q-extension/conventions}/pull-requests.md +1 -1
  12. package/q-extension/conventions/specs.md +31 -0
  13. package/q-extension/hooks/locked-version.mjs +169 -0
  14. package/q-extension/hooks/session-start.mjs +155 -0
  15. package/{hooks → q-extension/hooks}/session-start.sh +9 -8
  16. package/{references → q-extension/references}/agent-briefing.md +22 -11
  17. package/q-extension/references/enforce-declarations.md +16 -0
  18. package/q-extension/references/q-state.md +31 -0
  19. package/{references → q-extension/references}/run-contract.md +8 -5
  20. package/{skills → q-extension/skills}/address-feedback/SKILL.md +15 -11
  21. package/q-extension/skills/clean-worktrees/SKILL.md +66 -0
  22. package/{skills → q-extension/skills}/create-plan/SKILL.md +3 -3
  23. package/q-extension/skills/groom-docs/SKILL.md +65 -0
  24. package/{skills → q-extension/skills}/implement/SKILL.md +3 -3
  25. package/{skills → q-extension/skills}/implement-plan/SKILL.md +5 -5
  26. package/q-extension/skills/install/SKILL.md +136 -0
  27. package/q-extension/skills/reconcile/SKILL.md +110 -0
  28. package/{skills → q-extension/skills}/review/SKILL.md +2 -1
  29. package/{skills → q-extension/skills}/update-docs/SKILL.md +15 -10
  30. package/{skills → q-extension/skills}/upstream/SKILL.md +4 -2
  31. package/.claude-plugin/marketplace.json +0 -6
  32. package/agents/adversarial-reviewer.md +0 -62
  33. package/conventions/documentation.md +0 -102
  34. package/conventions/extensions.md +0 -52
  35. package/conventions/issue-tracking.md +0 -28
  36. package/hooks/session-start.mjs +0 -128
  37. package/references/enforce-pins.md +0 -16
  38. package/references/q-state.md +0 -31
  39. package/skills/groom-docs/SKILL.md +0 -62
  40. package/skills/install/SKILL.md +0 -150
  41. package/skills/sync/SKILL.md +0 -45
  42. package/skills/uninstall-extension/SKILL.md +0 -52
  43. package/skills/update/SKILL.md +0 -76
  44. /package/{conventions → q-extension/conventions}/writing.md +0 -0
  45. /package/{hooks → q-extension/hooks}/hooks.json +0 -0
  46. /package/{skills → q-extension/skills}/drive/SKILL.md +0 -0
  47. /package/{skills → q-extension/skills}/parallelize/SKILL.md +0 -0
  48. /package/{skills → q-extension/skills}/triage/SKILL.md +0 -0
package/README.md CHANGED
@@ -12,21 +12,22 @@ Named for Q, the quartermaster who equips James Bond with his gadgets — q outf
12
12
 
13
13
  ```sh
14
14
  npm install --save-dev --save-exact --ignore-scripts @lab43/q
15
- claude plugin marketplace add --scope local ./node_modules/@lab43/q
16
- claude plugin install q@q --scope project
15
+ claude --plugin-dir ./node_modules/@lab43/q/q-extension
17
16
  ```
18
17
 
19
- npm delivers q's bytes before Claude Code is involved, so installing q doesn't require already having q. Then run `/q:install` in the project, which:
18
+ npm delivers q's bytes before Claude Code is involved, so installing q doesn't require already having q. `--plugin-dir` loads q for that one session, which is all it takes to run `/q:install` in it:
20
19
 
21
- <!-- source: skills/install/SKILL.md -->
20
+ <!-- source: @lab43/q skills/install/SKILL.md -->
22
21
 
23
22
  - scaffolds your conventions
24
23
  - gives the project its own marketplace, sourcing the q you just installed
25
24
  - records the version your docs were reconciled against
26
25
 
26
+ Start every session after that with plain `claude`. The marketplace `/q:install` wrote is the project's own, and your tracked settings point each session at it.
27
+
27
28
  ## Joining a project that uses q
28
29
 
29
- <!-- source: skills/install/SKILL.md -->
30
+ <!-- source: @lab43/q skills/install/SKILL.md -->
30
31
 
31
32
  Install the project's dependencies, substituting your package manager where the project isn't on npm:
32
33
 
@@ -34,16 +35,14 @@ Install the project's dependencies, substituting your package manager where the
34
35
  npm install
35
36
  ```
36
37
 
37
- That is the whole of it — q arrives as a pinned dependency, and the project's tracked settings tell Claude Code to load it. `/q:install` folds this into the project's README, so a q-using repo carries it itself.
38
+ That is the whole of it — q arrives with the project's dependencies, and the project's tracked settings tell Claude Code to load it. `/q:install` writes a q section into the project's own README, so contributors meet q without leaving the repo.
38
39
 
39
40
  ## Skills
40
41
 
41
- <!-- source: skills/ -->
42
+ <!-- source: @lab43/q skills/ -->
42
43
  <!--
43
44
  Skill names must not wrap.
44
- Keep each name in <samp>. Keep nowrap on its cell.
45
- Do not switch a name in this column to <code>. GitHub gives <code> its own white-space: break-spaces. A value set on the element replaces the one inherited from the cell.
46
- Do not replace nowrap with a style attribute. GitHub strips style.
45
+ see: docs/conventions/documentation.md, Table cells that must not wrap
47
46
  -->
48
47
  <!-- markdownlint-disable MD033 -->
49
48
  <table>
@@ -53,24 +52,16 @@ That is the whole of it — q arrives as a pinned dependency, and the project's
53
52
  <th>What it does</th>
54
53
  </tr>
55
54
  <tr>
56
- <th rowspan="4" scope="rowgroup">Setup</th>
55
+ <th rowspan="2" scope="rowgroup">Setup</th>
57
56
  <td nowrap><samp>/q:install</samp></td>
58
- <td>Install q into a project, or add an extension to one. Idempotent, safe to re-run on a partially set-up project.</td>
59
- </tr>
60
- <tr>
61
- <td nowrap><samp>/q:sync</samp></td>
62
- <td>Set up or repair this machine for a q-using project, handing off to <code>/q:install</code>, <code>/q:update</code>, or <code>/q:uninstall-extension</code> when the project's records don't match its pins.</td>
57
+ <td>Set up q in a project you've already npm-installed it into, or repair a scaffold that has drifted. Safe to re-run on a partially set-up project.</td>
63
58
  </tr>
64
59
  <tr>
65
- <td nowrap><samp>/q:update</samp></td>
66
- <td>Update q and the project's installed extensions: move pins to the latest releases with your go-ahead, reconcile the project's docs with what each release changed, and catch up any pin that moved out of band.</td>
60
+ <td nowrap><samp>/q:reconcile</samp></td>
61
+ <td>Reconcile the project's records with what npm already did q or an extension updated, installed, or removed. Also sets up or repairs this machine.</td>
67
62
  </tr>
68
63
  <tr>
69
- <td nowrap><samp>/q:uninstall-extension</samp></td>
70
- <td>Remove an extension from a project, or reconcile a removal made out of band — the package, its group in the briefing's docs index, its watermark, and your ruling on each doc that references it.</td>
71
- </tr>
72
- <tr>
73
- <th rowspan="8" scope="rowgroup">Workflow</th>
64
+ <th rowspan="9" scope="rowgroup">Workflow</th>
74
65
  <td nowrap><samp>/q:triage</samp></td>
75
66
  <td>Choose what to work on next from a set of items — a Jira board, GitHub issues, a Notion doc — and hand each agreed pick to <code>/q:implement</code>.</td>
76
67
  </tr>
@@ -102,6 +93,10 @@ That is the whole of it — q arrives as a pinned dependency, and the project's
102
93
  <td nowrap><samp>/q:parallelize</samp></td>
103
94
  <td>Give parallel sessions their own copies of what they contend over while driving — ports, databases, caches, devices. Isolates what it can, and names what sessions must take turns over instead.</td>
104
95
  </tr>
96
+ <tr>
97
+ <td nowrap><samp>/q:clean-worktrees</samp></td>
98
+ <td>Clear the git worktrees that finished parallel sessions leave behind. Reports what each one holds and whether that work has reached the remote. You rule on the list before anything is removed.</td>
99
+ </tr>
105
100
  <tr>
106
101
  <th rowspan="3" scope="rowgroup">Docs</th>
107
102
  <td nowrap><samp>/q:update-docs</samp></td>
@@ -126,33 +121,36 @@ That is the whole of it — q arrives as a pinned dependency, and the project's
126
121
  <a href="docs/workflow-chart/light.png">
127
122
  <picture>
128
123
  <source media="(prefers-color-scheme: dark)" srcset="docs/workflow-chart/dark.png">
129
- <img alt="The q workflow: work flows from triage and start through plan, implement, and human review to merge, with adversarial review gating plan and implement. Conventions documentation project docs over the installed extensions over q grounds each step; gotchas and corrections flow back down as rules on project docs, and rules that belong upstream leave as PRs." src="docs/workflow-chart/light.png">
124
+ <img alt="The q workflow. Entry points /q:triage takes a set of work, /q:implement a single task, /q:review existing work — feed one workflow loop: investigate, discuss, execute, adversarial review, then a PR, opened directly in ship mode or after the human's local review in local mode, then human PR review and merge, with requested changes looping back into discuss. Docs ground every step: project docs — conventions, specs, guides, plans — over installed extensions over q, with plans, findings, and new rulings written back as work happens, and upstream PRs carrying overrides to the layers that own them." src="docs/workflow-chart/light.png">
130
125
  </picture>
131
126
  </a>
132
127
  <!-- markdownlint-enable MD033 -->
133
128
 
134
129
  q's effect on your repo comes from context routing and documentation discipline — everything it produces lives in plain text files in your repo, and it works in one loop:
135
130
 
136
- <!-- source: skills/install/SKILL.md -->
137
- <!-- source: hooks/session-start.mjs -->
131
+ <!-- source: @lab43/q skills/install/SKILL.md -->
132
+ <!-- source: @lab43/q hooks/session-start.mjs -->
138
133
 
139
134
  **Every session starts knowing where the rules are.** `/q:install` puts the routing in place:
140
135
 
141
136
  - scaffolds `docs/conventions/` — your project's conventions, one doc per topic, seeded with a `principles.md` for your cross-cutting rules and a `documentation.md` for your documentation rulings
142
- - installs q as the `@lab43/q` npm package, pinned exactly in your `package.json` — its conventions and its plugin arrive together, at one version
137
+ - builds on the `@lab43/q` npm package you installed — its conventions and its plugin arrive together, at one version, and the skill scaffolds around it
143
138
  - indexes every tier in your agent briefing (`CLAUDE.md`)
144
- - gives your project its own marketplace, sourcing the q it just pinned, so every teammate's machine runs the version the repo chose
145
- - records watermarks in a committed `.claude/q-state.json` — the versions those pins were last reconciled against
139
+ - gives your project its own marketplace, sourcing the q you installed and the plugin of any extension that ships one, so every teammate's machine runs the versions the repo chose
140
+ - records watermarks in a committed `.claude/q-state.json` — the versions your docs were last reconciled against
146
141
 
147
- Every session start validates that installed, pinned, and watermarked versions still agree — drift from any direction, a hand-run npm install or a Dependabot bump included, is flagged with its fix: run `/q:sync`. And every agent session, whether or not it ever invokes a q skill, is told to check every tier of conventions — q's, any extensions' you install, and yours — before writing code, making design decisions, or changing docs; your recorded decisions bind future sessions instead of living in one person's head.
142
+ Every session start validates that your lockfile, the installed copies, and the watermarks still agree — drift from any direction, a hand-run npm install or a Dependabot bump included, is flagged with its fix: run `/q:reconcile`. And every agent session, whether or not it ever invokes a q skill, is told to check every tier of conventions — q's, any extensions' you install, and yours — before writing code, making design decisions, or changing docs; your recorded decisions bind future sessions instead of living in one person's head.
148
143
 
149
144
  **Decisions become conventions as you make them.** The scaffold is deliberately near-empty, because conventions are earned as decisions are made, not pre-written. When a session hits a decision, lesson, or gotcha worth binding, `/q:update-docs` records it under q's documentation policy — phrased as a rule, one home per fact, placed where its next reader will look.
150
145
 
146
+ **A convention records practice. A spec records a promise.** A convention says how code here gets written, and it grows out of the decisions you make while working. A spec says what a feature does, and you write it on purpose, before the code or as a deliberate change to it. Break a convention and the code is wrong. Break a spec and the product is wrong, unless you meant to change the promise, in which case the spec changes with it.
147
+ <!-- source: @lab43/q conventions/documentation.md, Taxonomy -->
148
+
151
149
  **Grooming keeps the docs true.** `/q:groom-docs` periodically verifies the whole documentation surface against the code and the policy — accuracy, duplication, dead references — so the docs agents are routed to stay worth trusting, which is what makes the routing worth anything.
152
150
 
153
151
  **You stay in charge.**
154
152
 
155
- - Both halves of q install pinned, and pins move only when you approve an update, which reconciles your docs with what changed.
153
+ - Versions are yours to move npm and your lockfile decide what runs, and `/q:reconcile` folds each move into your docs.
156
154
  - Your project's rulings win on conflict — record the disagreement and it stands (see the markers below).
157
155
  - Every run that delivers work settles its review mode with you up front. In local mode nothing is committed until you review it. In ship mode the work goes straight to a PR you review on GitHub. Merging is always yours.
158
156
  - It's all plain text files in your repo — removing q leaves your docs intact and yours.
@@ -162,27 +160,54 @@ Every session start validates that installed, pinned, and watermarked versions s
162
160
  <!-- source: @lab43/q conventions/documentation.md, Markers -->
163
161
  <!-- source: @lab43/q conventions/documentation.md, Single source of truth -->
164
162
 
165
- q's documentation keeps every fact in exactly one authoritative home, but text still needs to point at, copy, or disagree with facts that live elsewhere. Markers declare which of those relationships is in play — making them visible to readers and checkable by grep, with no central list to maintain:
163
+ q's documentation keeps every fact in exactly one authoritative home. Text still has to point at, copy, or disagree with what lives elsewhere, and one site sometimes has to sit outside a rule the rest of the project follows. A marker declares which of those is in play — making it visible to readers and checkable by grep, with no central list to maintain:
166
164
 
167
- | Marker | Meaning |
168
- | --- | --- |
169
- | `(see: X)` | Plain cross-reference — nothing copied, the detail lives at X. |
170
- | `(source: X)` | This text is a copy and X is the authority — `/q:groom-docs` checks that the copy still agrees with X. |
171
- | `(overrides: X)` | This rule deliberately replaces the named one — a q rule (`overrides: @lab43/q conventions/documentation.md, Code examples in conventions docs`), an extension's rule (`overrides: @acme/q-ext-x conventions/retries.md, Backoff`), or a broader project convention (`overrides: docs/conventions/style.md, Magic numbers`). `/q:groom-docs` respects it, and `/q:upstream` picks up overrides worth carrying to the rule's owner. |
165
+ <!--
166
+ Markers must not wrap.
167
+ see: docs/conventions/documentation.md, Table cells that must not wrap
168
+ -->
169
+ <!-- markdownlint-disable MD033 -->
170
+ <table>
171
+ <tr>
172
+ <th>Marker</th>
173
+ <th>Meaning</th>
174
+ </tr>
175
+ <tr>
176
+ <td nowrap><samp>(see: X)</samp></td>
177
+ <td>Plain cross-reference — nothing copied, the detail lives at X.</td>
178
+ </tr>
179
+ <tr>
180
+ <td nowrap><samp>(source: X)</samp></td>
181
+ <td>This text is a copy and X is the authority — <code>/q:groom-docs</code> checks that the copy still agrees with X.</td>
182
+ </tr>
183
+ <tr>
184
+ <td nowrap><samp>(overrides: X)</samp></td>
185
+ <td>This rule deliberately replaces the named one — a q rule (<code>overrides: @lab43/q conventions/conventions.md, Code examples in conventions docs</code>), an extension's rule (<code>overrides: @acme/q-ext-x conventions/retries.md, Backoff</code>), or a broader project convention (<code>overrides: docs/conventions/style.md, Magic numbers</code>). <code>/q:groom-docs</code> respects it, and <code>/q:upstream</code> picks up overrides worth carrying to the rule's owner.</td>
186
+ </tr>
187
+ <tr>
188
+ <td nowrap><samp>(exception: X)</samp></td>
189
+ <td>This site is exempt from the named rule, which still stands everywhere else (<code>exception: docs/conventions/logging.md, Structured fields</code>). It always names both a doc and a section, and the reason is the text it sits in, in prose or in a comment — without either part it excuses nothing. <code>/q:groom-docs</code> counts them by rule, so several against one rule surface as a signal the rule wants revisiting.</td>
190
+ </tr>
191
+ <tr>
192
+ <td nowrap><samp>(spec: X)</samp></td>
193
+ <td>This code enforces the named spec statement (<code>spec: docs/specs/tasks.md, Due dates</code>). It sits only at enforcing code — a test, a validation, a guard — in that file's comment syntax, never in prose, and always names a section. Amending the section means visiting every site marked with it. <code>/q:groom-docs</code> reports a marker naming a doc or section that no longer exists, and a section no marker names.</td>
194
+ </tr>
195
+ </table>
196
+ <!-- markdownlint-enable MD033 -->
172
197
 
173
198
  ## Developing q
174
199
 
175
- <!-- source: docs/conventions/documentation.md, The tier test -->
200
+ <!-- source: @lab43/q conventions/extensions.md, Which rules ship -->
176
201
 
177
- This repo has two conventions directories, by design. `conventions/` is the framework policy: it ships in the `@lab43/q` npm package and binds every consuming project. `docs/conventions/` is q's own project tier — rules for developing q itself (skill authoring, for example) that are not framework law. The split exists because q is a consuming project of its own workflow: it keeps its working docs at the same contract path any consumer would, kept apart from the product it ships.
202
+ This repo has two conventions directories, by design. `q-extension/` is the payload the `@lab43/q` npm package ships, and its `conventions/` are the framework policy that binds every consuming project. `docs/conventions/` is q's own project tier — rules for developing q itself (skill authoring, for example) that are not framework law. The split exists because q is a consuming project of its own workflow: it keeps its working docs at the same contract path any consumer would, kept apart from the product it ships. Every extension gets the same two homes, and the rule deciding between them ships with the rest.
178
203
 
179
204
  <!-- source: CLAUDE.md, Developing -->
180
205
  <!-- source: docs/guides/driving-manual.md -->
181
206
 
182
207
  To work on q:
183
208
 
184
- - `claude` in your checkout auto-loads your working copy of the plugin (the repo declares itself as the `q` marketplace in `.claude/settings.json`); from any other project, `claude --plugin-dir <path to your checkout>` loads it. SKILL.md edits apply immediately; `/reload-plugins` picks up hook and agent changes mid-session.
185
- - When the `q:` skills don't load in your checkout, the CLI's registry holds that directory under a name other than `q`, so `q@q` resolves to nothing. `claude plugin marketplace add` matches the registry by path, so re-adding `./` just reports the stale entry. Remove it with `claude plugin marketplace remove <name>`, then add `./` again.
209
+ - `claude` in your checkout auto-loads your working copy of the plugin (the repo declares itself as the `q-dev` marketplace in `.claude/settings.json`); from any other project, `claude --plugin-dir <path to your checkout>/q-extension` loads it without registering anything. SKILL.md edits apply immediately; `/reload-plugins` picks up hook and agent changes mid-session.
210
+ - When the `q:` skills don't load in your checkout, read the `q-dev` entry in `claude plugin marketplace list`. An entry naming a directory that is gone — usually a worktree that held the name and was then removed takes registering your checkout again, with its path written in full. No `q-dev` entry at all means the registry holds your directory under another name: remove that entry with `claude plugin marketplace remove <name>`, then register your checkout again. That remove also strips the marketplace from the repo's tracked `.claude/settings.json`, so check that file afterwards and put the declaration back.
186
211
  - `npm run check` runs every check the repo has, `npm test` among them. `package.json` names them; this line deliberately doesn't, because a list here goes stale the next time one is added. CI runs it on every pull request and on pushes to `main`.
187
212
  - `npm install` installs the pre-commit hook that runs `npm run check`. A tree you have not installed commits without checking anything.
188
213
  - Releasing is separate from merging, and PRs never touch a `version`. The steps live in `docs/guides/releasing.md`.
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@lab43/q",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "An agentic coding workflow framework: skills for planning, implementing, verifying, and grooming, grounded in per-project conventions docs.",
5
- "files": ["conventions", "skills", "agents", "hooks", "references", ".claude-plugin"],
5
+ "q": {
6
+ "description": "The rules of the q workflow, governing how a project's work gets planned, decided, documented, and shipped."
7
+ },
8
+ "files": ["q-extension"],
6
9
  "scripts": {
7
10
  "prepare": "husky",
8
11
  "check": "npm run check-plugin && npm run check-versions && npm run check-markdown && npm run check-frontmatter && npm test",
9
- "test": "node --test 'test/*.test.mjs'",
10
- "check-plugin": "claude plugin validate --strict . && claude plugin validate --strict skills && claude plugin validate --strict agents",
12
+ "test": "node --test 'tests/*.test.mjs'",
13
+ "check-plugin": "claude plugin validate --strict q-extension && claude plugin validate --strict q-extension/skills && claude plugin validate --strict q-extension/agents",
11
14
  "check-versions": "node scripts/check-versions.mjs",
12
15
  "check-markdown": "markdownlint-cli2",
13
16
  "check-frontmatter": "node scripts/check-frontmatter.mjs"
@@ -2,7 +2,7 @@
2
2
  "name": "q",
3
3
  "displayName": "q",
4
4
  "description": "An agentic coding workflow framework: skills for planning, implementing, verifying, and grooming, grounded in per-project conventions docs.",
5
- "version": "0.5.0",
5
+ "version": "0.6.1",
6
6
  "author": { "name": "Cameron Spencer", "email": "cameron@lab43.com" },
7
7
  "license": "MIT"
8
8
  }
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: adversarial-reviewer
3
+ description: Adversarial reviewer grounded in the project's conventions and specs — tries to refute what it is given, reporting blocking findings vs nits. Work review — a diff command or files to examine, code or prose, optionally with what the work is meant to deliver (an agreed scope, or the plan plus which of its steps are in scope, which came earlier, and which are deferred) — under the correctness and/or conventions lens. Plan review — a pre-implementation plan doc — under the feasibility and/or rigor lens. For an artifact in another repo's checkout, the prompt names the conventions surface grounding the review.
4
+ tools: Read, Grep, Glob, Bash
5
+ model: sonnet
6
+ ---
7
+
8
+ You are an adversarial reviewer for this repository. Your job is to try to refute the artifact you are given — assume it has problems and hunt for them. You are read-only: never modify files and never commit. An unexpected change in the working tree is covered by that, including one you believe you caused. Report it with your findings rather than reverting it. Never run a command that changes state outside this repository. Installs, plugin or package registrations, and writes to machine-wide config belong to the run, not to the review — a command that mutates them can break a project this review has nothing to do with.
9
+
10
+ Baseline checks are not your job: lint, typecheck, and the test suites are verified green before a review is launched. Never run them — a green suite is not a finding, and re-running it adds nothing. Use Bash for git and investigation. If you suspect a specific defect that only executing code can confirm, run the narrowest command that tests that suspicion (a single test file or one name-filtered test), never a package or project suite. The same economy governs facts: where the artifact records how a fact was verified, audit that evidence — is the method sound, the source current? Driving the product (launching apps or simulators, exercising UI) is outside your scope: the run owns the environment. When a suspicion only the running product can settle, report it as a finding that names exactly what to check.
11
+
12
+ Your prompt supplies an artifact and a lens; the artifact decides the review:
13
+
14
+ - **Work review** (see: Work review) — the artifact is a diff, given as a git command (`git diff <sha>..HEAD`, `git diff main...HEAD`) and/or a list of changed files — or, with no change in play, the files or directories to examine for what's already wrong. The prompt may also supply what the work is meant to deliver: an agreed scope, or the plan plus which of its steps are in scope, which came earlier, and which are deferred. Lenses: **correctness**, **conventions**, or both.
15
+ - **Plan review** (see: Plan review) — the artifact is a plan doc from `docs/plans/`, alone. Lenses: **feasibility**, **rigor**, or both.
16
+
17
+ For an artifact outside this project — another repo's checkout — the prompt names a substitute grounding surface. Wherever these instructions read this project's docs — the agent briefing's docs index, the project's conventions — read that surface instead, and treat the artifact's own repo as the codebase to search.
18
+
19
+ A combined review applies each lens in turn over the same artifact. If the prompt is missing something named here, do not review: return only a line naming what is missing, so the caller can relaunch with a complete prompt.
20
+
21
+ What to hunt for is defined here, not by the prompt. Anything the prompt carries beyond the artifact, the lens, and what the work is meant to deliver is background. Background may add a place to look. It never narrows the hunt. An account of what changed and why is a claim to refute, not a fact to confirm.
22
+
23
+ ## Work review
24
+
25
+ The artifact is a diff, or existing files with no change in play — code and prose alike. Your job is to refute it: show what shouldn't merge, or shouldn't stand. Given a diff, run its command and read every changed file in full; given files or directories, read them.
26
+
27
+ A site may already carry an exception marker excusing it from a named rule (source: @lab43/q conventions/documentation.md, Markers). Under either lens, don't report the site for breaking that rule when the marker's reason holds. Report it when the marker is missing its reason or its section, or when the reason does not bear out at the site. An incomplete or hollow marker dodges the rule rather than excusing the site. A marker the work under review introduces gets no deference at all: judge the excuse on its merits, and never let a change excuse itself by adding one.
28
+
29
+ Then hunt through the assigned lens or lenses.
30
+
31
+ ### The correctness lens
32
+
33
+ Defects by universal engineering judgment, rules or no rules. Read enough surrounding and related code to judge integration points and the local idiom first. Then hunt:
34
+
35
+ - bugs, broken or missed edge cases, error handling, security implications, race conditions, state bugs, dead code
36
+ - inconsistency with the surrounding code's patterns
37
+ - missing or hollow test coverage: tests that exist but don't exercise the new behavior
38
+ - reuse: for each helper, component, or pattern the code introduces, search the codebase (Grep/Glob) for an existing implementation or established pattern that already covers it, and name the existing code to use instead
39
+ - in prose, claims the repo contradicts and references that don't resolve
40
+
41
+ When a plan or an agreed scope accompanies the work, verify the work actually delivers it, implemented rather than just started, and treat falling short as a BLOCKING finding. With a plan, judge only the in-scope steps: a step assigned elsewhere and missing from the code is NOT a finding.
42
+
43
+ ### The conventions lens
44
+
45
+ Defects against this project's recorded law: its conventions and its specs. Read the law governing the artifact's territory first:
46
+
47
+ - the conventions, found from the agent briefing's docs index
48
+ - the specs, found from that index and from the markers in the changed files and the tests covering them: grep those files for `spec:` followed by a path under `docs/specs/`, and read every spec a hit names
49
+ - for prose, the writing rules, which always apply (see: @lab43/q conventions/writing.md)
50
+
51
+ Then hunt:
52
+
53
+ - violations of those docs, citing the specific doc and rule for every finding
54
+ - docs the change should have updated and didn't, held to what the documentation policy says each doc carries (see: @lab43/q conventions/documentation.md): a README describing the old interface, a briefing index missing a new doc's line, a conventions doc the change falsifies
55
+ - drift in a living exemplar: grep the project's conventions for each reviewed file's path. Drift there outranks every other finding, because the docs actively send imitators to it
56
+ - code that contradicts a spec statement
57
+ - a spec section the diff amends while a site marked with that section did not move: grep the whole repo for markers naming the section, because the sites that must move sit outside the diff
58
+ - enforcing code the diff adds without its marker: for each validation, guard, constraint, or test the diff adds, ask whether it enforces a commitment in the specs you read
59
+
60
+ A conflict between code and law resolves by the kind of law:
61
+
62
+ - Against a convention, the rule is presumed right. Grep sibling sites for evidence: many sites deviating the same way indicts the rule, one site indicts the code, and marked exceptions are that evidence already gathered. Report a rule the evidence indicts as a FOLLOW-UP, flagged as a candidate to amend the rule and carrying the evidence. That call is the user's, and the code is not the thing to fix.
63
+ - Against a spec, the finding is BLOCKING with two exits, revert the change or amend the spec in the same change. Name both and choose neither, because only the user picks (source: @lab43/q conventions/specs.md, Disagreement). However many sites disagree, give no verdict on which side is wrong.
64
+
65
+ ## Plan review
66
+
67
+ The artifact is a plan doc in `docs/plans/` with no implementation yet — there is no diff to run. Your job is to refute the plan before any code is written. Read it in full. Its recorded decisions are constraints, not findings — do not relitigate them, but DO flag when verified evidence contradicts one (as a finding that names the evidence).
68
+
69
+ Then hunt through the assigned lens or lenses.
70
+
71
+ ### The feasibility lens
72
+
73
+ The plan held against reality. Read every file, function, config value, and helper the plan names, plus the code around them — then hunt: claims about current behavior that the code contradicts (wrong file, wrong signature, behavior that doesn't exist); ripple effects the plan misses — search for tests, helpers, CI steps, scripts, and docs that depend on what the plan changes and aren't accounted for; plan steps already done or obsoleted by the current codebase; phases that can't stand alone as commits that build and pass their tests; insufficiency — executing every phase would still not deliver what the Goal section promises; over-engineering — machinery, phases, or generality the Goal does not require, where the codebase offers a simpler path (name it).
74
+
75
+ ### The rigor lens
76
+
77
+ The plan held against its standards. Read the plan format (see: @lab43/q conventions/plans.md) and the conventions and specs governing the plan's territory, found from the agent briefing's docs index — then hunt: violations of any of them, quoting the failing text and citing the rule; sections that contradict each other; and phases that would contradict a spec statement without scheduling the spec's amendment in the phase that ships the behavior (source: @lab43/q conventions/specs.md, Disagreement). When the plan is right and the cited rule looks stale, report the conflict as a FOLLOW-UP, flagged as a candidate to amend the rule — that call is the user's, and the plan is not the thing to fix.
78
+
79
+ ## Output
80
+
81
+ Your final message is the review: the three sections below, each a numbered list of one-line findings, a section omitted when it is empty — except BLOCKING, which when empty is replaced by the line `NO BLOCKING FINDINGS`.
82
+
83
+ ```text
84
+ BLOCKING:
85
+ 1. <anchor> — the defect, in one line; a finding that rests on a rule names it.
86
+
87
+ NITS:
88
+ 1. ...
89
+
90
+ FOLLOW-UPS:
91
+ 1. ...
92
+ ```
93
+
94
+ - The anchor is the finding's evidence: `file:line` for code; the plan section plus what contradicts it for plans (`plan §Phase 2 vs src/services/email.ts:32`).
95
+ - BLOCKING = what must not proceed. For a work review: wrong to merge, or wrong to leave as it stands — bugs, convention violations, spec violations, reimplementation of existing code, missing tests for new behavior, unimplemented plan steps. For a plan: implementing it as written would fail, break something it doesn't mention, or violate conventions or specs.
96
+ - NITS = worth noting, fine to skip.
97
+ - FOLLOW-UPS = improvements outside the review's scope, as candidates for future work — the reviewed code's approach beats an existing pattern used elsewhere (name where), duplication or debt discovered nearby. Never BLOCKING, never fixed here.
98
+ - Do not invent findings to appear useful, and do not rubber-stamp — verify claims against the actual code, not its surface appearance. Every finding must name a concrete failure or a specific violated rule.
@@ -0,0 +1,49 @@
1
+ # Conventions
2
+
3
+ Rules for how a project's conventions are tiered, written, and enforced.
4
+
5
+ ## Three tiers of conventions
6
+
7
+ - **Framework conventions** — the conventions docs `@lab43/q` ships, a dependency in the project's `package.json`. It carries the rules of the workflow itself, and defines the format an extension follows. Every q project installs it, and none can remove it.
8
+ - **Extension conventions** — the installed extensions (see: @lab43/q conventions/extensions.md), each a dependency the same way, so rule improvements reach the project as its versions move. An extension extends q with rules of its own — for a library, a stack, or an organization's shared standards.
9
+ - **Project conventions** — `docs/conventions/` in the consuming repo (a fixed contract path). Everything specific to the project's stack and codebase, plus its `documentation.md` mirror of the documentation policy, where documentation rulings and deviations are recorded. These are living docs: skills grow them as decisions are made and groom them as they rot.
10
+
11
+ **Precedence: project conventions win over any extension's rule, whichever extension carries it. An extension's rule in turn wins over q's.** A project overrides a rule by recording the deviation in the project conventions doc whose topic owns it (created if needed), so the override sits where a reader applying the rule will look.
12
+
13
+ - A deviation is written as an ordinary rule: the decision and the rationale, plus an overrides marker (see: @lab43/q conventions/documentation.md, Markers) naming the rule it replaces.
14
+ - A deviation is refined in place or deleted as the decision evolves, never appended as a log entry.
15
+ - An override outlived by its target — updated to agree, or gone — is spent and comes out.
16
+ - Overriding a rule needs no other mechanism — the readers are agents, so stating the deviation is enough.
17
+
18
+ A refinement that reaches beyond this project — one that would improve a q rule, or an extension's — is a candidate to upstream. Record it as an ordinary rule where it belongs and suggest `/q:upstream` to the user in the session. Never annotate the doc with its upstream candidacy.
19
+
20
+ Conventions move into what a repo publishes when their audience grows beyond one project, on the user's decision (source: @lab43/q conventions/extensions.md, Which rules ship).
21
+
22
+ ## Conventions docs
23
+
24
+ Rules for whoever is about to write or evaluate code — the unit this workflow reads and grows.
25
+
26
+ **One topic per doc, broadly targeted until proven otherwise**: a doc is about "tests", not about "mocking data in Jest". Narrow docs scatter rules a reader needs together and multiply index lines — a doc that proves narrower than its topic merges into the doc owning the broader one. A doc narrows only by splitting, when a second topic has demonstrably grown inside it.
27
+
28
+ **Every statement is a rule** — something to follow, a constraint to check, or a decision that binds future code, phrased that way. A sentence that wouldn't change what a reader writes or flags gets cut.
29
+
30
+ - Descriptions of how the system currently works are not conventions — the code and exemplars carry those.
31
+ - Never facts readable from the code: directory listings, dependency lists, schema enumerations, config values, and model/version names rot the moment code moves, and the code already answers them.
32
+ - Record decisions and rejected alternatives only when they're highly likely to come up again: the alternative is the first thing a reader would reach for, or something deliberately ignored reads as an oversight. Each rejection names the alternative and the reason, nothing more.
33
+ - The rationale stands inline — never cite the repo's issues or PRs as provenance; git history is the paper trail. Links to other projects' trackers as evidence for external-tool claims, and operational pointers to pending work tracked in an issue, remain fine.
34
+
35
+ **A rule lands in the doc whose topic owns it**, integrated into the section it belongs to (see: @lab43/q conventions/writing.md, Refine rather than append) — grep the surface first; the rule may sharpen a sentence already there. A new doc is created only when no existing topic owns the rule.
36
+
37
+ ## Code examples in conventions docs
38
+
39
+ Prose rules carry the conventions; code carries itself:
40
+
41
+ - Each pattern names a **living exemplar** — a real file in the repo — and says which of its lines are load-bearing for the pattern, so an imitator doesn't copy the incidental along with the essential. Exemplar references and these notes are carved out of the no-code-readable-facts rule as a class; they exist to point *into* the code.
42
+ - Short shape-only snippets are allowed where a rule is illegible without one. Snippets must not be copy-paste-complete: no import paths, no env-var literals, no full bodies. Anything an agent would paste verbatim must come from the exemplar.
43
+ - Symbols, files, and helpers named in prose must exist — `/q:groom-docs` greps for them.
44
+
45
+ Rejected: full copy-paste code templates, even compile-checked ones — doc inaccuracies cluster inside template code and code-readable fact restatements, not prose rules, and a stale template actively produces failing code.
46
+
47
+ ## Documentation is the last rung
48
+
49
+ Documentation is the weakest enforcement rung (source: @lab43/q conventions/principles.md, Prefer the strongest enforcement rung): conventions prose carries only what components and lint can't express — decisions, rationale, rejected alternatives, cross-component gotchas. When a rule graduates into a component or a lint rule, delete its doc prose and move the rationale into the component or lint rule itself, where the reader who would remove it will see it. A doc entry survives graduation only if it meets the rejected-alternatives bar; git history keeps everything else. A spec's prose is the one carve-out: it stays after a test holds it, because it records the intent behind the test, and the test cannot drift from the commitment without the drift being visible (source: @lab43/q conventions/specs.md, Enforcement).
@@ -0,0 +1,79 @@
1
+ # Documentation Policy
2
+
3
+ Rules for what belongs in a project's documentation, where it lives, and how it stays accurate. Follow them over any instinct. Every doc this policy governs must stay reviewable by a human: hold every edit to the writing rules (see: @lab43/q conventions/writing.md).
4
+
5
+ ## Taxonomy
6
+
7
+ The policy owns what this taxonomy names — the `docs/` directories below, the README, and the briefing — plus, in the repo that authors an extension, its conventions docs and the `q.description` in its `package.json` (source: @lab43/q conventions/extensions.md, Authoring). Anything else under `docs/` — assets, generated output, tooling — is outside the policy: no rule here governs it, and grooming leaves it alone.
8
+
9
+ File names are kebab-case. A taxonomy directory is read whole, subdirectories included, so a project groups its docs into subdirectories as it likes. Every doc opens with a topic title and an intro stating what the doc is *for* — its purpose, not an inventory of its contents: "Guidance for writing tests", never "Mocking data in Jest, stubbing API calls, and assertion gotchas". A purpose holds as sections change; a contents list rots on the next edit — and purpose is what a reader deciding whether the doc applies actually needs.
10
+
11
+ The intro is the authoritative description of its doc. The briefing index's line for the doc is drawn from it and restates it, and grooming checks each pair for agreement. A doc the index carries arrives complete in one change: its intro plus its index line.
12
+
13
+ Two doc types carry rules, and they divide by what they govern. A convention governs how code is written, and is recorded as the decision surfaces. A spec governs what a feature does, and is written on purpose: on the user's instruction naming the change, or through a plan the user approved that schedules the edit. Never write or amend a spec on a run's own initiative. A lesson that reads as a product commitment is reported to the user as a spec candidate and left unwritten.
14
+
15
+ - **`docs/conventions/`** — the project's conventions docs (see: @lab43/q conventions/conventions.md).
16
+ - **`docs/specs/`** — the project's specs: what the product commits to, stated as behavior the code must honor. Format and enforcement rules live in their own doc (see: @lab43/q conventions/specs.md). Grooming gives a spec every check a conventions doc gets, with accuracy reversed: a commitment the code does not honor is reported to the user as unmet, never corrected as a doc, because a spec may run ahead of its code and only the user knows whether the gap is work in progress, work missed, or a regression. Grooming also audits the spec markers (see: Markers), reporting each marker naming a doc or section that does not exist and each spec section no marker names.
17
+ - **`docs/plans/`** — feature plans across their whole lifecycle — upcoming, in flight, and shipped; format and lifecycle rules live in their own doc (see: @lab43/q conventions/plans.md). Grooming checks status only — surfacing stale `pending` plans for the user's ruling — and treats merged plans' frozen bodies as exempt from accuracy, duplication, and pruning checks.
18
+ - **`docs/guides/`** — guides: instructions for using and operating the product, not for writing its code (deployment walkthroughs, feature guides, operational procedures). Step-by-step detail is fine, and so are inline code-readable specifics — bucket names, URLs, ports — a reader mid-task shouldn't have to dig out of code or config; only repo-referencing facts (script names, env vars, paths, such specifics) are held to accuracy — external-console steps can't be verified from the repo.
19
+ - **`README.md`** — the human overview, answering an arriving reader's questions: what this is, what it does, how to use it.
20
+ - **Summarizing facts owned elsewhere is its normal mode**, not a violation — the obligation is checkability: a summary that mirrors one identifiable home carries a source marker; free-form overview prose is held accurate against the things it describes by grooming. Inline code-readable specifics — URLs, ports, commands — are fine under the same obligations; the arriving reader shouldn't have to dig for them.
21
+ - **Interface, not internals**: enumerating the product's interface (commands, skills, entry points) serves the reader and belongs; inventorying the repo's internals (directory layout, file lists) restates what browsing already shows — an internal detail earns mention only when it explains something non-obvious.
22
+ - **Prose is evergreen**: a sentence describing the current moment ("being migrated to…") rots silently once the moment passes — describe what the product is, and let git history carry the journey.
23
+ - **`CLAUDE.md`** — the always-loaded agent briefing. Rejected: `AGENTS.md`, the cross-tool briefing convention — Claude Code doesn't read it, and q runs in Claude Code. Every line costs context in every session, so only what applies session-wide belongs; information needed for particular kinds of work lives in the relevant convention doc or skill, with at most a one-line pointer here. Two things are required:
24
+ - **The standing instructions** that make the conventions bind: all three tiers of conventions apply (see: @lab43/q conventions/conventions.md, Three tiers of conventions) — check them before writing code, before design decisions and reviews, and before changing docs — and doc changes go through `/q:update-docs`, the README and the briefing itself included.
25
+ - **The docs index** — one line per doc, restating its intro: every conventions doc, whether q's, an installed extension's, this repo's own payload, or the project's own, every spec, and every guide. Group the lines by where the docs come from, the specs in a group of their own. Head each group with what its docs govern, so a session reading the index can tell whose rules are whose. An extension's heading pairs its package name with its `q.description`, whether the project installs that extension or authors it (see: @lab43/q conventions/extensions.md, Description). An index line is routing, not content. A guide a session can't act on is still one it should know exists. Skills are never indexed: the session's skill list already carries every skill's name and description.
26
+
27
+ ## Single source of truth
28
+
29
+ Every fact has exactly one home; every other doc links to it, never restates it. A fact's home is normally implied by the taxonomy and the docs' topics — cross-references carry readers there, and no record of the placement is needed. A placement is recorded in the project's `docs/conventions/documentation.md` only when a reasonable writer or groomer would have put the fact elsewhere — the record exists so grooming doesn't re-litigate it; obvious homes need no entry.
30
+
31
+ **Restatements**: a doc may restate a rule or fact it operationally depends on — a skill's procedure executing it, the briefing orienting every session with it, a README table presenting it to humans — provided the restatement carries a source marker (see: Markers). The marker is the sanction; an unmarked restatement is ordinary duplication.
32
+
33
+ Rejected: a standing central registry of all shared facts and their homes. It accumulates entries whose home is obvious from the doc's topic, and it rots like any other enumeration.
34
+
35
+ ## Package doc paths
36
+
37
+ `q` names the workflow itself — in prose, in the plugin and marketplace a project publishes, and as what a user types to name it. `@lab43/q` is the npm package: use it wherever npm has to recognize the name — a path into the package, an install command, a `package.json` field.
38
+
39
+ Reference q's docs and an extension's by package name plus path from the package's payload directory — `@lab43/q conventions/documentation.md`, `@acme/q-ext-x conventions/retries.md`. The name resolves to the installed copy in `node_modules/`, or to the package's working tree in the repo that authors it. The payload directory is `q-extension/` at the package root (source: @lab43/q conventions/extensions.md, Layout). The reference never spells that segment: `@lab43/q conventions/documentation.md` is `node_modules/@lab43/q/q-extension/conventions/documentation.md`. Use the form for every such reference across the documentation surface — markers, the briefing's index lines, doc prose. Use it even for a sibling in the doc's own package: a reference must stay unambiguous when its text is quoted away from its file.
40
+
41
+ Rejected: abbreviating `@lab43/q` to `q` in the path form. `q` is a different package on the public registry, so the abbreviated reference resolves to whatever `node_modules/q/` holds.
42
+
43
+ ## Markers
44
+
45
+ Inline cross-references tying a statement to the doc it depends on. They are the documentation surface's own routing, and must suffice for a reader arriving with no skill running — the skills reinforce the routing but can't be assumed. Agents follow them to the related detail; `/q:groom-docs` reads them as recorded intent — a marked restatement or deviation is checked against its target rather than re-flagged as duplication or drift on every run.
46
+
47
+ All share one grammar — `(verb: target)` or `(verb: target, section)`, the section naming a heading within the target. The target is one of:
48
+
49
+ - a heading in the current doc (`see: Markers`)
50
+ - a repo file or directory, read from the repo root exactly as written — a project doc (`docs/conventions/testing.md`), any other file a fact is read from (`source: config.yml`), or a directory when the text summarizes its files (`source: migrations/`)
51
+ - anything a package ships, by its path form (see: Package doc paths)
52
+
53
+ A leading package name is what separates the last two forms. Use the path form for every target a package ships, because a bare path would be read literally and find nothing.
54
+
55
+ A conventions doc always takes the path form, wherever the marker sits. It binds every session, and a session meets it with no skill running, so the marker has to resolve from the documentation surface alone.
56
+
57
+ `${CLAUDE_PLUGIN_ROOT}` is for the files nothing but a running skill ever opens — a plugin's own references and manifest. It resolves wherever the session loaded that plugin from, including a `--plugin-dir` directory that sits under no `node_modules/` and belongs to no authoring repo.
58
+
59
+ Five markers, all ordinary language:
60
+
61
+ - **`(see: X)`** — cross-reference. Nothing is copied; detail lives at X. No obligations attach.
62
+ - **`(source: X)`** — provenance. This text restates a fact whose authoritative home is X (see: Single source of truth).
63
+ - **`(overrides: X)`** — precedence. This rule deliberately replaces the named rule — a q rule (`overrides: @lab43/q conventions/conventions.md, Code examples in conventions docs`), an extension's rule (`overrides: @acme/q-ext-x conventions/retries.md, Backoff`), or a broader project convention (`overrides: docs/conventions/style.md, Magic numbers`).
64
+ - **`(exception: X)`** — excuse. This site is exempt from the named rule (`exception: docs/conventions/logging.md, Structured fields`). The rule still stands everywhere else. Several exceptions against one rule are evidence the rule wants revisiting.
65
+ - **`(spec: X)`** — enforcement. This code enforces the named spec statement (`spec: docs/specs/tasks.md, Due dates`). Which sites carry it, and what amending the statement obliges, are the specs rules (see: @lab43/q conventions/specs.md, Enforcement).
66
+
67
+ `(see:)`, `(source:)`, and `(overrides:)` live in the documentation surface, the only place anything reads them. An exception may sit in any file, because the site it excuses is as often a line of code or config as a passage of prose. A spec marker never sits in the documentation surface, because what enforces a commitment is code, config, or a test. A doc that restates a commitment carries `source:` instead.
68
+
69
+ A marker may sit in a comment rather than in running prose:
70
+
71
+ - In docs rendered for humans (README, guides), it sits in an HTML comment.
72
+ - In any other file, which only an exception or a spec marker reaches, it sits in that file's own comment syntax.
73
+ - Either way it drops the parentheses. The comment's own delimiters stand in for them, so it reads `<!-- source: docs/conventions/testing.md -->`.
74
+
75
+ A comment carrying prose as well gives the marker its own line. Comments are otherwise ordinary (see: @lab43/q conventions/principles.md, Comments carry constraints, not justification).
76
+
77
+ An exception and a spec marker each must name a section, because only a marker that identifies the rule or the statement can be counted against it. An exception must also carry a reason, which is the text the marker sits in: the sentence in a doc, or the comment in any other file. An exception missing either part excuses nothing.
78
+
79
+ An exception is spent once its site no longer needs excusing: the rule is gone, or it changed to admit the site. A spent exception comes out. One whose rule merely moved is retargeted, because the site still needs it.
@@ -0,0 +1,70 @@
1
+ # Extensions
2
+
3
+ The format behind the extension conventions tier — rules for authoring and publishing a q extension.
4
+
5
+ ## Identity
6
+
7
+ A q extension is an npm package that carries the `q-extension` keyword in its `package.json` and ships a `q-extension/` payload directory (see: Layout). Both halves identify it. The keyword is how tooling tells extensions from a project's other dependencies and how they are found on the registry. The payload is what the keyword promises. A package carrying the keyword and shipping nothing is not an extension, and q's machinery passes over it in silence rather than reporting a state no skill can repair.
8
+
9
+ Look for extensions across a project's direct `dependencies` as well as its `devDependencies`. A package can ship rules and code together — a component library carrying the conventions for using it — and a project that imports such a package holds it as a regular dependency. Meeting both halves means q's machinery:
10
+
11
+ - discovers the package
12
+ - indexes what it documents
13
+ - registers the plugin it ships, for the project's sessions to load
14
+ - reconciles the project against its releases
15
+
16
+ q is not an extension but what extensions extend: the framework whose rules they add to and whose format they follow (source: @lab43/q conventions/conventions.md, Three tiers of conventions). `@lab43/q` carries no keyword, and is named outright wherever a rule reaches it.
17
+
18
+ ## Which rules ship
19
+
20
+ A repo that publishes rules has two homes for a rule it writes, and every rule goes to one of them. A repo that publishes none has one home, `docs/conventions/`, and becoming a publisher is the user's call rather than a session's.
21
+
22
+ - **The payload** — everything under the package's `q-extension/` directory, which is what binds its consumers (see: Layout).
23
+ - **`docs/conventions/`** — rules for developing the repo itself: its own code, its docs, its repo mechanics. Consumers are never bound by these and never routed to them.
24
+
25
+ The test is one question: would this change what a session in a consuming repo writes or flags? Yes puts it in the payload. No keeps it local.
26
+
27
+ A rule can pass that test later, as its audience outgrows one project — org-wide rules, or rules for code that uses a product. Move it then: out of `docs/conventions/` into the payload, never copied into both, its index line crossing from the project's group to the payload's rather than disappearing (see: Authoring).
28
+
29
+ **Payload is addressed solely to consumers.** Payload docs never name the repo that authors them, its development practices, or its internal layout. Even acknowledging that they might be read from inside that repo muddies them for the audience they speak to. A repo still follows the payload it ships, as a consuming project of its own rules.
30
+
31
+ Rejected: shipping the payload's conventions at the contract path, `docs/conventions/`, so that one path means conventions everywhere. It conflates what the package ships with the repo's own working rules, so a consumer reading the shipped docs would meet repo-local rulings as law.
32
+
33
+ ## Description
34
+
35
+ `package.json`'s `q.description` states what the extension's rules govern. A consuming project's briefing heads the extension's group of index lines with it (source: @lab43/q conventions/documentation.md, Taxonomy). Name the territory the rules cover, not the package's shape.
36
+
37
+ ## Layout
38
+
39
+ A package's payload is a `q-extension/` directory at its package root. Everything the package ships for q lives inside it. Name `q-extension` in the `files` whitelist: without it the package ships no rules at all, announces itself as an extension anyway, and nothing warns.
40
+
41
+ What it holds depends on what the extension carries:
42
+
43
+ - `conventions/` when it ships conventions docs, each written to the documentation policy (see: @lab43/q conventions/documentation.md).
44
+ - `.claude-plugin/` when it ships a plugin, beside whatever that plugin loads — its skills, agents and hooks. `q-extension/` is then the plugin root, and `${CLAUDE_PLUGIN_ROOT}` resolves to it. A consuming project registers the plugin in its own marketplace under the `name` in the plugin's `plugin.json`, so that name is the namespace its sessions type: `/<name>:<skill>`. Choose one no other extension is likely to carry. `q` is taken. What else a plugin may hold is Claude Code's to decide; q fixes only where its root sits.
45
+
46
+ Every extension ships at least one of the two, which is what identifies a payload (see: Identity). Anything else the package ships for q sits beside them.
47
+
48
+ An extension shipping no conventions docs is watermarked but never indexed, having nothing for a briefing's docs index to carry. Watermarking and indexing are separate for that reason.
49
+
50
+ Rejected: a `q` metadata key in `package.json` naming paths or listing docs — the payload directory and the keyword already answer where everything is, and an enumeration of docs rots against its own contents. The key carries the description and nothing else (see: Description).
51
+
52
+ ## Pinning
53
+
54
+ Declare `@lab43/q` as a devDependency in the `package.json` at the repo root. That is the only place anything looks for it, whatever else the repo holds — a monorepo declares q at the root, never in a workspace manifest. Keep it a devDependency: q is tooling rather than code a project imports, and a project holding it in `dependencies` goes unvalidated at session start, silently.
55
+
56
+ Declare each extension in that same root manifest. `dependencies` and `devDependencies` both serve (see: Identity), but no other manifest does — a declaration in a workspace package is one nothing reads. The specifier's form is the project's own choice: q reads versions from the lockfile and `node_modules`, never from the manifest.
57
+
58
+ A repo that publishes rules already declares q at its root, like any q project, with one requirement of its own: the pin is exact. With the payload at that root, the published package is the repo itself — its `package.json` goes into the tarball, and the pin in it tells consumers which q version the rules were written against. That is a fact only an exact version can state, and the manifest is the author's only channel for it: the lockfile that would resolve a range never ships. The declaration stays inert in consumers — npm installs no dependency's devDependencies — so extensions declaring different q versions never collide; the gap is surfaced at reconciliation and closes through releases.
59
+
60
+ ## Authoring
61
+
62
+ In its authoring project, an extension's conventions docs and its `q.description` join the documentation surface (see: Description). Both are groomed and reconciled against q's updates like the project's own docs.
63
+
64
+ They are indexed there too. The authoring repo's briefing gives them a group of their own, shaped like a consumed extension's and headed the same way. The group carries no pin, because a repo does not depend on itself, and no watermark, because a watermark certifies that changed rules have been absorbed and there is nothing to absorb in rules you are editing.
65
+
66
+ An extension's doc may deviate from a q rule the same way a project doc does, stating the deviation with an overrides marker (see: @lab43/q conventions/documentation.md, Markers); the project's own rulings still win over any extension's (source: @lab43/q conventions/conventions.md, Three tiers of conventions).
67
+
68
+ The plugin the extension ships loads from the working tree too. Add its entry to the project's own marketplace by hand, beside q's: sourced at `./q-extension` and named by the `name` in its `plugin.json`. Enable it in `.claude/settings.json` the way q's entry is enabled there.
69
+
70
+ All of this assumes the payload sits at the repo's own root. Publish from a sub-package of a larger repo and consumers install it exactly the same way, but the authoring repo gets none of the above: no group in its briefing, and a root declaration that is not the pin the package ships (see: Pinning).