@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.
package/herdr/README.md CHANGED
@@ -11,6 +11,11 @@ layouts (whole-window arrangements of mods).
11
11
  | `mods/layout-switch/` | A dropdown that shows the current layout and switches to another. |
12
12
  | `layouts/default.json` | Herdr's own layout, plus the layout dropdown. |
13
13
  | `layouts/test.json` | `default` plus the CPU mod in the sidebar. |
14
+ | `projects/template/` | The starting `PROJECT.md` for every new project. |
15
+
16
+ The skills are in [../skills/](../skills/), outside this folder. They are
17
+ linked into `~/.claude/skills` (`CLAUDE_CONFIG_DIR` picks another `~/.claude`)
18
+ by the same `entourage install` and `entourage update`.
14
19
 
15
20
  ## How it works
16
21
 
@@ -76,6 +81,147 @@ re-reads everything.
76
81
  - **Something broke the window:** `ctrl-alt-shift-escape` always returns Herdr
77
82
  to its own default layout.
78
83
 
84
+ ## Projects
85
+
86
+ A project is a group of repos that shows up in Herdr as one space. Only the
87
+ template is in this repo. Your own projects are in
88
+ `~/.config/entourage/projects` (`ENTOURAGE_HOME` picks another
89
+ `~/.config/entourage`), one folder each:
90
+
91
+ | In a project folder | What it is |
92
+ |---|---|
93
+ | `PROJECT.md` | What the project is and what belongs in each repo. You write this. |
94
+ | `repos` | One repo path per line. `entourage project add` writes it; you can edit it. |
95
+ | `links/` | Generated: a link to each repo, named after its folder. |
96
+ | `tasks/` | One folder per task, holding a worktree of each repo. See [Tasks](#tasks). |
97
+ | `CLAUDE.md`, `AGENTS.md` | Generated: links to `PROJECT.md`, so an agent started in the space reads it. |
98
+
99
+ - **Make one:** `entourage project new <name>`, then
100
+ `entourage project add <name> <path>` for each repo. The repo must already
101
+ be cloned on this machine.
102
+ - **Open it:** `entourage project open <name>` rebuilds the links and shows
103
+ the project's space, making it if it is not open. The space's folder is the
104
+ project folder.
105
+ - **Check them:** `entourage status` reports a repo that has moved or gone,
106
+ and a `PROJECT.md` that is still the template. Delete the template's first
107
+ line once you have filled it in.
108
+ - **Remove a repo:** delete its line from `repos`; the next `open` drops its
109
+ link. To remove a project, close its space and delete its folder.
110
+ - **The linked repos are shared.** A repo in two projects is the same clone
111
+ in both, so switching branches in one changes it in the other.
112
+
113
+ ## Tasks
114
+
115
+ A task is one piece of work in a project, usually a Linear card. It has two
116
+ commands, used in this order.
117
+
118
+ ### Writing the card up
119
+
120
+ ```sh
121
+ entourage task new <project> <card>
122
+ ```
123
+
124
+ - **The card is its ID**, like `ABC-122`. Upper or lower case both work.
125
+ - **It opens a tab named after the card** in the project's space, in the
126
+ project folder, and starts an agent in it. The agent is `claude`;
127
+ `ENTOURAGE_AGENT` picks another command.
128
+ - **The agent's first message** is [prompts/task-new.md](../prompts/task-new.md)
129
+ with the card and project filled in. It tells the agent to start with
130
+ `sdlc-define` and follow each skill's handoff block to the next
131
+ (`sdlc-plan`, then `sdlc-breakdown`), in that one session, and to wait for
132
+ your approval at the end. Edit that file to change what the agent is told.
133
+ - **It makes no branch, worktree or task folder.** The card has no type until
134
+ the agent has defined it, and the type is the start of the branch name.
135
+ - **It checks first.** An unknown project, something that is not a card ID,
136
+ Herdr not running, no agent on your `PATH`, or the skills not linked into
137
+ `~/.claude/skills` stops it before anything is opened. Run
138
+ `entourage update` to link the skills.
139
+
140
+ ### Starting the work
141
+
142
+ One branch, checked out as a git worktree of the repos the task needs, and
143
+ shown as a tab in the project's space.
144
+
145
+ ```sh
146
+ entourage task start <project> <branch> [<repo>[:<group>[,<group>...]] ...]
147
+ ```
148
+
149
+ - **Targets say what the task works on.** Each one names a repo of the
150
+ project by its folder name, and optionally groups inside it:
151
+
152
+ | After the branch | The task gets |
153
+ |---|---|
154
+ | nothing | every repo of the project, each with its whole setup |
155
+ | `app:athlete` | the `app` repo, set up for its `athlete` group |
156
+ | `app:athlete,coach` | `app`, set up for both groups |
157
+ | `app:athlete billing` | two repos: `app` for `athlete`, and all of `billing` |
158
+
159
+ A repo that is not named gets no worktree and no setup; read it through the
160
+ project's `links/`. A group is the repo's own word for a part of itself
161
+ (see [What a repo provides](#what-a-repo-provides)): lowercase letters,
162
+ digits and dashes. entourage passes it on and does not check that the repo
163
+ knows it. A repo whose folder name has a colon in it cannot be named as a
164
+ target.
165
+
166
+ - **The branch is `<type>/<description>`**, following
167
+ [Conventional Branch](https://conventionalbranch.org): `feat/abc-122-insert-task-here`,
168
+ `fix/abc-140-header-bug`, `chore/update-dependencies`. Put the card's ID in
169
+ the description. The types are `feature`, `feat`, `bugfix`, `fix`, `hotfix`,
170
+ `release` and `chore`, plus `ai`, `claude`, `codex`, `copilot` and `cursor`.
171
+ - **The description names the task.** `feat/abc-122-insert-task-here` makes
172
+ the folder `tasks/abc-122-insert-task-here` and a tab of that name.
173
+ - **Each of the task's repos gets a worktree** at `tasks/<task>/<repo>`, on the new branch,
174
+ cut from the remote's default branch after a fetch. A repo that cannot be
175
+ fetched starts from what is local, with a warning.
176
+ - **The repos' own checkouts are not touched.** They stay on whatever branch
177
+ they were on.
178
+ - **Where the tab starts:** in the worktree when the task has one repo; in
179
+ the task folder when it has several. That folder has `CLAUDE.md` and
180
+ `AGENTS.md` links to the project's `PROJECT.md`.
181
+ - **Setup runs in the tab.** For each repo that has a `setup` recipe (see
182
+ [What a repo provides](#what-a-repo-provides)), `just setup`, followed by
183
+ the target's groups if it named any, is typed into
184
+ the new tab's shell, so `task start` returns within a second or two and you
185
+ watch the install where you will work. With several repos they run one after another,
186
+ and one that fails stops the rest. A repo without the recipe is skipped and
187
+ named in the output.
188
+ - **Setup never fails the task.** The task and its tab are there either way.
189
+ Without `just`, the output says setup was skipped. If the line could not be
190
+ typed into the tab, the output gives you the line to run yourself.
191
+ - **Nothing is made unless everything can be.** A task or branch of that name
192
+ that already exists, a missing repo, or Herdr not running stops it first,
193
+ and a worktree that fails partway is undone.
194
+ - **Remove a task by hand for now:** in each repo run
195
+ `git worktree remove <project folder>/tasks/<task>/<repo>` and
196
+ `git branch -D <branch>`, then delete the task's folder and close its tab.
197
+
198
+ ## What a repo provides
199
+
200
+ entourage knows nothing about how a repo is built or run. A repo says so
201
+ itself, in a [justfile](https://just.systems) at its root, with recipes that
202
+ have the same names in every repo. entourage only knows the names.
203
+
204
+ | Recipe | What it must do | Used by |
205
+ |---|---|---|
206
+ | `setup` | Make a fresh checkout ready to work in: install dependencies and anything else a new worktree lacks. Safe to run twice. Called with group names (`just setup athlete coach`), make ready only what those groups need, and fail with a clear message for a group the repo does not have. | `entourage task start` |
207
+
208
+ ```just
209
+ setup:
210
+ npm install
211
+ ```
212
+
213
+ - **Only a justfile at the repo's own root counts**: `justfile`, `Justfile` or
214
+ `.justfile`. One in a folder above is never used.
215
+ - **A repo with several codebases names its own groups**, such as `athlete`
216
+ for a web app with the API and database it needs. A target like
217
+ `app:athlete` reaches the recipe as `just setup athlete`. A repo with one
218
+ codebase needs none: its `setup` takes no arguments.
219
+ - **`entourage status` notes** each repo with no justfile or no `setup`
220
+ recipe. A note is not a problem: tasks in that project still start, without
221
+ setup.
222
+ - **`just` has to be installed** on the machine. Without it, tasks start
223
+ without setup and `entourage status` says so.
224
+
79
225
  ## Changing things
80
226
 
81
227
  - Work from a git clone, not the npm install: clone the repo and run
@@ -0,0 +1,19 @@
1
+ <!-- entourage:template -->
2
+ <!-- Delete the line above once this doc is filled in. `entourage status` reports the project as unfinished until then. -->
3
+
4
+ # __NAME__
5
+
6
+ One paragraph: what this project is, who it is for, and what "done" usually
7
+ looks like for a piece of work in it.
8
+
9
+ ## Repos
10
+
11
+ One section per repo in this project. An agent reads this to decide which
12
+ repo a piece of work belongs in, so be specific.
13
+
14
+ ### example-repo
15
+
16
+ - **Owns:** what lives here and nowhere else.
17
+ - **Does not own:** things people expect to find here but that live in
18
+ another repo, and which repo that is.
19
+ - **Run and test:** how to set it up and how to run its tests.
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "@johngaynor/entourage",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
5
5
  "bin": {
6
6
  "entourage": "cli/entourage"
7
7
  },
8
8
  "files": [
9
9
  "cli/entourage",
10
- "herdr/"
10
+ "cli/lib/",
11
+ "herdr/",
12
+ "prompts/",
13
+ "skills/"
11
14
  ],
12
15
  "scripts": {
13
- "test": "cli/test.sh"
16
+ "test": "test/run.sh"
14
17
  },
15
18
  "os": [
16
19
  "darwin",
@@ -0,0 +1,17 @@
1
+ Write up Linear card {card} so that it is ready to build. This session is in the entourage project `{project}`.
2
+
3
+ Start with the sdlc-define skill. Each skill ends by writing a handoff block. Write each one before you start the next skill, even though you carry straight on: the blocks are how I see how each step ended. You are driving this run, so act on the block's `status`:
4
+
5
+ - `done`: go straight on to the step in `next`, without waiting for me. `plan` is the sdlc-plan skill and `breakdown` is the sdlc-breakdown skill.
6
+ - `needs-human`: wait for my answer, then carry on with the same skill.
7
+ - `failed`: stop there. Don't start the next skill.
8
+
9
+ If I ask for a change when I'm approving, sdlc-breakdown tells you which skill makes it. When that skill hands off, go back to sdlc-breakdown, not on to `next`.
10
+
11
+ Do every step yourself, in this session. Don't hand a step to a subagent.
12
+
13
+ sdlc-breakdown asks me to approve the card. When it hands off with `next: setup`, the card is approved. Give me the command that starts the work, and don't run it yourself:
14
+
15
+ entourage task start {project} <type>/<card-id>-<short-name>
16
+
17
+ Use the type you set on the card, the card's ID in lowercase, and two to four words from its title, in lowercase with hyphens. If the card was sliced, give the command for the first sub-issue.
@@ -0,0 +1,229 @@
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 the human 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 the human to approve, happens on every card. Creating sub-issues happens only after they approve 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, say so when you ask the human to approve.
21
+ 4. If the card already has a Breakdown 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, go on to ask them to approve the card.
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 the human 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 ask the human to approve.
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, say so when you ask the human to approve.
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 the human 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 the human turns down should leave nothing behind to clean up.
89
+
90
+ ### Ask the human to approve
91
+
92
+ Breakdown is the last step before building, so it ends by asking the human to approve the whole card: the Specification, the Plan and the Breakdown together. This happens on every card, sliced or not.
93
+
94
+ Give them a summary they 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 them to approve or say what to change. The summary goes above the handoff block, and the block is the ask:
102
+
103
+ ```
104
+ phase: breakdown
105
+ status: needs-human
106
+ question: Approve <card ID> as specified, planned and broken down?
107
+ options: approve | change breakdown | change plan | change specification
108
+ ```
109
+
110
+ Wait for their answer.
111
+
112
+ | The human says | Then |
113
+ |---|---|
114
+ | Change the breakdown | Revise the Breakdown section and ask again |
115
+ | Change the Specification or the Plan | Make the change by that section's own skill, `sdlc-define` or `sdlc-plan`, as a revision the human asked for. That skill ends with its own `done` block, whose `next` does not apply here: come back to this step and 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 |
116
+ | Approve, and the card is one piece | The card is ready to build. Hand off, as described below |
117
+ | Approve, and the card is sliced | Go on to part 2 |
118
+
119
+ ## Part 2: Create the sub-issues
120
+
121
+ Do this only when the human has approved the card in this session, and only when the breakdown has more than one slice.
122
+
123
+ For each slice, in order, create a sub-issue of the card:
124
+
125
+ - **Title.** The slice name.
126
+ - **Type.** The parent's type, set as the label. Slices don't get a type of their own.
127
+ - **Description.** One or two sentences saying what this slice delivers, then its own sections in the same form as any card:
128
+ - A collapsed Specification, with the parent's Why narrowed to this slice, and the slice's Done when.
129
+ - 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.
130
+ - A Breakdown section that reads `One piece. Slice <n> of <total>.`
131
+ - **Order.** Mark it as blocked by the slice before it. The first slice is blocked by nothing.
132
+
133
+ 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.
134
+
135
+ 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.
136
+
137
+ Read the parent and each sub-issue back, then hand off.
138
+
139
+ ## Hand off
140
+
141
+ Breakdown is finished when the human has approved the card and, if it was sliced, its sub-issues exist. Then write the handoff block:
142
+
143
+ - `phase: breakdown`, `status: done` and `next: setup`.
144
+ - `summary`: that the card is approved, and whether it is one piece or sliced. If it was sliced, the sub-issues in order with their IDs, and which one is first.
145
+ - `flags`: anything that didn't go to plan, such as a blocking relation that couldn't be set.
146
+
147
+ Setup is not a skill. It is the `entourage task start` command, which the human runs, so there is no step for you to go on to.
148
+
149
+ ## The handoff block
150
+
151
+ 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.
152
+
153
+ 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:
154
+
155
+ ```
156
+ phase: <this step>
157
+ status: <done, needs-human or failed>
158
+ next: <the step that follows>
159
+ summary: <one to three sentences on what you did>
160
+ flags: <what the human should know but wasn't asked>
161
+ question: <one question>
162
+ options: <the answers you expect, your recommendation first, separated by " | ">
163
+ reason: <what went wrong, and what you already tried>
164
+ ```
165
+
166
+ Which lines you write depends on the status:
167
+
168
+ | Status | Use it when | Lines |
169
+ |---|---|---|
170
+ | `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 |
171
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
172
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
173
+
174
+ - **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`.
175
+ - **`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`.
176
+ - **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.
177
+ - **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.
178
+ - **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.
179
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
180
+
181
+ ## If something goes wrong
182
+
183
+ | When this happens | Do this |
184
+ |---|---|
185
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
186
+ | 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 |
187
+ | 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 |
188
+ | 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 |
189
+ | 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 |
190
+ | A blocking relation can't be set | Tell the human. The order is still on the parent's Breakdown list, so it isn't lost |
191
+ | The human's answer isn't a clear yes | Treat it as a change request. Ask what they want changed, then ask for approval again |
192
+
193
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
194
+
195
+ ## Examples
196
+
197
+ **One piece.** The card "Export orders as CSV" has a plan that touches four files and delivers one behaviour.
198
+
199
+ ```
200
+ ## Breakdown
201
+ One piece. Four files and one behaviour, small enough for a single pull request.
202
+ ```
203
+
204
+ **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.
205
+
206
+ ```
207
+ ## Breakdown
208
+ 1. **Staff can add a note to an order**
209
+ - [ ] On an order, a staff member can type a note and save it.
210
+ - [ ] Saved notes show on the order, newest first, with the author and time.
211
+ - [ ] Someone who is not staff can neither add nor see notes.
212
+ 2. **Staff can edit and delete their own notes**
213
+ - [ ] A staff member can edit a note they wrote, and the note shows it was edited.
214
+ - [ ] A staff member can delete a note they wrote, after confirming.
215
+ - [ ] A staff member cannot edit or delete someone else's note.
216
+ 3. **A note can be shown to the customer**
217
+ - [ ] A staff member can mark a note as visible to the customer.
218
+ - [ ] The customer sees those notes, and only those, on their order page.
219
+ ```
220
+
221
+ **The wrong cut** for the same card:
222
+
223
+ ```
224
+ 1. Notes table and migration
225
+ 2. Notes API
226
+ 3. Notes in the staff app
227
+ ```
228
+
229
+ 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,183 @@
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 the human 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. 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
+ 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 the human about the other part and ask whether they want 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 in `flags` when you hand off. 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 the human
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 they have, 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, in a handoff block with `status: needs-human`. Put your best guess first in `options`, so they 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 the human 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. Hand off
104
+
105
+ When the Specification is on the card and you have read it back, write the handoff block. Define is not finished until it is written:
106
+
107
+ - `phase: define`, `status: done` and `next: plan`.
108
+ - `summary`: the type you set, whether you replaced a label that was already there, and how many Done when items there are.
109
+ - `flags`: anything you weren't sure about, and whether the card looks like more than one thing.
110
+
111
+ ## The handoff block
112
+
113
+ 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.
114
+
115
+ 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:
116
+
117
+ ```
118
+ phase: <this step>
119
+ status: <done, needs-human or failed>
120
+ next: <the step that follows>
121
+ summary: <one to three sentences on what you did>
122
+ flags: <what the human should know but wasn't asked>
123
+ question: <one question>
124
+ options: <the answers you expect, your recommendation first, separated by " | ">
125
+ reason: <what went wrong, and what you already tried>
126
+ ```
127
+
128
+ Which lines you write depends on the status:
129
+
130
+ | Status | Use it when | Lines |
131
+ |---|---|---|
132
+ | `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 |
133
+ | `needs-human` | You can't go on without an answer or an approval | `phase`, `status`, `question`, `options`, and `summary` if it helps them answer |
134
+ | `failed` | Something is missing or went wrong, and this skill tells you to stop or doesn't cover it | `phase`, `status`, `reason` |
135
+
136
+ - **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`.
137
+ - **`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`.
138
+ - **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.
139
+ - **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.
140
+ - **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.
141
+ - **After `failed`, change nothing more.** Leave the card as it is for the human.
142
+
143
+ ## If something goes wrong
144
+
145
+ | When this happens | Do this |
146
+ |---|---|
147
+ | The card ID doesn't resolve | Ask the human for the ID. Don't pick a card because its title looks similar |
148
+ | 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 |
149
+ | 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 |
150
+ | 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 |
151
+ | The collapsed section shows as plain `>>>` text | Leave the content as it is and tell the human. Don't keep reformatting it |
152
+ | The `Type` label group, or the label you need, doesn't exist | Don't create it. Finish the Specification, and tell the human which label is missing |
153
+ | The card carries more than one type label | Leave only the one you worked out |
154
+
155
+ If something fails that isn't on this list, stop and tell the human what happened. Don't work around it.
156
+
157
+ ## Example
158
+
159
+ **The card arrives as**
160
+
161
+ > **Export orders as CSV**
162
+ > Managers keep asking for the raw order list so they can work on it in a spreadsheet. Let them download it.
163
+
164
+ **Type:** `feat`, set as the label.
165
+
166
+ **Appended to the card**
167
+
168
+ ```
169
+ >>> ## Specification
170
+ **Why:** A manager can download the order list as a CSV, so they can analyse it in their own spreadsheet.
171
+
172
+ **Done when:**
173
+ - [ ] On the orders page, a manager sees a Download CSV button.
174
+ - [ ] The file has one row per order, with the order number, date, customer, status and total.
175
+ - [ ] The file covers the same filters and date range that are showing on screen.
176
+ - [ ] With no orders in range, the file has the header row and no others.
177
+ - [ ] Someone who is not a manager does not see the button and cannot fetch the file.
178
+
179
+ **Out of scope:** Scheduled or emailed exports.
180
+ >>>
181
+ ```
182
+
183
+ Notice what isn't there: no endpoint, no file names, no library. Those are plan's.