@sjawhar/opencode-legion-envoy 8.17.0 → 8.17.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.
@@ -1,121 +1,56 @@
1
1
  ---
2
2
  name: dispatch-brainstorming
3
- description: "Use in a session with Dispatch whenever a design conversation with a person starts: brainstorming or /brainstorming, \"let's design\", writing or changing a spec, writing an implementation plan, or a feature request or change that needs a person's choices. In a session with Dispatch it replaces superpowers' brainstorming and writing-plans; a Legion architect's own spec follows skill://legion-architect instead."
3
+ description: "Use when a session with Dispatch starts a design conversation with a person: brainstorming, /brainstorming or \"let's design\". Also use it there for a spec, an implementation plan, or a change that needs a person's choices. It replaces superpowers' brainstorming and writing-plans. A Legion architect's own spec follows skill://legion-architect instead."
4
4
  ---
5
5
 
6
6
  # Brainstorming in Dispatch
7
7
 
8
- This skill governs a design conversation with a person, never a Legion architect's own issue
9
- spec: an architect follows `skill://legion-architect` for that, even for a child issue.
8
+ A Legion architect's own issue spec, a child's too, follows `skill://legion-architect`. A Legion phase worker never writes the spec: it sends the decision to its architect (`skill://legion-worker`).
10
9
 
11
- In a session with Dispatch, such a conversation happens in its issue's spec, and the plan that
12
- follows is a document on the same issue. This skill replaces superpowers' `brainstorming` and
13
- `writing-plans` there, even when the user invokes one of them by name:
10
+ This skill replaces superpowers' `brainstorming` and `writing-plans`, even when the user names one:
14
11
 
15
- - No design question goes to chat. Every question is a decision block in the spec, and your reply
16
- in chat links the issue and asks nothing.
17
- - There is no limit of one question per message. Every question that is ready goes out at once.
18
- - There is no approval after each section, only the one at the end.
19
- - A small change gets a short spec, never a design in chat: its size shortens the spec and changes
20
- nothing about where the conversation happens.
21
- - The spec is the issue's primary document and the plan is its `plan.md` document, in place of
22
- superpowers' spec and plan files (`docs/superpowers/specs/`, `docs/superpowers/plans/`). A copy
23
- also goes in the repository only when the person, the issue, its spec or the repository asks for
24
- one.
12
+ - The spec is the issue's primary document, the plan its `plan.md`. No `docs/superpowers/` files.
13
+ - Each design question is a decision block in the spec, never a chat question. A small change gets a short spec.
14
+ - Send every ready question at once. Request approval once, at the end.
15
+ - Ask in stages: clarifying questions, two or three approaches with a recommendation, the design by section. A question that depends on no open answer goes out at once.
16
+ - Copy the spec, plan or spec code into the repository only when the person, the issue, its spec or the repository asks.
25
17
 
26
- The brainstorming stages still shape what you ask: clarifying questions, then two or three
27
- approaches with a recommendation, then the design section by section. A question that depends on
28
- no open answer goes out at once, whatever its stage.
29
-
30
- Read `skill://dispatch` before the first version: its "Writing a spec", "Decision blocks",
31
- "Writing for the human" and "Approval of a spec" sections define the spec's shape, each block's
32
- shape, and when approval is requested. A Legion phase worker never writes the issue's spec
33
- document; it sends a decision to its architect (`skill://legion-worker`).
18
+ Before the first version, read the code and documents the design touches. Before the first version, also read the `skill://dispatch` sections "Writing a spec", "Decision blocks", "Writing for the human" and "Approval of a spec".
34
19
 
35
20
  ## Where the spec lives
36
21
 
37
- Search Dispatch first, as `skill://dispatch-first` says. When an issue already tracks the work, its
38
- primary document is the spec: extend it in place with `dispatch doc-edit`, keeping the human's own
39
- text. Otherwise create the issue with its first version as `spec`, in the project a search hit
40
- already named or, when none does, the project the human names:
41
-
42
- ```bash
43
- dispatch issue --project <KEY> --title '<title>' --spec-file - <<'EOF'
44
- <the spec's first version>
45
- EOF
46
- ```
47
-
48
- No command lists every project, so when nothing you found names one, ask the human in chat which
49
- project the issue belongs in before you create it — a filing question with nowhere else to land
50
- yet, not a design question, so it does not change "your reply in chat links the issue and asks
51
- nothing" for the design itself. Never read the project from the environment, a configuration file,
52
- or the Dispatch HTTP API: every read and write goes through a `dispatch` command.
53
-
54
- Before the first version, read the code and documents the design touches, so the facts you write
55
- are ones you checked.
22
+ 1. Search first (`skill://dispatch-first`). If an issue tracks the work, extend its primary document with `dispatch doc-edit`, keeping the human's text.
23
+ 2. Else run `dispatch issue --project <KEY> --title '<title>' --spec-file -` in the project a search hit names.
24
+ 3. If no hit names a project, ask the human in chat which one (`dispatch projects` lists them). This is a filing question, not a design question.
25
+ 4. Use only `dispatch` commands. Never get the project from the environment, a configuration file or the Dispatch HTTP API.
56
26
 
57
27
  ## Each turn
58
28
 
59
- 1. **Start with what is established.** The first version holds only what the conversation has
60
- established: the problem and its evidence, what the human has said in their own words, the
61
- facts the next questions need, and each question that is ready, as a decision block at the end
62
- of the section that sets it up. Write nothing past those questions: no design, no defaults you
63
- chose, no "what we will build", and no recommendation outside a decision block's own text. A
64
- point the human has not stated, however obvious it seems (what a word in the request means, how
65
- an edge case behaves, what a change does to an existing command), goes inside a decision block
66
- or stays out. This is stricter than `skill://dispatch`'s general rule for an inferred point
67
- elsewhere in a spec ("a point you inferred says so, with the reasoning"): in a live conversation
68
- nothing is settled until the human has seen it, so even a flagged inference waits for its own
69
- decision block.
70
- 2. **The human answers or comments.** Reply to each human comment in its thread
71
- (`dispatch comment --reply-to <comment id>`), then rewrite the passage the answer or the comment
72
- changes. Under an open ask whose next move is yours, such as the approval request you must
73
- revise or hand back, reply with `--reply-to-ask <ask id> --turn agent` instead: a `--reply-to`
74
- reply takes the default turn, which hands the request back to the human unchanged, and a call
75
- with a corrected `--summary` is refused while it waits on them.
76
- 3. **Each next version keeps answers in place and adds what they open.** An answered decision
77
- block already carries its own record, as `skill://dispatch`'s "Writing a spec" says; leave it
78
- where it is. Where an answer changes design text elsewhere in the spec, rewrite that text. Then
79
- add the next sections, each with its question. Every question that is ready goes out
80
- at once, each as a decision block at the end of the section that sets it up; a question waits
81
- only when it depends on an answer still open.
82
- 4. **A comment that answers a question settles it** as surely as the block does. It carries no
83
- rendered record, so write it into the text at once, recording the person as `skill://dispatch`'s
84
- "Writing a spec" says, and close the block with `dispatch resolve-ask` if the human has not.
85
- 5. **Request approval at the end, not after each section.** Once nothing in the spec is new to the
86
- human, request it exactly when "Approval of a spec" in `skill://dispatch` says: every decision
87
- block settled, the human has agreed to every point in the spec, and the current
88
- version is not yet approved (or waived, as that section's next paragraph covers). The request
89
- carries nothing new, as that section also says.
29
+ 1. **First version: only what the human settled.** Write the problem, its evidence, the human's words and the facts the questions need. Add each ready question as a block at the end of its section. Write no design, no default you chose, and no recommendation outside a block. A point the human did not state goes in a block or stays out, however obvious. A flagged inference waits too.
30
+ 2. **Reply to each comment in its thread** (`dispatch comment --reply-to <comment id>`), then rewrite what it changes. When the next move on an open ask is yours, such as an approval request to revise, use `--reply-to-ask <ask id> --turn agent`.
31
+ 3. **Each next version keeps answered blocks in place** and rewrites every passage a decision changes. The spec records the current design and requirements, never how you got there. Then add the next sections and their ready questions.
32
+ 4. **A comment that answers a question settles it.** Write the answer into the text at once, as "Writing a spec" says. Close the block with `dispatch resolve-ask` if it is still open.
33
+ 5. **Request approval** when nothing in the spec is new to the human, as "Approval of a spec" says.
90
34
 
91
35
  ## Coming to terms
92
36
 
93
- The conversation comes to terms in both directions. Explain what the code does today, plainly
94
- enough for the human to react to and with each tool, event and route it uses named exactly (as
95
- "Writing for the human" in `skill://dispatch` says), and ask; the human's model comes out of those
96
- reactions, and so do corrections to it. Neither your model nor theirs is the starting truth.
37
+ Explain plainly what the code does now, naming each tool, event and route exactly, and ask. Neither model is true at the start: the human's reactions give their model and its corrections.
97
38
 
98
- ## The plan
99
-
100
- Once the spec is approved — or, when the issue needed no spec at all (a bug fix with no design
101
- decision), once you have enough to plan from — the implementation plan is the issue's `plan.md`
102
- document, never its spec:
39
+ ## Handing over a spec or plan
103
40
 
104
- ```bash
105
- dispatch artifact --issue <KEY> --name plan.md --content-file - <<'EOF'
106
- <the plan>
107
- EOF
108
- ```
41
+ 1. Start your chat reply with:
42
+ 1. Each decision the human must make: options, trade-offs and your recommendation, clear without the document. The human answers in the block.
43
+ 2. Each point the human has not yet settled, one line each, with a line reference.
44
+ 3. The link.
45
+ 2. The reply carries only what is new. The document stays the full current design.
46
+ 3. If no decision is open and nothing is new, do not ask for review in the reply. Say the document records what you agreed. Turn step 5 still applies.
47
+ 4. When you ask for review, say "ready for review", never "complete". Put the uncertainty first and show your reasoning.
109
48
 
110
- Uploading `plan.md` again writes its next version. `writing-plans`'s content rules still apply in
111
- full — file structure, task right-sizing, bite-sized steps, no placeholders, the header, and its
112
- self-review — only where the plan lives changes: the issue's `plan.md`, in place of a plan file.
113
- A copy in the repository, or spec code there, goes in only when the person, the issue, its spec or
114
- the repository asks for it.
115
- Technical choices inside the approved design are made in the plan and need no question. A plan
116
- never changes a decision the human made in the spec: a change to one goes back to the spec as a
117
- decision block, with the evidence for it.
49
+ ## The plan
118
50
 
119
- Execution reads the plan the same way: `dispatch doc-read --issue <KEY> --artifact plan.md` in place
120
- of opening a plan file, then follows `executing-plans` or `subagent-driven-development` as it would
121
- for a file on disk.
51
+ - Write it after the spec's approval. With no spec (a bug fix with no design decision), write it when you can plan.
52
+ - Upload it with `dispatch artifact --issue <KEY> --name plan.md --content-file -`. Each upload is a new version.
53
+ - Follow all `writing-plans` content rules: file structure, task size, small steps, no placeholders, the header, its self-review.
54
+ - Make technical choices inside the approved design in the plan, with no question. A change to a human's decision goes back to the spec as a block, with its evidence.
55
+ - If the human says "plan only", stop after the plan.
56
+ - To execute, read it with `dispatch doc-read --issue <KEY> --artifact plan.md`, then follow `executing-plans` or `subagent-driven-development`.
@@ -1,58 +1,40 @@
1
1
  ---
2
2
  name: dispatch-first
3
- description: "Use in any session with the dispatch command, before planning, filing an issue, asking a human, posting a finding, or starting work that someone may already track or have decided."
3
+ description: "Use when a session has the dispatch command, before you plan, file an issue, ask a human, post a finding, or start work. Someone may track that work already or hold a decision on it."
4
4
  ---
5
5
 
6
6
  # Dispatch first
7
7
 
8
- Dispatch already holds most of what you are about to plan, file or ask: the open issues, their
9
- specs, and the answers humans gave. A second issue for tracked work, or a question a human already
10
- answered, costs that human the time to notice it and splits the history across two places.
8
+ Dispatch holds the open issues, their specs and the answers humans gave. A duplicate issue or a repeated question costs a human time and splits the history.
11
9
 
12
10
  ## Search before you act
13
11
 
14
- Before you plan, file an issue, ask, post a finding or start work, search Dispatch with the `dispatch` command in your shell (`dispatch --help` lists every command). Every word of
15
- the query must match, so each word you add can only lose hits: search with two or three words, the
16
- thing and what is wrong with it, as a user would name them. Never paste a draft.
12
+ - Before you plan, file an issue, ask, post a finding or start work, run `dispatch search` (`dispatch --help` lists every command).
13
+ - Every query word must match, so each added word can only lose hits. Use two or three words: the thing and what is wrong with it, as a user names them. Never paste a draft.
17
14
 
18
15
  ```bash
19
16
  dispatch search --query 'broadcast send order'
20
17
  dispatch search --query 'reviewer threads OR review comments'
21
18
  ```
22
19
 
23
- When a query finds nothing, drop a word before you add one. Try two or three wordings (the
24
- component's name, the symptom, the fix) before you conclude that nothing exists. Open every hit
25
- that could be yours with `dispatch read`, then its parent (the `child_of` row under `Links:`); the
26
- parent's children and the issue's `Components:` line show where the rest of that work lives.
20
+ - No hits: drop a word before you add one. Try two or three wordings (the component's name, the symptom, the fix) before you conclude that nothing exists.
21
+ - Open each hit that could be yours with `dispatch read`, then its parent (the `child_of` row under `Links:`). The parent's children and the `Components:` line show where the rest of the work is.
27
22
 
28
23
  ## What to do with what you find
29
24
 
30
- Filing an issue or opening an ask also searches for you: the result's `advice.suggestions` names
31
- likely duplicates or a decision that may already settle it. Treat a hit there the same as one you
32
- found yourself.
33
-
34
- - **The work is already tracked: extend that issue.** Put the finding on it (a comment, a message,
35
- or an edit to its spec) instead of filing another. File a new issue only when no hit covers the
36
- work, and cite the nearest one you ruled out (`dispatch://KEY`).
37
- - **The question is already decided: cite the decision.** An answered ask is the record. Point to
38
- it where you rely on it (`dispatch://KEY/ask/<id>`) instead of asking again.
39
- - **You met a duplicate: close it.** Keep the issue that holds the spec and the discussion, carry
40
- over anything only the duplicate has, then close the duplicate with a reason that names the
41
- survivor: `dispatch issue-update --issue <KEY> --status done --reason 'Duplicate of dispatch://KEY.'`.
42
- When the duplicate carries the `legion` label, or another session or a human holds its claim,
43
- comment on it naming the survivor instead of closing it.
44
- - **Every ask and message stands on its own.** The person who answers sees only that text: put the
45
- facts, the options and your recommendation in it, and link what you cite (`dispatch://…`)
46
- instead of writing "see above" or "my earlier message".
25
+ `dispatch issue` and `dispatch ask` also search: treat a hit in the result's `advice.suggestions` as one you found.
26
+
27
+ - **Work already tracked:** put the finding on that issue (a comment, a message, or a spec edit). File a new issue only when no hit covers the work, and cite the nearest one you ruled out (`dispatch://KEY`).
28
+ - **Question already decided:** the answered ask is the record. Cite it (`dispatch://KEY/ask/<id>`) where you rely on it. Do not ask again.
29
+ - **Duplicate found:** keep the issue with the spec and the discussion, and copy over what only the duplicate has. Then close it: `dispatch issue-update --issue <KEY> --status done --reason 'Duplicate of dispatch://KEY.'`. If it has the `legion` label, or another session or a human holds its claim, comment on it with the survivor's name. Do not close it.
30
+ - **Every ask and message stands alone:** the reader sees only that text. Put the facts, the options and your recommendation in it. Link what you cite (`dispatch://…`). Never write "see above" or "my earlier message".
47
31
 
48
32
  ## Design in the spec
49
33
 
50
- A design conversation with a person, or the implementation plan that follows one, uses
51
- `skill://dispatch-brainstorming`: read it before your first design question on a change, the spec,
52
- or that plan. It replaces superpowers' `brainstorming` and `writing-plans` here, even when the user
53
- invokes one by name. Before a spec's first version and each approval request, have a fresh read-only subagent (on Oh My Pi, `task(agent="scout")`, or whatever read-only agent the host bundles) check it against the code, the human's words and any command output a claim rests on, and resolve what it flags. A Legion architect's own issue spec follows `skill://legion-architect`, and its fresh reader in that Legion session is the Legion plugin's `plan-gap-analyst` agent.
34
+ - A design conversation with a person, or the plan that follows it, uses `skill://dispatch-brainstorming`. Read it before your first design question, the spec, or the plan. It replaces superpowers' `brainstorming` and `writing-plans` here, also when the user names one of them.
35
+ - Before a spec's first version and each approval request, get a fresh read-only subagent to check it. On Oh My Pi, use `task(agent="scout")`. Elsewhere, use the host's read-only agent. It checks the spec against the code, the human's words and the command output that its claims rest on. Resolve what it flags.
36
+ - A Legion architect's own issue spec follows `skill://legion-architect`. Its fresh reader in that Legion session is the Legion plugin's `plan-gap-analyst` agent.
54
37
 
55
38
  ## Load the full skill before you write
56
39
 
57
- Before any write to Dispatch (an ask, a message, a comment, a document edit, a status change, a
58
- claim), load `skill://dispatch` unless you already have in this session.
40
+ Before any write to Dispatch, load `skill://dispatch`: an ask, a message, a comment, a document edit, a status change, a claim. Skip this if you loaded it in this session.
@@ -1,192 +1,103 @@
1
1
  ---
2
2
  name: thermonuclear-code-quality
3
- description: Run a strict maintainability review for abstraction quality, oversized files, and ad-hoc branching growth. Use for a thermonuclear code-quality review or a deep maintainability audit.
3
+ description: Use when asked for a thermonuclear code-quality review or a deep maintainability audit of a branch or PR diff. Also use when asked to review abstraction quality, oversized files or ad-hoc branching growth.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # Thermonuclear Code Quality
8
8
 
9
- Use this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
10
-
11
- Look for structural simplifications that preserve behavior while making the implementation smaller, more direct, and easier to maintain. Do not stop at local cleanup when a coherent simplification is available.
12
-
13
- ## Core Prompt
14
-
15
- Start from this baseline:
16
-
17
- > Perform a deep code quality audit of the current branch's changes.
18
- > Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
19
- > Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
20
- > Restructure when there is a clear path to a simpler implementation.
21
- > Be thorough and rigorous. Verify claims before reporting them.
22
-
23
- ## Non-Negotiable Additional Standards
24
-
25
- Apply the baseline prompt above, plus these explicit review rules:
26
-
27
- 0. **Be ambitious about structural simplification.**
28
- - Do not stop at "this could be a bit cleaner."
29
- - Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
30
- - Prefer the solution that makes the code feel inevitable in hindsight.
31
- - Assume there is often a "code judo" move available: a re-organization that uses the existing architecture more effectively and makes the change dramatically simpler and more elegant.
32
- - If you see a path to delete complexity rather than rearrange it, push hard for that path.
33
-
34
- 1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.**
35
- - Treat this as a strong code-quality smell by default.
36
- - Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
37
- - If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
38
- - Depart from this only if there is a compelling structural reason and the resulting file remains well organized.
39
-
40
- 2. **Do not allow random spaghetti growth in existing code.**
41
- - Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
42
- - If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
43
- - Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
44
- - Call out changes that make the surrounding code harder to reason about, even if they technically work.
45
-
46
- 3. **Bias toward cleaning the design, not just accepting working code.**
47
- - If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
48
- - Do not rubber-stamp "it works" implementations that leave the codebase messier.
49
- - Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
50
-
51
- 4. **Prefer direct, boring, maintainable code over hacky or magical code.**
52
- - Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
53
- - Be skeptical of generic mechanisms that hide simple data-shape assumptions.
54
- - Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
55
-
56
- 5. **Push hard on type and boundary cleanliness when they affect maintainability.**
57
- - Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist.
58
- - Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
59
- - If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
60
-
61
- 6. **Keep logic in the canonical layer and reuse existing helpers.**
62
- - Call out feature logic leaking into shared paths or implementation details leaking through APIs.
63
- - Prefer existing canonical utilities/helpers over bespoke one-offs.
64
- - Push code toward the right package, service, or module instead of normalizing architectural drift.
65
-
66
- 7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.**
67
- - If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
68
- - If related updates can leave state half-applied, push for a more atomic structure.
69
- - Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
70
-
71
- ## Primary Review Questions
72
-
73
- For every meaningful change, ask:
74
-
75
- - Is there a "code judo" move that would make this dramatically simpler?
76
- - Can this change be reframed so fewer concepts, branches, or helper layers are needed?
77
- - Does this improve or worsen the local architecture?
78
- - Did the diff add branching complexity where a better abstraction should exist?
79
- - Did a previously cohesive module become more coupled, more stateful, or harder to scan?
80
- - Is this logic living in the right file and layer?
81
- - Did this change enlarge a file or component past a healthy size boundary?
82
- - Are there repeated conditionals that signal a missing model or missing helper?
83
- - Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
84
- - Is this abstraction actually earning its keep, or is it just a wrapper?
85
- - Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
86
- - Is this logic living in the canonical layer, or did the diff leak details across a boundary?
87
- - Is this orchestration more sequential or less atomic than it needs to be?
88
-
89
- ## What to Flag Aggressively
90
-
91
- Escalate findings when you see:
92
-
93
- - A complicated implementation where a cleaner reframing could delete whole categories of complexity.
94
- - Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
95
- - A file crossing 1000 lines due to the PR, especially if the new code could be split out.
96
- - New conditionals bolted onto unrelated code paths.
97
- - One-off booleans, nullable modes, or flags that complicate existing control flow.
98
- - Feature-specific logic leaking into general-purpose modules.
99
- - Generic "magic" handling that hides simple structure and makes the code harder to reason about.
100
- - Thin wrappers or identity abstractions that add indirection without simplifying anything.
101
- - Unnecessary casts, `any`, `unknown`, or optional params that muddy the real contract.
102
- - Copy-pasted logic instead of extracted helpers.
103
- - Narrow edge-case handling implemented in the middle of an already busy function.
104
- - Refactors that technically pass tests but make the code less modular or less readable.
105
- - "Temporary" branching that is likely to become permanent debt.
106
- - Bespoke helpers where the codebase already has a canonical utility for the job.
107
- - Logic added in the wrong layer/package when it should live somewhere more central.
108
- - Sequential async flow where independent work could use simpler parallel execution.
109
- - Partial-update logic that leaves state less atomic than necessary.
110
-
111
- ## Preferred Remedies
112
-
113
- When you identify a code-quality problem, prefer suggestions like:
114
-
115
- - Delete a whole layer of indirection rather than polishing it.
116
- - Reframe the state model so conditionals disappear instead of getting centralized.
117
- - Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
118
- - Turn special-case logic into a simpler default flow with fewer exceptions.
119
- - Extract a helper or pure function.
120
- - Split a large file into smaller focused modules.
121
- - Move feature-specific logic behind a dedicated abstraction.
122
- - Replace condition chains with a typed model or explicit dispatcher.
123
- - Separate orchestration from business logic.
124
- - Collapse duplicate branches into a single clearer flow.
125
- - Delete wrappers that do not meaningfully clarify the API.
126
- - Reuse the existing canonical helper instead of introducing a near-duplicate.
127
- - Make type boundaries more explicit so the control flow gets simpler.
128
- - Move the logic to the package/module/layer that already owns the concept.
129
- - Parallelize independent work when that also simplifies the orchestration.
130
- - Restructure related updates into a more atomic flow when partial state would be harder to reason about.
131
-
132
- Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
133
- Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
134
-
135
- ## Review Tone
136
-
137
- Be direct, serious, and demanding about quality.
138
- Do not be rude, but do not soften major maintainability issues into mild suggestions.
139
- If the code makes the codebase messier, say so.
140
- If the implementation missed a substantial simplification, state it.
141
-
142
- Good phrases:
143
-
144
- - `this pushes the file past 1k lines. can we decompose this first?`
145
- - `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
146
- - `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
147
- - `this feels like feature logic leaking into a shared path. can we isolate it?`
148
- - `this abstraction seems unnecessary. can we just keep the direct flow?`
149
- - `why does this need a cast / optional here? can we make the boundary more explicit instead?`
150
- - `this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?`
151
- - `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
152
- - `this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?`
153
-
154
- ## Output Expectations
155
-
156
- Prioritize findings in this order:
157
-
158
- 1. Structural code-quality regressions
159
- 2. Missed opportunities for dramatic simplification / code-judo restructuring
160
- 3. Spaghetti / branching complexity increases
161
- 4. Boundary / abstraction / type-contract problems that make the code harder to reason about
162
- 5. File-size and decomposition concerns
163
- 6. Modularity and abstraction issues
164
- 7. Legibility and maintainability concerns
165
-
166
- Do not flood the review with low-value nits if there are larger structural issues.
167
- Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
168
-
169
- ## Approval Bar
170
-
171
- Do not approve merely because behavior seems correct.
172
- The bar for approval is:
173
-
174
- - no clear structural regression
175
- - no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
176
- - no unjustified file-size explosion
177
- - no obvious spaghetti-growth from special-case branching
178
- - no hacky or magical abstraction that makes the code harder to reason about
179
- - no unnecessary wrapper/cast/optionality churn obscuring the real design
180
- - no clear architecture-boundary leak or avoidable canonical-helper duplication
181
- - no missed opportunity for an obvious decomposition that would materially improve maintainability
182
-
183
- Treat these as presumptive blockers unless the author can justify them with evidence:
184
-
185
- - the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
186
- - the PR pushes a file from below 1000 lines to above 1000 lines
187
- - the PR adds ad-hoc branching that makes an existing flow more tangled
188
- - the PR solves a local problem by scattering feature checks across shared code
189
- - the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
190
- - the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
191
-
192
- If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
9
+ A strict maintainability audit of the current branch's changes.
10
+
11
+ ## Baseline
12
+
13
+ - Rethink how to structure and implement the changes so code quality improves and behavior does not change. The aim is code that is smaller, more direct and easier to maintain.
14
+ - Improve abstractions and modularity. Reduce spaghetti code. Make the code succinct and legible.
15
+ - Restructure when there is a clear path to a simpler implementation. Do not stop at local cleanup when a coherent simplification is available.
16
+ - Be thorough and rigorous. Verify each claim before you report it.
17
+
18
+ ## Look for the code-judo move first
19
+
20
+ - For each meaningful change, ask: can a reorganization that uses the existing architecture better make whole branches, helpers, modes, conditionals or layers disappear?
21
+ - Push hard to delete complexity, not to rearrange it. Prefer the solution that looks inevitable in hindsight.
22
+ - A refactor that moves code but leaves the reader the same number of concepts to hold is not a simplification. Ask whether the model itself can be simpler.
23
+ - Do not accept a cleaner version of the same messy idea when a much simpler idea is plausible. Do not give "maybe rename this" feedback when the real issue is structural.
24
+ - "It works" and "tests pass" are not the bar. If the structure can become meaningfully cleaner with the same behavior, push for the cleaner version.
25
+
26
+ ## What to flag, and the remedy to propose
27
+
28
+ Flag these aggressively, and any change that makes the surrounding code harder to reason about, even when the code works:
29
+
30
+ | Smell | Remedy |
31
+ |---|---|
32
+ | The PR pushes a file from under 1000 lines to over 1000 | Ask whether to decompose first into helpers, subcomponents, modules or local abstractions. Accept only for a compelling structural reason, with the file still well organized. |
33
+ | Ad-hoc conditionals, special cases, one-off booleans, nullable modes or flags in unrelated or busy flows. Narrow edge cases in the middle of a busy function. "Temporary" branches. | A design problem, not a nit. Reframe the state model so the conditionals disappear, not only move to one place. Make the special case part of a simpler default flow. Else move it behind its own abstraction, helper, state machine, policy object or module. |
34
+ | Repeated conditionals or condition chains | A typed model or an explicit dispatcher. |
35
+ | Copy-pasted logic or duplicate branches | Extract a helper or pure function. Collapse into one flow. |
36
+ | Hacky, brittle or "magic" behavior. Generic mechanisms that hide simple data-shape assumptions. | Direct, boring code. |
37
+ | Thin wrappers, identity abstractions, pass-through helpers | Delete the layer. |
38
+ | Unnecessary optionality, `unknown`, `any`, casts, loose ad-hoc objects. A silent fallback over an unclear invariant. | Explicit typed models or shared contracts, so the control flow gets simpler. |
39
+ | Feature logic in shared paths. Implementation details leaking through APIs. Logic in the wrong file, layer or package. | Move it to the layer that owns the concept, so the feature extends an existing abstraction. |
40
+ | A bespoke helper where a canonical utility exists | Reuse the canonical helper. |
41
+ | A module that became more coupled, stateful or hard to scan. Orchestration mixed with business logic. | Split into focused modules. Separate orchestration from business logic. |
42
+ | Independent work run in sequence for no good reason | Run it in parallel when that also simplifies the orchestration. |
43
+ | Related updates that can leave state half-applied | A more atomic flow. |
44
+
45
+ Flag orchestration only when the cleaner structure is obvious. Do not over-index on micro-optimizations.
46
+
47
+ ## Tone
48
+
49
+ - Be direct, serious and demanding. Do not be rude.
50
+ - Do not soften a major maintainability issue into a mild suggestion. If the code makes the codebase messier, or missed a substantial simplification, say so.
51
+ - Examples:
52
+ - `this pushes the file past 1k lines. can we decompose this first?`
53
+ - `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
54
+ - `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
55
+ - `why does this need a cast / optional here? can we make the boundary more explicit instead?`
56
+ - `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
57
+
58
+ ## Output
59
+
60
+ Order findings:
61
+
62
+ 1. Structural regressions
63
+ 2. Missed dramatic simplifications (code judo)
64
+ 3. Spaghetti and branching growth
65
+ 4. Boundary, abstraction and type-contract problems
66
+ 5. File size and decomposition
67
+ 6. Modularity and abstraction
68
+ 7. Legibility and maintainability
69
+
70
+ Give a small number of high-conviction comments. When larger structural issues exist, leave out low-value nits.
71
+
72
+ ## Approval bar
73
+
74
+ Correct behavior alone does not earn approval. Approve only when the diff has none of these:
75
+
76
+ - a clear structural regression
77
+ - a missed, visible path to a dramatically simpler implementation
78
+ - unjustified file-size growth
79
+ - spaghetti growth from special-case branching
80
+ - a hacky or magic abstraction
81
+ - wrapper, cast or optionality churn that hides the design
82
+ - a clear boundary leak, or avoidable duplication of a canonical helper
83
+ - a missed obvious decomposition that would materially help maintainability
84
+
85
+ These block unless the author justifies them with evidence:
86
+
87
+ - incidental complexity kept when a plausible code-judo move would delete it
88
+ - a file pushed from under 1000 lines to over 1000
89
+ - ad-hoc branching that tangles an existing flow
90
+ - a local problem solved by scattering feature conditionals across shared code
91
+ - an unnecessary abstraction, wrapper or cast-heavy contract
92
+ - a duplicated helper, or logic in the wrong layer, when a clear canonical home exists
93
+
94
+ When the bar is not met, leave explicit, actionable feedback and push for a cleaner decomposition.
95
+
96
+ ## Verdict
97
+
98
+ Make the first line of the report the verdict, in exactly this form, with the short sha of the head commit you reviewed (`git rev-parse --short=8 HEAD`):
99
+
100
+ - `Verdict: APPROVE at <sha>` when the diff meets the approval bar.
101
+ - `Verdict: CHANGES at <sha>` when it does not.
102
+
103
+ A PR gate can read the verdict from the first line of a posted report, and it reads only that line. Put nothing before the verdict.