@eltonssouza/development-utility-kit 0.17.0 → 0.18.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.
- package/.claude/CONTEXT.template.md +44 -0
- package/.claude/agents/analyst.md +19 -7
- package/.claude/agents/code-reviewer.md +5 -0
- package/.claude/agents/stack-resolver.md +8 -3
- package/.claude/hooks/flow-state.js +30 -0
- package/.claude/skills/stack-discovery/SKILL.md +7 -0
- package/.claude/skills/to-issues/SKILL.md +10 -6
- package/CLAUDE.md +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# CONTEXT — project domain glossary
|
|
2
|
+
|
|
3
|
+
> Per-repo **ubiquitous-language** glossary (ADR-050). Agents read this before
|
|
4
|
+
> exploring code and use its exact vocabulary in plans, issues, code, and tests.
|
|
5
|
+
> Together with the stack pack it forms the project's working context.
|
|
6
|
+
> Copy this template to the project root as `CONTEXT.md` and fill it in
|
|
7
|
+
> (`stack-discovery` / `create-stack-pack` can seed it for you).
|
|
8
|
+
|
|
9
|
+
## Domain in one paragraph
|
|
10
|
+
|
|
11
|
+
<What this project is, who uses it, and the core value — 2–4 sentences in the
|
|
12
|
+
team's own words.>
|
|
13
|
+
|
|
14
|
+
## Ubiquitous language (the glossary)
|
|
15
|
+
|
|
16
|
+
Use these terms verbatim — never invent synonyms. One row per concept.
|
|
17
|
+
|
|
18
|
+
| Term | Means | NOT to be confused with |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `<Order>` | <a customer's confirmed purchase, after payment> | `Cart` (pre-payment) |
|
|
21
|
+
| `<...>` | <...> | <...> |
|
|
22
|
+
|
|
23
|
+
## Bounded contexts (if multi-context)
|
|
24
|
+
|
|
25
|
+
- `<context-name>` — <responsibility>; owns `<entities>`.
|
|
26
|
+
- (Single-context project: write "single context".)
|
|
27
|
+
|
|
28
|
+
## Core invariants
|
|
29
|
+
|
|
30
|
+
Business rules that must always hold (named, so plans/tests reference them).
|
|
31
|
+
|
|
32
|
+
- `INV-1`: <e.g. an Order always has at least one line item>
|
|
33
|
+
- `INV-2`: <...>
|
|
34
|
+
|
|
35
|
+
## Naming conventions
|
|
36
|
+
|
|
37
|
+
- Entities/tables: <e.g. singular PascalCase entities, snake_case tables>
|
|
38
|
+
- Endpoints: <e.g. `/api/v1/<plural-resource>`>
|
|
39
|
+
- Events/statuses: <the allowed status strings, exactly>
|
|
40
|
+
|
|
41
|
+
## Pointers
|
|
42
|
+
|
|
43
|
+
- ADRs that touch the domain: `docs/brain/decisions/` (or `docs/adr/`)
|
|
44
|
+
- Stack pack: resolved from `## Project Identity` via `stack-resolver`
|
|
@@ -31,17 +31,25 @@ Do NOT generate the PLAN from a free description in the human path.
|
|
|
31
31
|
|
|
32
32
|
Receive an ambiguous feature/bug/task description and distill it into a complete plan with requirements, BDD user stories, sprint ordering, and **DoD criteria written so that each task or sprint can be handed to `/goal <condition>` in Claude Code and run autonomously until the condition is met**.
|
|
33
33
|
|
|
34
|
+
## Synthesis principles (ADR-050)
|
|
35
|
+
|
|
36
|
+
Three patterns shape every plan you write — they are *our* implementations of ideas learned from the community, not optional flavour:
|
|
37
|
+
|
|
38
|
+
- **Domain glossary first (`CONTEXT.md`).** If the project has a `CONTEXT.md` (per-repo ubiquitous-language glossary), read it before anything and use its exact vocabulary throughout the plan — entities, actions, statuses. The glossary + the stack pack together are the project's working context. If absent, propose seeding one in §7 (Decisões pendentes).
|
|
39
|
+
- **Tracer-bullet vertical slices.** Decompose sprints/tasks by **end-to-end vertical slices** that cut through every layer (DB → service → API → UI) and ship something demonstrable — NOT horizontal layers ("all backend, then all frontend"). Each slice is independently shippable and gated.
|
|
40
|
+
- **Deep modules (Ousterhout).** In modeling, prefer **deep modules**: a simple, stable, testable interface hiding substantial functionality. Flag **shallow modules** (interface as wide as the implementation, pass-through) as a smell to consolidate.
|
|
41
|
+
|
|
34
42
|
## Flow
|
|
35
43
|
|
|
36
|
-
1. **Understanding**: objective, personas, flows, criteria, copywriting, constraints. Inspect existing code.
|
|
44
|
+
1. **Understanding**: read `CONTEXT.md` (domain glossary) if present and adopt its vocabulary; then objective, personas, flows, criteria, copywriting, constraints. Inspect existing code.
|
|
37
45
|
2. **Requirements**:
|
|
38
46
|
- **FR** (functional) — what the system does.
|
|
39
47
|
- **NFR** (non-functional) — performance, security, UX.
|
|
40
48
|
- **BR** (business rules) — validations, policies.
|
|
41
49
|
- **IR** (implicit) — permissions, audit, pagination, loading, responsiveness, empty states.
|
|
42
|
-
3. **Modeling**: entities + attributes, relationships, detailed flows, technical mapping (endpoints, components, migrations).
|
|
50
|
+
3. **Modeling**: entities + attributes, relationships, detailed flows, technical mapping (endpoints, components, migrations). **Sketch the modules** you will build/modify and mark each **deep** (simple interface, encapsulated complexity — preferred) or **shallow** (pass-through — consolidate). Use the `CONTEXT.md` vocabulary for module + entity names.
|
|
43
51
|
4. **BDD User Stories**: Given/When/Then for happy path AND edge cases. Priority (S/M/L) and estimate.
|
|
44
|
-
5. **Sprints**: tasks ordered with dependencies.
|
|
52
|
+
5. **Sprints**: tasks ordered with dependencies, decomposed as **tracer-bullet vertical slices** — each task/slice cuts end-to-end (DB → service → API → UI as applicable) and is independently demonstrable + gated, never a horizontal layer.
|
|
45
53
|
6. **Risks and pending items**: ambiguities (mark as "ask the client"), `tech-lead` decisions.
|
|
46
54
|
7. **Goal-ready DoD**: for every task and every sprint, write a Definition of Done that a `/goal` evaluator (Haiku by default) can verify objectively from command output or file inspection. See §"Goal-ready output rules" below.
|
|
47
55
|
8. **Generate**: `docs/plans/PLAN_<NAME>.md` following the canonical structure (§"Plan structure").
|
|
@@ -100,11 +108,12 @@ The generated `docs/plans/PLAN_<NAME>.md` must have these sections in this order
|
|
|
100
108
|
|
|
101
109
|
## 5. Sprints
|
|
102
110
|
### Sprint 1 — <tema>
|
|
103
|
-
- Tasks (
|
|
104
|
-
1. T-001 <
|
|
105
|
-
- Cobre US-001
|
|
111
|
+
- Tasks = tracer-bullet vertical slices (cada uma corta DB→service→API→UI e é demonstrável):
|
|
112
|
+
1. T-001 <slice end-to-end, ex: "criar produto: migration + endpoint POST + tela mínima de cadastro">
|
|
113
|
+
- Cobre US-001 (happy path da fatia)
|
|
114
|
+
- Módulos: <deep: X | shallow a consolidar: Y>
|
|
106
115
|
- DoD: <condição machine-checkable>
|
|
107
|
-
2. T-002
|
|
116
|
+
2. T-002 <próxima fatia vertical, ex: "listar produtos: query + GET + tela de listagem">
|
|
108
117
|
|
|
109
118
|
### Sprint 2 — ...
|
|
110
119
|
|
|
@@ -165,6 +174,9 @@ retornou GO.
|
|
|
165
174
|
6. **§8 `/goal` block ends the file.** Always present, never empty. If the plan has a single sprint, you still emit one sprint-level `/goal` plus one final goal.
|
|
166
175
|
7. **No AI/Claude/Anthropic/LLM references in the plan prose.** The PLAN must read as written by the engineering team. Same restriction as commits.
|
|
167
176
|
8. **Filename**: `docs/plans/PLAN_<NAME_KEBAB_CASE>.md`. No spaces, no accents in filename — slug derived from the feature name.
|
|
177
|
+
9. **Tracer-bullet decomposition (ADR-050).** Sprints/tasks are vertical end-to-end slices, never horizontal layers. A task that touches only one layer must be justified (e.g. a pure migration) or merged into a slice.
|
|
178
|
+
10. **Deep modules (ADR-050).** §3 marks each module deep/shallow; shallow modules are flagged for consolidation, not shipped silently.
|
|
179
|
+
11. **Domain glossary (ADR-050).** If `CONTEXT.md` exists, the plan uses its vocabulary verbatim; if absent, §7 proposes seeding it.
|
|
168
180
|
|
|
169
181
|
## Interface
|
|
170
182
|
|
|
@@ -77,6 +77,11 @@ For any check above, the **STACK CONTEXT pack overrides** when more specific (e.
|
|
|
77
77
|
|
|
78
78
|
## 4. Cross-cutting checks (universal)
|
|
79
79
|
|
|
80
|
+
### Design — deep modules (ADR-050)
|
|
81
|
+
- Prefer **deep modules**: simple, stable interface hiding substantial functionality.
|
|
82
|
+
- Flag **shallow modules** as MINOR/MAJOR: interface as wide/complex as the implementation, pure pass-through wrappers, or a class that just forwards to another. Recommend consolidation.
|
|
83
|
+
- New names match the project's `CONTEXT.md` glossary (if present) — flag vocabulary drift as MINOR.
|
|
84
|
+
|
|
80
85
|
### Security (delegate hard cases to `security-engineer`)
|
|
81
86
|
- Token / password / PII not logged.
|
|
82
87
|
- CORS not `permitAll` in production.
|
|
@@ -24,15 +24,16 @@ Read project's CLAUDE.md, parse `## Project Identity`, identify Primary stack, l
|
|
|
24
24
|
6. **Read the pack**:
|
|
25
25
|
- If pack exists -> Read it -> return rendered STACK CONTEXT block (see §Output below).
|
|
26
26
|
- If pack absent -> **hard-fail** with `PACK_MISSING_ERROR` (see §Hard-fail protocol below). Do NOT silently fall through to defaults. Do NOT invent a pack.
|
|
27
|
-
7. **
|
|
28
|
-
|
|
27
|
+
7. **Read the domain glossary (ADR-050)**: check the project root for `CONTEXT.md` (per-repo ubiquitous-language glossary). If present, read it and append a `DOMAIN GLOSSARY` section to the output so downstream agents use the project's exact vocabulary. If absent, note `Domain glossary: none (suggest seeding CONTEXT.md)` — non-fatal.
|
|
28
|
+
8. **Always emit first-line tag** for validation by invoking skill:
|
|
29
|
+
`[STACK: <lang>/<framework>-<major> | PACK: loaded|none | GLOSSARY: present|none]`
|
|
29
30
|
|
|
30
31
|
## Output format
|
|
31
32
|
|
|
32
33
|
When pack loaded:
|
|
33
34
|
|
|
34
35
|
```
|
|
35
|
-
[STACK: java/spring-boot-3 | PACK: loaded]
|
|
36
|
+
[STACK: java/spring-boot-3 | PACK: loaded | GLOSSARY: present]
|
|
36
37
|
|
|
37
38
|
=== STACK CONTEXT ===
|
|
38
39
|
Language: java
|
|
@@ -43,6 +44,9 @@ Pack path: .claude/stacks/java/spring-boot-3.md
|
|
|
43
44
|
|
|
44
45
|
=== STACK RULES (inline — do not Read again) ===
|
|
45
46
|
<full pack content, including frontmatter, all 10 sections>
|
|
47
|
+
|
|
48
|
+
=== DOMAIN GLOSSARY (CONTEXT.md — use this vocabulary) ===
|
|
49
|
+
<full CONTEXT.md content if present, else: "none — suggest seeding CONTEXT.md">
|
|
46
50
|
=== END STACK CONTEXT ===
|
|
47
51
|
```
|
|
48
52
|
|
|
@@ -91,6 +95,7 @@ When the pack is absent, before emitting `PACK_MISSING_ERROR`:
|
|
|
91
95
|
5. **No agent dispatch** — this agent is a leaf; invokers (skills) dispatch others based on the resolver's output.
|
|
92
96
|
6. **Hard-fail on missing pack** — no silent fallback. `PACK_MISSING_ERROR` is mandatory. Invokers must stop or present bypass confirmation. This is non-negotiable (ADR-026 T1.2).
|
|
93
97
|
7. **Always suggest nearest packs** — a resolver that returns only "not found" without suggestions violates this contract.
|
|
98
|
+
8. **Domain glossary is non-fatal (ADR-050)** — read project `CONTEXT.md` if present and append it; if absent, note it and proceed. Never hard-fail on a missing glossary (unlike a missing pack).
|
|
94
99
|
|
|
95
100
|
## Interface
|
|
96
101
|
|
|
@@ -129,6 +129,36 @@ function deriveState(projectRoot) {
|
|
|
129
129
|
// docs/plans/ does not exist — no plan artifacts
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
// Local-files issue layer (ADR-050): .scratch/<feature>/ is an OPTIONAL,
|
|
133
|
+
// governed alternative to docs/ artifacts. A PRD.md counts as discovery; an
|
|
134
|
+
// issues/ dir with at least one issue counts as a plan. So governance still
|
|
135
|
+
// holds for projects that use the issue-style local files instead of docs/.
|
|
136
|
+
try {
|
|
137
|
+
const scratch = path.join(root, '.scratch');
|
|
138
|
+
for (const feat of fs.readdirSync(scratch)) {
|
|
139
|
+
const featDir = path.join(scratch, feat);
|
|
140
|
+
let isDir = false;
|
|
141
|
+
try { isDir = fs.statSync(featDir).isDirectory(); } catch { /* skip */ }
|
|
142
|
+
if (!isDir) continue;
|
|
143
|
+
if (!discoveryArtifact && fs.existsSync(path.join(featDir, 'PRD.md'))) {
|
|
144
|
+
discoveryArtifact = path.join(featDir, 'PRD.md');
|
|
145
|
+
if (!activeFeature) activeFeature = feat;
|
|
146
|
+
}
|
|
147
|
+
if (!planArtifact) {
|
|
148
|
+
const issuesDir = path.join(featDir, 'issues');
|
|
149
|
+
try {
|
|
150
|
+
const issues = fs.readdirSync(issuesDir).filter((f) => f.endsWith('.md'));
|
|
151
|
+
if (issues.length > 0) {
|
|
152
|
+
planArtifact = path.join(issuesDir, issues.sort()[0]);
|
|
153
|
+
if (!activeFeature) activeFeature = feat;
|
|
154
|
+
}
|
|
155
|
+
} catch { /* no issues/ dir */ }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
// .scratch/ does not exist — no local-files issue artifacts
|
|
160
|
+
}
|
|
161
|
+
|
|
132
162
|
// Determine stage
|
|
133
163
|
let stage = 'none';
|
|
134
164
|
if (planArtifact) {
|
|
@@ -108,6 +108,13 @@ Use `Edit` para substituir SOMENTE a seção `## Project Identity` em `CLAUDE.md
|
|
|
108
108
|
> "Pack `.claude/stacks/java/spring-boot-5.md` não existe. Disparando `create-stack-pack` para gerar antes de continuar."
|
|
109
109
|
Depois que `create-stack-pack` retorna, feche com o output normal.
|
|
110
110
|
|
|
111
|
+
### Step 7 — Seed CONTEXT.md (domain glossary — ADR-050)
|
|
112
|
+
|
|
113
|
+
Se o projeto **não** tem `CONTEXT.md` no root, ofereça semear a partir do template:
|
|
114
|
+
> "Quer que eu crie um `CONTEXT.md` (glossário de domínio) a partir do template? Os agents usam o vocabulário dele em planos/issues/código."
|
|
115
|
+
|
|
116
|
+
Se **sim**: copie `.claude/CONTEXT.template.md` para `CONTEXT.md` no root e pré-preencha o que já souber da sabatina (domínio em 1 parágrafo + 2-3 termos do glossário). Deixe o resto como placeholder pro user completar. Não bloqueia o fim da skill (opcional).
|
|
117
|
+
|
|
111
118
|
## 5. Inviolable rules
|
|
112
119
|
|
|
113
120
|
1. **Sabatina conversacional, opt-in.** Nunca rode em CI, `sprint-runner`, ou qualquer fluxo autônomo.
|
|
@@ -54,13 +54,17 @@ Read the full `PRD_*.md`. Extract from each section:
|
|
|
54
54
|
|
|
55
55
|
If `docs/issues/` does not exist, create it. Use `Write` to create `docs/issues/.gitkeep` if needed, then proceed to write the ISSUES file.
|
|
56
56
|
|
|
57
|
-
### Step 4 — Decompose into issues
|
|
57
|
+
### Step 4 — Decompose into issues (tracer-bullet vertical slices — ADR-050)
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
59
|
+
Decompose by **tracer-bullet vertical slices**, not horizontal layers. Each issue cuts **end-to-end** through every layer it needs (DB → service → API → UI) and ships something demonstrable on its own — never "backend of feature X" + "frontend of feature X" as separate issues.
|
|
60
|
+
|
|
61
|
+
Rules:
|
|
62
|
+
- **One issue per vertical slice.** A User Story is usually one slice; if a story spans layers, the issue still owns the whole slice end-to-end.
|
|
63
|
+
- **First slice = the thinnest end-to-end path** that proves the architecture (the literal "tracer bullet"). Order issues so the thinnest walking-skeleton slice ships first.
|
|
64
|
+
- Additional issues for cross-cutting NFRs (security hardening, a11y audit, performance baseline) when they are distinct, shippable items.
|
|
65
|
+
- Do NOT create an issue for items in `## Out of scope`.
|
|
66
|
+
- Granularity: each slice completable in one sprint by one developer. Split large stories **by slice** (e.g. "create + read" then "update + delete"), never by layer.
|
|
67
|
+
- Use the project's `CONTEXT.md` glossary vocabulary in titles/bodies if present.
|
|
64
68
|
|
|
65
69
|
### Step 5 — Write ISSUES_*.md
|
|
66
70
|
|
package/CLAUDE.md
CHANGED
|
@@ -250,8 +250,21 @@ These thresholds are **universal across stacks**. Stack-specific tooling (JaCoCo
|
|
|
250
250
|
|
|
251
251
|
- **Clean Code + SOLID** applied through code, without naming names ostentatiously.
|
|
252
252
|
- **No premature abstraction**. Interface for one implementation = code smell.
|
|
253
|
+
- **Prefer deep modules** (Ousterhout, ADR-050): a **simple, stable interface hiding substantial functionality**. A **shallow module** — interface as wide/complex as its implementation, or a pure pass-through — is a smell; consolidate it. `analyst` marks modules deep/shallow in the plan; `code-reviewer`/`tech-lead` flag shallow ones in review.
|
|
253
254
|
- **Never suggest a technology without justification**. Simplest solution = best.
|
|
254
255
|
|
|
256
|
+
## Project domain glossary — `CONTEXT.md` (ADR-050)
|
|
257
|
+
|
|
258
|
+
A project MAY ship a root `CONTEXT.md` (per-repo ubiquitous-language glossary — terms, bounded contexts, invariants, naming). When present, **agents read it before exploring code and use its vocabulary verbatim** in plans, issues, code, and tests. `stack-resolver` surfaces it alongside the stack pack (`DOMAIN GLOSSARY` block); together they are the project's working context. Seed one from `.claude/CONTEXT.template.md` (`stack-discovery` offers this). Absent glossary is non-fatal.
|
|
259
|
+
|
|
260
|
+
## Decomposition — tracer-bullet vertical slices (ADR-050)
|
|
261
|
+
|
|
262
|
+
Features are decomposed into **end-to-end vertical slices** (DB → service → API → UI) that each ship something demonstrable — never horizontal layers ("all backend, then all frontend"). The thinnest end-to-end slice ships first (the walking skeleton). `analyst` and `to-issues` own this; `sprint-runner` executes slice by slice.
|
|
263
|
+
|
|
264
|
+
## Optional local-files issue layer — `.scratch/` (ADR-050)
|
|
265
|
+
|
|
266
|
+
Projects may use an **issue-style local-files layer** instead of (or alongside) the `docs/discovery|prd|plans/` artifacts: one dir per feature at `.scratch/<feature-slug>/` with `PRD.md` and `issues/NN-<slug>.md` (each issue carries a `Status:` line). This is **governed** — `flow-guard` recognizes `.scratch/<feature>/PRD.md` as a discovery artifact and `.scratch/<feature>/issues/*.md` as a plan artifact, so the same prerequisite gating applies. It is an option, not a replacement; the `docs/` file pipeline remains the default.
|
|
267
|
+
|
|
255
268
|
## Backend layout (DDD, universal pattern)
|
|
256
269
|
|
|
257
270
|
The package/folder names below are **conceptual** — actual naming may vary by language (`com.company.project/domain/...` in Java, `app/domain/...` in Python, `internal/domain/...` in Go):
|