dsh-plugin-strict-spec 0.0.0-stage → 0.5.0

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 (33) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +236 -2
  3. package/README.zh.md +191 -0
  4. package/cordis.patch.yml +5 -0
  5. package/dist/cli/strict-spec-cli.js +38892 -0
  6. package/dist/client.js +50 -0
  7. package/dist/host.js +154 -0
  8. package/dist/skills/strict-roadmap-plan/SKILL.md +176 -0
  9. package/dist/skills/strict-roadmap-recommend/SKILL.md +321 -0
  10. package/dist/skills/strict-roadmap-reorder/SKILL.md +194 -0
  11. package/dist/skills/strict-roadmap-review/SKILL.md +180 -0
  12. package/dist/skills/strict-roadmap-transition/SKILL.md +323 -0
  13. package/dist/skills/strict-scene-edit/SKILL.md +156 -0
  14. package/dist/skills/strict-spec-apply/SKILL.md +212 -0
  15. package/dist/skills/strict-spec-architecture/SKILL.md +143 -0
  16. package/dist/skills/strict-spec-archive/SKILL.md +165 -0
  17. package/dist/skills/strict-spec-auto/SKILL.md +334 -0
  18. package/dist/skills/strict-spec-brainstorm/SKILL.md +228 -0
  19. package/dist/skills/strict-spec-bugfix/SKILL.md +285 -0
  20. package/dist/skills/strict-spec-design/SKILL.md +168 -0
  21. package/dist/skills/strict-spec-design-sync/SKILL.md +165 -0
  22. package/dist/skills/strict-spec-init/SKILL.md +123 -0
  23. package/dist/skills/strict-spec-maintenance/SKILL.md +130 -0
  24. package/dist/skills/strict-spec-modify/SKILL.md +148 -0
  25. package/dist/skills/strict-spec-propose/SKILL.md +553 -0
  26. package/dist/skills/strict-spec-review/SKILL.md +315 -0
  27. package/dist/skills/strict-spec-ship/SKILL.md +94 -0
  28. package/dist/skills/strict-spec-spec-edit/SKILL.md +117 -0
  29. package/dist/skills/strict-spec-sync-specs/SKILL.md +128 -0
  30. package/dist/skills/strict-spec-verify/SKILL.md +79 -0
  31. package/dist/skills/strict-tech-edit/SKILL.md +161 -0
  32. package/dist/skills/strict-tech-sync/SKILL.md +202 -0
  33. package/package.json +109 -4
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: strict-spec-bugfix
3
+ description: Fix a known bug through a narrow strict YAML change. Use when a concrete defect, expected behavior, and enough reproduction evidence are in hand to implement a minimal fix with regression coverage; route unclear, unreproduced, or evidence-gathering investigations to strict-spec-brainstorm first, and route open-ended product ideas to strict-spec-brainstorm or strict-spec-propose.
4
+ metadata:
5
+ skill_id: strict_spec_bugfix
6
+ author: strict-spec-driven
7
+ type: agent_skill
8
+ version: 1.0.0
9
+ ---
10
+
11
+ You are fixing a known bug through the strict workflow.
12
+
13
+ This skill owns the bugfix-specific discipline — confirming the issue is a known
14
+ bug, reproducing it before touching production code, keeping the fix minimal,
15
+ and proving it with before-and-after regression evidence. The general workflow
16
+ procedures it sits on top of are owned by the skills listed under Delegated
17
+ Procedures below, and this skill does not restate them.
18
+
19
+ ## This Skill's Commands
20
+
21
+ If you cannot remember the exact command used by this skill, look it up here
22
+ before running anything. Do not guess.
23
+
24
+ ```yaml
25
+ check-workflow-state: strict-spec-cli check-workflow-state
26
+ tech-status: strict-spec-cli tech-status
27
+ lesson-status: strict-spec-cli lesson-status [--category <category>]
28
+ lesson-create: strict-spec-cli lesson-create --title <text> --category <category> --context <text> --observation <text> --takeaway <text> --applies-when <text> --origin <text> --evidence <text>
29
+ lesson-edit: strict-spec-cli lesson-edit <lesson-id> --origin <text> --evidence <text>
30
+ propose: strict-spec-cli propose <change-name>
31
+ generate: strict-spec-cli generate <change-name> <proposal|design|questions|tasks|delta-spec|delta-tech> --<named-args>
32
+ ready: strict-spec-cli ready <change-name>
33
+ next: strict-spec-cli next <change-name>
34
+ apply: strict-spec-cli apply <change-name>
35
+ verify: strict-spec-cli verify <change-name>
36
+ archive: strict-spec-cli archive <change-name>
37
+ ```
38
+
39
+ ## YAML Writing Rules
40
+
41
+ - Keep strict artifacts in valid YAML structures at every stage. Do not replace
42
+ structured fields with Markdown prose.
43
+ - If artifact fields are unclear, use `strict-spec-cli schema-show <schema-name>`;
44
+ installed skills do not carry a `templates` directory.
45
+ - Shared schema cache root: `~/.strict-spec-schemas/`. When a YAML artifact already declares `schema_file`, resolve that relative path under the shared cache root to inspect the concrete schema file without relying on a local templates directory.
46
+ - If a valid artifact example would clarify the shape, use
47
+ `strict-spec-cli sample-show <sample-name>`; installed skills do not rely on a
48
+ local `examples` directory.
49
+ - Use block scalars only for free-text content. Prefer `>-` for wrapped prose
50
+ such as longer `summary`, `approach`, `decision`, `rationale`, `question`,
51
+ `context`, `answer`, and spec `statement` values. Use `|` only when literal
52
+ line breaks must be preserved.
53
+ - Quote short strings that may contain YAML-sensitive characters or ambiguous
54
+ scalar values, including `command` strings, URLs, paths, text containing `:`
55
+ or `#`, leading `-`, JSON-like fragments, boolean-like words, and timestamp-
56
+ like values.
57
+ - Keep short structural fields as plain scalars unless quoting is needed for
58
+ correctness. Do not force IDs, enums, schema identifiers, artifact types,
59
+ task references, or similar fields into block scalars.
60
+ - Before moving between workflow stages, self-check indentation, list nesting,
61
+ quote closure, and colon spacing, then use the documented verification
62
+ commands to catch remaining schema or YAML issues.
63
+
64
+ ## CLI-Only YAML Authoring Protocol
65
+
66
+ Every mutation of repository-owned YAML in this skill goes through the strict
67
+ CLI. This skill writes `change-planning-state`, `change-delta-state`,
68
+ `spec-state`, `tech-state`, `lessons-state`. Before the first mutation run
69
+ `strict-spec-cli yaml-authoring-protocol <artifact-kind>` for each of them:
70
+ that command reports the ordered authoring steps, the owning command for each
71
+ operation, and the bundled schema and example keys with their cache-resolved
72
+ paths, bound to the artifact kind and current where a copy would go stale.
73
+ Validate the result with `strict-spec-cli verify <change-name>`,
74
+ `strict-spec-cli lesson-status`.
75
+
76
+ **Stop rather than edit YAML directly.** When a required command, argument, or
77
+ artifact kind is unavailable, stop and report the missing capability. Editing
78
+ the YAML directly, writing a raw payload, or scripting around the CLI is never
79
+ an available fallback, and an unavailable command is a reason to stop rather
80
+ than a reason to improvise.
81
+
82
+ ## Preferred Human Language
83
+
84
+ Comply with `preferred_human_language` from `.strict-spec-driven/config.yaml` —
85
+ the user's common human language, not a programming language — for all
86
+ user-facing and generated operator-facing text, unless that file is absent or
87
+ the active user message asks otherwise.
88
+
89
+ ## Delegated Procedures
90
+
91
+ Each procedure below is owned by the skill named beside it. That skill's
92
+ guidance is authoritative for it, and this skill does not restate it. Follow the
93
+ owning skill's procedure at the step that needs it; how it is loaded is whatever
94
+ the running harness provides.
95
+
96
+ - requirement-interrogation: owned by `strict-spec-propose`
97
+ - change-intake-gate: owned by `strict-spec-propose`
98
+ - spec-artifact-routing: owned by `strict-spec-propose`
99
+ - delta-artifact-authoring: owned by `strict-spec-propose`
100
+ - implementation-order: owned by `strict-spec-apply`
101
+ - lesson-outcome: owned by `strict-spec-review`
102
+
103
+ Delegation moves where a procedure is stated, never whether it runs. Every gate
104
+ this skill declares below still binds, and a delegated procedure that cannot be
105
+ followed stops the run exactly as an inline one would.
106
+
107
+ What a bugfix adds to those procedures stays here, at the step that needs it.
108
+ The one that shapes every later step: interrogate the defect's real impact and
109
+ the outcome the requester expects, not the patch you already have in mind.
110
+
111
+ ## Steps
112
+
113
+ Before any other step, run `strict-spec-cli check-workflow-state`. If `.strict-spec-driven/` is
114
+ missing, stop immediately and tell the user to run `/strict-spec-init`. Do not
115
+ run `init` from this skill.
116
+
117
+ 1. **Confirm bugfix fit** — use this skill only when the issue is a known bug:
118
+ observed incorrect behavior, expected behavior, affected path or component,
119
+ and reproduction evidence or a credible failing assertion are available. If
120
+ the issue cannot be reproduced or needs evidence gathering before code
121
+ changes, stop and recommend `strict-spec-brainstorm`, which interrogates the
122
+ problem before any scope is committed. If the request is a new product
123
+ behavior or a broad design decision, stop and recommend
124
+ `strict-spec-brainstorm` or `strict-spec-propose`.
125
+
126
+ 2. **Reset context from targeted files** — treat prior chat context as stale
127
+ unless it has been revalidated from current repository state. Read:
128
+ - `.strict-spec-driven/config.yaml`
129
+ - `.strict-spec-driven/specs/INDEX.yaml`
130
+ - every strict YAML main spec the bug appears to violate or touch, if any;
131
+ for a purely internal defect, confirm from the spec index that no main spec
132
+ requirement is implicated instead of forcing one
133
+ - the relevant implementation and test files
134
+ - the applicable technical standards by running
135
+ `strict-spec-cli tech-status` and reading the relevant files under
136
+ `.strict-spec-driven/tech/`
137
+ - the recorded experience that may bear on this defect by running
138
+ `strict-spec-cli lesson-status --category <category>` for the category matching the failing
139
+ area and matching its `applies_when` conditions
140
+ against the failing area. Lessons carry no MUST or SHOULD strength; treat
141
+ them as warnings worth checking, and weight a lesson with several
142
+ occurrences because it has bitten this project repeatedly.
143
+ Use this evidence to run the delegated change-intake-gate procedure before
144
+ asking the human or continuing into implementation.
145
+
146
+ 3. **Reproduce before fixing** — prove the failure before making production
147
+ code changes. Reading code and inferring a likely defect is not enough to
148
+ edit production code.
149
+ - Use an existing failing test, a new minimal failing regression test, or a
150
+ deterministic command that demonstrates the defect.
151
+ - If reproduction is impossible in the local environment because of missing
152
+ dependencies, credentials, fixtures, services, platform state, or unclear
153
+ reproduction steps, record the blocker in `questions.yaml` and stop before
154
+ implementation.
155
+ - Do not use this skill for unclear or unreproduced issues. Route evidence
156
+ gathering to `strict-spec-brainstorm` instead of making a source-level fix
157
+ from code inspection alone.
158
+
159
+ 4. **Propose or resume a narrow change** — derive a short kebab-case change
160
+ name from the defect, usually starting with `fix-`. If the change does not
161
+ exist, run:
162
+ ```bash
163
+ strict-spec-cli propose <change-name>
164
+ ```
165
+ If a populated change already exists, resume it without regenerating
166
+ planning artifacts.
167
+
168
+ 5. **Populate bugfix planning artifacts** — for new or empty scaffolds, generate
169
+ supported artifacts in this order and keep every artifact scoped to the bug.
170
+ - `proposal.yaml`: state the observed bug, expected behavior, why the
171
+ current behavior violates a strict spec or intended contract, in-scope
172
+ affected paths, explicit out-of-scope adjacent issues, and unchanged
173
+ behavior.
174
+ - `design.yaml`: record the minimal fix strategy, why the fix belongs at the
175
+ selected layer, and any risk to unchanged behavior.
176
+ - `tasks.yaml`: use concrete sections for Reproduction, Implementation,
177
+ Testing, and Verification. Include a failing-regression-test or equivalent
178
+ deterministic reproduction task before the production fix. Testing tasks
179
+ must include runnable `command` fields. For technical-only bugfixes,
180
+ include the concrete scripts, tooling, generated assets, documentation, or
181
+ skill-prompt edits in scope; include validation, strict `ready`/`verify`,
182
+ and archive-readiness or archive-merge checks when relevant.
183
+ The reproduction task must come first in list order, so place a task with
184
+ `--before <task-id>` or `--after <task-id>` instead of letting it append;
185
+ task order is the order `apply` walks, so a task that must run before
186
+ existing pending work is anchored rather than appended, and naming an
187
+ existing task id with an anchor moves it there while preserving its
188
+ `status` and `command`.
189
+ - `questions.yaml`: resolve the seeded requirement questions through the
190
+ delegated requirement-interrogation procedure. Leave `open: []` only when
191
+ reproduction, scope, expected behavior, and regression validation are all
192
+ clear. Otherwise record the missing decision and stop before
193
+ implementation.
194
+ - delta specs: route them with the delegated spec-artifact-routing and
195
+ delta-artifact-authoring procedures, and prefer `MODIFIED` operations when
196
+ the bug corrects an existing requirement; use `ADDED` only when the
197
+ expected behavior is not already represented. Leave `specs/` empty only for
198
+ a purely internal defect with no observable spec impact.
199
+
200
+ 6. **Run the proposal checkpoint** — before implementation, semantically check
201
+ every generated or edited file under `.strict-spec-driven/changes/<change-name>/`
202
+ against the known bug, reproduction evidence, expected behavior, relevant
203
+ main specs, applicable technical standards, unchanged behavior, task
204
+ coverage, unresolved-question impact, delta spec scenarios, and delta tech
205
+ use when applicable. When no delta specs are appropriate, replace delta spec
206
+ scenario review with a justified absence check for the technical-only bugfix. For technical-only bugfixes, verify that
207
+ tasks cover reproduction evidence, scripts or tooling, validation commands,
208
+ `ready`/`verify`, and archive or archive-merge checks when archive behavior
209
+ is affected. The checkpoint should fix safe, in-scope
210
+ documentation gaps immediately. Do not expand scope or answer unresolved
211
+ human questions silently.
212
+
213
+ 7. **Validate readiness** — run:
214
+ ```bash
215
+ strict-spec-cli ready <change-name>
216
+ ```
217
+ If you use `verify` before implementation, treat pending-task diagnostics as
218
+ expected. If `questions.yaml.open` is not empty, explain each blocker,
219
+ recommend concrete answers or options with tradeoffs, and stop.
220
+
221
+ 8. **Implement the minimal fix** — follow the delegated implementation-order
222
+ procedure, and hold it to the bugfix's narrower bar:
223
+ - Create or confirm the failing regression evidence before production edits.
224
+ - Make the smallest production change that satisfies the expected behavior.
225
+ - Preserve every `proposal.yaml.unchanged_behavior` item.
226
+ - Do not opportunistically refactor, rename, reformat, or fix adjacent bugs
227
+ unless required for the target bugfix.
228
+
229
+ 9. **Run regression evidence** — complete every Testing task by running its
230
+ `command`. The targeted regression must fail before the fix and pass after
231
+ the fix. If the before/after evidence cannot be produced locally, leave the
232
+ implementation unstarted or unarchived and record the blocker instead of
233
+ claiming the bug is fixed. Then run the configured complete project-level
234
+ regression command from `.strict-spec-driven/config.yaml` before archive.
235
+ That evidence survives the lesson declaration in step 11: a write the
236
+ configured regression command neither compiles nor reads — currently a
237
+ change-local delta-tech artifact or a lesson — does not invalidate passing
238
+ complete project regression evidence. Any other write after it, including a
239
+ delta-spec, a planning artifact, or a source or test file, forces a rerun
240
+ before archive.
241
+
242
+ 10. **Verify and review before archive** — run:
243
+ ```bash
244
+ strict-spec-cli verify <change-name>
245
+ ```
246
+ When the running harness provides it, hand this review to
247
+ a sub-agent started with a fresh context, briefed with the change name and
248
+ this step rather than an account of the fix; it reads and reports,
249
+ edits no file, and you keep the fixes and reruns that follow.
250
+ This is a recommendation, not a requirement: without such a capability, or
251
+ when the operator prefers otherwise, review in the current context to the
252
+ same standard. The reviewer reads the
253
+ changed implementation, tests, strict artifacts, relevant main specs, and
254
+ tracked diff directly. Check correctness, spec alignment,
255
+ unchanged behavior, regression assertions, error handling, and technical
256
+ standard compliance. Automatically fix safe in-scope review findings and
257
+ rerun strict verification plus the configured complete regression command
258
+ after review-time changes. Do not call or rely on a `strict-spec-cli review` command.
259
+
260
+ 11. **Declare the lesson outcome (required)** — follow the delegated
261
+ lesson-outcome procedure before archiving. A defect that reached a fix is
262
+ direct evidence about why the existing tests and technical standards failed
263
+ to catch it, which is the reusable part of a bugfix, so the trigger to
264
+ record one is a gap that will let the next defect through too — a missing
265
+ test shape, a misleading error message, an invariant nothing enforces. A fix
266
+ for a plain typo teaches nothing and is declared "no lesson".
267
+
268
+ 12. **Archive only when clean** — archive only after strict verification,
269
+ direct review, targeted regression, and complete regression evidence pass:
270
+ ```bash
271
+ strict-spec-cli archive <change-name>
272
+ ```
273
+ Summarize the fixed bug, regression evidence, updated specs, archive
274
+ destination, and any follow-up that remains outside the bugfix scope.
275
+
276
+ ## Rules
277
+
278
+ - Use this skill for known bug fixes, not open-ended design or investigation.
279
+ - Reproduce before fixing; code inspection alone is not sufficient evidence to
280
+ modify production code.
281
+ - Use regression evidence that fails before the fix and passes after it.
282
+ - Keep the change narrow and preserve documented unchanged behavior.
283
+ - Do not implement adjacent fixes or refactors unless required for the target bug.
284
+ - Stop for explicit human input when reproduction, expected behavior, or scope is ambiguous.
285
+ - Archive only after strict verification, direct review, targeted regression, and complete project regression evidence pass.
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: strict-spec-design
3
+ description: Author or refresh the strict YAML design-system artifact from repository and design evidence, then render the generated DESIGN.md through the strict design CLI.
4
+ metadata:
5
+ skill_id: strict_spec_design
6
+ author: strict-spec-driven
7
+ type: agent_skill
8
+ version: 1.0.0
9
+ ---
10
+
11
+ You are helping the user author or refresh `.strict-spec-driven/design-system.yaml`
12
+ and render the generated design document from it.
13
+
14
+ `DESIGN.md` is a generated file. It is never hand-edited. It is rendered in the
15
+ design.md interchange format: YAML front matter carrying the machine-readable
16
+ design tokens, then a generated banner, then the canonical sections. Your job is
17
+ the design-system artifact; the CLI owns rendering, comparison, and validation.
18
+
19
+ The design-system artifact is optional. A project with no user interface — a
20
+ library, a backend service, a CLI — simply does not have one, and `init`
21
+ deliberately does not scaffold it. Do not create one to satisfy artifact shape.
22
+
23
+ ## This Skill's Commands
24
+
25
+ If you cannot remember the exact command used by this skill, look it up here
26
+ before running anything. Do not guess.
27
+
28
+ ```yaml
29
+ check-workflow-state: strict-spec-cli check-workflow-state
30
+ design-status: strict-spec-cli design-status
31
+ design-init: strict-spec-cli design-init
32
+ design-edit: strict-spec-cli design-edit [named semantic fields or removals]
33
+ design-generate: strict-spec-cli design-generate
34
+ design-check: strict-spec-cli design-generate --check
35
+ schema-show: strict-spec-cli schema-show design-system
36
+ sample-show: strict-spec-cli sample-show design-system
37
+ tech-status: strict-spec-cli tech-status
38
+ ```
39
+
40
+ ## CLI-Only YAML Authoring Protocol
41
+
42
+ Every mutation of repository-owned YAML in this skill goes through the strict
43
+ CLI. This skill writes `design-system-state`. Before the first mutation run
44
+ `strict-spec-cli yaml-authoring-protocol design-system-state`: that command
45
+ reports the ordered authoring steps, the owning command for each operation, and
46
+ the bundled schema and example keys with their cache-resolved paths, bound to
47
+ the artifact kind and current where a copy would go stale. Validate the result
48
+ with `strict-spec-cli design-status`.
49
+
50
+ **Stop rather than edit YAML directly.** When a required command, argument, or
51
+ artifact kind is unavailable, stop and report the missing capability. Editing
52
+ the YAML directly, writing a raw payload, or scripting around the CLI is never
53
+ an available fallback, and an unavailable command is a reason to stop rather
54
+ than a reason to improvise.
55
+
56
+ ## Preferred Human Language
57
+
58
+ Comply with `preferred_human_language` from `.strict-spec-driven/config.yaml` —
59
+ the user's common human language, not a programming language — for all
60
+ user-facing and generated operator-facing text, including generated design
61
+ prose, unless that file is absent or the active user message asks otherwise.
62
+
63
+ ## What Belongs in the Design-System Artifact
64
+
65
+ The strict workflow splits user interface work three ways. This artifact owns
66
+ exactly one of them.
67
+
68
+ - **This artifact — visual identity.** The design tokens the interface is built
69
+ from (`tokens.colors`, `tokens.typography`, `tokens.layout`,
70
+ `tokens.elevation`, `tokens.shapes`), the `components` that consume those
71
+ tokens, and the `guidance` that explains the identity.
72
+ - **Main spec requirements — observable UI behavior.** What is shown, what is
73
+ interactive, how state changes, and the loading, error, and empty conditions.
74
+ These belong in a strict main spec, not here.
75
+ - **`ui`-category technical standards — UI engineering rules.** Design-system
76
+ usage rules, styling conventions, accessibility baselines, and
77
+ internationalization. These belong in `.strict-spec-driven/tech/`, not here.
78
+
79
+ Pixel-level visual fidelity is governed by visual-regression snapshots. Reference
80
+ them from `components.<id>.mapping.snapshots` so `design-status` can report a
81
+ snapshot path that no longer exists; never inline pixel detail into the artifact.
82
+
83
+ Token groups are fixed by the schema, but the entries inside each group are
84
+ open: no schema decides what a project's palette or spacing scale is named. A
85
+ token group you do not declare is omitted from the rendered document rather than
86
+ rendered empty, so declare only what the project actually has.
87
+
88
+ ## Steps
89
+
90
+ Before any other step, run `strict-spec-cli check-workflow-state`. If
91
+ `.strict-spec-driven/` is missing, stop immediately and tell the user to run
92
+ `/strict-spec-init`. Do not run `init` from this skill.
93
+
94
+ 1. **Check workflow state** — run `strict-spec-cli check-workflow-state` first.
95
+
96
+ 2. **Read the current state** — run `strict-spec-cli design-status`. It reports
97
+ whether the artifact validates, how many token groups, tokens, and components
98
+ it declares, and which mapped implementation and snapshot paths no longer
99
+ exist. Treat reported mapping drift as work to do: a component mapped to a
100
+ deleted file is either a stale mapping or a component that no longer exists.
101
+ The command exits non-zero when the artifact is absent, which is the expected
102
+ state for a project that has no user interface.
103
+
104
+ 3. **Create the artifact when it is absent** — once the project is confirmed to
105
+ have a user interface, run `strict-spec-cli design-init`. It writes a
106
+ schema-valid skeleton with empty token and component collections so you edit a
107
+ valid artifact instead of composing one from nothing, and it reports an
108
+ existing artifact as skipped rather than overwriting it, so it is safe to run
109
+ before a refresh. `init` never creates this artifact, so this is the only way
110
+ to scaffold it.
111
+
112
+ 4. **Inspect the schema when the shape is unclear** — run
113
+ `strict-spec-cli schema-show design-system` and
114
+ `strict-spec-cli sample-show design-system`. Do not guess field names.
115
+
116
+ 5. **Gather evidence before writing** — derive tokens from what the interface
117
+ actually uses, not from an idealized palette: read the stylesheets, theme
118
+ files, component library configuration, and existing UI source. Run
119
+ `strict-spec-cli tech-status` and read any `ui`-category standard so the
120
+ identity you record is consistent with the rules that bind the code.
121
+
122
+ 6. **Write or update `.strict-spec-driven/design-system.yaml` through the CLI** — invoke `strict-spec-cli design-edit` once per identity, token, component, guidance, mapping, snapshot, or exact named removal. Never edit the YAML directly. Keep token and
123
+ component ids stable across edits: they are the anchors readers, diffs, and
124
+ component token references rely on. Preserve authoring order within a group,
125
+ because the renderer emits entries in document order. Reference tokens from
126
+ components by their dotted path, such as `colors.primary`, so a reader can
127
+ follow a component property back to the token that defines it.
128
+
129
+ 7. **Render the document** — run `strict-spec-cli design-generate`. It writes
130
+ `DESIGN.md` at the repository root, or the path given to `--output`.
131
+
132
+ 8. **Confirm the result** — run `strict-spec-cli design-status` again for a clean
133
+ validation and no mapping drift, then `strict-spec-cli design-generate --check`
134
+ to confirm the rendered document matches its source. Check mode exits non-zero
135
+ and names the stale source artifact when it does not.
136
+
137
+ ## Detecting Staleness Later
138
+
139
+ `strict-spec-cli design-generate --check` is the drift gate. It renders in
140
+ memory, compares against the file on disk, never writes, and exits non-zero when
141
+ the document is stale or absent, naming which source artifact changed. It is an
142
+ on-demand check: it is deliberately not wired into `verify`, `ready`, or
143
+ `archive`. A project that wants it run on a schedule instead declares a
144
+ `generated-doc-check` entry under `maintenance.checks` in
145
+ `.strict-spec-driven/config.yaml`, which reports a stale document as a
146
+ maintenance finding.
147
+
148
+ That check compares the document against the artifact. It cannot tell that the
149
+ artifact itself has fallen behind the interface code — that a component was
150
+ deleted or a palette retuned. Use `/strict-spec-design-sync` for that: it scans
151
+ the UI sources, reports the divergence, and reconciles the artifact after you
152
+ confirm each edit.
153
+
154
+ ## Rules
155
+
156
+ - Never hand-edit `DESIGN.md` or any file carrying the generated banner; change
157
+ the source artifact and re-render
158
+ - Never hand-edit `.strict-spec-driven/design-system.yaml`; use `design-edit` named fields and removals so unrelated entries are preserved and the full candidate validates before commit
159
+ - Never record observable UI behavior or UI engineering rules here; they belong
160
+ in main specs and `ui`-category technical standards respectively
161
+ - Keep token and component ids stable; renaming an id is a content change
162
+ readers see as a deletion plus an addition, and it silently breaks every
163
+ component token reference that points at it
164
+ - Map components to real repo-relative implementation and snapshot paths and fix
165
+ mapping drift rather than deleting the mapping to silence it
166
+ - Do not create a design-system artifact for a project with no user interface,
167
+ and do not invent tokens or components the interface does not have; ask the
168
+ user when the intended identity is genuinely ambiguous
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: strict-spec-design-sync
3
+ description: Scan user interface code and the strict YAML design-system artifact for drift, then synchronize the live artifact and re-render the generated design document after user confirmation.
4
+ metadata:
5
+ skill_id: strict_spec_design_sync
6
+ author: strict-spec-driven
7
+ type: agent_skill
8
+ version: 1.0.0
9
+ ---
10
+
11
+ You are helping the user synchronize `.strict-spec-driven/design-system.yaml` with
12
+ the visual identity the user interface code already implements.
13
+
14
+ `/strict-spec-design` authors the artifact from scratch. This skill is for
15
+ afterwards: components get added and deleted, palettes get retuned, spacing
16
+ scales get renamed, and the recorded identity silently stops matching the code.
17
+ `design-status` catches only one kind of drift — a mapped path that no longer
18
+ exists — because no script can tell that a hex value in a stylesheet has diverged
19
+ from `tokens.colors.primary`. That judgment is this skill's job.
20
+
21
+ ## This Skill's Commands
22
+
23
+ If you cannot remember the exact command used by this skill, look it up here
24
+ before running anything. Do not guess.
25
+
26
+ ```yaml
27
+ check-workflow-state: strict-spec-cli check-workflow-state
28
+ design-status: strict-spec-cli design-status
29
+ design-init: strict-spec-cli design-init
30
+ design-edit: strict-spec-cli design-edit [named semantic fields or removals]
31
+ design-generate: strict-spec-cli design-generate
32
+ design-check: strict-spec-cli design-generate --check
33
+ schema-show: strict-spec-cli schema-show design-system
34
+ tech-status: strict-spec-cli tech-status
35
+ ```
36
+
37
+ ## CLI-Only YAML Authoring Protocol
38
+
39
+ Every mutation of repository-owned YAML in this skill goes through the strict
40
+ CLI. This skill writes `design-system-state`. Before the first mutation run
41
+ `strict-spec-cli yaml-authoring-protocol design-system-state`: that command
42
+ reports the ordered authoring steps, the owning command for each operation, and
43
+ the bundled schema and example keys with their cache-resolved paths, bound to
44
+ the artifact kind and current where a copy would go stale. Validate the result
45
+ with `strict-spec-cli design-status`.
46
+
47
+ **Stop rather than edit YAML directly.** When a required command, argument, or
48
+ artifact kind is unavailable, stop and report the missing capability. Editing
49
+ the YAML directly, writing a raw payload, or scripting around the CLI is never
50
+ an available fallback, and an unavailable command is a reason to stop rather
51
+ than a reason to improvise.
52
+
53
+ ## Preferred Human Language
54
+
55
+ Comply with `preferred_human_language` from `.strict-spec-driven/config.yaml` —
56
+ the user's common human language, not a programming language — for all
57
+ user-facing and generated operator-facing text, including generated design
58
+ prose, unless that file is absent or the active user message asks otherwise.
59
+
60
+ ## Scope of This Skill
61
+
62
+ This skill synchronizes the live design-system artifact directly. It has no
63
+ active-change mode, unlike `/strict-tech-sync`:
64
+
65
+ - There is no delta-design artifact type and archive has no design-system merge
66
+ path, so a design-system edit is never carried inside a change.
67
+ - Do not invent a `delta-design` artifact to mirror delta tech.
68
+ - When the drift you find is really a change in **observable UI behavior**, it
69
+ belongs in a strict main spec, not here — stop and route it to
70
+ `/strict-spec-brainstorm` or `/strict-spec-propose`.
71
+ - When it is really a **UI engineering rule** (design-system usage, styling
72
+ conventions, accessibility baselines, internationalization), it belongs in a
73
+ `ui`-category technical standard — stop and route it to `/strict-tech-sync` or
74
+ `/strict-tech-edit`.
75
+
76
+ ## Steps
77
+
78
+ Before any other step, run `strict-spec-cli check-workflow-state`. If
79
+ `.strict-spec-driven/` is missing, stop immediately and tell the user to run
80
+ `/strict-spec-init`. Do not run `init` from this skill.
81
+
82
+ 1. **Check workflow state** — run `strict-spec-cli check-workflow-state` first.
83
+
84
+ 2. **Read the recorded identity** — run `strict-spec-cli design-status`. It
85
+ reports whether the artifact validates, how many token groups, tokens, and
86
+ components it declares, and which mapped implementation and snapshot paths no
87
+ longer exist. If it reports the artifact as absent, there is nothing to
88
+ synchronize: the project either has no user interface, or it needs
89
+ `strict-spec-cli design-init` and `/strict-spec-design` first. Say so and
90
+ stop rather than authoring an artifact from a sync run.
91
+
92
+ 3. **Choose the scan scope** — if the user already gave one, use it. Otherwise
93
+ ask whether to scan the whole interface or a narrower target such as one
94
+ component family, one theme, or one token group. Respect the answer; do not
95
+ widen a scoped scan into repository-wide maintenance.
96
+
97
+ 4. **Read repository evidence in that scope** — inspect the stylesheets, theme
98
+ and token files, design-system or component-library configuration, and the UI
99
+ sources that consume them. Run `strict-spec-cli tech-status` and read any
100
+ `ui`-category standard so the identity you record stays consistent with the
101
+ rules that bind the code. Use `strict-spec-cli schema-show design-system`
102
+ when a field's shape is unclear; do not guess field names.
103
+
104
+ 5. **Classify drift findings** — compare code evidence to the recorded artifact
105
+ and sort findings into:
106
+ - tokens and components already recorded accurately
107
+ - values the code uses that the artifact records differently
108
+ - tokens or components present in the code but missing from the artifact
109
+ - tokens or components recorded in the artifact that the code no longer has
110
+ - mapped implementation or snapshot paths that no longer resolve
111
+ - inconsistent areas where the team must pick one value before it can be
112
+ recorded (needs human input)
113
+ - findings that belong in a main spec or a `ui` standard instead of here
114
+ - areas in scope with no meaningful drift
115
+
116
+ 6. **Report the drift summary in chat** — cover the scope analyzed, each
117
+ confirmed divergence with its file reference and the current versus recorded
118
+ value, the inconsistencies that need a decision, the findings routed
119
+ elsewhere, and the areas that were clean. Do not write a report file.
120
+
121
+ 7. **Get user confirmation** — before editing the artifact, ask the user to
122
+ confirm each proposed edit: the target token or component id, the operation,
123
+ and the exact value to record. Do not proceed on a plausible guess. A value
124
+ that appears inconsistently across the code is a decision for the user, not a
125
+ majority vote for you to take.
126
+
127
+ 8. **Write confirmed findings to the live artifact** — translate every confirmed finding into a named `strict-spec-cli design-edit` upsert or exact removal. Never edit `.strict-spec-driven/design-system.yaml` directly:
128
+ - keep token and component ids stable; renaming an id reads to a reader as a
129
+ deletion plus an addition and breaks every component token reference that
130
+ points at it
131
+ - preserve authoring order within a group, because the renderer emits entries
132
+ in document order
133
+ - reference tokens from components by their dotted path, such as
134
+ `colors.primary`
135
+ - fix mapping drift by correcting the path or removing the component that no
136
+ longer exists — never delete a mapping merely to silence the report
137
+
138
+ 9. **Re-render and confirm** — run `strict-spec-cli design-generate` to
139
+ re-render the design document, then `strict-spec-cli design-status` for clean
140
+ validation and no mapping drift, then
141
+ `strict-spec-cli design-generate --check` to confirm the rendered document
142
+ matches its source.
143
+
144
+ 10. **Report final changes** — summarize which tokens, components, guidance
145
+ entries, and mappings changed, that the design document was re-rendered, and
146
+ any inconsistency left unresolved and why.
147
+
148
+ ## Rules
149
+
150
+ - Do not change product code; synchronize only the strict design-system artifact
151
+ and re-render the document it feeds
152
+ - Never hand-edit `DESIGN.md` or any file carrying the generated banner; change
153
+ the artifact and re-render
154
+ - Never hand-edit `.strict-spec-driven/design-system.yaml`; synchronize it only through `design-edit` named fields and removals
155
+ - Read the recorded identity and the applicable `ui` standards before judging
156
+ that any drift exists
157
+ - Respect the user-selected scan scope
158
+ - Get explicit user confirmation before every artifact edit, and never guess a
159
+ token value the code reports inconsistently
160
+ - Do not create a strict change, a delta-design artifact, or a design-system
161
+ artifact from this skill; route behavior changes to main specs and engineering
162
+ rules to `ui`-category standards
163
+ - Do not write a standalone report file; the drift summary belongs in chat
164
+ - Keep component links in `mapping.implementation` and `mapping.snapshots`, not
165
+ in guidance prose