@andresmassello/uscha 1.51.3 → 1.53.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.
@@ -1,161 +1,203 @@
1
- ---
2
- name: uscha-discovery
3
- description: >
4
- Front of the methodology for greenfield work. From a general idea (plus optional
5
- reference docs, URLs, PDFs, or an existing codebase), grill the user ONE question at
6
- a time — each with your recommended answer — PROPOSING the system shape (domain model,
7
- API/operation surface, architecture options) so the human approves instead of authors.
8
- Write the spec package (CONTEXT.md, SPEC.md, docs/adr/*.md, ACCEPTANCE.md, RISKS.md,
9
- HANDOFF.md) directly to the repo as decisions crystallize. Invoke for "discovery",
10
- "modelá esto desde una idea", "solo tengo la idea, no sé el cómo todavía".
11
- allowed-tools: Read, Write, Glob, Grep, WebFetch
12
- disable-model-invocation: false
13
- ---
14
-
15
- # discovery — from a bare idea to a writable spec package
16
-
17
- The human brings the idea, the constraints and the reference material. **You bring the
18
- shape.** Your job is to interrogate until there is a shared system shape, and to write
19
- the documents as you go — not to ask the human to design the system for you.
20
-
21
- ## Non-negotiable principles
22
-
23
- 1. **One question at a time, each WITH your recommended answer.** This is the inversion
24
- that makes discovery work: you propose (entities, endpoints, architecture, a default
25
- decision), the human confirms or corrects. Never dump a list of 20 questions, and
26
- never ask the human to supply structure you can propose yourself.
27
- 2. **Explore instead of asking.** If a reference doc/URL/PDF, the existing codebase, or
28
- an existing `CONTEXT.md`/`docs/adr/` can answer a question, read it first. Only ask
29
- the human what genuinely requires their judgment.
30
- 3. **Propose the shape.** From the idea + references, propose the core entities, the
31
- operation/API surface, and 2–3 architecture options with trade-offs. Walk the design
32
- tree branch by branch, resolving dependencies between decisions one at a time.
33
- 4. **Grill, don't agree.** Surface contradictions, fuzzy/overloaded terms, missing
34
- failure modes and unstated constraints. A discovery where you agreed with everything
35
- failed.
36
- 5. **Write files lazily and inline.** Create a file only when you have something real to
37
- write, and update it the moment a decision crystallizes — don't batch to the end.
38
-
39
- ## Inputs
40
-
41
- - **The idea** (required): what the human wants to achieve. It doesn't have to be
42
- complete or well-formed.
43
- - **Reference material** (optional): manuals, PDFs, URLs, API specs. Read them with
44
- WebFetch/Read before proposing they are how you propose an accurate shape.
45
- - **Existing codebase** (optional): if present, explore it; respect `CONTEXT.md` and
46
- existing ADRs.
47
-
48
- ## Domain awareness (explore first)
49
-
50
- - Look for `CONTEXT.md` (domain glossary), `CONSTITUTION.md` (project invariants) and
51
- `docs/adr/` and read them. The CONSTITUTION constrains every shape you propose — never
52
- propose anything that would violate it.
53
- - **Sharpen fuzzy language.** When the human uses a vague or overloaded term, propose a
54
- precise canonical term: "You say 'account' the Customer or the User? They're different things."
55
- - **Maintain a glossary in `CONTEXT.md`**, updated inline as each term is resolved. Only
56
- terms meaningful to domain experts; don't couple it to implementation details.
57
-
58
- ## The grilling agenda (walk the tree, propose at each step)
59
-
60
- Resolve these in order; for each, propose first, then ask. Skip what references already
61
- answer.
62
-
63
- 0. **Project name (first).** The very first thing you ask: "What do we call this?" Write the
64
- answer to `uscha.config.json` as `"project": "<name>"` (create the config if absent). The
65
- mirador shows it prominently at the top and the dashboard reads it from there; if unset it
66
- falls back to the joined repo names.
67
- 1. **Purpose / value / why now.** What job does this remove? Cost of not doing it?
68
- 2. **Domain model.** Propose the core entities and their relationships. ("From the domain
69
- I deduce these core entities: do they work for you, or is one missing?")
70
- 3. **Operation / API surface.** Propose the endpoints/operations and their
71
- contracts (idempotency, status codes).
72
- 4. **Big decisions (→ ADR).** Propose 2–3 architecture options with trade-offs and
73
- a recommended default: persistence, protocol, idempotency, sync/async, multi-tenancy.
74
- 5. **Behavior and dirty cases.** Happy path, then failures, retries, partial states,
75
- concurrency, what must NOT happen.
76
- 6. **Inviolable constraints (→ `CONSTITUTION.md`).** Domain + security + operation
77
- rules that can't be broken (money to the cent, no numbering gaps, never cross
78
- environments, secrets never logged, auth). Write/extend `CONSTITUTION.md` with these —
79
- one invariant per line, with a CWE reference where it maps. They feed the severity gate
80
- downstream, and a breach is a BLOCKER, never a trade-off.
81
- 7. **Out of scope.** Explicit boundaries with forward references.
82
- 8. **Acceptance / Definition of Done.** Concrete, checkable criteria + success metrics.
83
- 9. **Quality bar ( config, kit 1.17.0).** "What level of quality is ENOUGH here, and which
84
- dimensions are negotiable (coverage, perf, security)?" Propose thresholds fit for
85
- the risk profile (a payments core is not an internal dashboard). What the human
86
- declares goes into `uscha.config.json` (`defaults.coverage_threshold`,
87
- `defaults.readiness_caps`, `defaults.simplicity`) — a declared threshold reads as
88
- **requerimiento (config)** in the engine's output; an undeclared one stays a kit
89
- default (opinion) and is labeled as such. Declaring is committing the config.
90
- 10. **Residual risks and dependencies.** What's uncertain, what must exist first.
91
- For each HIGH-uncertainty risk, ask (kit 1.19.0, Tip 21 'Prototype to Learn'):
92
- "Does it warrant a time-boxed spike before freezing the SPEC?" A spike runs on a
93
- `spike/*` branch and its ONLY legitimate output is an **ADR with lessons**
94
- (facts that feed the SPEC)never mergeable code. The contract is executable:
95
- `phase --require pr-ready` refuses any `spike/*` branch, INV-GOLDEN-01 style.
96
-
97
- ## Files to write (lazily, inline)
98
-
99
- - **`CONTEXT.md`** — domain glossary; create on first resolved term, update as you go.
100
- - **`CONSTITUTION.md`** project invariants no ADR/SPEC may violate (security with CWE
101
- refs, domain rules, operation). Create/extend from the "restricciones inviolables" step.
102
- This is the layer above the ADRs; a breach is a BLOCKER finding downstream.
103
- - **`DOMAIN-MODEL.md`** the proposed core entities and their relationships (the "shape"
104
- you proposed and the human approved). Distinct from the glossary: this is the model, not
105
- the vocabulary.
106
- - **`SPEC.md`** objective/value, risk, scope/out-of-scope, behavior,
107
- inputs/outputs/errors, acceptance, test plan, operation, rollback.
108
- - **`docs/adr/ADR-NNN-<slug>.md`** one per durable decision. Format: Status
109
- (proposed/accepted/**experiment**/deprecated/superseded) · Context · Alternatives · Decision ·
110
- Consequences · **Implementation Plan** (affected paths, patterns to follow, tests to
111
- write) · **Verification** (`- [ ]` checkboxes a coding agent can check). The
112
- Implementation Plan makes the ADR an executable spec: the agent implements it without
113
- asking follow-ups. Number from the highest existing ADR. Use `Status: Experiment` only
114
- for a bounded, reversible hypothesis that needs real feedback; include `Hypothesis`,
115
- `Feedback Signal`, `Review By` or `Review Trigger`, `Promote Criteria`, and
116
- `Rollback / Supersede Criteria`.
117
- - **`ACCEPTANCE.md`** Definition of Done as `- [ ]` checkboxes + success metrics. This
118
- is the file the readiness KPI measures downstream. Give EVERY criterion a stable
119
- traceable ID: `- [ ] AC-01 when X then Y` (sequential, never reused). Downstream,
120
- a criterion only closes MEASURED when a green testcase carries its tag in the name
121
- (`test_ac1_x` / `testAC01X` / `"AC-01: ..."`) write criteria so each one is
122
- coverable by at least one named test.
123
- - **`RISKS.md`** residual risks, assumptions, points needing human approval.
124
- - **`HANDOFF.md`** what to read before coding + hard "no hacer" rules + required evidence.
125
-
126
- ## Offer ADRs sparingly
127
-
128
- Only write an ADR when ALL three hold (otherwise it's noise that buries the important ones):
129
- 1. **Hard to reverse** changing your mind later has real cost.
130
- 2. **Surprising without context** a future reader will wonder "why this way?".
131
- 3. **A real trade-off** there were genuine alternatives and you chose one for reasons.
132
-
133
- ## Convergence finish when
134
-
135
- A shared system shape exists: entities, operations and big decisions taken (or recorded
136
- as explicit assumptions), every failure mode has defined behavior, out-of-scope is
137
- explicit, and the DoD is checkable. State plainly that it converged, then write/finalize
138
- the package and the handoff.
139
-
140
- ## Handoff
141
-
142
- End with the implementation handoff (works for a human, an agent, or CI):
143
-
144
- > "Read CONTEXT.md, SPEC.md, docs/adr/*.md and ACCEPTANCE.md. Before touching code:
145
- > 1) summarize the expected behavior, 2) flag ambiguities or contradictions,
146
- > 3) propose a file plan + tests. Implement only the SPEC's scope. Do not change
147
- > contracts outside the SPEC, and do not edit the SPEC to make your implementation look correct."
148
-
149
- Flow: `/uscha-discovery` (idea → package) `/uscha-devloop` (build + QA + evidence) → human gate.
150
-
151
- ## Relationship to adr-refine
152
-
153
- `uscha-discovery` is the greenfield front: you only have an idea, so the skill PROPOSES the
154
- shape. `uscha-adr-refine` is the same interview applied to a KNOWN feature where the shape is
155
- already clear and you only need precision. Both emit the same package; pick by starting
156
- point.
157
-
158
- ## Tracked-markdown protocol
159
-
160
- If a target `.md` already exists and is tracked, ask for its current version before
161
- overwritingnever silently replace real progress.
1
+ ---
2
+ name: uscha-discovery
3
+ description: >
4
+ Front of the methodology for greenfield work. From a general idea (plus optional
5
+ reference docs, URLs, PDFs, or an existing codebase), grill the user ONE question at
6
+ a time — each with your recommended answer — PROPOSING the system shape (domain model,
7
+ API/operation surface, architecture options) so the human approves instead of authors.
8
+ Write the spec package (CONTEXT.md, SPEC.md, docs/adr/*.md, ACCEPTANCE.md, RISKS.md,
9
+ HANDOFF.md) directly to the repo as decisions crystallize. Invoke for "discovery",
10
+ "modelá esto desde una idea", "solo tengo la idea, no sé el cómo todavía".
11
+ allowed-tools: Read, Write, Glob, Grep, WebFetch
12
+ disable-model-invocation: false
13
+ ---
14
+
15
+ # discovery — from a bare idea to a writable spec package
16
+
17
+ The human brings the idea, the constraints and the reference material. **You bring the
18
+ shape.** Your job is to interrogate until there is a shared system shape, and to write
19
+ the documents as you go — not to ask the human to design the system for you.
20
+
21
+ ## Orientation markers (non-negotiable)
22
+
23
+ The operator must never have to ask "where am I?" or "what happens now?". Two markers, always.
24
+ They are navigation, not ceremony: one line per turn, one block at the end.
25
+
26
+ **Open every turn with a breadcrumb**, then the content:
27
+
28
+ `[uscha · discovery · <step> <target>]`
29
+
30
+ - `<step>` `Q<n>` for a question, `pass <n>` for a loop iteration, `step <n>` otherwise.
31
+ Count what has actually happened. **Never write a denominator** (`Q4/12`): this phase
32
+ converges, its length is not known in advance, and an invented total is exactly the kind of
33
+ narrated number the method forbids. **When the ledger already measures the count** (the QA
34
+ loop's `loop_count`), use the measured number never keep a parallel tally of your own.
35
+ - `<target>` — the artifact this turn feeds (`SPEC`, `ADR-003`, `ACCEPTANCE`, `LEDGER`,
36
+ `RECEIVED`, ...). Drop `→ <target>` only when the turn genuinely feeds none.
37
+
38
+ **Close with the close block ONCE, when the skill finishes** — not on every turn. Ending
39
+ without it is a defect, even when the phase converged cleanly:
40
+
41
+ ```
42
+ [uscha · discovery · CLOSED]
43
+ Produced: <files actually written, or "nothing">
44
+ Blocks: <what stands between here and the next phase, or "nothing">
45
+ Next: <the next action, and why it is that one>
46
+ Run: <the exact command or skill to invoke>
47
+ ```
48
+
49
+ This is **not** the implementation handoff some skills also emit: that one is a prompt for
50
+ whoever implements next, this one is navigation for the human operator, and both can appear.
51
+
52
+ `Blocks` and `Next` are **derived from the state you just produced** — never copied from a
53
+ fixed route, **including any `Flow:` line in this file**. Those lines are the nominal path;
54
+ open ADR experiments, an unclosed spike, an unapproved golden or a red gate all change what
55
+ genuinely comes next, and the derived answer wins. If the next phase cannot start yet, name it
56
+ and say exactly what unblocks it.
57
+
58
+ Keep the CONTENT in the conversation's language, but keep the labels (`CLOSED`, `Produced`,
59
+ `Blocks`, `Next`, `Run`) verbatim — they are the method's vocabulary and the smoke checks them.
60
+
61
+ ## Non-negotiable principles
62
+
63
+ 1. **One question at a time, each WITH your recommended answer.** This is the inversion
64
+ that makes discovery work: you propose (entities, endpoints, architecture, a default
65
+ decision), the human confirms or corrects. Never dump a list of 20 questions, and
66
+ never ask the human to supply structure you can propose yourself.
67
+ 2. **Explore instead of asking.** If a reference doc/URL/PDF, the existing codebase, or
68
+ an existing `CONTEXT.md`/`docs/adr/` can answer a question, read it first. Only ask
69
+ the human what genuinely requires their judgment.
70
+ 3. **Propose the shape.** From the idea + references, propose the core entities, the
71
+ operation/API surface, and 2–3 architecture options with trade-offs. Walk the design
72
+ tree branch by branch, resolving dependencies between decisions one at a time.
73
+ 4. **Grill, don't agree.** Surface contradictions, fuzzy/overloaded terms, missing
74
+ failure modes and unstated constraints. A discovery where you agreed with everything
75
+ failed.
76
+ 5. **Write files lazily and inline.** Create a file only when you have something real to
77
+ write, and update it the moment a decision crystallizes don't batch to the end.
78
+
79
+ ## Inputs
80
+
81
+ - **The idea** (required): what the human wants to achieve. It doesn't have to be
82
+ complete or well-formed.
83
+ - **Reference material** (optional): manuals, PDFs, URLs, API specs. Read them with
84
+ WebFetch/Read before proposing they are how you propose an accurate shape.
85
+ - **Existing codebase** (optional): if present, explore it; respect `CONTEXT.md` and
86
+ existing ADRs.
87
+
88
+ ## Domain awareness (explore first)
89
+
90
+ - Look for `CONTEXT.md` (domain glossary), `CONSTITUTION.md` (project invariants) and
91
+ `docs/adr/` and read them. The CONSTITUTION constrains every shape you propose — never
92
+ propose anything that would violate it.
93
+ - **Sharpen fuzzy language.** When the human uses a vague or overloaded term, propose a
94
+ precise canonical term: "You say 'account' the Customer or the User? They're different things."
95
+ - **Maintain a glossary in `CONTEXT.md`**, updated inline as each term is resolved. Only
96
+ terms meaningful to domain experts; don't couple it to implementation details.
97
+
98
+ ## The grilling agenda (walk the tree, propose at each step)
99
+
100
+ Resolve these in order; for each, propose first, then ask. Skip what references already
101
+ answer.
102
+
103
+ 0. **Project name (first).** The very first thing you ask: "What do we call this?" Write the
104
+ answer to `uscha.config.json` as `"project": "<name>"` (create the config if absent). The
105
+ mirador shows it prominently at the top and the dashboard reads it from there; if unset it
106
+ falls back to the joined repo names.
107
+ 1. **Purpose / value / why now.** What job does this remove? Cost of not doing it?
108
+ 2. **Domain model.** Propose the core entities and their relationships. ("From the domain
109
+ I deduce these core entities: do they work for you, or is one missing?")
110
+ 3. **Operation / API surface.** Propose the endpoints/operations and their
111
+ contracts (idempotency, status codes).
112
+ 4. **Big decisions (→ ADR).** Propose 2–3 architecture options with trade-offs and
113
+ a recommended default: persistence, protocol, idempotency, sync/async, multi-tenancy.
114
+ 5. **Behavior and dirty cases.** Happy path, then failures, retries, partial states,
115
+ concurrency, what must NOT happen.
116
+ 6. **Inviolable constraints (→ `CONSTITUTION.md`).** Domain + security + operation
117
+ rules that can't be broken (money to the cent, no numbering gaps, never cross
118
+ environments, secrets never logged, auth). Write/extend `CONSTITUTION.md` with these
119
+ one invariant per line, with a CWE reference where it maps. They feed the severity gate
120
+ downstream, and a breach is a BLOCKER, never a trade-off.
121
+ 7. **Out of scope.** Explicit boundaries with forward references.
122
+ 8. **Acceptance / Definition of Done.** Concrete, checkable criteria + success metrics.
123
+ 9. **Quality bar (→ config, kit 1.17.0).** "What level of quality is ENOUGH here, and which
124
+ dimensions are negotiable (coverage, perf, security)?" Propose thresholds fit for
125
+ the risk profile (a payments core is not an internal dashboard). What the human
126
+ declares goes into `uscha.config.json` (`defaults.coverage_threshold`,
127
+ `defaults.readiness_caps`, `defaults.simplicity`) — a declared threshold reads as
128
+ **requerimiento (config)** in the engine's output; an undeclared one stays a kit
129
+ default (opinion) and is labeled as such. Declaring is committing the config.
130
+ 10. **Residual risks and dependencies.** What's uncertain, what must exist first.
131
+ For each HIGH-uncertainty risk, ask (kit 1.19.0, Tip 21 'Prototype to Learn'):
132
+ "Does it warrant a time-boxed spike before freezing the SPEC?" A spike runs on a
133
+ `spike/*` branch and its ONLY legitimate output is an **ADR with lessons**
134
+ (facts that feed the SPEC) — never mergeable code. The contract is executable:
135
+ `phase --require pr-ready` refuses any `spike/*` branch, INV-GOLDEN-01 style.
136
+
137
+ ## Files to write (lazily, inline)
138
+
139
+ - **`CONTEXT.md`** — domain glossary; create on first resolved term, update as you go.
140
+ - **`CONSTITUTION.md`** — project invariants no ADR/SPEC may violate (security with CWE
141
+ refs, domain rules, operation). Create/extend from the "restricciones inviolables" step.
142
+ This is the layer above the ADRs; a breach is a BLOCKER finding downstream.
143
+ - **`DOMAIN-MODEL.md`** — the proposed core entities and their relationships (the "shape"
144
+ you proposed and the human approved). Distinct from the glossary: this is the model, not
145
+ the vocabulary.
146
+ - **`SPEC.md`** objective/value, risk, scope/out-of-scope, behavior,
147
+ inputs/outputs/errors, acceptance, test plan, operation, rollback.
148
+ - **`docs/adr/ADR-NNN-<slug>.md`** — one per durable decision. Format: Status
149
+ (proposed/accepted/**experiment**/deprecated/superseded) · Context · Alternatives · Decision ·
150
+ Consequences · **Implementation Plan** (affected paths, patterns to follow, tests to
151
+ write) · **Verification** (`- [ ]` checkboxes a coding agent can check). The
152
+ Implementation Plan makes the ADR an executable spec: the agent implements it without
153
+ asking follow-ups. Number from the highest existing ADR. Use `Status: Experiment` only
154
+ for a bounded, reversible hypothesis that needs real feedback; include `Hypothesis`,
155
+ `Feedback Signal`, `Review By` or `Review Trigger`, `Promote Criteria`, and
156
+ `Rollback / Supersede Criteria`.
157
+ - **`ACCEPTANCE.md`** — Definition of Done as `- [ ]` checkboxes + success metrics. This
158
+ is the file the readiness KPI measures downstream. Give EVERY criterion a stable
159
+ traceable ID: `- [ ] AC-01 — when X then Y` (sequential, never reused). Downstream,
160
+ a criterion only closes MEASURED when a green testcase carries its tag in the name
161
+ (`test_ac1_x` / `testAC01X` / `"AC-01: ..."`) write criteria so each one is
162
+ coverable by at least one named test.
163
+ - **`RISKS.md`** — residual risks, assumptions, points needing human approval.
164
+ - **`HANDOFF.md`** — what to read before coding + hard "no hacer" rules + required evidence.
165
+
166
+ ## Offer ADRs sparingly
167
+
168
+ Only write an ADR when ALL three hold (otherwise it's noise that buries the important ones):
169
+ 1. **Hard to reverse** — changing your mind later has real cost.
170
+ 2. **Surprising without context** — a future reader will wonder "why this way?".
171
+ 3. **A real trade-off** — there were genuine alternatives and you chose one for reasons.
172
+
173
+ ## Convergence — finish when
174
+
175
+ A shared system shape exists: entities, operations and big decisions taken (or recorded
176
+ as explicit assumptions), every failure mode has defined behavior, out-of-scope is
177
+ explicit, and the DoD is checkable. State plainly that it converged, then write/finalize
178
+ the package and the handoff.
179
+
180
+ ## Handoff
181
+
182
+ End with the implementation handoff (works for a human, an agent, or CI):
183
+
184
+ > "Read CONTEXT.md, SPEC.md, docs/adr/*.md and ACCEPTANCE.md. Before touching code:
185
+ > 1) summarize the expected behavior, 2) flag ambiguities or contradictions,
186
+ > 3) propose a file plan + tests. Implement only the SPEC's scope. Do not change
187
+ > contracts outside the SPEC, and do not edit the SPEC to make your implementation look correct."
188
+
189
+ Flow: `/uscha-discovery` (idea → package) → `/uscha-devloop` (build + QA + evidence) → human gate.
190
+
191
+ That route is the **nominal** one, not the answer: the `Next:`/`Run:` you emit in the close block are DERIVED from the state you actually produced, and override it whenever an open experiment, an unclosed spike, an unapproved golden or a red gate stands in between.
192
+
193
+ ## Relationship to adr-refine
194
+
195
+ `uscha-discovery` is the greenfield front: you only have an idea, so the skill PROPOSES the
196
+ shape. `uscha-adr-refine` is the same interview applied to a KNOWN feature where the shape is
197
+ already clear and you only need precision. Both emit the same package; pick by starting
198
+ point.
199
+
200
+ ## Tracked-markdown protocol
201
+
202
+ If a target `.md` already exists and is tracked, ask for its current version before
203
+ overwriting — never silently replace real progress.