@groupby/ai-dev 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/teams/snpd/github/PULL_REQUEST_TEMPLATE.md +20 -0
- package/teams/snpd/skills/docs-init/SKILL.md +343 -0
- package/teams/snpd/skills/docs-init-v2/SKILL.md +402 -0
- package/teams/snpd/skills/draft-plan/SKILL.md +201 -0
- package/teams/snpd/skills/draft-pr/SKILL.md +252 -0
- package/teams/snpd/skills/jira-spec/SKILL.md +216 -0
- package/teams/snpd/skills/tdd-implement/SKILL.md +320 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-init-v2
|
|
3
|
+
description: Use when the user wants to initialize or refresh the canonical `/docs` folder, `CLAUDE.md`, and `README.md` based on the current repo state. Creates the five canonical docs if missing; audits them for drift against the code if present. Triggered by `/docs-init-v2` or requests like "update the docs v2", "create the docs v2", "refresh project documentation v2", "init docs v2".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# docs-init
|
|
7
|
+
|
|
8
|
+
Initialize or refresh project documentation. Works in two modes automatically:
|
|
9
|
+
|
|
10
|
+
- **Init mode** — `/docs` is missing or incomplete. Create the canonical
|
|
11
|
+
five-file structure from a fresh repo scan.
|
|
12
|
+
- **Refresh mode** — `/docs` exists. Audit each file against the current
|
|
13
|
+
code and report what is outdated, drifted, or newly worth documenting.
|
|
14
|
+
Apply updates only after the user approves the human-readable report.
|
|
15
|
+
|
|
16
|
+
## The Canonical Structure
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
README.md ← 30-second landing page + links into docs/
|
|
20
|
+
CLAUDE.md ← thin index for AI agents
|
|
21
|
+
docs/
|
|
22
|
+
architecture.md ← system, packages, domain model, cross-cutting concerns
|
|
23
|
+
local-setup.md ← prerequisites, run, test, troubleshooting
|
|
24
|
+
conventions.md ← code style, testing, API, migrations, PR norms
|
|
25
|
+
operations.md ← deploy, secrets, observability, runbooks
|
|
26
|
+
decisions.md ← append-only "why" log (ADR-lite)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Every doc under `docs/` MUST start with a `> **Scope:**` block explaining
|
|
30
|
+
what belongs there, what does not, and where it is referenced from.
|
|
31
|
+
Preserve this block on every edit.
|
|
32
|
+
|
|
33
|
+
## Procedure
|
|
34
|
+
|
|
35
|
+
### 1. Detect mode
|
|
36
|
+
|
|
37
|
+
- Check for `README.md`, `CLAUDE.md`, and each of the five `docs/*.md` files.
|
|
38
|
+
- If three or more are missing → **init mode**.
|
|
39
|
+
- Otherwise → **refresh mode**.
|
|
40
|
+
- **Exception:** If canonical files are missing but the repo has substantial
|
|
41
|
+
existing documentation (e.g. `docs/` with other files, detailed README,
|
|
42
|
+
wiki-style markdown), treat as **refresh mode** — bridge existing docs
|
|
43
|
+
into the canonical structure rather than creating from scratch. Mention
|
|
44
|
+
existing docs in the report and propose how to integrate or link them.
|
|
45
|
+
- Announce the detected mode to the user before proceeding.
|
|
46
|
+
|
|
47
|
+
### 2. Scan the repo
|
|
48
|
+
|
|
49
|
+
Gather facts from the actual code, not assumptions:
|
|
50
|
+
|
|
51
|
+
- **Stack & build:** `build.gradle` / `pom.xml` / `package.json` /
|
|
52
|
+
`Cargo.toml` / `go.mod` / `pyproject.toml` / `setup.py` /
|
|
53
|
+
`requirements.txt` / `Makefile` / equivalent — language version,
|
|
54
|
+
framework, key libraries.
|
|
55
|
+
- **Run commands:** README scripts, build-tool tasks (`./gradlew tasks`,
|
|
56
|
+
`npm run`, `make`, `cargo`, `go`, `pytest`, etc.), `docker-compose.yml`.
|
|
57
|
+
- **Package layout:** top-level dirs under `src/` (or `lib/`, `app/`,
|
|
58
|
+
`cmd/`, `internal/`, `pkg/` for Go, `dags/`/`jobs/` for Airflow,
|
|
59
|
+
`packages/`/`apps/` for monorepos, `manifests/` for infra repos).
|
|
60
|
+
- **Domain types:** entity/model/record/struct/schema classes; group by
|
|
61
|
+
package or module.
|
|
62
|
+
- **Tests:** test framework, conventions, fixture locations.
|
|
63
|
+
- **Migrations:** Flyway / Liquibase / Alembic / Knex / equivalent paths
|
|
64
|
+
and naming.
|
|
65
|
+
- **CI/CD:** files under `.github/workflows/`, `.circleci/`, `Jenkinsfile`,
|
|
66
|
+
`cloudbuild.yaml`, or equivalent. Note the CI system in use.
|
|
67
|
+
- **Deploy:** `helm/`, `k8s/`, `kustomize/`, `terraform/`, Dockerfile,
|
|
68
|
+
`Procfile`, Argo CD manifests.
|
|
69
|
+
- **Observability:** OpenTelemetry / logging / Prometheus / Datadog config.
|
|
70
|
+
- **Secrets:** Vault references, sealed-secrets, workload identity, ADC,
|
|
71
|
+
env var injection.
|
|
72
|
+
- **API surface:** controller annotations, OpenAPI spec, route definitions,
|
|
73
|
+
proto definitions, GraphQL schema.
|
|
74
|
+
|
|
75
|
+
For refresh mode, also collect `git log --since="<doc-mtime>"` per doc to
|
|
76
|
+
narrow attention to changes the doc may not yet reflect.
|
|
77
|
+
|
|
78
|
+
### 3a. Init mode — draft (do NOT write yet)
|
|
79
|
+
|
|
80
|
+
Draft the seven files in memory using the canonical templates below. Every
|
|
81
|
+
`docs/` file starts with the `Scope` block. Leave honest placeholders where
|
|
82
|
+
the repo does not yet have the answer (e.g. operations runbooks, dashboard
|
|
83
|
+
links). Do not fabricate.
|
|
84
|
+
|
|
85
|
+
**Verification checklist — apply to every claim before including it:**
|
|
86
|
+
|
|
87
|
+
1. **Commands** — Before writing any `./gradlew <task>`, `npm run <script>`,
|
|
88
|
+
`make <target>`, `go <cmd>`, or similar, confirm the task exists (check
|
|
89
|
+
`build.gradle` tasks, `package.json` scripts, Makefile targets, workflow
|
|
90
|
+
files). Never guess task names.
|
|
91
|
+
2. **Config keys** — Quote exact property paths from the actual config file
|
|
92
|
+
(YAML, properties, JSON, TOML, `.env`, Helm values, Kustomize overlays).
|
|
93
|
+
Do not paraphrase or use placeholder syntax like `${...}`.
|
|
94
|
+
3. **Directory contents** — List (`ls`) the directory before describing what it
|
|
95
|
+
contains. Never say "contains templates only" or "contains X" without
|
|
96
|
+
checking.
|
|
97
|
+
4. **Credentials** — Never instruct placing credentials in a repo-tracked file.
|
|
98
|
+
Recommend user-home config instead: `~/.gradle/gradle.properties`,
|
|
99
|
+
`~/.m2/settings.xml`, `~/.npmrc`, `~/.pypirc`, `~/.docker/config.json`,
|
|
100
|
+
or environment variables / Application Default Credentials (ADC).
|
|
101
|
+
5. **Submodule commands** — Use `git submodule update --init --recursive`
|
|
102
|
+
(pinned commit). Never use `--remote` (breaks reproducible builds).
|
|
103
|
+
6. **CI/CD triggers** — Read the actual trigger/filter syntax for the CI system
|
|
104
|
+
in use (GitHub Actions `on:` block, CircleCI `filters:`, Jenkins pipeline
|
|
105
|
+
triggers, etc.). List all branches/events accurately.
|
|
106
|
+
7. **Scope qualifiers** — When stating "all X do Y," verify there are no
|
|
107
|
+
exceptions (e.g. health, metrics, actuator endpoints outside the API prefix).
|
|
108
|
+
8. **File references** — When describing what a file is used for, trace its
|
|
109
|
+
references (grep for the filename) so the description matches actual usage.
|
|
110
|
+
|
|
111
|
+
Targets: `CLAUDE.md` ≤ 40 lines, `README.md` ≤ 30 lines.
|
|
112
|
+
|
|
113
|
+
**Do not write these files to disk yet.** Continue to step 4, where the
|
|
114
|
+
draft contents are summarized in the audit report and the user approves
|
|
115
|
+
before any file is created.
|
|
116
|
+
|
|
117
|
+
### 3b. Refresh mode — audit each file
|
|
118
|
+
|
|
119
|
+
For each existing doc, classify findings into three buckets:
|
|
120
|
+
|
|
121
|
+
- **Outdated** — the doc states something that is no longer true (a removed
|
|
122
|
+
command, a renamed package, a retired workflow, a wrong version number).
|
|
123
|
+
- **Drifted** — the doc is technically correct but missing material the
|
|
124
|
+
code now contains (a new package, a new build task, a new workflow, a
|
|
125
|
+
new env profile).
|
|
126
|
+
- **New opportunities** — content the doc does not have but probably
|
|
127
|
+
should (a recently added feature area, a new observability surface).
|
|
128
|
+
|
|
129
|
+
`decisions.md` is **append-only**: propose new entries on approval, but
|
|
130
|
+
never rewrite or remove existing ones.
|
|
131
|
+
|
|
132
|
+
### 4. Report to the user (human-friendly, NOT a diff)
|
|
133
|
+
|
|
134
|
+
In **init mode**, the report summarizes what each new file will contain
|
|
135
|
+
(one paragraph per file describing scope and key sections drafted), and
|
|
136
|
+
the "Proposed actions" list reads as `Create <path>` items.
|
|
137
|
+
|
|
138
|
+
In **refresh mode**, the report follows the per-file findings format
|
|
139
|
+
below.
|
|
140
|
+
|
|
141
|
+
Output a single readable report in this exact shape:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
# Documentation audit — <YYYY-MM-DD>
|
|
145
|
+
|
|
146
|
+
Mode: <init | refresh>
|
|
147
|
+
|
|
148
|
+
## Summary
|
|
149
|
+
<2-3 sentences: what was created or what needs attention overall>
|
|
150
|
+
|
|
151
|
+
## Per-file findings
|
|
152
|
+
|
|
153
|
+
### docs/architecture.md
|
|
154
|
+
**Outdated:**
|
|
155
|
+
- The package list mentions `legacy/` but that directory was removed in <commit>.
|
|
156
|
+
- Lists framework version X.Y; build file now pins X.Z.
|
|
157
|
+
|
|
158
|
+
**Drifted:**
|
|
159
|
+
- A new top-level package is not mentioned.
|
|
160
|
+
|
|
161
|
+
**New opportunities:**
|
|
162
|
+
- A retry strategy was added in <PR>; worth a short paragraph.
|
|
163
|
+
|
|
164
|
+
### docs/local-setup.md
|
|
165
|
+
**Outdated:**
|
|
166
|
+
- (none)
|
|
167
|
+
|
|
168
|
+
**Drifted:**
|
|
169
|
+
- A new build/test task was added in <commit> but the doc does not list it.
|
|
170
|
+
|
|
171
|
+
(... continue for each file ...)
|
|
172
|
+
|
|
173
|
+
### CLAUDE.md
|
|
174
|
+
**Outdated:** (none)
|
|
175
|
+
**Drifted:** Pointer to `docs/operations.md` is missing.
|
|
176
|
+
|
|
177
|
+
### README.md
|
|
178
|
+
**Outdated:** Quick-start references an old env-var value that has been
|
|
179
|
+
renamed.
|
|
180
|
+
|
|
181
|
+
## Proposed actions
|
|
182
|
+
|
|
183
|
+
Numbered list of concrete edits I would make if you approve. Group by
|
|
184
|
+
file. Each item is one sentence — no diffs.
|
|
185
|
+
|
|
186
|
+
## Verified against source
|
|
187
|
+
|
|
188
|
+
List what was checked to ensure accuracy:
|
|
189
|
+
- Commands: <which tasks were confirmed and how>
|
|
190
|
+
- Config keys: <which files were read for exact property names>
|
|
191
|
+
- Directories: <which directories were listed>
|
|
192
|
+
- Workflow triggers: <which workflow files were read>
|
|
193
|
+
- Credentials: <confirm no repo-tracked file instructions>
|
|
194
|
+
|
|
195
|
+
## Awaiting your approval
|
|
196
|
+
|
|
197
|
+
Reply "apply" to make the changes, "apply <numbers>" to apply a subset
|
|
198
|
+
(e.g. "apply 1,3,5"), or "skip" to make no changes.
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
If a bucket is empty for a file, write `(none)` — do not omit the bucket.
|
|
202
|
+
This makes it obvious that the check ran.
|
|
203
|
+
|
|
204
|
+
### 5. Apply on approval
|
|
205
|
+
|
|
206
|
+
- On `apply` — create or edit each affected file. In init mode this means
|
|
207
|
+
creating all seven files from the drafts in step 3a. In refresh mode
|
|
208
|
+
it means editing existing files in place. Preserve `Scope` blocks. Do
|
|
209
|
+
not reorganize content across files. Do not change file names.
|
|
210
|
+
- On `apply <numbers>` — apply only the selected proposed actions.
|
|
211
|
+
- On `skip` — make no edits or creations; thank the user and exit.
|
|
212
|
+
- After applying, print a short summary of which files were created or
|
|
213
|
+
changed and suggest a commit message.
|
|
214
|
+
|
|
215
|
+
## Hard rules
|
|
216
|
+
|
|
217
|
+
- **Apply edits only after explicit user approval.** No file under `docs/`,
|
|
218
|
+
`CLAUDE.md`, or `README.md` is edited before the user replies `apply` or
|
|
219
|
+
`apply <numbers>`.
|
|
220
|
+
- **`decisions.md` is append-only.** New entries may be added on approval;
|
|
221
|
+
existing entries are never edited or removed.
|
|
222
|
+
- **Preserve every `> **Scope:**` block** verbatim on edited docs.
|
|
223
|
+
- **Do not move content between files.** Each file's scope is the
|
|
224
|
+
convention. If content does not fit any of the five, mention it in the
|
|
225
|
+
report and ask whether to create a new file or fold it elsewhere.
|
|
226
|
+
- **Do not fabricate.** If the repo has no dashboards, no runbooks, no
|
|
227
|
+
decisions yet, leave honest placeholders or empty sections.
|
|
228
|
+
- **Verify every factual claim.** Before including any command, config key,
|
|
229
|
+
directory description, or workflow trigger in the docs, confirm it against
|
|
230
|
+
the actual source file. See the verification checklist in step 3a.
|
|
231
|
+
- **Never reference repo-tracked files for credentials.** Always use
|
|
232
|
+
user-home paths (`~/.gradle/gradle.properties`, `~/.m2/settings.xml`,
|
|
233
|
+
`~/.npmrc`, `~/.pypirc`) or environment variables / ADC.
|
|
234
|
+
- **Never use `--remote` in submodule commands.** Use pinned commits for
|
|
235
|
+
reproducible builds.
|
|
236
|
+
- **Qualify universal statements.** If writing "all endpoints do X," verify
|
|
237
|
+
there are no exceptions and add qualifiers if needed.
|
|
238
|
+
- **Do not delete sections without flagging them.** Surfacing a removal
|
|
239
|
+
belongs in the report, not as a silent edit.
|
|
240
|
+
- **Do not edit `.github/PULL_REQUEST_TEMPLATE.md`, CI files, or code.**
|
|
241
|
+
This skill only touches docs.
|
|
242
|
+
- **Keep `CLAUDE.md` ≤ 40 lines and `README.md` ≤ 30 lines** after edit.
|
|
243
|
+
If pointers no longer fit, ask before expanding.
|
|
244
|
+
|
|
245
|
+
## Canonical templates
|
|
246
|
+
|
|
247
|
+
When in init mode, use these skeletons. Fill from the repo scan.
|
|
248
|
+
|
|
249
|
+
### `docs/architecture.md`
|
|
250
|
+
|
|
251
|
+
```markdown
|
|
252
|
+
# Architecture
|
|
253
|
+
|
|
254
|
+
> **Scope:** What this system is, how it's structured, and the domain it models.
|
|
255
|
+
> Put here: tech stack, package/module layout, key components, domain entities,
|
|
256
|
+
> cross-cutting concerns (auth, multi-tenancy, observability).
|
|
257
|
+
> Do **not** put here: how to run it (→ local-setup.md), how to deploy it
|
|
258
|
+
> (→ operations.md), code style (→ conventions.md).
|
|
259
|
+
>
|
|
260
|
+
> **Referenced from:** `README.md` and `CLAUDE.md`.
|
|
261
|
+
|
|
262
|
+
## Overview
|
|
263
|
+
## Package Structure
|
|
264
|
+
## Key Libraries
|
|
265
|
+
## Domain Model
|
|
266
|
+
## Cross-Cutting Concerns
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### `docs/local-setup.md`
|
|
270
|
+
|
|
271
|
+
```markdown
|
|
272
|
+
# Local Setup
|
|
273
|
+
|
|
274
|
+
> **Scope:** Everything needed to clone, run, and test on a fresh machine.
|
|
275
|
+
> Put here: prerequisites, full setup steps, env vars, build/test commands,
|
|
276
|
+
> troubleshooting.
|
|
277
|
+
> Do **not** put here: deployment (→ operations.md), architecture
|
|
278
|
+
> (→ architecture.md).
|
|
279
|
+
>
|
|
280
|
+
> **Referenced from:** `README.md` quick-start (links here for detail) and `CLAUDE.md`.
|
|
281
|
+
|
|
282
|
+
## Prerequisites
|
|
283
|
+
## Run the Service
|
|
284
|
+
## Common Tasks
|
|
285
|
+
## Environment Profiles
|
|
286
|
+
## Troubleshooting
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### `docs/conventions.md`
|
|
290
|
+
|
|
291
|
+
```markdown
|
|
292
|
+
# Conventions
|
|
293
|
+
|
|
294
|
+
> **Scope:** How we write and review code in this repo.
|
|
295
|
+
> Put here: language conventions, testing philosophy, naming rules, API
|
|
296
|
+
> rules, migration rules, PR norms.
|
|
297
|
+
> Do **not** put here: architecture (→ architecture.md), ops (→ operations.md).
|
|
298
|
+
>
|
|
299
|
+
> **Referenced from:** `CLAUDE.md` (so AI agents follow these) and `README.md`.
|
|
300
|
+
|
|
301
|
+
## Code Style
|
|
302
|
+
## Testing
|
|
303
|
+
## API Conventions
|
|
304
|
+
## Database Migrations
|
|
305
|
+
## PRs and Commits
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### `docs/operations.md`
|
|
309
|
+
|
|
310
|
+
```markdown
|
|
311
|
+
# Operations
|
|
312
|
+
|
|
313
|
+
> **Scope:** What happens after merge — deploy, run, observe, recover.
|
|
314
|
+
> Put here: deploy pipelines, environments, secrets source, dashboards,
|
|
315
|
+
> alerts, runbooks.
|
|
316
|
+
> Do **not** put here: architecture (→ architecture.md), local dev
|
|
317
|
+
> (→ local-setup.md).
|
|
318
|
+
>
|
|
319
|
+
> **Referenced from:** `README.md` and `CLAUDE.md`.
|
|
320
|
+
|
|
321
|
+
## Deploy
|
|
322
|
+
## Secrets
|
|
323
|
+
## Observability
|
|
324
|
+
## Common Runbooks
|
|
325
|
+
## On-Call
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `docs/decisions.md`
|
|
329
|
+
|
|
330
|
+
```markdown
|
|
331
|
+
# Decisions
|
|
332
|
+
|
|
333
|
+
> **Scope:** Short, append-only log of *why* this codebase is the way it is.
|
|
334
|
+
> Captures decisions whose rationale is not obvious from reading the code.
|
|
335
|
+
> Put here: framework choices, trade-offs taken, deliberate deviations.
|
|
336
|
+
> Do **not** put here: how-to instructions, code-level comments.
|
|
337
|
+
>
|
|
338
|
+
> **Referenced from:** `CLAUDE.md`, and linked from PRs that introduce a
|
|
339
|
+
> non-obvious choice.
|
|
340
|
+
|
|
341
|
+
## Format
|
|
342
|
+
|
|
343
|
+
Append a new entry as a new top-level section. Don't edit prior entries —
|
|
344
|
+
if a decision is reversed, add a new entry that supersedes the old one.
|
|
345
|
+
|
|
346
|
+
Each entry:
|
|
347
|
+
- **Context:** what prompted the decision
|
|
348
|
+
- **Decision:** what we chose
|
|
349
|
+
- **Consequence:** what this means going forward (and what we're giving up)
|
|
350
|
+
|
|
351
|
+
## Entries
|
|
352
|
+
|
|
353
|
+
*(No entries yet.)*
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### `CLAUDE.md`
|
|
357
|
+
|
|
358
|
+
```markdown
|
|
359
|
+
# CLAUDE.md
|
|
360
|
+
|
|
361
|
+
Index for AI coding agents (Claude Code, Copilot CLI). Keep this file short —
|
|
362
|
+
point to `docs/` for substance.
|
|
363
|
+
|
|
364
|
+
## What this repo is
|
|
365
|
+
|
|
366
|
+
<one-paragraph description from the repo scan>
|
|
367
|
+
|
|
368
|
+
## Where things live
|
|
369
|
+
|
|
370
|
+
- **Architecture, domain model, package layout** → [docs/architecture.md](docs/architecture.md)
|
|
371
|
+
- **Build / run / test commands** → [docs/local-setup.md](docs/local-setup.md)
|
|
372
|
+
- **Code style, testing conventions, API/migration rules** → [docs/conventions.md](docs/conventions.md)
|
|
373
|
+
- **Deploy, secrets, observability, runbooks** → [docs/operations.md](docs/operations.md)
|
|
374
|
+
- **Why things are the way they are** → [docs/decisions.md](docs/decisions.md)
|
|
375
|
+
|
|
376
|
+
## Rules for working in this repo
|
|
377
|
+
|
|
378
|
+
<3-6 short bullets — only repo-specific gotchas an agent must follow on
|
|
379
|
+
every turn. Do not duplicate detail that lives in docs/>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### `README.md`
|
|
383
|
+
|
|
384
|
+
```markdown
|
|
385
|
+
# <repo name>
|
|
386
|
+
|
|
387
|
+
<one-paragraph description>
|
|
388
|
+
|
|
389
|
+
## Quick start
|
|
390
|
+
|
|
391
|
+
<3-5 lines: the shortest possible happy path>
|
|
392
|
+
|
|
393
|
+
Requires <prereqs>. For detail see [docs/local-setup.md](docs/local-setup.md).
|
|
394
|
+
|
|
395
|
+
## Documentation
|
|
396
|
+
|
|
397
|
+
- [Architecture](docs/architecture.md) — system overview, domain model, package layout
|
|
398
|
+
- [Local setup](docs/local-setup.md) — full setup, tasks, troubleshooting
|
|
399
|
+
- [Conventions](docs/conventions.md) — code style, testing, API & migration rules
|
|
400
|
+
- [Operations](docs/operations.md) — deploy, secrets, observability, runbooks
|
|
401
|
+
- [Decisions](docs/decisions.md) — why things are the way they are
|
|
402
|
+
```
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: draft-plan
|
|
3
|
+
description: Use when the user invokes `/draft-plan` (or asks to "draft a plan", "plan this spec"). Reads a spec file from `.claude/artifacts/` (typically a `*-spec.md` produced by /jira-spec), performs a deep codebase review, drafts a high-level implementation plan, and discusses it with the user. On approval, writes the plan to a sibling `*-plan.md` file and stops — does not start implementation. Only runs when explicitly invoked — do NOT auto-trigger on the word "plan".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# draft-plan
|
|
7
|
+
|
|
8
|
+
Turn a spec into a discussed, approved, high-level implementation plan.
|
|
9
|
+
|
|
10
|
+
## Inputs
|
|
11
|
+
|
|
12
|
+
- **Spec file path** — typically `.claude/artifacts/{KEY}_{slug}-spec.md`. The
|
|
13
|
+
user may pass it explicitly (`/draft-plan S4R-10559_ai-adoption-runbook-spec.md`)
|
|
14
|
+
or by ticket key (`/draft-plan S4R-10559`).
|
|
15
|
+
- **If no argument is given:** list all `*-spec.md` files in `.claude/artifacts/`
|
|
16
|
+
with their last-modified dates and ask which one to plan.
|
|
17
|
+
- **Do not invent a spec.** If no matching spec file exists, stop and tell the
|
|
18
|
+
user to run `/jira-spec` first.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### 1. Read the spec verbatim
|
|
23
|
+
|
|
24
|
+
- Read the entire spec file.
|
|
25
|
+
- Pay attention to: Original Description, Acceptance Criteria, AI-gathered
|
|
26
|
+
Implementation Notes, Open Questions. The first two are authoritative; the
|
|
27
|
+
third is a starting hypothesis, not a constraint.
|
|
28
|
+
|
|
29
|
+
### 2. Investigate the codebase (deeper than `/jira-spec`)
|
|
30
|
+
|
|
31
|
+
The spec used **medium-depth** scanning — file lists and excerpts. This skill
|
|
32
|
+
uses **deep** scanning. For each likely touch point:
|
|
33
|
+
|
|
34
|
+
- Read the relevant files **end-to-end**, not just excerpts.
|
|
35
|
+
- Trace data flow across layers (e.g. controller → service → repository →
|
|
36
|
+
migration) for any feature that crosses them.
|
|
37
|
+
- Identify shared abstractions the change must conform to (factories,
|
|
38
|
+
interfaces, base classes, validators, mappers).
|
|
39
|
+
- Find related tests and fixtures — understand the existing test shape before
|
|
40
|
+
proposing new tests.
|
|
41
|
+
- Check `docs/architecture.md`, `docs/conventions.md`, and any
|
|
42
|
+
`docs/decisions.md` entries for constraints the plan must respect.
|
|
43
|
+
If those files do not exist, fall back to `CLAUDE.md` / `AGENTS.md`
|
|
44
|
+
and the top-level `README.md`.
|
|
45
|
+
- Run `git log --oneline -- <path>` on key files to see recent changes that
|
|
46
|
+
suggest active areas / patterns.
|
|
47
|
+
|
|
48
|
+
Time-box this: deep does not mean exhaustive. Stop when you can describe the
|
|
49
|
+
shape of the change confidently, not when you've read everything.
|
|
50
|
+
|
|
51
|
+
### 3. Draft the plan structure (in chat, not yet written)
|
|
52
|
+
|
|
53
|
+
Present the plan to the user in chat first, using this shape:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Plan preview — {KEY}: {short summary}
|
|
57
|
+
|
|
58
|
+
## Goal
|
|
59
|
+
<1–2 sentences in plain English. Tied to the spec's Acceptance Criteria.>
|
|
60
|
+
|
|
61
|
+
## Approach
|
|
62
|
+
<3–6 sentences describing the chosen direction. Why this shape rather than
|
|
63
|
+
alternatives. Reference architecture/conventions docs where they constrain
|
|
64
|
+
the choice.>
|
|
65
|
+
|
|
66
|
+
## Affected areas
|
|
67
|
+
|
|
68
|
+
### <Module or layer 1, e.g. "api/ — HTTP layer">
|
|
69
|
+
- `path/to/file` — what role this file plays in the change
|
|
70
|
+
- `path/to/other` — likewise
|
|
71
|
+
|
|
72
|
+
### <Module or layer 2>
|
|
73
|
+
- ...
|
|
74
|
+
|
|
75
|
+
(Group by module/layer, not by file. List files that will change or that the
|
|
76
|
+
change must conform to. Do NOT cite line numbers or specific methods unless
|
|
77
|
+
the user digs in.)
|
|
78
|
+
|
|
79
|
+
## Sequencing
|
|
80
|
+
1. <First phase — what gets done, in what order, why this order>
|
|
81
|
+
2. <Second phase>
|
|
82
|
+
3. <Third phase>
|
|
83
|
+
|
|
84
|
+
(Each phase should be independently committable / reviewable where possible.)
|
|
85
|
+
|
|
86
|
+
## Test strategy
|
|
87
|
+
- <Which existing test classes will be extended; which new tests are needed,
|
|
88
|
+
by surface (integration / unit / fixture-based). No specific test method
|
|
89
|
+
names yet.>
|
|
90
|
+
|
|
91
|
+
## Risks & open questions
|
|
92
|
+
- <Anything that could derail the plan. Performance, data migration,
|
|
93
|
+
backwards compatibility, etc.>
|
|
94
|
+
- <Anything the spec leaves ambiguous that the user should decide before
|
|
95
|
+
implementation.>
|
|
96
|
+
|
|
97
|
+
## Out of scope
|
|
98
|
+
- <Explicit non-goals — things that look related but won't be addressed in
|
|
99
|
+
this plan.>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 4. Discuss with the user
|
|
103
|
+
|
|
104
|
+
After presenting the plan, ask the user:
|
|
105
|
+
|
|
106
|
+
> *"Does this plan capture the right approach? Reply with `approve` to write
|
|
107
|
+
> the plan to a file, or tell me what to change."*
|
|
108
|
+
|
|
109
|
+
Iterate:
|
|
110
|
+
|
|
111
|
+
- If the user asks "why did you choose X over Y?" — explain, and if the
|
|
112
|
+
answer changes the plan, update it.
|
|
113
|
+
- If the user asks for more detail on a specific area (e.g. "go deeper on
|
|
114
|
+
how validation will work") — investigate further and add that detail to
|
|
115
|
+
the plan. **Detail captured during discussion is the exception that
|
|
116
|
+
earns its way in.** Without an explicit ask, keep the plan high-level.
|
|
117
|
+
- If the user disagrees with the approach — revise. Do not write a plan
|
|
118
|
+
the user hasn't endorsed.
|
|
119
|
+
- Track decisions made during the discussion in a running "Decisions"
|
|
120
|
+
section that gets included on write.
|
|
121
|
+
|
|
122
|
+
### 5. Write the plan on approval, then stop
|
|
123
|
+
|
|
124
|
+
Trigger: user replies `approve` (or equivalent: "ok write it", "looks good,
|
|
125
|
+
save it", etc.).
|
|
126
|
+
|
|
127
|
+
- **Output path:** derive from the spec path by replacing the `-spec` suffix
|
|
128
|
+
with `-plan`.
|
|
129
|
+
- `S4R-10559_ai-adoption-runbook-spec.md` → `S4R-10559_ai-adoption-runbook-plan.md`
|
|
130
|
+
- Both files live in `.claude/artifacts/`.
|
|
131
|
+
- **If the plan file already exists,** ask before overwriting.
|
|
132
|
+
- Write the plan using the same structure as the in-chat preview, plus:
|
|
133
|
+
- A header block with the spec file, ticket key, and the date the plan
|
|
134
|
+
was approved.
|
|
135
|
+
- A "Decisions during planning" section capturing anything the user
|
|
136
|
+
clarified, chose, or ruled out during the discussion.
|
|
137
|
+
- After writing, report the absolute path of the saved file and a
|
|
138
|
+
one-line summary of what was written. **Then stop.**
|
|
139
|
+
|
|
140
|
+
### What "stop" means after approval
|
|
141
|
+
|
|
142
|
+
Approval authorizes **writing the plan file — nothing else.** After the
|
|
143
|
+
file is written, this skill is done. Do **not**:
|
|
144
|
+
|
|
145
|
+
- Start implementation, even partially or "to show what it would look like".
|
|
146
|
+
- Edit any source file, test, config, build file, migration, CI workflow,
|
|
147
|
+
or any other doc.
|
|
148
|
+
- Create a branch, stage changes, or run a build / test / lint.
|
|
149
|
+
- Ask "want me to start implementing now?", "should I create the first
|
|
150
|
+
commit?", or similar follow-up prompts.
|
|
151
|
+
- Suggest next actions beyond a single closing line pointing at the file
|
|
152
|
+
("Plan saved at `<path>` — open a fresh session to implement.").
|
|
153
|
+
|
|
154
|
+
Implementation happens in a separate session that reads the saved plan.
|
|
155
|
+
|
|
156
|
+
## Content rules
|
|
157
|
+
|
|
158
|
+
- **High-level by default.** No line numbers. No code snippets. No
|
|
159
|
+
literal method bodies. No specific SQL. No exact JSON shapes.
|
|
160
|
+
- **Affected files are allowed.** Pointing at `path/to/Service` is fine;
|
|
161
|
+
saying "change line 142 to call `foo()`" is not.
|
|
162
|
+
- **Deeper detail enters only via discussion.** If the user asks
|
|
163
|
+
"what specifically changes in CategoryValidationTree?", you may add a
|
|
164
|
+
short paragraph describing the conceptual change. Still no line-level
|
|
165
|
+
prescriptions.
|
|
166
|
+
- **No invented requirements.** The plan must trace to the spec. If the
|
|
167
|
+
spec is silent on something the plan needs, surface it as an open
|
|
168
|
+
question, not a silent decision.
|
|
169
|
+
- **Verify every file path cited in "Affected areas".** Before presenting
|
|
170
|
+
the plan, confirm each listed path actually exists in the repo. If a
|
|
171
|
+
file is expected to be created by this work, mark it `(new)`. If a path
|
|
172
|
+
was a guess that turned out wrong, fix or remove it. Hallucinated paths
|
|
173
|
+
waste implementation time.
|
|
174
|
+
- **Acceptance Criteria from the spec must be addressable.** Each AC
|
|
175
|
+
should map to something in "Affected areas" or "Test strategy".
|
|
176
|
+
- **No implementation, ever.** Approval means "save the plan", not "start
|
|
177
|
+
coding". The skill ends after the file is written.
|
|
178
|
+
|
|
179
|
+
## Hard rules
|
|
180
|
+
|
|
181
|
+
- **Do not write the plan file until the user approves.** Discussion
|
|
182
|
+
happens in chat; the file is the artifact of agreement.
|
|
183
|
+
- **Do not modify the spec file.** Specs are append-only audit records.
|
|
184
|
+
- **Do not write to `~/.claude/`.** Plans live in the repo's
|
|
185
|
+
`.claude/artifacts/` only.
|
|
186
|
+
- **One plan file per spec.** Do not append to a different spec's plan.
|
|
187
|
+
|
|
188
|
+
## Common mistakes
|
|
189
|
+
|
|
190
|
+
- Starting the deep scan before reading the spec end-to-end.
|
|
191
|
+
- Writing the plan to disk before the user has approved it.
|
|
192
|
+
- Treating approval as a green light to start coding. Approval saves the
|
|
193
|
+
plan; the skill stops there.
|
|
194
|
+
- Offering to "kick off implementation" after writing the file.
|
|
195
|
+
- Including code snippets or line numbers to look thorough — this makes
|
|
196
|
+
the plan rot fast and discourages the implementer from thinking.
|
|
197
|
+
- Skipping the "Out of scope" section. Explicit non-goals prevent scope
|
|
198
|
+
creep during implementation.
|
|
199
|
+
- Treating the spec's AI-gathered Implementation Notes as authoritative.
|
|
200
|
+
They are guesses from a shallower scan; verify before relying on them.
|
|
201
|
+
- Producing a plan that doesn't trace back to Acceptance Criteria.
|