@johngaynor/entourage 0.1.0 → 0.2.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.
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: sdlc-plan
3
+ description: Write the technical plan for a Linear card that already has a Specification by reading the card and the code, then appending a Plan (Approach, Changes, Tests) to the card. Use this after define and before breakdown, and whenever asked to plan a card, scope it technically or work out how to build it, even if the request only says "plan ABC-123" or "how would we build this one".
4
+ ---
5
+
6
+ # Plan a card
7
+
8
+ Plan is the second step of the lifecycle. Define said what is wanted. Plan reads the code and says how it will be built: the approach, the files that change, and how each Done when item will be shown to be true.
9
+
10
+ Two readers depend on it. The human reads it to approve the card, so it has to be short and honest. The build step starts later in a fresh session with only the card, so the plan has to be exact enough to build from cold. A plan that says "update the orders module" helps neither of them.
11
+
12
+ Plan only reads. It writes no code and makes no branch or worktree. Whether the card is one piece or several is breakdown's job, which comes next.
13
+
14
+ ## Before you write anything
15
+
16
+ 1. Read the card with the Linear tools: the original description and the Specification.
17
+ 2. If there is no Specification, define hasn't run. Say so and stop.
18
+ 3. If the card already has a Plan section, don't write a second one. If the human has asked for it to be revised, revise it in place. Otherwise tell the human and ask whether they want it revised, and if they don't, hand off as `done` without changing it.
19
+
20
+ ## 1. Read the code
21
+
22
+ Start from the project's `PROJECT.md`. Its sections on what each repo owns tell you where this work belongs.
23
+
24
+ Then read until you could explain the change to someone who knows the codebase:
25
+
26
+ - **The guidance above the code you expect to touch.** Read the `CLAUDE.md`, `AGENTS.md` or `.ai/` files on the path down to those files. They hold conventions you can't infer from one file.
27
+ - **Where similar work already lives.** Find the closest existing feature and read it end to end. The best plan is usually "built like that one".
28
+ - **What you can reuse.** Look for shared helpers, components and test utilities before planning a new one.
29
+ - **How it is tested.** Find the tests for the closest feature, and note the level they work at and how they are set up.
30
+
31
+ The repo clones linked into the project are shared reference copies. Don't switch branches or edit anything in them. Fetch first, and if a clone isn't on an up-to-date base branch, read from the remote base branch with git instead of from the working files.
32
+
33
+ ## 2. Write the Plan
34
+
35
+ It has three parts.
36
+
37
+ ### Approach
38
+
39
+ A few sentences on how it will be built. Name the existing pattern it follows and where that pattern lives.
40
+
41
+ - If you chose between two real options, add one line on the one you rejected and why. It saves the human asking.
42
+ - If the work needs a new dependency, say so here. That is a decision the human should see.
43
+ - If the work needs more than one repo, say which and why.
44
+
45
+ ### Changes
46
+
47
+ The files you expect to touch, grouped by app or package. Give each one a few words on what changes.
48
+
49
+ - Write each path from the repo root, starting with the repo's name, so the repo never needs stating separately.
50
+ - Mark new files as new.
51
+ - Include the unglamorous ones: migrations, config, seed data, docs.
52
+ - Name the helpers you will reuse.
53
+ - Check that every existing path you write is real. A path you guessed reads exactly like one you checked, and the build step will trust it.
54
+
55
+ This is a list of where and what, not code. Don't write the implementation.
56
+
57
+ ### Tests
58
+
59
+ One line for each Done when item, in the same order, saying how it will be shown to be true.
60
+
61
+ - Prefer a test, and say what level it works at and which file it goes in.
62
+ - Where a test can't prove the item, say what will: a screenshot, or the output of a command.
63
+ - Every Done when item gets a line. An item with no line is an item nobody will check.
64
+ - For a fix, the first test reproduces the bug and fails before the change.
65
+ - For a change that shouldn't alter behaviour, name the existing tests that cover it. No new ones are needed.
66
+
67
+ ## 3. Stay inside the Specification
68
+
69
+ Plan never edits the Specification or the original description. They are what the human asked for, and the plan answers to them.
70
+
71
+ - **A Done when item can't be met as written.** The code may show that an item is impossible, contradicts how the product works, or costs far more than the card suggests. Ask the human before going any further, in a handoff block with `status: needs-human`. They may change the Specification. You may not.
72
+ - **A technical question.** Settle it from the code where you can. Ask the human only what the code can't answer, such as an upcoming change that affects the approach, or a choice between two workable options with different costs. Ask one question at a time, in a handoff block with `status: needs-human` and your recommendation first in `options`.
73
+ - **Something outside the Specification.** While reading you may find a nearby bug, a missing test or a refactor that would help. Leave it out of the plan and put it in `flags` when you hand off. Folding it in makes the card bigger than what they approved.
74
+
75
+ ## 4. Write it to the card
76
+
77
+ - Append the Plan below the Specification as a collapsible section.
78
+ - Change nothing above it.
79
+ - Add nothing else: no repo line, no risk, no open questions.
80
+
81
+ Use this form:
82
+
83
+ ```
84
+ >>> ## Plan
85
+ **Approach:** …
86
+
87
+ **Changes:**
88
+ - `repo/path/to/file`: what changes
89
+ - `repo/path/to/new-file` (new): what it holds
90
+
91
+ **Tests:**
92
+ 1. <Done when item, in a few words>: how it is shown
93
+ 2. …
94
+ >>>
95
+ ```
96
+
97
+ After writing, read the card back. Check that the description and Specification are unchanged and that the Plan shows as a collapsed section.
98
+
99
+ ## 5. Hand off
100
+
101
+ When the Plan is on the card and you have read it back, write the handoff block. Plan is not finished until it is written:
102
+
103
+ - `phase: plan`, `status: done` and `next: breakdown`.
104
+ - `summary`: the approach in one sentence, roughly how much it touches (how many files, in which apps or repos), and whether it looks like one pull request's worth or more. Breakdown decides, but your read is useful.
105
+ - `flags`: anything you found that sits outside the Specification.
106
+
107
+ ## The handoff block
108
+
109
+ Every step of the lifecycle ends the same way, so whoever is driving it, a person or a script, can tell how the step ended without reading the whole session.
110
+
111
+ Write one handoff block every time this step ends or pauses: when the step is finished, when you need an answer, and when something has gone wrong. Write it even when you go straight on to another step, because the block is the record that this one ended. Put it in a code block, one value per line, as the last thing you write for this step:
112
+
113
+ ```
114
+ phase: <this step>
115
+ status: <done, needs-human or failed>
116
+ next: <the step that follows>
117
+ summary: <one to three sentences on what you did>
118
+ flags: <what the human should know but wasn't asked>
119
+ question: <one question>
120
+ options: <the answers you expect, your recommendation first, separated by " | ">
121
+ reason: <what went wrong, and what you already tried>
122
+ ```
123
+
124
+ Which lines you write depends on the status:
125
+
126
+ | Status | Use it when | Lines |
127
+ |---|---|---|
128
+ | `done` | This step's work is on the card and you have read it back | `phase`, `status`, `next`, `summary`, and `flags` if there are any |
129
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
130
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
131
+
132
+ - **Wherever this skill says to ask, tell or stop, use the block.** An ask is `needs-human`. Something to tell goes in `flags`. A stop because something is missing or went wrong is `failed`.
133
+ - **`needs-human` is a pause, not an ending.** Wait for the answer, then carry on with this step. The step is over only at `done` or `failed`.
134
+ - **Ask one question per block.** If you have two, ask first the one whose answer could change the other. The human can always answer in their own words, so `options` are suggestions.
135
+ - **Keep the block short.** Above it goes only what the human needs and can't read on the card: a section you could not write there, or the summary they approve from.
136
+ - **After `done`, this step is over.** Write the block before anything else. If another step sent you here to revise this section, go back to that step and ignore `next`. Otherwise go on to the step in `next` only if you were asked to run more than this one step, and if you weren't, stop there.
137
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
138
+
139
+ ## If something goes wrong
140
+
141
+ | When this happens | Do this |
142
+ |---|---|
143
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
144
+ | The Linear tools aren't available | Stop and say so. Show the finished section in the session so the work isn't lost. Don't save it somewhere else and report the step as done |
145
+ | A write to the card fails | Read the card before doing anything else. Retry once, and only if the section isn't there, so it can't be added twice |
146
+ | The read-back shows that text above your section changed | Put it back from what you read at the start of this run, append your section again, and tell the human |
147
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
148
+ | A repo named in `PROJECT.md` is missing, or the fetch fails | Tell the human, and ask whether to plan from what is on disk |
149
+ | You can't tell which repo the work belongs in | Ask the human. Don't guess paths |
150
+ | A path you were about to write doesn't exist | Find the real one, or mark the file as new. Never leave a path you haven't checked |
151
+
152
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
153
+
154
+ ## Example
155
+
156
+ **The card's Specification**
157
+
158
+ ```
159
+ **Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
160
+
161
+ **Done when:**
162
+ - [ ] On the orders page, a manager sees a Download CSV button.
163
+ - [ ] The file has one row per order, with the order number, date, customer, status and total.
164
+ - [ ] The file covers the same filters and date range that are showing on screen.
165
+ - [ ] With no orders in range, the file has the header row and no others.
166
+ - [ ] Someone who is not a manager does not see the button and cannot fetch the file.
167
+ ```
168
+
169
+ **Appended to the card**
170
+
171
+ ```
172
+ >>> ## Plan
173
+ **Approach:** Add a CSV response to the existing orders list endpoint, and a button on the orders page that calls it with the filters currently applied. This follows the invoice export, which already streams a CSV the same way. A separate export endpoint was rejected because it would duplicate the list endpoint's filtering.
174
+
175
+ **Changes:**
176
+ - `shop/api/app/orders/routes.py`: accept `format=csv` on the list route, managers only
177
+ - `shop/api/app/orders/export.py` (new): turn the filtered query into CSV rows, reusing `csv_stream` from `shop/api/app/common/export.py`
178
+ - `shop/web/src/pages/orders/OrdersPage.tsx`: Download CSV button, shown to managers, passing the current filters
179
+ - `shop/web/src/api/orders.ts`: `downloadOrdersCsv(filters)`
180
+
181
+ **Tests:**
182
+ 1. Button shows for a manager: component test in `OrdersPage.test.tsx`
183
+ 2. Columns, and one row per order: API test in `test_orders_export.py`
184
+ 3. Same filters and range as on screen: API test with a filtered request, and a component test that the filters are passed
185
+ 4. Empty range gives the header only: API test in `test_orders_export.py`
186
+ 5. A non-manager can't see or fetch it: component test for the button, API test for a 403
187
+ >>>
188
+ ```