@ervis/skills 0.1.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.
Files changed (28) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +335 -0
  3. package/bin/install.js +135 -0
  4. package/package.json +39 -0
  5. package/skills/README.md +18 -0
  6. package/skills/engineering/commit/SKILL.md +47 -0
  7. package/skills/engineering/implement-ruby/template.md +75 -0
  8. package/skills/engineering/ticket-grooming/SKILL.md +58 -0
  9. package/skills/incubator/qrspi-design/SKILL.md +131 -0
  10. package/skills/incubator/qrspi-implement/SKILL.md +123 -0
  11. package/skills/incubator/qrspi-plan/SKILL.md +113 -0
  12. package/skills/incubator/qrspi-question/SKILL.md +184 -0
  13. package/skills/incubator/qrspi-research/SKILL.md +109 -0
  14. package/skills/incubator/qrspi-research-resolve/SKILL.md +94 -0
  15. package/skills/incubator/qrspi-structure/SKILL.md +116 -0
  16. package/skills/incubator/qrspi-test-plan/SKILL.md +253 -0
  17. package/skills/incubator/qrspi-test-plan/references/example-test-plan.md +151 -0
  18. package/skills/productivity/brainstorm/SKILL.md +49 -0
  19. package/skills/productivity/brainstorm/references/assumption-mapping.md +24 -0
  20. package/skills/productivity/brainstorm/references/five-whys.md +20 -0
  21. package/skills/productivity/brainstorm/references/pre-mortem.md +21 -0
  22. package/skills/productivity/brainstorm/references/question-burst.md +23 -0
  23. package/skills/productivity/brainstorm/references/question-formulation-technique.md +27 -0
  24. package/skills/productivity/brainstorm/references/six-thinking-hats.md +24 -0
  25. package/skills/productivity/brainstorm/references/starbursting.md +19 -0
  26. package/skills/productivity/caveman/SKILL.md +49 -0
  27. package/skills/productivity/simple-english/SKILL.md +15 -0
  28. package/skills/research/.gitkeep +0 -0
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: ticket-grooming
3
+ description: Groom a JIRA/GitHub ticket, issue, user story, or spec until a coding agent could build it with zero open questions. Plans the implementation to surface the decisions nobody made, checks the ticket's claims and unstated assumptions against the real codebase, works out whether this repository has already shipped something of the same shape and says so plainly when it has not, so novel work is called out as needing a spike rather than stamped ready. Traces invariants and entity lifecycles for the bugs that only show up in transitions, then writes a document separating what the business still has to decide from how it resolves in code. Use this whenever the user pastes a ticket, story, spec, or a link to one, or says things like "is this ticket ready", "groom this", "refine this story", "challenge this ticket", "poke holes in this", "is there enough context here to build this", or complains that a ticket is vague, a wishlist, UX-only, or missing business scope. Also use it before starting implementation work from a ticket the user did not write themselves.
4
+ ---
5
+
6
+ # Ticket Grooming
7
+
8
+ If the `simple-english` skill is available, follow it for everything you write for the user.
9
+
10
+ A ticket is ready when a competent coding agent could implement it end to end without asking anyone a question. That is the only test, and it is harsher than it sounds: a well-written ticket that leaves one real decision open fails it, and a scrappy one that closes them all passes.
11
+
12
+ Your job is to find the decisions nobody has made, settle what you can, and ask about what is left.
13
+
14
+ ## What the ticket owes you, and what it does not
15
+
16
+ You have the repository. The schema, the endpoints, the call sites, the current behavior are all there to be read, and a ticket owes you none of it. Go and look.
17
+
18
+ What the code cannot tell you is anything that exists only in someone's head: why the work is wanted, what a business term means here, what should happen in a case the system has never faced, what is deliberately out of scope, who ought to be allowed, what the business would accept as proof it works, whether an already-stored record is now wrong or merely old. That is the whole subject of grooming. Everything else, answer yourself.
19
+
20
+ This one distinction does most of the work. Hold it while you read and the questions sort themselves: if the repo could settle it, settling it is your job, and asking instead is a round trip you chose to spend.
21
+
22
+ ## Finding what is missing
23
+
24
+ Plan the implementation for real. Not code, a plan good enough to hand someone: what changes, what is new, what the data looks like, what the tests would assert.
25
+
26
+ The moment you reach for a guess, stop. That guess is the finding. Gaps you walk into are real in a way that gaps recalled from a list are not, which is why this beats reviewing the ticket against a template. Keep going to the end, then look at how many guesses the plan is standing on.
27
+
28
+ ## What to check the ticket against
29
+
30
+ Four things worth going after. They overlap, and which one pays off varies by ticket, so read them as places to look rather than steps to perform.
31
+
32
+ **Claims, and the assumptions underneath them.** Tickets assert how things work today, and assertions written from memory drift from the code. Check them and cite what you find; a contradicted claim often invalidates the design built on it. Then go after what the ticket assumed without saying: "add a column to the export" assumes that data is in scope where the export is built, "let admins reassign ownership" assumes ownership is single-valued. Chase the load-bearing ones, the ones where being wrong collapses the ticket, not every premise.
33
+
34
+ **Precedent, matched on properties rather than on features.** Precedent means this repository already ships something of the same shape: a decision made, reviewed, merged and left running, with every local constraint nobody wrote down baked into it. A known pattern or a library that could do it carries none of that, so it does not count. Ask what the change is underneath, then go find it. A contact form and a newsletter signup are unrelated features and one problem, an unauthenticated public write endpoint, which is what drags in rate limiting, spam, sanitisation and abuse logging. If one already ships, all of that is solved and none of it needs asking.
35
+
36
+ Match on the properties that pull concerns behind them: reachable without auth, crossing a tenant boundary, taking user-supplied content, sending something outbound, running long or async, touching money or personal data, unbounded input, rewriting rows already stored. A ticket usually has several and the answer differs between them, so check each. Where one has precedent, follow it and say where it is; where the ticket diverges from it, the divergence is the question; where one is new here, the unknowns are in the code rather than the ticket and answering questions will not surface them, so say it needs a spike and what the spike has to find out. Confirm the precedent solved your actual problem and not one sharing its vocabulary: a hardened check on user-supplied URLs looks like what you need to let someone reference an image in an outbound email, but it guards connections the server makes, and that image is fetched by the recipient's mail client.
37
+
38
+ **Invariants.** An abstraction guarantees things: what is always true, what must hold before a call, what a caller may rely on after. Work out which of them this change touches, then sort each into preserved, broken on purpose, or broken by accident. Only the last is a defect, and the ticket will rarely distinguish, because the author was thinking about the feature and not the guarantee. A break that turns out to be intended still belongs in the ticket, or the next reader files it as a bug.
39
+
40
+ **Lifecycles, crossed.** Walk the subject through created, changed, disabled, deleted, restored, then walk everything it associates with through the same, and cross the two. This generates cases rather than recalling them, which is why it finds what no checklist does: the dashboard shared with a team whose owner is deactivated, the export in flight when its source is deleted, the schedule whose recipient lost access. Tickets describe the steady state; the bugs are in the transitions, and usually in the transitions of the other thing. Include the rows already in the database, which went through those transitions before the new rules existed and are the least likely to satisfy them.
41
+
42
+ ## What to do with what you find
43
+
44
+ Not every gap is worth someone's attention. A question earns its place only if a wrong answer changes the code. If the likeliest guess being wrong would cost nothing, take the guess, write it down as an assumption, and move on; a stated assumption gets corrected, a silent one becomes a bug. Thirty questions get ignored, four get answered today.
45
+
46
+ Ask what survives in the language of whoever wrote the ticket. They know the business and usually not the codebase, so a question they cannot parse earns a guess or a meeting rather than an answer. "Should this column be nullable" is unanswerable by them; "should accounts that never set this keep behaving exactly as they do today" is the same fork in the code, and anyone can answer it. If you cannot restate a question without naming a table, a class or a file, it is usually a decision you should be making yourself, and you are escalating because that feels safer. Make the call and say what it would cost to be wrong.
47
+
48
+ Give each question its consequence. "What happens to existing subscriptions" gets skimmed. "What happens to the 40k existing subscriptions, because backfilling them as active may bill people who cancelled" gets answered.
49
+
50
+ ## What to produce
51
+
52
+ A document, written to a file, because this is a loop: answers come back, you run it again, the verdict moves. Keep it in a gitignored scratchpad inside the repository, where it sits beside the code it cites and survives the session without landing in anyone's history. Look at what the repo already ignores before inventing a path, and if nothing fits, exclude it locally rather than editing a tracked ignore file you do not own.
53
+
54
+ Lead with the verdict and be blunt about it. Ready, needs a spike, or not ready, and why in a sentence. Do not soften it to be encouraging, and be especially careful with the spike case, because a ticket whose questions are all answered can look finished while its riskiest property has never been built here.
55
+
56
+ Then separate what the business decided from how it resolves in the code, and keep that separation strict. The business half holds the answers only they can give, in language they can confirm or correct, with no table or class or file names anywhere in it. The code half holds your translation, cited, and the author never has to read it. Merged, they skim a paragraph of schema and quietly stop reviewing. Split, each reader gets the half they can judge, and the implementer gets your groundwork instead of redoing it.
57
+
58
+ Beyond that, shape the document around what you found rather than around a fixed set of headings. A ticket with one blocking question and a clean precedent does not need the same structure as one facing a migration over a table nobody has touched in three years. Say what you checked, including where you looked and found nothing, so a reader can tell the difference between a question you closed and one you never reached.
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: qrspi-design
3
+ description: Design step of the QRSPI workflow. Interviews the user about the design decisions, with the research facts as evidence, and writes design.md. The design has the current state, the desired end state, the patterns to follow, the decisions and their reasons, what is out of scope, and the open risks. Design is the lowest-cost point to change direction before planning. It reads task.md, research.md, and question-sources.md from the task directory. Use it after qrspi-research-resolve, or when the user says "qrspi design", "/qrspi-design", or "design this from the research".
4
+ ---
5
+
6
+ # QRSPI Design
7
+
8
+ ## Dependencies
9
+
10
+ - **`simple-english`** (required). Follow it for all text that you write for the user. You can find it in `skills/productivity/` of this repository. If it is not available, stop. Tell the user to install it.
11
+ - **`mattpocock-skills/grilling`** (required). This skill does the interview in step 2. You can find it in the `mattpocock-skills` plugin of Matt Pocock. If it is not available, stop. Tell the user to install it.
12
+
13
+ This is the design step of QRSPI: Question, Research, Design, Structure, Plan, Test plan, Implement.
14
+
15
+ In this step you decide where the work goes, before anyone plans how. A change of direction costs the least here. After this step, each change costs more.
16
+
17
+ You know the goal again. Research found the facts without the goal. Now you weigh these facts against the goal, and the user makes the decisions.
18
+
19
+ ## Input
20
+
21
+ The user starts the skill like this: `qrspi-design <task-dir>`. For example: `qrspi-design ~/wiki/rate-limit`.
22
+
23
+ - **`<task-dir>`.** The first argument. This is the directory for all files of this task. If the user does not give it, ask for it.
24
+ - **`<task-dir>/task.md`.** What the user wants.
25
+ - **`<task-dir>/research.md`.** The final research facts from `qrspi-research-resolve`. Each fact has a `file:line` reference or a URL, or a note that the user gave it. The research is done. Do not ask for more research.
26
+ - **`<task-dir>/question-sources.md`.** Why each research question exists. Use it to connect each fact to its concept, its area, and its facet. The facet tells the group of the fact in `design.md`, for example Invariants or Assumptions.
27
+
28
+ If `research.md` does not exist, stop. Tell the user to run `qrspi-research-resolve` first.
29
+
30
+ ## 1. Read the input
31
+
32
+ Read all of `task.md`, `research.md`, and `question-sources.md`. Know what the task wants and what exists now before you do more.
33
+
34
+ Done when you can say in two or three sentences what exists now and what must change.
35
+
36
+ ## 2. Interview the user
37
+
38
+ Run `grilling`, with these differences:
39
+
40
+ 1. **Evidence.** Base each recommendation on the facts in `research.md`. Give the `file:line` reference or the URL. If a recommendation goes against a fact, say so.
41
+ 2. **Existing patterns first.** Recommend a pattern that the code already uses. There are two reasons. The code stays consistent. Also, the team approved these patterns, and they work in production. Look for features with the same shape, not only features with the same name. For example, a register page has the same shape as a contact form: an untrusted user sends a form. Take over what these features do, including their protections, for example rate limits and bot protection. If the work leaves out something that they have, that is a decision. Tell why. Recommend a new pattern only when no existing pattern fits. Then say clearly that it is new, and tell why no existing pattern fits. In `design.md`, each decision shows if it is existing or new.
42
+ 3. **Facts.** Do not look up facts yourself, and do not send an agent. If a decision needs a fact that `research.md` does not have, ask the user for it. If the user is not sure, help the user. Tell what the decision loses without the fact. Suggest who can know it, for example a teammate or the owner of the product. Mark each such fact with "(from the user)" in `design.md`.
43
+ 4. **Output.** Write `design.md` (step 3).
44
+
45
+ Where `grilling` and this skill do not agree, this skill wins.
46
+
47
+ Ask about the decisions that need human judgment, for example:
48
+
49
+ - Which of the patterns in the code does the work follow? Which patterns must it not follow?
50
+ - Which approach does the work take, when research shows more than one?
51
+ - What must be true when the work is done, and how do we check it?
52
+ - What is out of scope?
53
+
54
+ For each option, show what it is, where the code already uses it (`file:line`), and its cost.
55
+
56
+ Done when each decision has an answer from the user.
57
+
58
+ ## 3. Write the design
59
+
60
+ Write `<task-dir>/design.md`:
61
+
62
+ ```markdown
63
+ # Design
64
+
65
+ ## Current state
66
+ <What exists now, from research.md. Each fact has a file:line reference.
67
+ Put each fact in one group. If a group has no facts, write "None found".>
68
+
69
+ ### How it works
70
+ - A report has the states draft and published. `app/models/report.rb:12`
71
+
72
+ ### Invariants
73
+ <Rules that the code enforces. The work must keep them, or change them on purpose.>
74
+ - A report always has an owner. `app/models/report.rb:14`
75
+
76
+ ### Assumptions
77
+ <What the code takes as true without a check. If the work depends on one, it is a risk.>
78
+ - The code assumes that a member has one account. `app/models/member.rb:8`
79
+
80
+ ### Cascades
81
+ <Changes here that cause changes somewhere else.>
82
+ - Reports are destroyed with the member. `app/models/member.rb:20`
83
+
84
+ ### Who depends on it
85
+ <Callers, consumers of the same data, and owners. When the work changes something, this list shows what else can break.>
86
+ - The dashboard reads the reports table. `app/dashboards/reports_widget.rb:30`
87
+
88
+ ### Lifecycle
89
+ <The states and the moves between them. New code must handle each state.>
90
+ - A report moves from draft to published when the owner shares it. `app/models/report.rb:40`
91
+
92
+ ## Desired end state
93
+ <What we build, and how we check that it is correct.>
94
+
95
+ ## Patterns to follow
96
+ <Code patterns that the work must follow, with file:line references.
97
+ Also the patterns that research found and that the work must not follow, and why.
98
+ Mark each new pattern with "(new)", and tell why no existing pattern fits.>
99
+
100
+ ## Decisions
101
+ <Mark each decision "existing" or "new".
102
+ Existing: the codebase already does this. Give the file:line reference of the place that does it.
103
+ New: the codebase does not do this yet. Tell why no existing way fits.>
104
+ 1. **<decision>** (existing): <the choice> - <why>. Done the same way in <file:line>.
105
+ 2. **<decision>** (new): <the choice> - <why>. No existing way fits, because <reason>.
106
+
107
+ ## Not doing
108
+ <What is out of scope. This stops the scope from growing in later steps.>
109
+
110
+ ## Open risks
111
+ <What is not certain and can show during the work.>
112
+ ```
113
+
114
+ Keep it short. It is a document that sets the direction. It is not a specification. Structure and Plan add the detail later.
115
+
116
+ Show `design.md` to the user. Change it until the user approves it.
117
+
118
+ Done when the user approves the design.
119
+
120
+ ## 4. Hand off
121
+
122
+ Tell the user: "Next: run `qrspi-structure` with `<task-dir>`."
123
+
124
+ ## Rules
125
+
126
+ - The user makes the decisions. You recommend, then you wait for the answer.
127
+ - Prefer the patterns that the code already uses. Do not invent a pattern when an existing one fits.
128
+ - Do not write `design.md` before the interview in step 2 is done.
129
+ - Do not research in this step. Research happens only in `qrspi-research`.
130
+ - Each pattern and each current-state fact has a `file:line` reference.
131
+ - Do not plan the work in this step. Do not write file-by-file changes or code. Structure and Plan do that.
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: qrspi-implement
3
+ description: Implement step of the QRSPI workflow. Does the work of plan.md one slice at a time. For each slice, it writes the code and the tests. It writes the tests from the test cases of test-plan.md. A slice is done when its checks and its tests pass. After each slice, it ticks the checkboxes in plan.md and makes one commit. The checkboxes show the progress. Thus, a new session can continue where the last one stopped. It reads plan.md and test-plan.md from the task directory. Use it after qrspi-test-plan, or when the user says "qrspi implement", "/qrspi-implement", "implement the plan", or "continue the implementation".
4
+ ---
5
+
6
+ # QRSPI Implement
7
+
8
+ ## Dependencies
9
+
10
+ - **`simple-english`** (required). Follow it for all text that you write for the user. You can find it in `skills/productivity/` of this repository. If it is not available, stop. Tell the user to install it.
11
+
12
+ This is the implement step of QRSPI: Question, Research, Design, Structure, Plan, Test plan, Implement.
13
+
14
+ You do the work of the plan, one slice at a time. `plan.md` tells how to change the code. `test-plan.md` has the black-box test cases. You write the code and the tests. The work is done when each test case of `test-plan.md` has a test, and all tests pass.
15
+
16
+ The checkboxes in `plan.md` show what is done. If the session stops, the next session reads them and continues.
17
+
18
+ ## Input
19
+
20
+ The user starts the skill like this: `qrspi-implement <task-dir>`. For example: `qrspi-implement ~/wiki/rate-limit`.
21
+
22
+ - **`<task-dir>`.** The first argument. This is the directory for all files of this task. If the user does not give it, ask for it.
23
+ - **`<task-dir>/plan.md`.** Your working document for the code.
24
+ - **`<task-dir>/test-plan.md`.** The test cases for each slice. It also lists the expected contract changes.
25
+
26
+ If `plan.md` does not exist, stop. Tell the user to run `qrspi-plan` first.
27
+
28
+ If `test-plan.md` does not exist, stop. Tell the user to run `qrspi-test-plan` first.
29
+
30
+ ## 1. Find where to start
31
+
32
+ Read all of `plan.md` and `test-plan.md`. Find the first slice that has a checkbox that is not ticked (`- [ ]`). Start there.
33
+
34
+ The ticked checkboxes (`- [x]`) show work that is done. Trust this work, unless something looks wrong.
35
+
36
+ ## 2. Do one slice
37
+
38
+ 1. Read each file that the slice changes, before you change it. Know the code that you change.
39
+ 2. Make the changes of the slice. Follow the intent of the plan. If the code is a little different from what the plan expects, adapt to it.
40
+ 3. Keep each invariant of the slice, and check each dependent, as the plan tells.
41
+ 4. Write a test for the goal case and for each case of the slice in `test-plan.md`. Use the test style of the project. Test only through the interface that each case names. Replace a dependency only where `test-plan.md` tells you to.
42
+
43
+ You can write the tests first or the code first. You choose the order.
44
+
45
+ The tests are your work, the same as the code. You can give the tests to a different agent, the tester. In a team, a tester and a developer do this work. Give the tester only `test-plan.md` and the number of the slice. The tester does not need `plan.md`.
46
+
47
+ Do only the changes of the plan. Do not refactor, clean up, or improve other code, even if that code is not clean. If you see something that must be fixed, tell the user after the slice.
48
+
49
+ Use sub-agents only for a specific problem, for example to find the cause of an error in code that you do not know.
50
+
51
+ ## 3. Handle a problem in the plan
52
+
53
+ Sometimes the code is very different from what the plan expects. For example, a dependency is missing, an API is wrong, or the plan has a wrong fact. Then stop, and tell the user:
54
+
55
+ ```
56
+ Problem in slice <N>:
57
+ Expected: <what the plan says>
58
+ Found: <what the code has>
59
+ Effect: <what this means for the plan>
60
+
61
+ How must I continue?
62
+ ```
63
+
64
+ Write the answer of the user in `plan.md`, in the slice, and mark it with "(from the user)". Then continue.
65
+
66
+ ## 4. Check the slice
67
+
68
+ 1. Run the "By command" checks of the slice. If a check fails, use "Find the cause of a failing test" below. Then run the check again.
69
+ 2. When a check passes, tick its checkbox in `plan.md`: `- [ ]` becomes `- [x]`.
70
+ 3. Run the tests for the goal case and the cases of the slice.
71
+
72
+ Done when each "By command" check of the slice passes. The tests for the goal case and the cases of the slice must also pass.
73
+
74
+ ### Find the cause of a failing test
75
+
76
+ `test-plan.md` lists the expected contract changes for each public interface. Compare each failing test with this list:
77
+
78
+ - **The failure agrees with a change on the list.** The failure is expected. Change the test to the new contract.
79
+ - **The failure agrees with no change on the list.** The failure is probably a bug. Fix the code. Do not change the test. If you change a test only to make it pass, you hide a broken contract.
80
+ - **You are not sure.** Stop and ask the user.
81
+ - **The code needs a contract change that is not on the list.** Stop and ask the user. The design missed this change.
82
+
83
+ ## 5. Commit the slice
84
+
85
+ Make one commit for the slice, after its "By command" checks pass. Use a message like "Slice <N>: <name of the slice>". One commit for each slice lets the user undo one slice alone.
86
+
87
+ ## 6. Ask for the checks by hand
88
+
89
+ Ask the user only when it is necessary. If the slice has no "By hand" checks, go to the next slice.
90
+
91
+ Otherwise, tell the user:
92
+
93
+ ```
94
+ Slice <N> is done.
95
+
96
+ Checks by command that passed:
97
+ - [x] <each check>
98
+
99
+ Please check by hand:
100
+ - [ ] <each check by hand from the plan>
101
+
102
+ Tell me when this is done. Then I start slice <N+1>.
103
+ ```
104
+
105
+ Tick a "By hand" checkbox only when the user confirms it. If the user told you to do more slices without a stop, continue, and collect the checks by hand for the end.
106
+
107
+ ## 7. Continue
108
+
109
+ Do steps 2 to 6 for each slice, in the order of the plan.
110
+
111
+ When all slices are done, tell the user: "Next: run the PR step with `<task-dir>`."
112
+
113
+ ## Rules
114
+
115
+ - One slice at a time. Do not skip ahead.
116
+ - Read the code before you change it.
117
+ - The checkboxes in `plan.md` are the record of progress. Tick them when a check passes.
118
+ - Tick a "By hand" checkbox only when the user confirms it.
119
+ - A slice is done when its checks pass, and the tests for its goal case and its cases pass.
120
+ - Change an existing test only for a contract change on the list in `test-plan.md`.
121
+ - If the plan is wrong, stop and ask. Do not change the plan in silence.
122
+ - Do only the changes of the plan. Tell the user about other problems after the slice.
123
+ - One commit for each slice, after its checks pass.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: qrspi-plan
3
+ description: Plan step of the QRSPI workflow. Expands each slice of structure.md into exact changes - file paths, what changes in each file, code snippets for the parts that are not obvious, and checks with checkboxes. The plan is the working document of the implementor. An agent that reads only plan.md must be able to do the work. It reads structure.md, design.md, and research.md from the task directory and writes plan.md. Use it after qrspi-structure, or when the user says "qrspi plan", "/qrspi-plan", or "write the implementation plan".
4
+ ---
5
+
6
+ # QRSPI Plan
7
+
8
+ ## Dependencies
9
+
10
+ - **`simple-english`** (required). Follow it for all text that you write for the user. You can find it in `skills/productivity/` of this repository. If it is not available, stop. Tell the user to install it.
11
+
12
+ This is the plan step of QRSPI: Question, Research, Design, Structure, Plan, Test plan, Implement.
13
+
14
+ The plan is the working document of the implementor. It must contain all that the implementor needs, and nothing more. The user approved the design and the structure. The user only checks parts of the plan.
15
+
16
+ ## Input
17
+
18
+ The user starts the skill like this: `qrspi-plan <task-dir>`. For example: `qrspi-plan ~/wiki/rate-limit`.
19
+
20
+ - **`<task-dir>`.** The first argument. This is the directory for all files of this task. If the user does not give it, ask for it.
21
+ - **`<task-dir>/structure.md`.** The approved slices.
22
+ - **`<task-dir>/design.md`.** The approved design: current state, patterns, and decisions.
23
+ - **`<task-dir>/research.md`.** The research facts, with `file:line` references.
24
+
25
+ If `structure.md` does not exist, stop. Tell the user to run `qrspi-structure` first.
26
+
27
+ ## 1. Read the input
28
+
29
+ Read all of `structure.md`, `design.md`, and `research.md`.
30
+
31
+ Also read the files that `structure.md` lists, and the files that `design.md` gives as examples of its patterns. You need them to write exact changes. Do not search the code for new facts. Research is done.
32
+
33
+ Find the commands that the project uses to build, lint, and test. Look in `AGENTS.md`, `CLAUDE.md`, the `Makefile`, `package.json`, or the equivalent files.
34
+
35
+ ## 2. Expand each slice
36
+
37
+ Do the slices in the order of `structure.md`. Do not change the order. For each slice, write:
38
+
39
+ - **Changes.** For each file: the exact path, the action (create, change, or delete), and what changes.
40
+ - **Code snippets.** Only for the parts that are not obvious, for example new functions, new types, or migrations. Skip boilerplate. When the change follows an existing pattern, give the `file:line` of the example in the code.
41
+ - **Invariants and dependents.** Take them from the "Touches" list of the slice in `structure.md`. For each invariant, tell how the change keeps it. For each dependent, tell what the implementor must check.
42
+ - **Checks.** The project commands that must pass, and the checks by hand. Each check has a checkbox (`- [ ]`). The implementor uses the checkboxes to track progress.
43
+
44
+ Put in the plan only the changes of `design.md` and `structure.md`. Do not add refactoring, cleanup, or improvements to other code, even if that code is not clean.
45
+
46
+ ## 3. Check for common gaps
47
+
48
+ - **Schema migrations.** If a slice changes the schema, also update the tests that check the schema version.
49
+ - **Generated code.** If a slice needs code generation, tell what to do when the generator fails or is not available. For example, add the fields by hand to the generated files.
50
+ - **Coverage.** Each file in `structure.md` is in the plan.
51
+
52
+ ## 4. Handle an open question
53
+
54
+ The plan must not have open questions. If you find one, stop. Ask the user. Write the answer in the plan, and mark it with "(from the user)".
55
+
56
+ Sometimes a slice cannot be done as `structure.md` says, for example because a file is different from the structure. Do not work around it without a word. Tell the user what you found, and ask how to resolve it. Write the answer in the plan, and mark it with "(from the user)".
57
+
58
+ ## 5. Write the plan
59
+
60
+ Write `<task-dir>/plan.md`:
61
+
62
+ ````markdown
63
+ # Plan
64
+
65
+ ## Overview
66
+ <1-2 sentences, from the desired end state in design.md.>
67
+
68
+ ## Slice 1: <name from structure.md>
69
+
70
+ ### Changes
71
+
72
+ #### 1. <file or group of files>
73
+ **File**: `path/to/file.ext`
74
+ **Action**: <create / change / delete>
75
+ <What changes. Follow the pattern in `path/to/example.ext:40`.>
76
+
77
+ ```language
78
+ // the code to add or change, only where it is not obvious
79
+ ```
80
+
81
+ #### 2. <next file>
82
+ ...
83
+
84
+ ### Invariants and dependents
85
+ - Invariant: <the invariant> - <how the change keeps it>
86
+ - Dependent: <the dependent> - <what to check>
87
+
88
+ ### Checks
89
+ #### By command
90
+ - [ ] <project lint or test command> passes
91
+ - [ ] <a command for this slice>
92
+
93
+ #### By hand
94
+ - [ ] <what to check, and the expected result>
95
+
96
+ ## Slice 2: <name>
97
+ ...
98
+ ````
99
+
100
+ ## 6. Show the summary
101
+
102
+ Give the user a short summary of the plan. Tell each place where the plan does not follow `structure.md`, and why.
103
+
104
+ Tell the user: "Next: run `qrspi-test-plan` with `<task-dir>`."
105
+
106
+ ## Rules
107
+
108
+ - The plan is complete. An agent that reads only `plan.md` can do the work.
109
+ - Follow the slice order of `structure.md`.
110
+ - Follow the existing patterns. Give the `file:line` of the example for each pattern.
111
+ - Each check has a checkbox.
112
+ - The plan has no open questions.
113
+ - Use the commands of the project for the checks.
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: qrspi-question
3
+ description: First step of the QRSPI workflow. Turns a task into neutral research questions with the clean room method. You know the goal. The researcher must not know it. questions.md is the only thing that crosses the wall. The skill finds the areas of the code that the task affects. It asks a fixed set of facets for each area. It tests the questions for goal leaks. It reads task.md from the task directory and writes questions.md for the qrspi-research step. Use it to start a QRSPI run, or when the user says "qrspi", "start qrspi", "qrspi question", "/qrspi-question", "make the research questions", or "turn this task into research questions".
4
+ ---
5
+
6
+ # QRSPI Question
7
+
8
+ ## Dependencies
9
+
10
+ - **`simple-english`** (required). Follow it for all text that you write for the user. You can find it in `skills/productivity/` of this repository. If it is not available, stop. Tell the user to install it.
11
+ - **`codebase-locator`** (required). This agent does the scan in step 2. You can find it in the `agents/` directory of this repository. If it is not available, stop. Tell the user to install it.
12
+
13
+ This is the first step of QRSPI: Question, Research, Design, Structure, Plan, Test plan, Implement.
14
+
15
+ ## The clean room
16
+
17
+ This step uses the clean room method. Companies used this method to copy a product legally. A dirty team studies the original product and writes a spec. A clean team never sees the original product. The clean team builds only from the spec. A reviewer makes sure that the spec contains nothing from the original product.
18
+
19
+ In QRSPI:
20
+
21
+ | Clean room | QRSPI |
22
+ |---|---|
23
+ | Dirty team | You. You know the goal. |
24
+ | The spec | `questions.md`. It is the only thing that crosses the wall. |
25
+ | The reviewer | The leak test. |
26
+ | Clean team | The researcher. It never sees the goal. |
27
+
28
+ Why: a researcher who knows the goal finds the facts that support the goal. That researcher misses the other facts. A researcher who does not know the goal cannot bend the facts. You must know the goal. Only the goal tells you which facts are necessary.
29
+
30
+ ## Input
31
+
32
+ The user starts the skill like this: `qrspi-question <task-dir>`. For example: `qrspi-question ~/wiki/rate-limit`.
33
+
34
+ - **`<task-dir>`.** The first argument. This is the directory for all files of this task. If the user does not give it, ask for it.
35
+ - **`<task-dir>/task.md`.** This file tells what the user wants. It can have any form: a few lines, a ticket, or a link to an issue. If it does not exist, tell the user to write it. Do not change it.
36
+
37
+ ## 1. Find the concepts
38
+
39
+ Make a list of the concepts that the task names or needs. For example, take the task "rate limit the public API per plan". Its concepts are: public API requests, client identity, plans, shared storage, and how other systems limit rates.
40
+
41
+ A concept does not stand alone. It connects to other things in many ways. For example:
42
+
43
+ - **Lifecycle.** It changes state over time.
44
+ - **Ownership.** Other records own it or depend on it. For example, a saved report belongs to a member. When the member is suspended or deleted, something happens to the report.
45
+ - **Producer and consumer.** It writes data that other code reads, or it reads data that other code writes. For example, the new feature writes to the table of concept A. Concept B reads that table, but no code in A calls B.
46
+ - **Cascade.** A change to it causes a change somewhere else. For example, a foreign key with `ON DELETE CASCADE` deletes the rows of B when a row of A is deleted. Triggers, callbacks, and events can also cause cascades.
47
+
48
+ Some connections, for example producers, consumers, and cascades, are frequently not in the calls between the code. Thus a search that follows calls does not find them. Step 2 finds their code, and step 3 asks about the connections.
49
+
50
+ Also name the shape of the work. The shape is the kind of work, without the name of the feature. For example, a register page and a contact form have the same shape: an untrusted user sends a form. Features with the same shape have the same needs, for example input checks, rate limits, and bot protection. Step 2 finds the features that have the same shape.
51
+
52
+ If the task is too vague for this list, stop. Ask the user to make the task clearer. Do not guess.
53
+
54
+ Done when each concept is a short noun phrase.
55
+
56
+ ## 2. Find the affected areas
57
+
58
+ For each concept, find its location in the code. Use `codebase-locator`. Get only paths and names. Do not read the code to learn how it works. That work is research.
59
+
60
+ Each location that you find is an affected area. In this skill, "area" always means an affected area. Some concepts are not in the code, for example how other systems do something. Such a concept is a web area.
61
+
62
+ Then find the blind spots: related areas that no concept names. Use `codebase-locator` to search for:
63
+
64
+ - **Neighbors.** Code next to each area.
65
+ - **Same shape.** Other features with the same shape as the work, for example the contact form for a register page.
66
+ - **Producers and consumers.** Code that uses the names of the data stores of each area. Data stores are, for example, tables, columns, files, caches, or queues.
67
+ - **Cascades.** Foreign keys, triggers, callbacks, and event handlers that use the names of these data stores. Look in the schema, the migrations, and the model definitions.
68
+
69
+ Add each blind spot as an area. Mark it as a blind spot.
70
+
71
+ Done when each concept has one or more areas.
72
+
73
+ ## 3. Ask the facets for each area
74
+
75
+ For each area, write the questions from this checklist. Do not ask only the questions that the goal makes you think of.
76
+
77
+ For a code area:
78
+
79
+ | Facet | Question shape |
80
+ |---|---|
81
+ | Flow | How does control get to it? Where does control go next? |
82
+ | Contracts | What calls it? What does it call? |
83
+ | Data | Which data does it read or write? Where does it keep the data? |
84
+ | Data relationships | How does its data relate to other data? For example: foreign keys, associations, join tables, or copies of the same data in other places. |
85
+ | Producers and consumers | Which other code writes the data that it reads? Which other code reads the data that it writes? |
86
+ | Lifecycle | Which states can it have? What moves it from one state to the next state? What runs at each change, for example callbacks, jobs, events, or emails? |
87
+ | Ownership | Which records own it? Which records depend on it? What happens to it when these records change state? For example, the records are suspended, deleted, merged, or moved to another plan. |
88
+ | Cascades | What else changes when it changes or is deleted? For example: database cascades, triggers, callbacks, or events. |
89
+ | Invariants | What must always be true here? Which code makes sure of it? For example: soft delete, audit trails, or records that must not change. |
90
+ | Config | Which settings or environment values change what it does? |
91
+ | Limits | Which limits apply? For example: sizes, rates, timeouts, or dependencies on other services. |
92
+ | Assumptions | What does the code accept as true without a check? For example: state, users, or input. |
93
+ | Errors | What happens when it fails? What happens at the edge cases? |
94
+ | Tests | Which tests check it now? |
95
+ | Precedent | Which other features have the same shape? How did the team build them? Which protections and checks do they have? |
96
+
97
+ For a web area:
98
+
99
+ | Facet | Question shape |
100
+ |---|---|
101
+ | Options | Which approaches or tools exist? |
102
+ | Trade-offs | What do their docs say about the costs and limits of each option? |
103
+ | Standards | Which specs or standards apply? |
104
+ | Use | Which known systems use which option? |
105
+
106
+ Skip a facet only when it clearly does not apply to the area. All facets are necessary for two reasons:
107
+
108
+ - You get the facts that the goal did not make you think of.
109
+ - Each area gets the same facets. Thus the researcher cannot see which facet is important to you.
110
+
111
+ Done when each area has a question for each facet that applies.
112
+
113
+ ## 4. Merge and split
114
+
115
+ - **Merge** two questions when they send the researcher to the same code.
116
+ - **Split** a question when it asks about two things that are not related.
117
+
118
+ Do not merge or split to get a specific number. The number of questions is a result, not a target.
119
+
120
+ Done when no two questions overlap and each question asks about one thing.
121
+
122
+ ## 5. Write each question neutrally
123
+
124
+ - **Describe. Do not propose.** "How does X work?" is correct. "How should we change X?" is not correct.
125
+ - **Ask about all the options.** "What shared storage does the app use?" is correct. "Can we use Redis?" is not correct.
126
+ - **Do not put an assumed fact in the question.** "Where does the app check API keys?" assumes that the app checks API keys. "How does the app find out who sent a request?" does not assume this.
127
+ - **Trace a flow.** Do not ask a yes-or-no question.
128
+
129
+ Put one tag at the start of each question: `[code]` or `[web]`.
130
+
131
+ ## 6. Test for leaks
132
+
133
+ This test is the reviewer of the clean room. Nothing from the goal can cross the wall.
134
+
135
+ 1. Read only `questions.md`, as the researcher will read it. Find the words that show what we will build or change. Write these words again.
136
+ 2. If you can start a sub-agent, give it only `questions.md`. Ask it to guess the task. The sub-agent does not know the goal, thus this test is stronger. If its guess is close, find the words that told it. Then write the questions again.
137
+
138
+ Done when the questions do not show what we will build.
139
+
140
+ ## 7. Check the size
141
+
142
+ - **More than approximately 10 areas.** Tell the user. The task can be too large. Offer to split it.
143
+ - **Only one area.** Tell the user. QRSPI can be too much for this task.
144
+
145
+ ## 8. Write the files
146
+
147
+ Write `<task-dir>/questions.md`. This file is the spec. It crosses the wall:
148
+
149
+ ```markdown
150
+ # Research questions
151
+
152
+ ## Context
153
+ <1-2 sentences: the areas to look at. Name areas only. "The request pipeline and shared storage" is correct. "Areas related to request throttling" is not correct.>
154
+
155
+ ## Questions
156
+ 1. [code] <question>
157
+ 2. [web] <question>
158
+ ```
159
+
160
+ Write `<task-dir>/question-sources.md`. This file stays on your side of the wall. Design reads it to know why each question exists:
161
+
162
+ ```markdown
163
+ # Question sources
164
+
165
+ | Q | Concept | Area | Facet | From |
166
+ |---|---------|------|-------|------|
167
+ | Q1 | client identity | app/middleware/ | Flow | concept |
168
+ | Q2 | shared storage | config/ | Data | concept |
169
+ | Q3 | request logging | app/logging/ | Contracts | blind spot |
170
+ ```
171
+
172
+ Show the user `questions.md` and the sources table. The table shows why the number of questions is what it is. Wait for approval.
173
+
174
+ Done when the user approves the questions.
175
+
176
+ ## 9. Hand off
177
+
178
+ Tell the user: "Next: run `qrspi-research` with `<task-dir>`."
179
+
180
+ # Rules
181
+
182
+ - Research reads only `questions.md`. Never give research `task.md` or `question-sources.md`.
183
+ - Do not change `questions.md` after approval.
184
+ - Sometimes you cannot ask a question without showing the goal. Then tell the user. Do not hide the problem with a vague question.