Skip to content

Commit 78ff8e3

Browse files
committed
refactor: reorganize skills directory and remove .spec-graph from tracking
1 parent 0d14147 commit 78ff8e3

10 files changed

Lines changed: 822 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.agents/
22
.sisyphus/
3+
.spec-graph/
34
bin/
45
dist/
5-
spec-graph
66
.DS_Store

.spec-graph/graph.db

-88 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec-graph export --format mermaid
3939

4040
For full command reference, entity types, and relation types, install the `spec-graph` skill into your AI agent. The skill provides all the context an agent needs to operate this tool.
4141
```bash
42-
bunx --bun skills add https://github.com/tyeongkim/spec-graph-cli.git --skill spec-graph
42+
bunx --bun skills add https://github.com/tyeongkim/spec-graph.git --skill '*'
4343
```
4444

4545
## Development

skills/spec-executor/SKILL.md

Lines changed: 272 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,272 @@
1+
---
2+
name: spec-executor
3+
description: >
4+
Manages spec-graph updates during implementation. Tracks phase progress by registering
5+
new entities discovered during development (API, STT, TST, QST, ASM), adding delivers
6+
relations for completed work, and running impact analysis before changes. Does NOT
7+
control how implementation is done — only keeps the graph in sync with reality.
8+
Use when implementing a phase and needing to update spec-graph, when starting work on
9+
a phase, when checking what remains to implement, or when registering implementation
10+
artifacts in the graph. Requires spec-graph CLI and an existing .spec-graph/ with a
11+
plan created by spec-planner.
12+
---
13+
14+
# spec-executor
15+
16+
Keeps spec-graph synchronized with implementation progress. This skill manages graph
17+
updates only — implementation approach is the agent's discretion.
18+
19+
## Prerequisites
20+
21+
- `spec-graph` CLI installed and available in PATH
22+
- Existing `.spec-graph/` with at least one PLN and PHS entities (created by spec-planner)
23+
24+
## Core Principles
25+
26+
1. **Graph reflects reality**: Only add `delivers` when implementation is actually complete.
27+
2. **Impact first**: Always run `impact` before modifying entities affected by your changes.
28+
3. **Scope discipline**: Write only to the current PHS. Other phases are read-only.
29+
4. **Query before create**: Check existing entities before registering new ones.
30+
5. **Delegate when possible**: If `task()` is available, delegate code work and keep graph updates to yourself.
31+
32+
---
33+
34+
## Procedure
35+
36+
### Step 0: Phase Selection
37+
38+
#### Case A: User specifies a PHS
39+
40+
Validate the specified phase:
41+
42+
```bash
43+
# Check phase exists and get its metadata
44+
spec-graph entity get PHS-XXX
45+
46+
# Check predecessor phases are resolved
47+
spec-graph query neighbors PHS-XXX --depth 1
48+
```
49+
50+
Verify all `precedes` predecessors have status `resolved`. If not:
51+
52+
```
53+
PHS-XXX cannot proceed optimally.
54+
Reason: PHS-YYY (predecessor) is not yet resolved.
55+
Currently recommended phase: PHS-YYY
56+
57+
Proceed with PHS-XXX anyway?
58+
```
59+
60+
If user confirms, proceed regardless. Do not block.
61+
62+
#### Case B: User does not specify a PHS
63+
64+
Find the optimal next phase:
65+
66+
```bash
67+
# List all phases in active plan
68+
spec-graph entity list --type phase --layer exec
69+
70+
# Check which are resolved
71+
spec-graph entity list --type phase --status resolved
72+
```
73+
74+
Selection criteria (in order):
75+
1. All `precedes` predecessors are `resolved`
76+
2. Status is `draft` or `active` (not resolved)
77+
3. Lowest `order` value among candidates
78+
79+
Present recommendation:
80+
81+
```
82+
Recommended next phase: PHS-XXX "[title]"
83+
- Goal: [goal from metadata]
84+
- Predecessors: all resolved
85+
- Remaining entities to deliver: N
86+
87+
Proceed with this phase?
88+
```
89+
90+
Wait for user confirmation.
91+
92+
#### Activate the Phase
93+
94+
Once phase is selected, transition to active:
95+
96+
```bash
97+
# Only if current status is draft
98+
spec-graph entity update PHS-XXX --status active --reason "Starting implementation"
99+
```
100+
101+
### Step 1: Scope Review
102+
103+
Query what this phase covers:
104+
105+
```bash
106+
spec-graph query scope PHS-XXX
107+
```
108+
109+
Parse the output to identify:
110+
- Arch entities covered by this phase (via `covers` relations)
111+
- Which of those already have `delivers` relations (already done)
112+
- Remaining work = covered entities without `delivers`
113+
114+
Present the work summary:
115+
116+
```
117+
Phase PHS-XXX scope:
118+
- Total covered: N entities
119+
- Already delivered: M entities
120+
- Remaining: K entities
121+
122+
Remaining work:
123+
- REQ-001: "..."
124+
- REQ-003: "..."
125+
- DEC-002: "..."
126+
```
127+
128+
### Step 2: Pre-Implementation (Impact Analysis)
129+
130+
Before implementing each entity, run impact:
131+
132+
```bash
133+
spec-graph impact REQ-001
134+
```
135+
136+
Inform the agent/user of affected entities:
137+
138+
```
139+
Implementing REQ-001 affects:
140+
- API-005 (high, structural) — direct implementation
141+
- TST-003 (medium, behavioral) — verifies this requirement
142+
143+
Consider these when implementing.
144+
```
145+
146+
This step is informational. It does not block implementation.
147+
148+
### Step 3: During Implementation (Entity Registration)
149+
150+
As implementation reveals new artifacts, register them:
151+
152+
```bash
153+
# Query first — avoid duplicates
154+
spec-graph entity list --type interface --layer arch
155+
156+
# Register discovered API
157+
spec-graph entity add --type interface --id API-001 \
158+
--title "POST /api/auth/login" \
159+
--metadata '{"kind":"http"}'
160+
161+
# Register test
162+
spec-graph entity add --type test --id TST-001 \
163+
--title "Auth login returns JWT on valid credentials" \
164+
--metadata '{"kind":"integration"}'
165+
166+
# Register state transition
167+
spec-graph entity add --type state --id STT-001 \
168+
--title "User: unauthenticated → authenticated" \
169+
--metadata '{"entity":"User","from":"unauthenticated","to":"authenticated"}'
170+
171+
# Register open question (if discovered)
172+
spec-graph entity add --type question --id QST-001 \
173+
--title "Should refresh tokens be stored in Redis or DB?" \
174+
--metadata '{"owner":"backend-team"}'
175+
```
176+
177+
Add arch-internal relations:
178+
179+
```bash
180+
# API implements requirement
181+
spec-graph relation add --from API-001 --to REQ-001 --type implements
182+
183+
# Test verifies requirement
184+
spec-graph relation add --from TST-001 --to REQ-001 --type verifies
185+
186+
# Interface triggers state
187+
spec-graph relation add --from API-001 --to STT-001 --type triggers
188+
```
189+
190+
Validate after each batch of mutations:
191+
192+
```bash
193+
spec-graph validate --layer arch
194+
```
195+
196+
### Step 4: Post-Implementation (delivers)
197+
198+
When an arch entity's implementation is confirmed complete, add `delivers`:
199+
200+
```bash
201+
spec-graph relation add --from PHS-XXX --to REQ-001 --type delivers
202+
spec-graph relation add --from PHS-XXX --to API-001 --type delivers
203+
```
204+
205+
**Rules for delivers**:
206+
- Only add when implementation is actually done (not planned, not in-progress)
207+
- Use the minimal proxy set — not every related entity, only those necessary and sufficient
208+
- Only add delivers for the current PHS (scope discipline)
209+
210+
Validate after adding delivers:
211+
212+
```bash
213+
spec-graph validate --layer mapping --phase PHS-XXX
214+
```
215+
216+
### Step 5: Progress Report
217+
218+
After each work session, summarize:
219+
220+
```
221+
Phase PHS-XXX progress:
222+
- Delivered: M / N entities
223+
- New entities registered: [list]
224+
- Open questions: [list if any]
225+
- Remaining: [list]
226+
```
227+
228+
---
229+
230+
## Delegation Policy
231+
232+
When `task()` is available (orchestration environment):
233+
234+
| Action | Owner | Delegate? |
235+
|--------|-------|-----------|
236+
| Code implementation | Delegated agent | Yes — via task() |
237+
| spec-graph entity/relation CRUD | This skill (you) | Never delegate |
238+
| Impact analysis | This skill (you) | Never delegate |
239+
| Validation | This skill (you) | Never delegate |
240+
241+
**Workflow with delegation**:
242+
1. Run impact analysis (yourself)
243+
2. Compose implementation prompt with context from impact + scope
244+
3. Delegate code work via `task()`
245+
4. Receive result
246+
5. Verify implementation (yourself)
247+
6. Register entities and delivers (yourself)
248+
7. Validate (yourself)
249+
250+
**Without delegation**: Do all steps yourself.
251+
252+
---
253+
254+
## Error Handling
255+
256+
| Exit Code | Meaning | Action |
257+
|-----------|---------|--------|
258+
| 0 | Success | Proceed |
259+
| 1 | Runtime error | Check stderr, retry |
260+
| 2 | Validation failure | Parse output, fix relations/entities, re-validate |
261+
| 3 | Invalid input | Check arguments/schema, fix, retry |
262+
263+
---
264+
265+
## Anti-Patterns
266+
267+
1. **Premature delivers**: Adding `delivers` before implementation is complete.
268+
2. **Scope violation**: Adding `delivers` for a phase other than the current one.
269+
3. **Skipping impact**: Modifying entities without checking what else is affected.
270+
4. **Bulk delivers**: Adding delivers for every related entity instead of the minimal set.
271+
5. **Delegating graph ops**: Letting delegated agents run spec-graph commands directly.
272+
6. **Phantom entities**: Registering entities for code that doesn't exist yet.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)