@khanhspring/forge-spec 1.0.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.
@@ -0,0 +1,279 @@
1
+ ---
2
+ name: "forge-spec"
3
+ description: "Phase 2 of 4. Researches existing specs for patterns, resolves brainstorm assumptions and open questions, challenges requirement gaps, then writes features/{slug}/spec.md on confirmation."
4
+ argument-hint: "Feature slug (e.g. 'user-registration')"
5
+ compatibility: "Requires spec repo with .forge/project.json and a completed forge-brainstorm (brainstorm.md on disk, or a summary in the current session)"
6
+ metadata:
7
+ author: "forge-workflow"
8
+ source: "spec-skills/forge-spec/SKILL.md"
9
+ user-invocable: true
10
+ disable-model-invocation: true
11
+ ---
12
+
13
+ # Forge Spec
14
+
15
+ Phase 2 of 4. Turn the brainstorm into a precise, unambiguous spec — no vague language,
16
+ no unresolved assumptions, every requirement testable.
17
+
18
+ <HARD-GATE>
19
+ Do NOT write `spec.md` until you have presented a spec outline and the user has
20
+ explicitly confirmed it. Do NOT add tasks or generate contracts at any point.
21
+ </HARD-GATE>
22
+
23
+ ---
24
+
25
+ ## Pre-check
26
+
27
+ - Find the brainstorm summary, in this order:
28
+ 1. A Brainstorm Summary in the current conversation, OR
29
+ 2. `features/{slug}/brainstorm.md` on disk (written by `/forge-brainstorm` after approval).
30
+ If neither exists: "Run `/forge-brainstorm {slug}` first — the spec is written from the brainstorm summary."
31
+ - Read `.forge/project.json` for module list.
32
+ - Feature slug from $ARGUMENTS, or derive from the brainstorm slug.
33
+ - Check if `features/{slug}/spec.md` already exists.
34
+ If yes: "A spec already exists for `{slug}`. Do you want to overwrite it? (yes/no)"
35
+
36
+ ---
37
+
38
+ ## Step 1 — Research Context
39
+
40
+ Before asking anything, research silently:
41
+
42
+ 1. **Existing specs** — scan `features/*/spec.md` for:
43
+ - REQ-N numbering style (do they restart at REQ-1 per feature, or is there a global counter?)
44
+ - How Non-Functional requirements are typically written
45
+ - Any related feature whose requirements this feature extends or depends on
46
+
47
+ 2. **CLAUDE.md** — note project principles and conventions.
48
+ Any principle that implies a requirement for this feature?
49
+ (e.g. "API contract before implementation" → this feature needs a contract requirement)
50
+
51
+ 3. **Brainstorm open items** — extract from the brainstorm summary:
52
+ - Any item listed under **Open Questions** that wasn't resolved
53
+ - Any item listed under **Assumptions** that needs to become an explicit requirement or be validated
54
+ - Any item listed under **Research Needed** that is still pending
55
+
56
+ Report findings:
57
+
58
+ > "Before drafting, here's what I found:
59
+ > - Related features: {list or 'none'}
60
+ > - Unresolved from brainstorm: {open questions / assumptions — or 'none, all clear'}
61
+ > - CLAUDE.md principles that apply: {list or 'none'}
62
+ > - Naming convention: {e.g. 'REQ-N restarts per feature'}"
63
+
64
+ ---
65
+
66
+ ## Step 2 — Resolve Brainstorm Carry-overs (one at a time)
67
+
68
+ If any open questions or assumptions were found in Step 1, resolve them before writing.
69
+ Ask one at a time.
70
+
71
+ For each unresolved open question:
72
+ > "The brainstorm left this open: '{question}'. How should the spec handle it?"
73
+
74
+ For each assumption:
75
+ > "The brainstorm assumed: '{assumption}'. Should this become a MUST requirement,
76
+ > a SHOULD requirement, or stay as a noted constraint?"
77
+
78
+ For each pending research item:
79
+ > "The brainstorm flagged this as needing research: '{item}'.
80
+ > Do you have an answer, or should we proceed with a stated assumption?"
81
+
82
+ Skip this step if the brainstorm had no open items.
83
+
84
+ ---
85
+
86
+ ## Step 3 — Clarifying Questions (one at a time)
87
+
88
+ Ask only about things genuinely unclear for writing precise requirements.
89
+ Do not re-ask things already answered in the brainstorm.
90
+
91
+ Areas to clarify if still unclear:
92
+
93
+ - **Requirement priorities** — is any requirement truly optional (MAY) vs expected (SHOULD) vs non-negotiable (MUST)?
94
+ - **NFR targets** — does this feature have measurable non-functional requirements? (response time, uptime, data retention, rate limits)
95
+ - **Error flows** — is every failure case from the brainstorm represented as a named error flow?
96
+ - **Boundary conditions** — any edge cases from the brainstorm challenge round that need to be requirements?
97
+ - **Out of scope** — anything that came up in brainstorm that should be explicitly excluded?
98
+
99
+ Skip if everything is already clear.
100
+
101
+ ---
102
+
103
+ ## Step 4 — Challenge Round
104
+
105
+ Before presenting the outline, flag at least 2 concerns about the spec content:
106
+
107
+ > "Before I draft the outline, a couple of things to flag:
108
+ >
109
+ > **[Concern 1]:** {e.g. 'The brainstorm mentioned rate limiting as a constraint, but there's
110
+ > no NFR for it — should I add one with a specific target, or leave it out of scope?'}
111
+ >
112
+ > **[Concern 2]:** {e.g. 'REQ for "validate email format" is vague — a developer could
113
+ > implement this 5 different ways. Should the spec define the validation rule explicitly
114
+ > (RFC 5322, or just presence of @), or leave it to the implementor?'}
115
+ >
116
+ > How should these be handled?"
117
+
118
+ Choose concerns specific to this feature's brainstorm — not generic warnings.
119
+ Wait for resolution before presenting the outline.
120
+
121
+ ---
122
+
123
+ ## Step 5 — Spec Outline & Gate
124
+
125
+ Present a structured outline before writing the full spec:
126
+
127
+ ```
128
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
129
+ Spec Outline: {Feature Name} [{slug}]
130
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
131
+ Modules: {list}
132
+
133
+ REQUIREMENTS
134
+ Functional ({n})
135
+ REQ-1 [MUST] {description}
136
+ REQ-2 [MUST] {description}
137
+ REQ-3 [SHOULD] {description}
138
+ Non-Functional ({n})
139
+ NFR-1 {requirement} — target: {value}
140
+
141
+ USER FLOWS
142
+ Happy Path: {name}
143
+ Error Flow: {name}
144
+ Error Flow: {name}
145
+
146
+ API ENDPOINTS
147
+ {METHOD} {path} → {module}
148
+
149
+ ASSUMPTIONS & CONSTRAINTS
150
+ - {constraint or assumption — or 'none'}
151
+
152
+ OUT OF SCOPE
153
+ - {item}
154
+
155
+ OPEN QUESTIONS
156
+ - {any remaining — or 'none'}
157
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
158
+ ```
159
+
160
+ End with:
161
+ > "Does this outline look right? Say **yes** to write the spec, or tell me what to change."
162
+
163
+ Wait for confirmation. Do not write `spec.md` before the user says yes.
164
+
165
+ ---
166
+
167
+ ## Step 6 — Write spec.md
168
+
169
+ Create `features/{feature-slug}/spec.md`:
170
+
171
+ ```markdown
172
+ # Feature: {Feature Name}
173
+
174
+ **ID:** {feature-slug}
175
+ **Status:** Draft
176
+ **Created:** {YYYY-MM-DD}
177
+ **Modules:** {comma-separated module names}
178
+
179
+ ---
180
+
181
+ ## Overview
182
+ {2–3 sentences. What it does and why it matters.}
183
+
184
+ ---
185
+
186
+ ## Actors & Permissions
187
+ {Carried from the brainstorm. One row per role.}
188
+
189
+ | Actor | Can do | Access scope |
190
+ |----------|---------------------------------|-------------------------------------|
191
+ | {role} | {what they can do} | {e.g. own records only / all / read-only} |
192
+
193
+ ---
194
+
195
+ ## Requirements
196
+
197
+ ### Functional
198
+
199
+ | ID | Requirement | Priority |
200
+ |-------|---------------|-----------|
201
+ | REQ-1 | {description} | [MUST] |
202
+ | REQ-2 | {description} | [SHOULD] |
203
+
204
+ ### Non-Functional
205
+
206
+ | ID | Requirement | Target |
207
+ |-------|----------------------|----------|
208
+ | NFR-1 | {e.g. response time} | {target} |
209
+
210
+ ---
211
+
212
+ ## Data Model
213
+ {Carried from the brainstorm's Data & State. Entities and what persists — no DB schema, conceptual only.}
214
+
215
+ | Entity | Created by | Key fields (conceptual) | Persists |
216
+ |----------|------------|--------------------------------|----------|
217
+ | {entity} | {actor/op} | {field, field, field} | {yes/no} |
218
+
219
+ Cross-module data: {what is shared with or derived from other modules — or "None"}
220
+
221
+ ---
222
+
223
+ ## User Flows
224
+
225
+ ### Happy Path: {name}
226
+ 1. {step}
227
+ 2. {step}
228
+
229
+ ### Error Flow: {name}
230
+ 1. {trigger}
231
+ 2. {system behavior}
232
+
233
+ ---
234
+
235
+ ## API Endpoints
236
+
237
+ | Method | Path | Module | Contract |
238
+ |--------|------|---------|----------|
239
+ | POST | /api/v1/{resource} | {module} | *(generated in forge-contract)* |
240
+
241
+ ---
242
+
243
+ ## Assumptions & Constraints
244
+ {Carried from the brainstorm's Constraints and any assumptions resolved as "noted constraint".}
245
+ - **Constraint:** {hard constraint — e.g. "must authenticate via existing SSO"}
246
+ - **Assumption:** {unvalidated assumption} — _risk if wrong: {impact}_
247
+ - (write "None" if empty)
248
+
249
+ ---
250
+
251
+ ## Out of Scope
252
+ - {explicit exclusion}
253
+
254
+ ---
255
+
256
+ ## Open Questions
257
+ - [ ] {any remaining unresolved item — omit section if empty}
258
+ ```
259
+
260
+ ### Writing rules
261
+ - `Status:` starts at `Draft` (lifecycle: Draft → Ready after contract → Done after close)
262
+ - Carry **Actors & Permissions**, **Data Model**, and **Assumptions & Constraints** forward from the brainstorm — do not drop them
263
+ - Every requirement must have a unique REQ-N or NFR-N ID
264
+ - Use [MUST] / [SHOULD] / [MAY] — no vague language like "should probably" or "ideally"
265
+ - Requirements must be testable — a developer should know unambiguously when one is met
266
+ - No code, no DB schema, no implementation details (Data Model is conceptual entities only)
267
+ - API section lists endpoint names only — no request/response schema
268
+ - Every error flow from the brainstorm must appear as a named Error Flow
269
+ - Keep it scannable — a developer should understand the feature in 5 minutes
270
+
271
+ ---
272
+
273
+ ## Step 7 — Gate
274
+
275
+ After writing, say:
276
+ > "Spec written to `features/{slug}/spec.md`. Review it and say **yes** to generate the task breakdown."
277
+
278
+ Do NOT add tasks to spec.md — tasks go in `features/{slug}/tasks.md` via `/forge-tasks`.
279
+ Do NOT generate contracts. Wait for confirmation.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: "forge-status"
3
+ description: "Scans features/ and shows phase status for every feature: 🔵 brainstorming, 🟡 spec written, 🟠 tasks ready, ✅ contract complete. Suggests the next forge command for each in-progress feature."
4
+ argument-hint: ""
5
+ compatibility: "Requires spec repo with .forge/project.json"
6
+ metadata:
7
+ author: "forge-workflow"
8
+ source: "spec-skills/forge-status/SKILL.md"
9
+ user-invocable: true
10
+ disable-model-invocation: true
11
+ ---
12
+
13
+ # Forge Status
14
+
15
+ Show the current status of all features in this spec repo.
16
+
17
+ ## Steps
18
+
19
+ 1. Scan the `features/` directory. If empty or missing, say "No features yet. Run `/forge-brainstorm` to plan your first feature."
20
+
21
+ 2. For each feature folder, determine its state (check in order, top to bottom):
22
+ - No `brainstorm.md` and no `spec.md` → 🔵 Brainstorming
23
+ - `brainstorm.md` exists, no `spec.md` → 🔵 Brainstormed
24
+ - `spec.md` exists, no `tasks.md` → 🟡 Spec written
25
+ - `tasks.md` exists, no contract file in `contracts/{any-module}/{slug}.yaml` → 🟠 Tasks ready
26
+ - Contract exists, but `tasks.md` has unchecked tasks → 🟣 Implementing
27
+ - Contract exists and all tasks in `tasks.md` are checked → ✅ Done
28
+
29
+ 3. For features in Implementing, read `tasks.md` and compute per-module completion
30
+ (ticked vs total under each `### {module}` heading) for the detail line.
31
+
32
+ 4. Also check `contracts/` for orphaned contracts (contract file exists but no matching feature folder) and flag them.
33
+
34
+ ## Output Format
35
+
36
+ ```
37
+ Feature Status — {project} spec repo
38
+ ══════════════════════════════════════════════════════
39
+
40
+ ✅ user-auth Done — all modules complete
41
+ 🟣 payment-flow Implementing — user-service 2/3, web-app 0/2
42
+ 🟠 notification-prefs Tasks ready — contract pending
43
+ 🟡 search-filters Spec written — tasks pending
44
+ 🔵 bulk-export Brainstormed — spec pending
45
+
46
+ ══════════════════════════════════════════════════════
47
+ 5 features · 1 done · 1 implementing · 3 planning
48
+ ```
49
+
50
+ ## What to Show Next
51
+ After the table, suggest the next action for each non-done feature:
52
+ - Brainstorming/Brainstormed → "Run `/forge-spec {slug}` to write the spec"
53
+ - Spec written → "Run `/forge-tasks {slug}` to generate the task breakdown"
54
+ - Tasks ready → "Run `/forge-contract {slug}` to generate the API contract"
55
+ - Implementing → "Module repos run `/forge-implement {slug}`, then `/forge-done` → `/forge-close {slug} {module}`"
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: "forge-tasks"
3
+ description: "Phase 3 of 4. Breaks an approved spec into a per-module task list and writes features/{slug}/tasks.md with checkboxes and acceptance criteria."
4
+ argument-hint: "Feature slug (e.g. 'user-registration')"
5
+ compatibility: "Requires spec repo with .forge/project.json and features/{slug}/spec.md"
6
+ metadata:
7
+ author: "forge-workflow"
8
+ source: "spec-skills/forge-tasks/SKILL.md"
9
+ user-invocable: true
10
+ disable-model-invocation: true
11
+ ---
12
+
13
+ # Forge Tasks — Spec Repo
14
+
15
+ Generate the task breakdown for a feature and write it to a dedicated file.
16
+
17
+ ## Pre-check
18
+ - Feature slug from $ARGUMENTS. If empty, list available features in `features/` and ask which one.
19
+ - Read `features/{slug}/spec.md` — must exist, otherwise say "Run `/forge-spec {slug}` first."
20
+ - Check if `features/{slug}/tasks.md` already exists:
21
+ - If yes → display it and ask: "Tasks already exist. Regenerate them? (yes/no)"
22
+ - If no → generate and write.
23
+
24
+ ## Task breakdown rules
25
+ - Group tasks by module using `### {module-name}` headings (use module names from `.forge/project.json`)
26
+ - Each task gets a unique ID: `TASK-N` (sequential across all modules)
27
+ - Tag each task with type: `[api]` / `[feat]` / `[ui]` / `[test]` / `[infra]`
28
+ - Write 1–3 acceptance criteria under each task
29
+ - Order tasks within each module by dependency (what must be done first)
30
+ - For frontend/consumer modules, reference the backend endpoint they integrate against
31
+
32
+ ## Output file: `features/{slug}/tasks.md`
33
+
34
+ ```markdown
35
+ # Tasks: {Feature Name}
36
+
37
+ **Feature:** {slug}
38
+ **Status:** Open
39
+ **Last updated:** {YYYY-MM-DD}
40
+ _(Status lifecycle: Open → Done, set by `/forge-close` when all modules finish)_
41
+
42
+ ---
43
+
44
+ ### {module-name} ({type})
45
+
46
+ - [ ] TASK-1 [api] {task title}
47
+ - {acceptance criterion}
48
+ - {acceptance criterion}
49
+
50
+ - [ ] TASK-2 [feat] {task title}
51
+ - {acceptance criterion}
52
+
53
+ ---
54
+
55
+ ### {module-name} ({type})
56
+
57
+ - [ ] TASK-3 [ui] {task title}
58
+ - {acceptance criterion}
59
+ ```
60
+
61
+ ## After writing — display summary
62
+
63
+ ```
64
+ Tasks: {feature-slug}
65
+ ══════════════════════════════════════════
66
+ ### user-service (backend)
67
+ - [ ] TASK-1 [api] POST /users/register
68
+ - [ ] TASK-2 [feat] Password hashing
69
+
70
+ ### web-app (frontend)
71
+ - [ ] TASK-3 [ui] Registration form component
72
+ ══════════════════════════════════════════
73
+ 3 tasks across 2 modules
74
+ ```
75
+
76
+ ## Gate
77
+ > "Tasks written to `features/{slug}/tasks.md`. Review and say **yes** to generate the API contract."
78
+
79
+ Do NOT generate contracts. Wait for confirmation.
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@khanhspring/forge-spec",
3
+ "version": "1.0.0",
4
+ "description": "Forge spec repo skills for Claude Code — brainstorm, spec, tasks, contract, and more",
5
+ "type": "module",
6
+ "bin": {
7
+ "forge-spec": "bin/install.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "forge-brainstorm",
12
+ "forge-close",
13
+ "forge-config",
14
+ "forge-contract",
15
+ "forge-init",
16
+ "forge-spec",
17
+ "forge-status",
18
+ "forge-tasks"
19
+ ],
20
+ "keywords": ["claude-code", "skills", "ai", "workflow", "microservices"],
21
+ "license": "MIT"
22
+ }