codeforge-dev 1.8.0 → 1.10.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 (55) hide show
  1. package/.devcontainer/.env +3 -0
  2. package/.devcontainer/CHANGELOG.md +107 -0
  3. package/.devcontainer/CLAUDE.md +30 -9
  4. package/.devcontainer/README.md +61 -2
  5. package/.devcontainer/config/defaults/main-system-prompt.md +162 -128
  6. package/.devcontainer/config/defaults/rules/spec-workflow.md +75 -0
  7. package/.devcontainer/config/defaults/rules/workspace-scope.md +7 -0
  8. package/.devcontainer/config/defaults/settings.json +63 -66
  9. package/.devcontainer/config/file-manifest.json +30 -18
  10. package/.devcontainer/connect-external-terminal.sh +17 -17
  11. package/.devcontainer/devcontainer.json +143 -144
  12. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +104 -97
  13. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/.claude-plugin/plugin.json +7 -0
  14. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/README.md +158 -0
  15. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/hooks/hooks.json +39 -0
  16. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/collect-edited-files.py +47 -0
  17. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/format-on-stop.py +297 -0
  18. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/lint-file.py +536 -0
  19. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/syntax-validator.py +146 -0
  20. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +81 -4
  21. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +18 -0
  22. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +18 -0
  23. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +89 -4
  24. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +18 -0
  25. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +142 -8
  26. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +18 -0
  27. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +108 -1
  28. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +24 -0
  29. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +97 -1
  30. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +33 -1
  31. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +24 -0
  32. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +50 -12
  33. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +96 -1
  34. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +100 -95
  35. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +186 -13
  36. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/spec-reminder.py +122 -0
  37. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +1 -1
  38. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-check/SKILL.md +98 -0
  39. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/SKILL.md +99 -0
  40. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/backlog-template.md +23 -0
  41. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/roadmap-template.md +33 -0
  42. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/SKILL.md +110 -0
  43. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/references/template.md +129 -0
  44. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-refine/SKILL.md +194 -0
  45. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-update/SKILL.md +142 -0
  46. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +19 -12
  47. package/.devcontainer/scripts/check-setup.sh +24 -25
  48. package/.devcontainer/scripts/setup-aliases.sh +88 -76
  49. package/.devcontainer/scripts/setup-config.sh +86 -83
  50. package/.devcontainer/scripts/setup-projects.sh +172 -131
  51. package/.devcontainer/scripts/setup-terminal.sh +48 -0
  52. package/.devcontainer/scripts/setup-update-claude.sh +49 -107
  53. package/.devcontainer/scripts/setup.sh +4 -17
  54. package/README.md +2 -2
  55. package/package.json +42 -42
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: spec-check
3
+ description: >-
4
+ This skill should be used when the user asks to "check spec status",
5
+ "audit specs", "which specs are stale", "spec health", "find missing
6
+ specs", "review spec quality", or needs a comprehensive audit of all
7
+ specifications in the project.
8
+ version: 0.1.0
9
+ context: fork
10
+ agent: explorer
11
+ ---
12
+
13
+ # Spec Health Audit
14
+
15
+ Audit all specifications in the current project and report their health status.
16
+
17
+ ## Workflow
18
+
19
+ ### Step 1: Discover Specs
20
+
21
+ ```
22
+ Glob: .specs/**/*.md
23
+ ```
24
+
25
+ If `.specs/` does not exist, report: "No specification directory found. Use `/spec-new` to create your first spec."
26
+
27
+ Exclude non-spec files:
28
+ - `ROADMAP.md`
29
+ - `BACKLOG.md`
30
+ - `LESSONS_LEARNED.md`
31
+ - Files in `archive/`
32
+ - `_overview.md` files (report them separately as parent specs)
33
+
34
+ ### Step 2: Read Each Spec
35
+
36
+ For each spec file, extract:
37
+ - **Feature name** from the `# Feature: [Name]` header
38
+ - **Version** from the `**Version:**` field
39
+ - **Status** from the `**Status:**` field
40
+ - **Last Updated** from the `**Last Updated:**` field
41
+ - **Approval** from the `**Approval:**` field (default `draft` if missing)
42
+ - **Line count** (wc -l)
43
+ - **Sections present** — check for each required section header
44
+ - **Acceptance criteria** — count total, count checked `[x]`
45
+ - **Requirements** — count total, count `[assumed]`, count `[user-approved]`
46
+ - **Discrepancies** — check if section has content
47
+
48
+ ### Step 3: Flag Issues
49
+
50
+ For each spec, check these conditions:
51
+
52
+ | Issue | Condition | Severity |
53
+ |-------|-----------|----------|
54
+ | **Unapproved** | Approval is `draft` or missing | High |
55
+ | **Assumed requirements** | Has requirements tagged `[assumed]` | Medium |
56
+ | **Stale** | Status is `planned` but Last Updated is >30 days ago | High |
57
+ | **Incomplete** | Missing required sections (Intent, Acceptance Criteria, Key Files, Requirements, Out of Scope) | High |
58
+ | **Long spec** | Exceeds ~200 lines — consider splitting | Info |
59
+ | **No criteria** | Acceptance Criteria section is empty or has no checkboxes | High |
60
+ | **Open discrepancies** | Discrepancies section has content | Medium |
61
+ | **Missing as-built** | Status is `implemented` but Implementation Notes is empty | Medium |
62
+ | **Stale paths** | Key Files references paths that don't exist | Low |
63
+ | **Draft + implemented** | Status is `implemented` but Approval is `draft` — approval gate was bypassed | High |
64
+ | **Inconsistent approval** | Approval is `user-approved` but spec has `[assumed]` requirements | High |
65
+
66
+ ### Step 4: Report
67
+
68
+ Output a summary table:
69
+
70
+ ```
71
+ ## Spec Health Report
72
+
73
+ | Feature | Version | Status | Approval | Updated | Lines | Issues |
74
+ |---------|---------|--------|----------|---------|-------|--------|
75
+ | Session History | v0.2.0 | implemented | user-approved | 2026-02-08 | 74 | None |
76
+ | Auth Flow | v0.3.0 | planned | draft | 2026-01-15 | 45 | Unapproved, Stale (26 days) |
77
+ | Settings Page | v0.2.0 | partial | draft | 2026-02-05 | 210 | Unapproved, Long spec |
78
+
79
+ ## Issues Found
80
+
81
+ ### High Priority
82
+ - **Auth Flow** (`.specs/v0.3.0/auth-flow.md`): Status is `planned` but last updated 26 days ago. Either implementation is stalled or the spec needs an as-built update.
83
+
84
+ ### Medium Priority
85
+ - **Settings Page** (`.specs/v0.2.0/settings-page.md`): 210 lines — consider splitting into sub-specs for easier consumption.
86
+
87
+ ### Suggested Actions
88
+ 1. Run `/spec-refine auth-flow` to validate assumptions and get user approval
89
+ 2. Run `/spec-update auth-flow` to update the auth flow spec
90
+ 3. Split settings-page.md into sub-specs
91
+
92
+ ### Approval Summary
93
+ - **User-approved:** 1 spec
94
+ - **Draft (needs /spec-refine):** 2 specs
95
+ - **Assumed requirements across all specs:** 8
96
+ ```
97
+
98
+ If no issues are found, report: "All specs healthy. N specs across M versions. All user-approved."
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: spec-init
3
+ description: >-
4
+ This skill should be used when the user asks to "initialize specs",
5
+ "set up specs", "bootstrap specs", "start using specs", "create spec
6
+ directory", "init specs for this project", or needs to set up the
7
+ .specs/ directory structure for a project that doesn't have one yet.
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # Initialize Specification Directory
12
+
13
+ ## Mental Model
14
+
15
+ Before any spec can be created, the project needs a `.specs/` directory with its supporting files: a ROADMAP (what each version delivers) and a BACKLOG (deferred items). This skill bootstraps that structure so `/spec-new` has a home.
16
+
17
+ ---
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Check Existing State
22
+
23
+ ```
24
+ Glob: .specs/**/*.md
25
+ ```
26
+
27
+ **If `.specs/` already exists:**
28
+ - Report current state: how many specs, versions, whether ROADMAP.md and BACKLOG.md exist
29
+ - Suggest `/spec-check` to audit health instead
30
+ - Do NOT recreate or overwrite anything
31
+ - Stop here
32
+
33
+ **If `.specs/` does not exist:** proceed to Step 2.
34
+
35
+ ### Step 2: Create Directory Structure
36
+
37
+ Create the `.specs/` directory at the project root.
38
+
39
+ ### Step 3: Create ROADMAP.md
40
+
41
+ Write `.specs/ROADMAP.md` using the template from `references/roadmap-template.md`.
42
+
43
+ ### Step 4: Create BACKLOG.md
44
+
45
+ Write `.specs/BACKLOG.md` using the template from `references/backlog-template.md`.
46
+
47
+ ### Step 5: Retroactive Documentation
48
+
49
+ Ask the user:
50
+
51
+ > "Are there existing features in this project that should be documented retroactively? I can help create specs for them using `/spec-new`."
52
+
53
+ If yes, guide the user through creating a spec for each feature using `/spec-new`.
54
+
55
+ If no, proceed to Step 6.
56
+
57
+ ### Step 6: Report
58
+
59
+ Summarize what was created:
60
+
61
+ ```
62
+ ## Spec Directory Initialized
63
+
64
+ Created:
65
+ - `.specs/` directory
66
+ - `.specs/ROADMAP.md` — version tracking table
67
+ - `.specs/BACKLOG.md` — deferred items list
68
+
69
+ Next steps:
70
+ - Add features to `BACKLOG.md` with priority grades (P0–P3)
71
+ - Pull features into a version in `ROADMAP.md` when ready to scope
72
+ - Use `/spec-new <feature-name> <version>` to create a spec
73
+ - Use `/spec-refine <feature-name>` to validate before implementation
74
+ - After implementing, use `/spec-update` to close the loop
75
+ - Use `/spec-check` to audit spec health at any time
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Constraints
81
+
82
+ - **Never overwrite** an existing `.specs/` directory or its contents.
83
+ - Templates are starting points — the user will extend them as the project grows.
84
+
85
+ ---
86
+
87
+ ## Ambiguity Policy
88
+
89
+ - If the user runs this in a workspace root with multiple projects, ask which project to initialize.
90
+ - If `.specs/` exists but is missing ROADMAP.md or BACKLOG.md, offer to create only the missing files.
91
+
92
+ ---
93
+
94
+ ## Reference Files
95
+
96
+ | File | Contents |
97
+ |------|----------|
98
+ | `references/roadmap-template.md` | Starter ROADMAP with version table format |
99
+ | `references/backlog-template.md` | Starter BACKLOG with item format |
@@ -0,0 +1,23 @@
1
+ # Backlog
2
+
3
+ Priority-graded feature and infrastructure backlog. Items are pulled into versions when ready to scope and spec. See `ROADMAP.md` for the versioning workflow.
4
+
5
+ ## P0 — High Priority
6
+
7
+ - [ ] [Feature] — [Description]
8
+
9
+ ## P1 — Important
10
+
11
+ - [ ] [Feature] — [Description]
12
+
13
+ ## P2 — Desired
14
+
15
+ - [ ] [Feature] — [Description]
16
+
17
+ ## P3 — Nice to Have
18
+
19
+ - [ ] [Feature] — [Description]
20
+
21
+ ## Infrastructure & CI
22
+
23
+ - [ ] [Item] — [Description]
@@ -0,0 +1,33 @@
1
+ # Roadmap
2
+
3
+ > Features live in the priority-graded backlog until pulled into a version.
4
+ > Versions are scoped and spec'd when ready to build — not pre-assigned.
5
+ > See `BACKLOG.md` for the feature backlog.
6
+
7
+ ## How Versioning Works
8
+
9
+ 1. **Backlog** — All desired features live in `BACKLOG.md`, graded by priority.
10
+ 2. **Version scoping** — When ready to start a new version, pull features from the backlog.
11
+ 3. **Spec first** — Each feature in a version gets a spec before implementation begins.
12
+ 4. **Ship** — Version is done when all its specs are implemented and verified.
13
+
14
+ Only the **next version** is defined in detail. Everything else is backlog.
15
+
16
+ ## Released
17
+
18
+ _None yet._
19
+
20
+ ## Current
21
+
22
+ ### v0.1.0 — [Name] 🔧
23
+
24
+ - [ ] [Feature pulled from backlog]
25
+ - [ ] [Feature pulled from backlog]
26
+
27
+ ## Next
28
+
29
+ > Scoped from `BACKLOG.md` when current version is complete.
30
+
31
+ ## Out of Scope
32
+
33
+ - [Items explicitly not planned]
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: spec-new
3
+ description: >-
4
+ This skill should be used when the user asks to "create a spec",
5
+ "new feature spec", "write a spec for", "spec this feature",
6
+ "start a new spec", "plan a feature", or needs to create a new
7
+ specification file from the standard template.
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # Create New Feature Specification
12
+
13
+ ## Mental Model
14
+
15
+ A specification is a contract between the person requesting a feature and the person building it. Writing the spec BEFORE implementation forces you to think through edge cases, acceptance criteria, and scope boundaries while changes are cheap — before any code exists.
16
+
17
+ Every project uses `.specs/` as the specification directory. Specs are version-organized, independently loadable, and should aim for ~200 lines.
18
+
19
+ ---
20
+
21
+ ## Workflow
22
+
23
+ ### Step 1: Parse Arguments
24
+
25
+ Extract the feature name and version from `$ARGUMENTS`:
26
+ - **Feature name**: kebab-case identifier (e.g., `session-history`, `auth-flow`)
27
+ - **Version**: semver string (e.g., `v0.3.0`)
28
+
29
+ If arguments are missing, ask the user for:
30
+ 1. Feature name (what is being built)
31
+ 2. Target version (which release this belongs to)
32
+
33
+ **Note:** Features should be pulled from the project's backlog (`BACKLOG.md`) into a version before creating a spec. If the feature isn't in the backlog yet, add it first, then assign it to a version.
34
+
35
+ ### Step 2: Determine File Path
36
+
37
+ - **Multi-feature version** (directory already exists or multiple features planned):
38
+ `.specs/{version}/{feature-name}.md`
39
+ - **Single-feature version** (one spec covers the whole version):
40
+ `.specs/{version}.md`
41
+
42
+ If `.specs/` does not exist at the project root, create it.
43
+
44
+ If `.specs/{version}/` does not exist and you're using the directory form, create it.
45
+
46
+ ### Step 3: Create the Spec File
47
+
48
+ Write the file using the standard template from `references/template.md`.
49
+
50
+ Pre-fill:
51
+ - **Version**: from arguments
52
+ - **Status**: `planned`
53
+ - **Last Updated**: today's date (YYYY-MM-DD)
54
+ - **Approval**: `draft`
55
+ - **Feature name**: from arguments
56
+
57
+ Leave all other sections as placeholders for the user to fill.
58
+
59
+ ### Step 4: Guide Content Creation
60
+
61
+ After creating the file, guide the user through filling it out:
62
+
63
+ 1. **Intent** — What problem does this solve? Who has this problem? (2-3 sentences)
64
+ 2. **Acceptance Criteria** — Use the `specification-writing` skill for EARS format and Given/When/Then patterns
65
+ 3. **Key Files** — Glob the codebase to identify existing files relevant to this feature
66
+ 4. **Schema / Data Model** — Reference file paths only, never inline schemas
67
+ 5. **API Endpoints** — Table format: Method | Path | Description
68
+ 6. **Requirements** — EARS format, numbered FR-1, FR-2, NFR-1, etc. Tag all requirements `[assumed]` at creation time — they become `[user-approved]` only after explicit user validation via `/spec-refine`.
69
+ 7. **Dependencies** — What this feature depends on
70
+ 8. **Out of Scope** — Explicit non-goals to prevent scope creep
71
+ 9. **Resolved Questions** — Leave empty at creation; populated by `/spec-refine`
72
+
73
+ ### Step 5: Validate
74
+
75
+ Before finishing:
76
+ - [ ] If the file exceeds ~200 lines, consider splitting into sub-specs
77
+ - [ ] No source code, SQL, or type definitions reproduced inline
78
+ - [ ] Status is `planned` and Approval is `draft`
79
+ - [ ] All required sections present (even if some are "N/A" or "TBD")
80
+ - [ ] Acceptance criteria are testable
81
+ - [ ] All requirements are tagged `[assumed]`
82
+
83
+ After validation, inform the user: **"This spec MUST go through `/spec-refine` before implementation begins.** All requirements are marked `[assumed]` until explicitly validated."
84
+
85
+ The `/spec-refine` skill walks through every `[assumed]` requirement with the user, validates tech decisions and scope boundaries, and upgrades approved items to `[user-approved]`. The spec's `**Approval:**` becomes `user-approved` only after all requirements pass review.
86
+
87
+ ---
88
+
89
+ ## Sizing Guidelines
90
+
91
+ - **Aim for ~200 lines per spec.** If a feature needs more, consider splitting into sub-specs with a parent `_overview.md` linking them.
92
+ - **Reference, don't reproduce.** Write `see src/engine/db/migrations/002.sql lines 48-70` — never paste the SQL.
93
+ - **Independently loadable.** Each spec file must be useful without loading any other file.
94
+ - **EARS format for requirements.** Use the `specification-writing` skill for templates and examples.
95
+
96
+ ---
97
+
98
+ ## Ambiguity Policy
99
+
100
+ - If the user doesn't specify a version, ask — do not assume.
101
+ - If the feature scope is unclear, write a minimal spec with `## Open Questions` listing what needs clarification.
102
+ - If a spec already exists for this feature, inform the user and suggest `/spec-update` instead.
103
+
104
+ ---
105
+
106
+ ## Reference Files
107
+
108
+ | File | Contents |
109
+ |------|----------|
110
+ | `references/template.md` | Full standard template with field descriptions and examples |
@@ -0,0 +1,129 @@
1
+ # Specification Template
2
+
3
+ Standard template for all feature specifications. Copy this structure when creating a new spec.
4
+
5
+ ---
6
+
7
+ ## Template
8
+
9
+ ```markdown
10
+ # Feature: [Name]
11
+
12
+ **Version:** v0.X.0
13
+ **Status:** planned
14
+ **Last Updated:** YYYY-MM-DD
15
+ **Approval:** draft
16
+
17
+ ## Intent
18
+
19
+ [What problem does this solve? Who has this problem? What's the cost of not solving it? 2-3 sentences.]
20
+
21
+ ## Acceptance Criteria
22
+
23
+ [Testable criteria. Use Given/When/Then for complex flows, checklists for simple features, or tables for business rules. Every criterion must be verifiable.]
24
+
25
+ - [ ] [Criterion 1]
26
+ - [ ] [Criterion 2]
27
+ - [ ] [Criterion 3]
28
+
29
+ ## Key Files
30
+
31
+ [File paths most relevant to implementation — paths an implementer should read first.]
32
+
33
+ **Backend:**
34
+ - `src/path/to/file.py` — [brief description]
35
+
36
+ **Frontend:**
37
+ - `src/web/path/to/component.svelte` — [brief description]
38
+
39
+ **Tests:**
40
+ - `tests/path/to/test_file.py` — [brief description]
41
+
42
+ ## Schema / Data Model
43
+
44
+ [Reference migration files and model files by path. Describe what changes — do NOT paste DDL, Pydantic models, or TypeScript interfaces.]
45
+
46
+ - New table: `table_name` — see `src/db/migrations/NNN.sql`
47
+ - Modified: `existing_table` — added `column_name` column
48
+
49
+ ## API Endpoints
50
+
51
+ | Method | Path | Description |
52
+ |--------|------|-------------|
53
+ | GET | `/api/resource` | List resources with pagination |
54
+ | POST | `/api/resource` | Create a new resource |
55
+
56
+ ## Requirements
57
+
58
+ ### Functional Requirements
59
+
60
+ - FR-1 [assumed]: [EARS format requirement — see specification-writing skill for templates]
61
+ - FR-2 [assumed]: When [event], the system shall [action].
62
+ - FR-3 [assumed]: If [unwanted condition], then the system shall [action].
63
+
64
+ ### Non-Functional Requirements
65
+
66
+ - NFR-1 [assumed]: The system shall respond to [endpoint] within [N]ms at the [percentile] percentile.
67
+ - NFR-2 [assumed]: [Security, accessibility, scalability requirement]
68
+
69
+ ## Dependencies
70
+
71
+ - [External system, library, or feature this depends on]
72
+ - [Blocked by: feature X must ship first]
73
+
74
+ ## Out of Scope
75
+
76
+ - [Explicit non-goal 1 — prevents scope creep]
77
+ - [Explicit non-goal 2]
78
+
79
+ ## Resolved Questions
80
+
81
+ [Decisions explicitly approved by the user via `/spec-refine`. Each entry: decision topic, chosen option, date, brief rationale.]
82
+
83
+ ## Implementation Notes
84
+
85
+ [Post-implementation only. Leave empty in planned specs. After building, document what actually shipped vs. what was planned.]
86
+
87
+ ## Discrepancies
88
+
89
+ [Post-implementation only. Document gaps between spec intent and actual build. Prevents next session from re-planning decided work.]
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Field Descriptions
95
+
96
+ | Section | Required | When to Fill |
97
+ |---------|----------|-------------|
98
+ | Intent | Always | At creation |
99
+ | Acceptance Criteria | Always | At creation |
100
+ | Key Files | Always | At creation (update post-implementation) |
101
+ | Schema / Data Model | If applicable | At creation |
102
+ | API Endpoints | If applicable | At creation |
103
+ | Requirements | Always | At creation |
104
+ | Dependencies | If applicable | At creation |
105
+ | Out of Scope | Always | At creation |
106
+ | Implementation Notes | Post-implementation | After building |
107
+ | Discrepancies | Post-implementation | After building |
108
+
109
+ ## Status Values
110
+
111
+ | Status | Meaning |
112
+ |--------|---------|
113
+ | `planned` | Spec written, implementation not started |
114
+ | `partial` | Some acceptance criteria implemented, work ongoing |
115
+ | `implemented` | All acceptance criteria met, as-built notes complete |
116
+
117
+ ## Approval Workflow
118
+
119
+ | Tag | Meaning |
120
+ |-----|---------|
121
+ | `[assumed]` | Requirement was drafted by AI or inferred — treated as a hypothesis |
122
+ | `[user-approved]` | Requirement was explicitly reviewed and approved by the user via `/spec-refine` |
123
+
124
+ | Approval Status | Meaning |
125
+ |-----------------|---------|
126
+ | `draft` | Spec has unvalidated assumptions — NOT approved for implementation |
127
+ | `user-approved` | All requirements are `[user-approved]` — ready for implementation |
128
+
129
+ **Workflow:** `/spec-new` creates → `/spec-refine` validates → implementation begins → `/spec-update` closes the loop.
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: spec-refine
3
+ description: >-
4
+ This skill should be used when the user asks to "refine a spec",
5
+ "review spec assumptions", "validate spec decisions", "question the
6
+ spec", "iterate on the spec", "check spec for assumptions", "approve
7
+ the spec", "walk me through the spec", or needs iterative
8
+ user-driven refinement of a specification through structured
9
+ questioning rounds.
10
+ version: 0.1.0
11
+ ---
12
+
13
+ # Iterative Spec Refinement
14
+
15
+ ## Mental Model
16
+
17
+ A draft spec is a hypothesis, not a commitment. Every requirement, tech decision, and scope boundary in a draft is an assumption until the user explicitly validates it. This skill systematically mines a spec for unvalidated assumptions, presents each to the user for review via structured questions, and iterates until every decision has explicit user approval.
18
+
19
+ No implementation begins on a spec with `**Approval:** draft`. This skill is the gate.
20
+
21
+ ---
22
+
23
+ ## Workflow
24
+
25
+ ### Step 1: Load & Inventory
26
+
27
+ Find the target spec:
28
+ - If `$ARGUMENTS` contains a path or feature name, use it directly
29
+ - Otherwise, glob `.specs/**/*.md` and ask the user which spec to refine
30
+
31
+ Read the full spec. Catalog:
32
+ - Every section and whether it has content
33
+ - The `**Approval:**` status (should be `draft`)
34
+ - All requirements and their current markers (`[assumed]` vs `[user-approved]`)
35
+ - The `## Open Questions` section (if any)
36
+ - The `## Resolved Questions` section (if any)
37
+
38
+ If the spec is already `**Approval:** user-approved` and all requirements are `[user-approved]`, report this and ask if the user wants to re-review anyway.
39
+
40
+ ### Step 2: Assumption Mining
41
+
42
+ Scan each section systematically for unvalidated decisions. Look for:
43
+
44
+ | Category | What to look for |
45
+ |----------|-----------------|
46
+ | **Tech decisions** | Database choices, auth mechanisms, API formats, libraries, protocols |
47
+ | **Scope boundaries** | What's included/excluded without stated rationale |
48
+ | **Performance targets** | Numbers (response times, limits, thresholds) that were assumed |
49
+ | **Architecture choices** | Where logic lives, service boundaries, data flow patterns |
50
+ | **Behavioral defaults** | Error handling, retry logic, fallback behavior, timeout values |
51
+ | **Unstated dependencies** | Systems, services, or libraries the spec assumes exist |
52
+ | **Security assumptions** | Auth requirements, data sensitivity, access control patterns |
53
+
54
+ For each assumption found, prepare a question with 2-4 alternatives including the current assumption.
55
+
56
+ Present findings via `AskUserQuestion` in rounds of 1-4 questions. Group related assumptions together. Example:
57
+
58
+ ```
59
+ Question: "Which authentication mechanism should this feature use?"
60
+ Options:
61
+ - JWT with refresh tokens (current assumption)
62
+ - Session cookies with httpOnly flag
63
+ - OAuth2 with external provider
64
+ ```
65
+
66
+ Record each answer. After the user responds, check: did any answer reveal new assumptions or contradictions? If yes, add follow-up questions to the queue.
67
+
68
+ ### Step 3: Requirement Validation
69
+
70
+ Walk through every requirement tagged `[assumed]`:
71
+
72
+ 1. **Read the requirement** aloud to the user (via the question text)
73
+ 2. **Assess** — is it specific? testable? complete?
74
+ 3. **Present via AskUserQuestion** with options:
75
+ - Approve as-is
76
+ - Needs revision (user provides direction via "Other")
77
+ - Remove (not needed)
78
+ - Defer to Open Questions (not decidable yet)
79
+
80
+ Process requirements in batches of 1-4 per question round. Prioritize:
81
+ - Requirements with the most ambiguity first
82
+ - Requirements that other requirements depend on
83
+ - Requirements involving tech decisions or external systems
84
+
85
+ For approved requirements, update the marker from `[assumed]` to `[user-approved]`.
86
+ For revised requirements, rewrite per user direction and mark `[user-approved]`.
87
+ For removed requirements, delete them.
88
+ For deferred requirements, move to `## Open Questions`.
89
+
90
+ ### Step 4: Acceptance Criteria Review
91
+
92
+ For each acceptance criterion:
93
+ 1. Is it measurable and testable?
94
+ 2. Does it map to a specific requirement?
95
+ 3. Are there requirements without corresponding criteria?
96
+
97
+ Present gaps to the user:
98
+ - Missing criteria for existing requirements
99
+ - Criteria that don't map to any requirement
100
+ - Criteria with vague or unmeasurable outcomes
101
+
102
+ Get approval on each criterion or batch of related criteria.
103
+
104
+ ### Step 5: Scope & Dependency Audit
105
+
106
+ Review the spec from four perspectives:
107
+
108
+ **User perspective:**
109
+ - Does the feature solve the stated problem?
110
+ - Are there user needs not addressed?
111
+ - Is the scope too broad or too narrow?
112
+
113
+ **Developer perspective:**
114
+ - Is this implementable with the current architecture?
115
+ - Are the key files accurate?
116
+ - Are there missing technical constraints?
117
+
118
+ **Security perspective:**
119
+ - Are there data sensitivity issues?
120
+ - Is authentication/authorization addressed?
121
+ - Are there input validation gaps?
122
+
123
+ **Operations perspective:**
124
+ - Deployment considerations?
125
+ - Monitoring and observability needs?
126
+ - Rollback strategy needed?
127
+
128
+ Surface any missing items via `AskUserQuestion`. Get explicit decisions on scope boundaries and dependency completeness.
129
+
130
+ ### Step 6: Final Approval
131
+
132
+ 1. Present a summary of all changes made during refinement:
133
+ - Assumptions resolved (count)
134
+ - Requirements approved/revised/removed
135
+ - New criteria added
136
+ - Scope changes
137
+
138
+ 2. Ask for final approval via `AskUserQuestion`:
139
+ - "Approve spec — all decisions validated, ready for implementation"
140
+ - "More refinement needed — specific concerns remain"
141
+
142
+ 3. On approval:
143
+ - Set `**Approval:** user-approved`
144
+ - Update `**Last Updated:**` to today
145
+ - Verify all requirements are tagged `[user-approved]`
146
+ - Populate `## Resolved Questions` with the decision trail from this session
147
+
148
+ 4. On "more refinement needed":
149
+ - Ask what concerns remain
150
+ - Loop back to the relevant phase
151
+
152
+ ---
153
+
154
+ ## Convergence Rules
155
+
156
+ - After each phase, check: did answers from this phase raise new questions? If yes, run another questioning round before advancing.
157
+ - The skill does NOT terminate until ALL of:
158
+ - Every `[assumed]` requirement is resolved (approved, revised, removed, or deferred)
159
+ - All acceptance criteria are reviewed
160
+ - The user gives explicit final approval
161
+ - If the user wants to stop early, leave `**Approval:** draft` and note remaining items in `## Open Questions`.
162
+
163
+ ---
164
+
165
+ ## Resolved Questions Format
166
+
167
+ Each resolved question follows this format:
168
+
169
+ ```markdown
170
+ 1. **[Decision topic]** — [Chosen option] (user-approved, YYYY-MM-DD)
171
+ - Options considered: [list]
172
+ - Rationale: [brief user reasoning or context]
173
+ ```
174
+
175
+ Keep entries concise — decision + options + rationale in 2-3 lines each.
176
+
177
+ ---
178
+
179
+ ## Ambiguity Policy
180
+
181
+ - If the spec has no `**Approval:**` field, treat it as `draft` and add the field.
182
+ - If requirements lack `[assumed]`/`[user-approved]` tags, treat all as `[assumed]`.
183
+ - If the user says "approve everything" without reviewing individual items, warn that blanket approval defeats the purpose — offer to fast-track by presenting summaries of each batch.
184
+ - If the spec is very short (< 30 lines), the full 6-phase process may be unnecessary. Adapt: merge phases 2-4 into a single review pass. Still require explicit final approval.
185
+ - If the user provides a feature name that matches multiple specs, list them and ask which to refine.
186
+
187
+ ---
188
+
189
+ ## Anti-Patterns
190
+
191
+ - **Rubber-stamping**: Presenting assumptions and immediately suggesting "approve all." Every assumption gets its own question with real alternatives.
192
+ - **Leading questions**: "Should we use JWT as planned?" is leading. Present alternatives neutrally: "Which auth mechanism should this feature use? Options: JWT, sessions, OAuth2."
193
+ - **Skipping phases**: Every phase surfaces different types of assumptions. Don't skip phases even if earlier phases had few findings.
194
+ - **Silent upgrades**: Never change `[assumed]` to `[user-approved]` without presenting the item to the user first.