canicode 0.10.5 → 0.11.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.
@@ -104,7 +104,7 @@ Override score, severity, or enable/disable individual rules:
104
104
  | Rule ID | Default Score | Default Severity |
105
105
  |---------|--------------|-----------------|
106
106
  | `fixed-size-in-auto-layout` | -6 | risk |
107
- | `missing-size-constraint` | -8 | risk |
107
+ | `missing-size-constraint` | -1 | missing-info |
108
108
 
109
109
  **Code Quality (4 rules)**
110
110
 
@@ -134,8 +134,8 @@ Override score, severity, or enable/disable individual rules:
134
134
 
135
135
  | Rule ID | Default Score | Default Severity |
136
136
  |---------|--------------|-----------------|
137
- | `missing-interaction-state` | -1 | suggestion |
138
- | `missing-prototype` *(disabled)* | -3 | missing-info |
137
+ | `missing-interaction-state` | -1 | missing-info |
138
+ | `missing-prototype` | -1 | missing-info |
139
139
  <!-- RULE_TABLE_END -->
140
140
 
141
141
  ### Example Configs
@@ -176,6 +176,65 @@ Override score, severity, or enable/disable individual rules:
176
176
 
177
177
  ---
178
178
 
179
+ ## Cursor MCP (canicode)
180
+
181
+ Configure the canicode MCP server so Cursor exposes `analyze`, `gotcha-survey`, and other tools.
182
+
183
+ ### Which MCP file affects which host?
184
+
185
+ Two different JSON locations are easy to confuse because both can live in a git repo and both use an `mcpServers` object. (See GitHub #436.)
186
+
187
+ | Path | Read by | Purpose |
188
+ | --- | --- | --- |
189
+ | **`.mcp.json`** at the **repository root** | **Claude Code** — `claude mcp add …` (project or user scope) persists entries here. | Shared with teammates when committed; this is the file skills and onboarding mean when they say “check `.mcp.json`” in a **Claude Code** context. |
190
+ | **`.cursor/mcp.json`** | **Cursor** — project-scoped MCP list ([Cursor MCP docs — configuration locations](https://cursor.com/docs/context/mcp)). | Team-shared MCP for Cursor Agent in that workspace. |
191
+ | **`~/.cursor/mcp.json`** | **Cursor** — global MCP list (same doc). | Personal MCP available across all projects; merged with project config (project wins if the same server name appears twice). |
192
+
193
+ **Cursor does not use the repo-root `.mcp.json` for MCP.** If you only edit `.mcp.json` because you copied a Claude Code snippet, Cursor will not load those servers until you add the same `mcpServers` entries under **`.cursor/mcp.json`** or **`~/.cursor/mcp.json`**, then reload MCP or restart Cursor.
194
+
195
+ **Claude Code does not read `.cursor/mcp.json`.** Register servers with `claude mcp add …` (or maintain the root `.mcp.json` format Claude Code expects for your install).
196
+
197
+ **Canicode CLI (`canicode init`):** When suggesting Figma MCP setup for Cursor-heavy flows, the init command treats **either** repo-root `.mcp.json` **or** `.cursor/mcp.json` as evidence that Figma MCP is configured — so mixed-host repos still get accurate “already configured” detection. That does **not** mean Cursor loads `.mcp.json`; it only avoids false negatives when both files exist.
198
+
199
+ ### Project config (`.cursor/mcp.json`)
200
+
201
+ Create or merge into `.cursor/mcp.json` in your repository root:
202
+
203
+ ```json
204
+ {
205
+ "mcpServers": {
206
+ "canicode": {
207
+ "command": "npx",
208
+ "args": ["-y", "--package=canicode", "canicode-mcp"]
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ Use long-form `--package` (short `-p` can confuse some parsers). Set your Figma token once with `npx canicode init --token figd_…` — the MCP server reads `~/.canicode/config.json`; you do not need `FIGMA_TOKEN` in the MCP block unless your team prefers env injection.
215
+
216
+ ### Figma MCP server id and tool names in Cursor (#437)
217
+
218
+ Cursor may show an MCP **server id** in the UI that is **not** literally the key you typed in `mcpServers` (for example a workspace or project prefix). Skills and docs often say “the `figma` MCP” or “call `use_figma`” as shorthand — **your session’s truth is the live tool list** after MCP reload (Cursor: MCP / Tools panel), not the string `figma` or `use_figma` read from a config file alone.
219
+
220
+ - If roundtrip fails with “cannot find `use_figma`” but Figma MCP shows as connected, open the tool list and note the **exact** tool identifier Cursor exposes (it may be namespaced).
221
+ - Keep the Figma MCP entry in `.cursor/mcp.json` (or `~/.cursor/mcp.json`) per [Figma’s MCP docs](https://developers.figma.com/docs/figma-mcp-server/) — then rely on the host-reported tool name when wiring skills or debugging.
222
+
223
+ ### Gotcha survey in Cursor
224
+
225
+ 1. Add the MCP config above and restart Cursor (or reload MCP).
226
+ 2. Run `npx canicode init --token … --cursor-skills` to install **canicode**, **canicode-gotchas**, and **canicode-roundtrip** (with `helpers.js`) under `.cursor/skills/`, and ensure the shared answer file exists at `.claude/skills/canicode-gotchas/SKILL.md` when needed (or run full `canicode init` and add `--cursor-skills`). Authoring is single-source under `.claude/skills/` in the repo; the npm build writes `skills/cursor/` (gotchas strip `# Collected Gotchas`; other skills are full copies).
227
+ 3. In chat, @-mention **canicode**, **canicode-gotchas**, or **canicode-roundtrip** as needed. For roundtrip, the Figma MCP must expose **`use_figma`** in the session — same requirement as Claude Code.
228
+
229
+ ### Manual test checklist (#407)
230
+
231
+ - [ ] MCP: Cursor shows `canicode` connected and the tools list includes `gotcha-survey` (and `analyze` if testing roundtrip Step 1).
232
+ - [ ] Figma MCP: `use_figma` is available when testing **roundtrip** (install + restart host if tools are missing).
233
+ - [ ] Calling `gotcha-survey` with a local fixture path returns JSON with `designGrade` and `questions` / `isReadyForCodeGen`.
234
+ - [ ] After the Q&A loop, `npx canicode upsert-gotcha-section --file … --design-key … --input=-` (JSON payload on stdin per `canicode-gotchas` Step 4b) succeeds and updates `.claude/skills/canicode-gotchas/SKILL.md`.
235
+ - [ ] Optional: @ **canicode-roundtrip** — Step 4 reads `helpers.js` from `.cursor/skills/canicode-roundtrip/helpers.js` after `canicode init --cursor-skills`.
236
+
237
+ ---
179
238
 
180
239
  ## Telemetry
181
240
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canicode",
3
- "version": "0.10.5",
3
+ "version": "0.11.1",
4
4
  "mcpName": "io.github.let-sunny/canicode",
5
5
  "description": "Lint Figma designs for AI code-gen and roundtrip the answers back into the file. CLI + MCP server.",
6
6
  "type": "module",
@@ -13,6 +13,12 @@ This skill works with either channel — the CLI or the canicode MCP server. Bot
13
13
  - A **saved fixture** (from `canicode calibrate-save-fixture`)
14
14
  - A **FIGMA_TOKEN** for live Figma URLs
15
15
 
16
+ ### Step 0: Verify canicode MCP tools are loaded (optional fast path)
17
+
18
+ Before shelling out to `npx canicode analyze …`, check whether the **`analyze` MCP tool** is available in **this** session — not only whether `.mcp.json` lists `canicode`. New MCP registrations usually need a **restart or MCP reload** before tools appear.
19
+
20
+ If you must use the CLI fallback, say so out loud: the user may have added `claude mcp add canicode …` but not restarted yet (#433). After restart/reload, `analyze` via MCP avoids the `npx` spawn. The fallback is valid — silence makes users think the MCP install failed.
21
+
16
22
  ## How to Analyze
17
23
 
18
24
  ### From a Figma URL
@@ -1,20 +1,31 @@
1
1
  ---
2
2
  name: canicode-gotchas
3
- description: Gotcha survey workflow plus accumulating per-design answers one Workflow region on top, numbered sections appended per Figma design
3
+ description: Gotcha survey (Claude Code or Cursor)Q&A workflow; answers accumulate in .claude/skills/canicode-gotchas/SKILL.md for figma-implement-design
4
4
  ---
5
5
 
6
- # CanICode Gotchas -- Design Gotcha Survey & Skill Writer
6
+ # CanICode Gotchas Design Gotcha Survey
7
7
 
8
- Run a gotcha survey on a Figma design to identify implementation pitfalls, collect developer answers, and upsert them into this skill file so code generation agents can reference them automatically. The file has two regions: the **Workflow** below (installed by `canicode init`, never overwritten) and the **Collected Gotchas** region at the bottom (one numbered section per design, replaced in place on re-runs).
8
+ **Channel contrast:** **`canicode-gotchas`** (**this skill**) persists answers **only** in **local** `.claude/skills/canicode-gotchas/SKILL.md` **memo-only**, no Plugin write to Figma. **`canicode-roundtrip`** writes to the **canvas**. Use gotchas when you want Q&A captured for code-gen context without mutating the file.
9
+
10
+ Run a gotcha survey on a Figma design to collect implementation context that Figma cannot encode natively, capture developer/designer answers, and upsert them into **`.claude/skills/canicode-gotchas/SKILL.md`** so downstream `figma-implement-design` runs have annotation-ready context. In this model, rules do rule-based best-practice detection, and gotcha is the annotation output from that detection. Some gotchas come from violation rules (what is wrong and how to resolve it); others come from info-collection rules (neutral context Figma cannot represent, like interaction intent/state).
11
+
12
+ **Install location:** The workflow prose may live under `.claude/skills/canicode-gotchas/SKILL.md` (default `canicode init`) or be copied to `.cursor/skills/canicode-gotchas/SKILL.md` (`canicode init --cursor-skills`). The **authoritative gotcha store** is always **`.claude/skills/canicode-gotchas/SKILL.md`** — the CLI `upsert-gotcha-section` writes there only. In the `.claude` copy, this file has two regions: the **Workflow** below (installed by `canicode init`, never overwritten manually) and the **Collected Gotchas** region at the bottom (one numbered section per design, replaced in place on re-runs).
9
13
 
10
14
  ## Prerequisites
11
15
 
12
- - **canicode MCP server** (preferred): `claude mcp add canicode -- npx --yes --package=canicode canicode-mcp` — long-form flags only; the short-form `-y -p` collides with `claude mcp add`'s parser (#366). The MCP server reads `FIGMA_TOKEN` from `~/.canicode/config.json` or the host environment, so do **not** pass `-e FIGMA_TOKEN=…` here (#364).
13
- - **Without canicode MCP** (fallback): the `canicode gotcha-survey --json` CLI produces the same response shape no MCP installation required.
14
- - **FIGMA_TOKEN** configured for live Figma URLs
16
+ - **canicode MCP** (recommended): Register the server with your host — **Claude Code:** `claude mcp add canicode -- npx --yes --package=canicode canicode-mcp` — long-form flags only; the short-form `-y -p` collides with `claude mcp add`'s parser (#366); do **not** pass `-e FIGMA_TOKEN=…` here (#364). **Cursor / other hosts:** add `canicode-mcp` to your MCP config — see [Customization guide](https://github.com/let-sunny/canicode/blob/main/docs/CUSTOMIZATION.md#cursor-mcp-canicode) (`~/.cursor/mcp.json` or project `.cursor/mcp.json`). The MCP server reads `FIGMA_TOKEN` from `~/.canicode/config.json` or the environment.
17
+ - **Without canicode MCP** (fallback): `npx canicode gotcha-survey "<input>" --json` same JSON shape as the MCP tool.
18
+ - **FIGMA_TOKEN** configured for live Figma URLs.
19
+ - **Gotcha destination on disk:** `.claude/skills/canicode-gotchas/SKILL.md` must exist before upsert — run `npx canicode init --token …` (add `--cursor-skills` if you also want the workflow file under `.cursor/skills/`).
15
20
 
16
21
  ## Workflow
17
22
 
23
+ ### Step 0: Verify canicode MCP tools are loaded (optional fast path)
24
+
25
+ Before Step 1, verify that `gotcha-survey` is callable in **this** session — not merely listed in `.mcp.json`. Newly registered MCP servers usually need a **host restart or MCP reload** before tools appear (same pattern as `/canicode-roundtrip` Step 0 for the Figma MCP).
26
+
27
+ When you fall back to `npx canicode gotcha-survey … --json`, tell the user explicitly: the canicode MCP may not be loaded yet. They should register it (`claude mcp add canicode -- npx --yes --package=canicode canicode-mcp`, or the Cursor/`mcp.json` equivalent in the Customization guide) and **restart the IDE or reload MCP** — then the next session can use the MCP tool without spawning `npx`. The CLI fallback is correct behavior; silence makes users think registration failed (#433).
28
+
18
29
  ### Step 1: Run the gotcha survey
19
30
 
20
31
  If the `gotcha-survey` MCP tool is available, call it with the user's Figma URL:
@@ -38,12 +49,12 @@ Either channel returns:
38
49
 
39
50
  If `isReadyForCodeGen` is `true` or `questions` is empty:
40
51
  - Tell the user: "This design scored **{designGrade}** and is ready for code generation — no gotchas to resolve."
41
- - Do NOT write to the skill file.
52
+ - Do NOT write to `.claude/skills/canicode-gotchas/SKILL.md`.
42
53
  - Stop here.
43
54
 
44
55
  ### Step 3: Present questions to the user
45
56
 
46
- The survey response carries a pre-computed `groupedQuestions.groups[].batches[]` shape so the SKILL never has to sort, partition, or maintain a batchable-rule whitelist in prose. The sort key, `_no-source` sentinel, and batchable-rule list all live in `core/gotcha/group-and-batch-questions.ts` with vitest coverage (per ADR-016). Iterate over it:
57
+ The survey response carries a pre-computed `groupedQuestions.groups[].batches[]` shape so this skill never has to sort, partition, or maintain a batchable-rule whitelist in prose. The sort key, `_no-source` sentinel, and batchable-rule list all live in `core/gotcha/group-and-batch-questions.ts` with vitest coverage (per ADR-016). Iterate over it:
47
58
 
48
59
  For every `batch` in `groupedQuestions.groups.flatMap((g) => g.batches)`:
49
60
 
@@ -90,19 +101,19 @@ When applying the batched answer, expand back to per-question records in Step 4
90
101
 
91
102
  ### Step 4: Upsert the gotcha section
92
103
 
93
- After collecting all answers, **upsert** this design's section into the `# Collected Gotchas` region at the bottom of this file:
104
+ After collecting all answers, **upsert** this design's section into the `# Collected Gotchas` region at the bottom of:
94
105
 
95
106
  ```
96
107
  .claude/skills/canicode-gotchas/SKILL.md
97
108
  ```
98
109
 
99
- This file goes in the **user's project** (current working directory), NOT in the canicode repo. The Workflow region above **must never be modified** — only the `# Collected Gotchas` region below is touched.
110
+ That path is in the **user's project** (current working directory), NOT in the canicode repo. If you are following this workflow from a copy under `.cursor/skills/`, still upsert into **`.claude/skills/...`** only — never write gotcha answers into the `.cursor` copy. The Workflow region in the `.claude` file **must never be modified manually** — only the `# Collected Gotchas` region is touched (via the CLI below).
100
111
 
101
112
  #### Step 4a: Use the `designKey` from the survey response
102
113
 
103
114
  `designKey` uniquely identifies the design so re-running on the same URL replaces the existing section in place. The survey response carries it on `survey.designKey` — read it directly. Do **not** parse the input URL in prose.
104
115
 
105
- The `core/contracts/design-key.ts` helper (`computeDesignKey`) handles every shape with vitest coverage so the SKILL stays ADR-016-compliant:
116
+ The `core/contracts/design-key.ts` helper (`computeDesignKey`) handles every shape with vitest coverage so this workflow stays ADR-016-compliant:
106
117
 
107
118
  - **Figma URL** → `<fileKey>#<nodeId>` with `-` → `:` normalization on the nodeId. Example: `https://figma.com/design/abc123XYZ/My-File?node-id=42-100&t=ref` → `designKey = "abc123XYZ#42:100"`. Trailing query parameters (`?t=...`, `?mode=...`) are dropped.
108
119
  - **Figma URL without `node-id`** → just `<fileKey>` (file-level key).
@@ -110,89 +121,60 @@ The `core/contracts/design-key.ts` helper (`computeDesignKey`) handles every sha
110
121
 
111
122
  #### Step 4b: Upsert via the canicode CLI
112
123
 
113
- File-state detection (4-way: missing / valid / missing-heading / clobbered) and section walking (find existing `## #NNN — ...` by `Design key` substring, otherwise compute the next monotonic zero-padded NNN) are deterministic markdown operations and live in `core/gotcha/upsert-gotcha-section.ts` with vitest coverage — the SKILL never re-implements them in prose (per ADR-016).
124
+ File-state detection (4-way: missing / valid / missing-heading / clobbered) and section walking (find existing `## #NNN — ...` by `Design key` substring, otherwise compute the next monotonic zero-padded NNN) are deterministic markdown operations and live in `core/gotcha/upsert-gotcha-section.ts` with vitest coverage — do not re-implement them in prose (per ADR-016).
125
+
126
+ Build **one JSON object** on stdin for `upsert-gotcha-section`. The CLI renders the section markdown from `survey` + `answers` via `renderGotchaSection` in TypeScript (#439) — severity, rule text, node ids, and instance context come **verbatim** from `gotcha-survey --json`; the skill must not paste LLM-authored section prose.
127
+
128
+ Payload shape:
129
+
130
+ ```json
131
+ {
132
+ "survey": {
133
+ "designKey": "<same as Step 4a>",
134
+ "designGrade": "<from gotcha-survey>",
135
+ "questions": "<full questions[] array from gotcha-survey — preserve order>"
136
+ },
137
+ "answers": {
138
+ "<nodeId>": { "answer": "…" }
139
+ },
140
+ "designName": "<Figma file name or fixture label>",
141
+ "figmaUrl": "<the user's input URL or path>",
142
+ "analyzedAt": "<ISO 8601 timestamp when you upsert>",
143
+ "today": "<YYYY-MM-DD local date for the section title>"
144
+ }
145
+ ```
146
+
147
+ For skipped / n/a: use `{ "skipped": true }` for that `nodeId`, or omit the key. Skipped questions do **not** get per-question rows; `renderGotchaSection` appends a compact **`#### Skipped (N)`** block listing each `ruleId` with a count (`ruleId` lines sorted lexically — see `src/core/gotcha/render-gotcha-section.ts`).
114
148
 
115
- Render the per-design section markdown using the **Output Template** below with the literal string `{{SECTION_NUMBER}}` in the header (the CLI substitutes the right NNN for you preserves it on replace, computes the next monotonic value on append). Then invoke:
149
+ Invoke (cac requires `--input=-`, not `--input -`, so the stdin sentinel survives parsing#420):
116
150
 
117
151
  ```bash
118
152
  npx canicode upsert-gotcha-section \
119
153
  --file .claude/skills/canicode-gotchas/SKILL.md \
120
154
  --design-key "<designKey from Step 4a>" \
121
- --section - # then pipe the rendered section markdown through stdin
155
+ --input=-
122
156
  ```
123
157
 
124
- The CLI prints a JSON result `{ state, action, sectionNumber, wrote, userMessage }`:
158
+ Pipe the JSON object on stdin. `--design-key` must equal `survey.designKey` (the CLI validates the match).
159
+
160
+ The CLI prints JSON `{ state, action, sectionNumber, wrote, userMessage, designKey }`:
125
161
 
126
162
  - `wrote: true` → success. `action` is `"replace"` (preserved `sectionNumber`) or `"append"` (next monotonic `sectionNumber`).
127
163
  - `wrote: false` with `state: "missing"` → tell the user: *"Your gotchas SKILL.md is not installed yet. Run `canicode init` first, then re-invoke this skill."* Stop here.
128
164
  - `wrote: false` with `state: "clobbered"` → tell the user: *"Your gotchas SKILL.md is missing the canicode YAML frontmatter (pre-#340 single-design clobber). Run `canicode init --force` to restore the workflow, then re-run this survey — your answers will land in a clean numbered section."* Stop here.
129
165
  - `wrote: true` with `state: "missing-heading"` → silent recovery. The CLI injected the `# Collected Gotchas` heading and appended the section; the workflow region above is untouched.
130
166
 
131
- The Workflow region above must never be touched. Do NOT copy Workflow prose into the per-design section; the section only carries metadata + gotcha answers.
132
-
133
- ## Output Template
134
-
135
- Each per-design section in the `# Collected Gotchas` region has this exact shape:
136
-
137
- ````markdown
138
- ## #NNN — {designName} — {YYYY-MM-DD}
139
-
140
- - **Figma URL**: {figmaUrl}
141
- - **Design key**: {designKey}
142
- - **Grade**: {designGrade}
143
- - **Analyzed at**: {analyzedAt}
144
-
145
- ### Gotchas
146
-
147
- #### {ruleId} — {nodeName}
148
-
149
- - **Severity**: {severity}
150
- - **Node ID**: {nodeId}
151
- - **Instance context** (omit this bullet if `instanceContext` was not in the survey question): parent instance `parentInstanceNodeId`, source node `sourceNodeId`, component `sourceComponentName` / `sourceComponentId` when present — roundtrip apply uses this to write on the source definition when instance overrides fail.
152
- - **Question**: {question}
153
- - **Answer**: {userAnswer}
154
-
155
- (repeat for each question)
156
- ````
157
-
158
- ### Field mapping
159
-
160
- | Field | Source |
161
- |-------|--------|
162
- | `NNN` | `sectionNumber` — zero-padded three-digit index. Preserved on re-run, incremented on append. |
163
- | `designName` | Figma file name or fixture name from the input |
164
- | `YYYY-MM-DD` | Today's date (the day you are running the survey) |
165
- | `figmaUrl` | The input URL or fixture path provided by the user |
166
- | `designKey` | `survey.designKey` from the gotcha-survey response (see Step 4a) |
167
- | `designGrade` | `designGrade` from gotcha-survey response |
168
- | `analyzedAt` | Current timestamp (ISO 8601) |
169
- | `ruleId` | `ruleId` from each question |
170
- | `nodeName` | `nodeName` from each question |
171
- | `severity` | `severity` from each question (blocking / risk) |
172
- | `nodeId` | `nodeId` from each question |
173
- | `instanceContext` | When present on the question, copy `parentInstanceNodeId`, `sourceNodeId`, `sourceComponentId`, `sourceComponentName` into the bullet above (roundtrip / Plugin apply) |
174
- | `question` | `question` from each question |
175
- | `userAnswer` | The answer collected from the user in Step 3 |
176
-
177
- ### Skipped questions
178
-
179
- If the user skipped a question or said "n/a", still include it in the section with:
180
-
181
- ```markdown
182
- - **Answer**: _(skipped)_
183
- ```
184
-
185
- This ensures the code generation agent knows the gotcha exists even if no answer was provided.
167
+ The Workflow region above must never be touched.
186
168
 
187
169
  ## Edge Cases
188
170
 
189
- - **No questions returned**: The design is ready for code generation. Inform the user and stop (Step 2). Do not touch the file.
171
+ - **No questions returned**: The design is ready for code generation. Inform the user and stop (Step 2). Do not touch `.claude/skills/canicode-gotchas/SKILL.md`.
190
172
  - **Re-run on the same design**: Replace that design's section in place (matched by `Design key`) — preserve the original `#NNN` number. Do NOT append a duplicate.
191
173
  - **Re-run on a different design**: Append a new section with the next `#NNN`. Prior designs' sections are untouched.
192
174
  - **Workflow region**: Never modified. If you notice the Workflow region has been edited by the user, leave their edits alone — only the `# Collected Gotchas` region is under skill control.
193
175
  - **Pre-#340 clobbered file** (the YAML frontmatter was rewritten to a per-design variant, so the canonical `canicode-gotchas` frontmatter is missing): tell the user to run `canicode init --force` to restore the workflow, then re-run the survey. The prior single-design content cannot be automatically migrated into a `## #001` section — the user re-runs and gets a clean section.
194
176
  - **MCP tool not available**: Fall back to `npx canicode gotcha-survey <input> --json` — the CLI returns the same `GotchaSurvey` shape. If the CLI is also unavailable (e.g. no node runtime), tell the user to install the canicode MCP server or the `canicode` npm package (see Prerequisites).
195
- - **Partial answers**: If the user stops mid-survey, upsert the section with answers collected so far. Mark remaining questions as _(skipped)_.
177
+ - **Partial answers**: If the user stops mid-survey, upsert the section with answers collected so far. Remaining questions count toward **`#### Skipped (N)`** (omit keys or `{ "skipped": true }`).
196
178
  - **Manual section deletion**: If the user deletes a middle section by hand, do not renumber existing sections. The next new section still gets `(highest existing number) + 1`; numeric gaps are acceptable (same pattern as `.claude/docs/ADR.md`).
197
179
 
198
180
  # Collected Gotchas