@johngaynor/entourage 0.1.0 → 0.1.2
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/README.md +67 -4
- package/cli/entourage +49 -184
- package/cli/lib/commands.sh +86 -0
- package/cli/lib/common.sh +33 -0
- package/cli/lib/links.sh +93 -0
- package/cli/lib/project.sh +172 -0
- package/cli/lib/task.sh +194 -0
- package/herdr/README.md +92 -0
- package/herdr/projects/template/PROJECT.md +19 -0
- package/package.json +6 -3
- package/prompts/task-new.md +14 -0
- package/skills/sdlc-breakdown/SKILL.md +178 -0
- package/skills/sdlc-define/SKILL.md +153 -0
- package/skills/sdlc-plan/SKILL.md +159 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc-breakdown
|
|
3
|
+
description: Decide whether a planned Linear card is one piece or several, by cutting it into thin end-to-end slices (elephant carpaccio) where it can be cut, then, once John approves, creating each slice as a sub-issue. Use this after plan on every card, and whenever asked to break down, slice or split a card, or to judge whether a card is too big for one pull request.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Break down a card
|
|
7
|
+
|
|
8
|
+
Breakdown is the third step of the lifecycle. Define said what is wanted and plan said how. Breakdown decides whether the card is built as one piece or as several, and if several, what each piece is.
|
|
9
|
+
|
|
10
|
+
The method is elephant carpaccio: cut the work into slices so thin that each one is small, yet each still works end to end. The aim is the earliest usable slice, followed by slices that extend it. Useful comes before done.
|
|
11
|
+
|
|
12
|
+
Thin slices matter more when an agent is building. Each slice can be checked end to end as soon as it merges, a mistake stays inside one small pull request, and if the third slice never ships, the first two still work.
|
|
13
|
+
|
|
14
|
+
This skill has two parts. Proposing, and asking John to approve, happens on every card. Creating sub-issues happens only after he approves a card that was sliced.
|
|
15
|
+
|
|
16
|
+
## Before you write anything
|
|
17
|
+
|
|
18
|
+
1. Read the card with the Linear tools: the Specification and the Plan.
|
|
19
|
+
2. If either is missing, the earlier step hasn't run. Say so and stop.
|
|
20
|
+
3. If the card is itself a sub-issue, don't slice it again. Slices go one level deep. If it looks too big, tell John.
|
|
21
|
+
4. If the card already has a Breakdown section, don't write a second one. Tell John and ask whether he wants it revised.
|
|
22
|
+
|
|
23
|
+
## Part 1: Propose
|
|
24
|
+
|
|
25
|
+
### First, is it already small?
|
|
26
|
+
|
|
27
|
+
Look at the plan's Changes. If the whole card is one agent, one sitting and one quick pull request, it stands as one piece, even if you could cut it further. Every slice costs John a review and a merge, so don't slice for its own sake.
|
|
28
|
+
|
|
29
|
+
### If it is too big, try to cut it
|
|
30
|
+
|
|
31
|
+
Cut along behaviour, using Done when as the map. Use the plan only to judge size and order.
|
|
32
|
+
|
|
33
|
+
A piece is a slice only if it passes all four checks:
|
|
34
|
+
|
|
35
|
+
1. **Vertical.** It carries one narrow piece of behaviour through every layer it needs. "The database part" and "the API part" are layers, not slices.
|
|
36
|
+
2. **Testable end to end.** Once it merges, there is something to click, read or call, and its own Done when can be checked without the later slices.
|
|
37
|
+
3. **Mergeable alone.** It is safe on main if nothing after it ever ships. Feature flags aren't available, so a slice has to be acceptable for users to see as it is.
|
|
38
|
+
4. **Small.** One agent, one sitting, one quick pull request.
|
|
39
|
+
|
|
40
|
+
Ways to make a slice thinner while keeping it end to end:
|
|
41
|
+
|
|
42
|
+
- One case before many.
|
|
43
|
+
- A fixed choice before a configurable one.
|
|
44
|
+
- Reading before writing.
|
|
45
|
+
- The main path before the rare ones.
|
|
46
|
+
- One kind of user before the others.
|
|
47
|
+
|
|
48
|
+
Permission and safety checks are not something to thin out. They go in the first slice that exposes the thing they protect, because a slice that ships an unprotected endpoint isn't mergeable alone.
|
|
49
|
+
|
|
50
|
+
Then check the set:
|
|
51
|
+
|
|
52
|
+
- **The first slice is the thinnest path that works.** Each later slice extends the one before.
|
|
53
|
+
- **Nothing is lost.** Every Done when item on the card is covered by a slice, whole or narrowed across more than one.
|
|
54
|
+
- **Nothing is added.** Slices divide the Specification. They don't grow it.
|
|
55
|
+
- **Each slice has its own Done when**, one to four outcomes written by the same rules as the card's.
|
|
56
|
+
- **The slices run in order.** Each builds on the last.
|
|
57
|
+
|
|
58
|
+
Two to five slices is usual. If you need more than six, the card is probably several cards. Propose what you have and say so when you finish.
|
|
59
|
+
|
|
60
|
+
### If it can't be cut
|
|
61
|
+
|
|
62
|
+
Some work has no cut that passes the checks. A refactor may have nothing to click halfway through. A migration may have to land together. A first slice may not be acceptable for users to see without the rest.
|
|
63
|
+
|
|
64
|
+
Then the card stands as one piece, however large it is. Don't force a cut that fails a check. A horizontal slice is worse than a large card, because it merges something nobody can test. Say in one line why it can't be cut, and if it is large, tell John when you finish.
|
|
65
|
+
|
|
66
|
+
### Write it to the card
|
|
67
|
+
|
|
68
|
+
Append a Breakdown section below the Plan. Leave it open, not collapsible, because it is what John reads to approve the card. Change nothing above it.
|
|
69
|
+
|
|
70
|
+
For one piece:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
## Breakdown
|
|
74
|
+
One piece. <one line on why: already small, or why it can't be cut>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For slices:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
## Breakdown
|
|
81
|
+
1. **<slice name: a short phrase for the behaviour>**
|
|
82
|
+
- [ ] <its Done when>
|
|
83
|
+
- [ ] …
|
|
84
|
+
2. **<slice name>**
|
|
85
|
+
- [ ] …
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Create nothing else in Linear yet. A proposal John turns down should leave nothing behind to clean up.
|
|
89
|
+
|
|
90
|
+
### Ask John to approve
|
|
91
|
+
|
|
92
|
+
Breakdown is the last step before building, so it ends by asking John to approve the whole card: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not.
|
|
93
|
+
|
|
94
|
+
Give him a summary he can answer from without opening Linear:
|
|
95
|
+
|
|
96
|
+
- The type.
|
|
97
|
+
- The Done when list.
|
|
98
|
+
- The approach, in a sentence or two.
|
|
99
|
+
- Whether it is one piece or several, and why. If several, the slice names in order.
|
|
100
|
+
|
|
101
|
+
Then ask him to approve or say what to change, and wait.
|
|
102
|
+
|
|
103
|
+
| John says | Then |
|
|
104
|
+
|---|---|
|
|
105
|
+
| Change the breakdown | Revise the Breakdown section and ask again |
|
|
106
|
+
| Change the Specification or the Plan | Make the change by that section's own skill, `sdlc-define` or `sdlc-plan`. Then re-check every section below the one that changed, because a new Done when item can make the Plan and the Breakdown wrong. Ask again |
|
|
107
|
+
| Yes, and the card is one piece | Tell him the card is approved and ready to build. Setup and build aren't built yet, so stop there |
|
|
108
|
+
| Yes, and the card is sliced | Go on to part 2 |
|
|
109
|
+
|
|
110
|
+
## Part 2: Create the sub-issues
|
|
111
|
+
|
|
112
|
+
Do this only when John has approved the card in this session, and only when the breakdown has more than one slice.
|
|
113
|
+
|
|
114
|
+
For each slice, in order, create a sub-issue of the card:
|
|
115
|
+
|
|
116
|
+
- **Title.** The slice name.
|
|
117
|
+
- **Type.** The parent's type, set as the label. Slices don't get a type of their own.
|
|
118
|
+
- **Description.** One or two sentences saying what this slice delivers, then its own sections in the same form as any card:
|
|
119
|
+
- A collapsed Specification, with the parent's Why narrowed to this slice, and the slice's Done when.
|
|
120
|
+
- A collapsed Plan, with the approach in a sentence or two, only the files this slice touches, and the Tests lines for its Done when items.
|
|
121
|
+
- A Breakdown section that reads `One piece. Slice <n> of <total>.`
|
|
122
|
+
- **Order.** Mark it as blocked by the slice before it. The first slice is blocked by nothing.
|
|
123
|
+
|
|
124
|
+
A sub-issue has to stand alone. The build step will open it in a fresh session and see only that card, so anything it needs from the parent goes into it.
|
|
125
|
+
|
|
126
|
+
Then update the parent's Breakdown list so each slice name carries its sub-issue's ID. The parent is not built. It stays as the record of the whole.
|
|
127
|
+
|
|
128
|
+
Read the parent and each sub-issue back. Tell John what was created, in order, and which slice is first. Setup and build aren't built yet, so stop there.
|
|
129
|
+
|
|
130
|
+
## If something goes wrong
|
|
131
|
+
|
|
132
|
+
| When this happens | Do this |
|
|
133
|
+
|---|---|
|
|
134
|
+
| The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
|
|
135
|
+
| 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 |
|
|
136
|
+
| 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 |
|
|
137
|
+
| 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 John |
|
|
138
|
+
| Creating the sub-issues stops partway | Don't start over. List the sub-issues the card already has, create only the missing ones, then set the blocking order |
|
|
139
|
+
| A blocking relation can't be set | Tell John. The order is still on the parent's Breakdown list, so it isn't lost |
|
|
140
|
+
| John's answer isn't a clear yes | Treat it as a change request. Ask what he wants changed, then ask for approval again |
|
|
141
|
+
|
|
142
|
+
If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
|
|
143
|
+
|
|
144
|
+
## Examples
|
|
145
|
+
|
|
146
|
+
**One piece.** The card "Export orders as CSV" has a plan that touches four files and delivers one behaviour.
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
## Breakdown
|
|
150
|
+
One piece. Four files and one behaviour, small enough for a single pull request.
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Sliced.** The card "Order notes" asks that staff can add notes to an order, edit and delete them, and mark some as visible to the customer. The plan touches the database, the API, the staff app and the customer app.
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
## Breakdown
|
|
157
|
+
1. **Staff can add a note to an order**
|
|
158
|
+
- [ ] On an order, a staff member can type a note and save it.
|
|
159
|
+
- [ ] Saved notes show on the order, newest first, with the author and time.
|
|
160
|
+
- [ ] Someone who is not staff can neither add nor see notes.
|
|
161
|
+
2. **Staff can edit and delete their own notes**
|
|
162
|
+
- [ ] A staff member can edit a note they wrote, and the note shows it was edited.
|
|
163
|
+
- [ ] A staff member can delete a note they wrote, after confirming.
|
|
164
|
+
- [ ] A staff member cannot edit or delete someone else's note.
|
|
165
|
+
3. **A note can be shown to the customer**
|
|
166
|
+
- [ ] A staff member can mark a note as visible to the customer.
|
|
167
|
+
- [ ] The customer sees those notes, and only those, on their order page.
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**The wrong cut** for the same card:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
1. Notes table and migration
|
|
174
|
+
2. Notes API
|
|
175
|
+
3. Notes in the staff app
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Nothing can be clicked until the third piece merges, so the first two can't be tested by anyone, and a mistake in the first surfaces two pull requests later.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc-define
|
|
3
|
+
description: Fill out a Linear card from its title and short description by setting its type label and writing its Specification (Why, Done when, Out of scope). Use this as the first step on any card that has no Specification yet, and whenever asked to define, spec, scope or write up a card, even if the request only says "start on ABC-123" and the card is still just a title and a sentence or two.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Define a card
|
|
7
|
+
|
|
8
|
+
Define is the first step of the lifecycle. It takes a card that holds a title and a sentence or two, and leaves it with a type and a Specification that says what is wanted and how anyone can tell it is done.
|
|
9
|
+
|
|
10
|
+
Everything after this step is checked against the Specification. Plan maps its tests to Done when, breakdown cuts along it, build is finished when it is true, and John reads it to approve the card. A vague Specification doesn't slow an agent down. It gets built as whatever the agent guessed.
|
|
11
|
+
|
|
12
|
+
Define says what and why. How it will be built belongs to plan, and whether it is one piece or several belongs to breakdown. Leave both alone here.
|
|
13
|
+
|
|
14
|
+
## Before you write anything
|
|
15
|
+
|
|
16
|
+
1. Get the card. If you weren't given a card ID, ask for one.
|
|
17
|
+
2. Read the card with the Linear tools: title, description, labels and comments.
|
|
18
|
+
3. If the card already has a Specification section, don't write a second one. Tell John and ask whether he wants it revised.
|
|
19
|
+
4. Read the project's `PROJECT.md`, and look at only enough of the product, docs and code to use the right names and to know what exists today. Stop there. Working out the approach is plan's job, and doing it now tends to leak files and design into the Specification.
|
|
20
|
+
|
|
21
|
+
## 1. Set the type
|
|
22
|
+
|
|
23
|
+
Every card gets exactly one type. The types come from Conventional Branch, because the type becomes the branch prefix.
|
|
24
|
+
|
|
25
|
+
| Type | Use it when the change… |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `feat` | adds behaviour a user, admin or agent can use |
|
|
28
|
+
| `fix` | corrects behaviour that was broken |
|
|
29
|
+
| `chore` | is neither: a refactor, docs, tests, tooling, infrastructure or a dependency update |
|
|
30
|
+
|
|
31
|
+
- If two could fit, take the first that does, in this order: `fix`, `feat`, `chore`.
|
|
32
|
+
- Work the type out from the title and description even when the card already carries a type label. Labels get added by habit and are often wrong. Replace the label if yours differs.
|
|
33
|
+
- Set the type as the card's label in the `Type` label group, which allows one per card. The name is lowercase and exact, because setup uses it as the branch prefix: `<type>/<card-id>-<short-name>`, for example `feat/abc-122-export-orders`.
|
|
34
|
+
- If the work is really two types, such as a fix plus an unrelated clean-up, this card keeps its main change. Tell John about the other part and ask whether he wants a second card for it. Don't create that card yourself.
|
|
35
|
+
|
|
36
|
+
The type is a label only. Don't write it into the card's text.
|
|
37
|
+
|
|
38
|
+
## 2. Write the Specification
|
|
39
|
+
|
|
40
|
+
It has three parts.
|
|
41
|
+
|
|
42
|
+
### Why
|
|
43
|
+
|
|
44
|
+
One or two lines on the reason. How it reads depends on the type.
|
|
45
|
+
|
|
46
|
+
| Type | Why reads as |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `feat` | A story: who can now do what, so that why |
|
|
49
|
+
| `fix` | What is broken and who it affects, with how to reproduce it, what was expected and what happens |
|
|
50
|
+
| `chore` | What is awkward, missing or out of date, and why now. For a refactor, also what must stay the same |
|
|
51
|
+
|
|
52
|
+
### Done when
|
|
53
|
+
|
|
54
|
+
A checklist of three to seven items. A small chore can have fewer. Each item is something a reviewer can check without asking you what you meant.
|
|
55
|
+
|
|
56
|
+
- **Describe an outcome, not work.** "A manager can download this month's orders as a CSV" is an outcome. "Add an export endpoint" is work, and it can be finished while the outcome is still false.
|
|
57
|
+
- **Make it pass or fail.** "The page loads quickly" can't fail. "The orders page shows within two seconds on the seed data" can.
|
|
58
|
+
- **Make each item checkable alone.** If two things have to be checked together, they are one item.
|
|
59
|
+
- **Cover the unhappy path that matters.** Think about the empty state, bad input and someone without permission, and include the ones a user would actually hit.
|
|
60
|
+
- **Turn needs like speed or access into items.** Agents build what the list says. A need that isn't on the list won't be met on purpose.
|
|
61
|
+
- **A fix always includes** "A test fails before the fix and passes after." That is what shows the bug was real and is gone.
|
|
62
|
+
- **A change that shouldn't alter behaviour, such as a refactor, always includes** "Existing tests pass without being changed." That is what shows behaviour didn't move.
|
|
63
|
+
- **Don't split by layer.** An API change and the screen that depends on it belong on the same card. A card that stops at the API can't be checked by anyone using the product.
|
|
64
|
+
|
|
65
|
+
If you end up with more than seven items, the card is probably more than one thing. Write the items anyway and say so when you finish. Breakdown deals with it after plan.
|
|
66
|
+
|
|
67
|
+
### Out of scope
|
|
68
|
+
|
|
69
|
+
Include this only when a reader would reasonably expect something that this card will not do. Otherwise leave it out.
|
|
70
|
+
|
|
71
|
+
## 3. When to ask John
|
|
72
|
+
|
|
73
|
+
Ask in the session and wait for the answer when:
|
|
74
|
+
|
|
75
|
+
- The title and description aren't enough to say who this is for or what done looks like.
|
|
76
|
+
- An item depends on a product decision or a fact only he has, such as a limit, a wording, or which users.
|
|
77
|
+
- There are two readings that would give different Done when lists.
|
|
78
|
+
|
|
79
|
+
Ask one question at a time, and offer your best guess so he can answer with a yes. Don't fill a gap with a guess or a placeholder. A made-up criterion reads exactly like a real one, and it will be built.
|
|
80
|
+
|
|
81
|
+
## 4. Write it to the card
|
|
82
|
+
|
|
83
|
+
- Leave the original description exactly as it is, at the top. It is the original ask, and later steps read it.
|
|
84
|
+
- Append the Specification below it as a collapsible section, so the card stays short when John opens it.
|
|
85
|
+
- Add nothing else. No type line, repo, risk or flags, and no approach or file names.
|
|
86
|
+
|
|
87
|
+
Use this form:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
>>> ## Specification
|
|
91
|
+
**Why:** …
|
|
92
|
+
|
|
93
|
+
**Done when:**
|
|
94
|
+
- [ ] …
|
|
95
|
+
- [ ] …
|
|
96
|
+
|
|
97
|
+
**Out of scope:** …
|
|
98
|
+
>>>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
After writing, read the card back. Check that the original description is unchanged and that the Specification shows as a collapsed section.
|
|
102
|
+
|
|
103
|
+
## 5. Finish
|
|
104
|
+
|
|
105
|
+
Tell John in two or three lines:
|
|
106
|
+
|
|
107
|
+
- The type you set, and whether you replaced a label that was already there.
|
|
108
|
+
- How many Done when items there are.
|
|
109
|
+
- Anything you weren't sure about, and whether the card looks like more than one thing.
|
|
110
|
+
|
|
111
|
+
Then stop. Plan is the next step, and John may want to read the Specification first.
|
|
112
|
+
|
|
113
|
+
## If something goes wrong
|
|
114
|
+
|
|
115
|
+
| When this happens | Do this |
|
|
116
|
+
|---|---|
|
|
117
|
+
| The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
|
|
118
|
+
| 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 |
|
|
119
|
+
| 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 |
|
|
120
|
+
| 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 John |
|
|
121
|
+
| The collapsed section shows as plain `>>>` text | Leave the content as it is and tell John. Don't keep reformatting it |
|
|
122
|
+
| The `Type` label group, or the label you need, doesn't exist | Don't create it. Finish the Specification, and tell John which label is missing |
|
|
123
|
+
| The card carries more than one type label | Leave only the one you worked out |
|
|
124
|
+
|
|
125
|
+
If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
|
|
126
|
+
|
|
127
|
+
## Example
|
|
128
|
+
|
|
129
|
+
**The card arrives as**
|
|
130
|
+
|
|
131
|
+
> **Export orders as CSV**
|
|
132
|
+
> Managers keep asking for the raw order list so they can work on it in a spreadsheet. Let them download it.
|
|
133
|
+
|
|
134
|
+
**Type:** `feat`, set as the label.
|
|
135
|
+
|
|
136
|
+
**Appended to the card**
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
>>> ## Specification
|
|
140
|
+
**Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
|
|
141
|
+
|
|
142
|
+
**Done when:**
|
|
143
|
+
- [ ] On the orders page, a manager sees a Download CSV button.
|
|
144
|
+
- [ ] The file has one row per order, with the order number, date, customer, status and total.
|
|
145
|
+
- [ ] The file covers the same filters and date range that are showing on screen.
|
|
146
|
+
- [ ] With no orders in range, the file has the header row and no others.
|
|
147
|
+
- [ ] Someone who is not a manager does not see the button and cannot fetch the file.
|
|
148
|
+
|
|
149
|
+
**Out of scope:** Scheduled or emailed exports.
|
|
150
|
+
>>>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Notice what isn't there: no endpoint, no file names, no library. Those are plan's.
|
|
@@ -0,0 +1,159 @@
|
|
|
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. John 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. Tell John and ask whether he wants it revised.
|
|
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 John asking.
|
|
42
|
+
- If the work needs a new dependency, say so here. That is a decision John 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 John 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. Stop and ask John. He may change the Specification. You may not.
|
|
72
|
+
- **A technical question.** Settle it from the code where you can. Ask John 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 and give your recommendation.
|
|
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 tell John when you finish. Folding it in makes the card bigger than what he 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. Finish
|
|
100
|
+
|
|
101
|
+
Tell John in a few lines:
|
|
102
|
+
|
|
103
|
+
- The approach in one sentence.
|
|
104
|
+
- Roughly how much it touches: how many files, in which apps or repos.
|
|
105
|
+
- Whether it looks like one pull request's worth or more. Breakdown decides, but your read is useful.
|
|
106
|
+
- Anything you found that sits outside the Specification.
|
|
107
|
+
|
|
108
|
+
Then stop. Breakdown is the next step.
|
|
109
|
+
|
|
110
|
+
## If something goes wrong
|
|
111
|
+
|
|
112
|
+
| When this happens | Do this |
|
|
113
|
+
|---|---|
|
|
114
|
+
| The card ID doesn't resolve | Ask John for the ID. Don't pick a card because its title looks similar |
|
|
115
|
+
| 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 |
|
|
116
|
+
| 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 |
|
|
117
|
+
| 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 John |
|
|
118
|
+
| The collapsed section shows as plain `>>>` text | Leave the content as it is and tell John. Don't keep reformatting it |
|
|
119
|
+
| A repo named in `PROJECT.md` is missing, or the fetch fails | Tell John, and ask whether to plan from what is on disk |
|
|
120
|
+
| You can't tell which repo the work belongs in | Ask John. Don't guess paths |
|
|
121
|
+
| 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 |
|
|
122
|
+
|
|
123
|
+
If something fails that isn't on this list, stop and tell John what happened. Don't work around it.
|
|
124
|
+
|
|
125
|
+
## Example
|
|
126
|
+
|
|
127
|
+
**The card's Specification**
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
**Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
|
|
131
|
+
|
|
132
|
+
**Done when:**
|
|
133
|
+
- [ ] On the orders page, a manager sees a Download CSV button.
|
|
134
|
+
- [ ] The file has one row per order, with the order number, date, customer, status and total.
|
|
135
|
+
- [ ] The file covers the same filters and date range that are showing on screen.
|
|
136
|
+
- [ ] With no orders in range, the file has the header row and no others.
|
|
137
|
+
- [ ] Someone who is not a manager does not see the button and cannot fetch the file.
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Appended to the card**
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
>>> ## Plan
|
|
144
|
+
**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.
|
|
145
|
+
|
|
146
|
+
**Changes:**
|
|
147
|
+
- `shop/api/app/orders/routes.py`: accept `format=csv` on the list route, managers only
|
|
148
|
+
- `shop/api/app/orders/export.py` (new): turn the filtered query into CSV rows, reusing `csv_stream` from `shop/api/app/common/export.py`
|
|
149
|
+
- `shop/web/src/pages/orders/OrdersPage.tsx`: Download CSV button, shown to managers, passing the current filters
|
|
150
|
+
- `shop/web/src/api/orders.ts`: `downloadOrdersCsv(filters)`
|
|
151
|
+
|
|
152
|
+
**Tests:**
|
|
153
|
+
1. Button shows for a manager: component test in `OrdersPage.test.tsx`
|
|
154
|
+
2. Columns, and one row per order: API test in `test_orders_export.py`
|
|
155
|
+
3. Same filters and range as on screen: API test with a filtered request, and a component test that the filters are passed
|
|
156
|
+
4. Empty range gives the header only: API test in `test_orders_export.py`
|
|
157
|
+
5. A non-manager can't see or fetch it: component test for the button, API test for a 403
|
|
158
|
+
>>>
|
|
159
|
+
```
|