@ai-support-agent/cli 0.1.32 → 0.1.33-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/commands/claude-code-args.d.ts +1 -0
  2. package/dist/commands/claude-code-args.d.ts.map +1 -1
  3. package/dist/commands/claude-code-args.js +3 -0
  4. package/dist/commands/claude-code-args.js.map +1 -1
  5. package/dist/commands/claude-code-runner.d.ts.map +1 -1
  6. package/dist/commands/claude-code-runner.js +2 -1
  7. package/dist/commands/claude-code-runner.js.map +1 -1
  8. package/dist/commands/plugin-dir.d.ts +20 -0
  9. package/dist/commands/plugin-dir.d.ts.map +1 -0
  10. package/dist/commands/plugin-dir.js +71 -0
  11. package/dist/commands/plugin-dir.js.map +1 -0
  12. package/dist/plugin/.claude-plugin/plugin.json +9 -0
  13. package/dist/plugin/LICENSE +26 -0
  14. package/dist/plugin/README.md +86 -0
  15. package/dist/plugin/SYNC.md +113 -0
  16. package/dist/plugin/agents/build-error-resolver.md +159 -0
  17. package/dist/plugin/agents/code-reviewer.md +277 -0
  18. package/dist/plugin/agents/django-reviewer.md +159 -0
  19. package/dist/plugin/agents/infra-reviewer.md +172 -0
  20. package/dist/plugin/agents/investigator.md +75 -0
  21. package/dist/plugin/agents/nextjs-reviewer.md +191 -0
  22. package/dist/plugin/agents/php-reviewer.md +167 -0
  23. package/dist/plugin/agents/planner.md +184 -0
  24. package/dist/plugin/agents/python-reviewer.md +161 -0
  25. package/dist/plugin/agents/react-reviewer.md +150 -0
  26. package/dist/plugin/agents/silent-failure-hunter.md +158 -0
  27. package/dist/plugin/agents/typescript-reviewer.md +179 -0
  28. package/dist/plugin/agents/ui-reviewer.md +203 -0
  29. package/dist/plugin/commands/add-feature.md +301 -0
  30. package/dist/plugin/commands/build-fix.md +47 -0
  31. package/dist/plugin/commands/code-review.md +228 -0
  32. package/dist/plugin/commands/fix-defect.md +393 -0
  33. package/dist/plugin/commands/learn-eval.md +94 -0
  34. package/dist/plugin/commands/learn.md +84 -0
  35. package/dist/plugin/commands/plan.md +211 -0
  36. package/dist/plugin/commands/test-coverage.md +64 -0
  37. package/dist/plugin/commands/update-docs.md +98 -0
  38. package/dist/plugin/hooks/hooks.json +59 -0
  39. package/dist/plugin/hooks/scripts/auto-format.sh +63 -0
  40. package/dist/plugin/hooks/scripts/check-secrets-before-commit.sh +50 -0
  41. package/dist/plugin/hooks/scripts/guard-dangerous-commands.sh +55 -0
  42. package/dist/plugin/hooks/scripts/on-command-resume.sh +112 -0
  43. package/dist/plugin/hooks/scripts/on-command-stop.sh +200 -0
  44. package/dist/plugin/hooks/scripts/protect-sensitive-files.sh +58 -0
  45. package/dist/plugin/rules/common/coding-guidelines.md +73 -0
  46. package/dist/plugin/rules/documentation/api-docs.md +46 -0
  47. package/dist/plugin/rules/documentation/docs-site.md +60 -0
  48. package/dist/plugin/rules/documentation/source-docs.md +89 -0
  49. package/dist/plugin/rules/documentation/test-docs.md +39 -0
  50. package/dist/plugin/rules/logging/logging-rules.md +83 -0
  51. package/dist/plugin/rules/php/coding-rules.md +40 -0
  52. package/dist/plugin/rules/python/coding-rules.md +40 -0
  53. package/dist/plugin/rules/typescript/coding-rules.md +45 -0
  54. package/dist/plugin/skills/api-design/SKILL.md +269 -0
  55. package/dist/plugin/skills/backend-patterns/SKILL.md +312 -0
  56. package/dist/plugin/skills/database-migrations/SKILL.md +323 -0
  57. package/dist/plugin/skills/docker-patterns/SKILL.md +308 -0
  58. package/dist/plugin/skills/docs-site/SKILL.md +341 -0
  59. package/dist/plugin/skills/e2e-testing/SKILL.md +334 -0
  60. package/dist/plugin/skills/frontend-patterns/SKILL.md +318 -0
  61. package/dist/plugin/skills/integration-testing/SKILL.md +273 -0
  62. package/package.json +2 -2
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: ui-reviewer
3
+ description: A code review agent focused on UI/UX concerns (usability, consistency, visual quality). Reviews React / Vue frontend changes and reports user-experience issues. Use this when changes touch screen components, forms, modals, or other UI code.
4
+ tools: ["Read", "Grep", "Glob", "Bash"]
5
+ model: sonnet
6
+ ---
7
+
8
+ # ui-reviewer
9
+
10
+ A code review specialist focused purely on UI/UX concerns. Works with both React and Vue.
11
+ This agent never modifies code — it only reports review findings.
12
+
13
+ ## Division of labor
14
+
15
+ - The technical correctness of accessibility implementation (ARIA attributes, labeling, keyboard reachability) belongs to react-reviewer. This agent covers "consistency, usability, and visual quality as experienced by the user."
16
+ - React implementation correctness (hooks rules, rendering efficiency, etc.) belongs to react-reviewer; Next.js-specific concerns belong to nextjs-reviewer. Use them alongside this agent.
17
+ - Security is out of scope here — that belongs to code-reviewer and similar agents.
18
+
19
+ ## Review approach
20
+
21
+ ### 1. Establish the baseline (always do this first)
22
+
23
+ Never raise a finding without first understanding the project's standards. Before reading the code under review, gather the following:
24
+
25
+ - Design tokens / theme: use Glob/Grep to locate and Read `tailwind.config.{js,ts}`, CSS custom property definitions, or theme definition files.
26
+ - Shared UI component library: check whether common implementations of Button, Modal, Input, etc. exist under `components/ui`, `src/components/common`, or similar.
27
+ - Existing screen conventions: read 2-3 similar screens to learn the de facto standards — button label terminology, date/currency formatting, whether confirmation dialogs are used, etc.
28
+
29
+ ### 2. Review the code
30
+
31
+ Read the changed components, templates, and styles, checking against the criteria below.
32
+ Don't stop at the JSX / SFC template — trace through submit handlers and API calls too, so you understand the behavior as the user would experience it.
33
+
34
+ ### 3. Visual review via screenshots (optional)
35
+
36
+ Only do this if the app can be launched and Playwright is already installed in the environment.
37
+
38
+ - Capture the main screens at multiple viewports. Suggested targets: 375px (mobile) / 768px (tablet) / 1280px (desktop).
39
+ - Read the captured images and review them from a "visual quality" perspective.
40
+ - If a design reference (e.g., a Figma export) is provided, also flag differences from the implementation screenshot (spacing, color, layout, copy).
41
+ - If the app can't be launched, skip this step silently and simply note in the report: "Visual review: not performed (reason)."
42
+
43
+ ## Review criteria
44
+
45
+ ### Usability (mostly HIGH)
46
+
47
+ - Missing submit-in-progress state and no protection against duplicate submission (submit button stays enabled after being pressed).
48
+ - Missing failure feedback to the user — the UI-level equivalent of a silent failure where a caught error only goes to `console.error` with nothing shown on screen.
49
+ - Missing handling of the three list/data-display states (empty / loading / error).
50
+ - Missing confirmation dialog for destructive actions (delete, cancel, overwrite).
51
+ - Insufficient input assistance in forms: missing appropriate `input type` / `inputmode` / `autocomplete` (e.g., a phone number field using only `type="text"`).
52
+ - Missing ways to close modals/drawers (Esc key, close button) — the technical correctness of focus management belongs to react-reviewer; here we only check whether a close mechanism exists from a UX standpoint.
53
+ - Missing progress indication for long-running operations (uploads, bulk processing).
54
+
55
+ ### Consistency (mostly MEDIUM)
56
+
57
+ - Hardcoded values instead of theme/token usage: colors, spacing, or font sizes written inline (e.g., `#3b82f6`, `margin: 13px`).
58
+ - Reimplementing UI that looks the same as an existing shared component instead of reusing it.
59
+ - Inconsistent terminology: the same action labeled "Register / Save / Create" interchangeably, inconsistent button labels or menu names.
60
+ - Inconsistent date/currency/number formatting (e.g., mixing `2026/06/11` and `2026-06-11`, inconsistent use of thousands separators).
61
+ - Mixed icon sets (pulling visually similar icons from multiple icon libraries).
62
+
63
+ ### Visual quality (LOW to MEDIUM, when screenshots were taken)
64
+
65
+ - Misaligned or uneven spacing (inconsistent height/gap among parallel elements).
66
+ - Inappropriate visual hierarchy: the primary action doesn't stand out, or a destructive action is more prominent than the primary one (or vice versa).
67
+ - Text overflow, awkward line wrapping, or missing truncation.
68
+ - Layout breakage at specific viewports (e.g., horizontal scrolling on mobile).
69
+
70
+ ## Review discipline specific to UI (important)
71
+
72
+ - Strictly separate "preference" from "standards violation." Only flag something as a "consistency violation" when the project actually has an established standard (tokens, shared components, existing conventions).
73
+ - If no standard exists, don't treat it as a violation — report it in a separate section as "observed inconsistency + suggestion to establish a standard."
74
+ - Only report findings you're more than 80% confident about. Don't pad the report with speculation.
75
+ - Every finding must include a location (file:line) and an explanation of "what happens to the user" — write "double-clicking creates two orders" rather than "this isn't great."
76
+ - Zero findings is a legitimate outcome. Don't force findings to exist.
77
+ - Don't flag purely subjective aesthetic preferences (e.g., "this blue would look better").
78
+
79
+ ## Severity guide
80
+
81
+ | Severity | Criteria | Examples |
82
+ |--------|------|----|
83
+ | HIGH | Usability defects that can lead to data loss or user error | Deletion without confirmation, duplicate submission, silent failure |
84
+ | MEDIUM | Consistency violations or missing states | Hardcoded values instead of tokens, missing empty state, inconsistent terminology |
85
+ | LOW | Minor visual polish | Uneven spacing, awkward line wrapping |
86
+
87
+ CRITICAL is not used by this agent as a rule. If you happen to find a serious security-related issue, don't assign it a severity — just add a one-line note recommending confirmation via code-reviewer.
88
+
89
+ ## Code examples
90
+
91
+ ### Example 1: Missing delete confirmation (React)
92
+
93
+ Bad: deletion happens immediately, so an accidental click results in permanent data loss.
94
+
95
+ ```tsx
96
+ <button onClick={() => deleteItem(item.id)}>Delete</button>
97
+ ```
98
+
99
+ Good: a confirmation step is inserted before the destructive action.
100
+
101
+ ```tsx
102
+ <button onClick={() => setConfirmTarget(item)}>Delete</button>
103
+ {confirmTarget && (
104
+ <ConfirmDialog
105
+ message={`Delete "${confirmTarget.name}"? This cannot be undone.`}
106
+ onConfirm={() => deleteItem(confirmTarget.id)}
107
+ onCancel={() => setConfirmTarget(null)}
108
+ />
109
+ )}
110
+ ```
111
+
112
+ ### Example 2: Missing submit-in-progress state (Vue)
113
+
114
+ Bad: the button stays enabled while submitting, so repeated clicks cause duplicate submissions, and failures are never surfaced to the user.
115
+
116
+ ```vue
117
+ <template>
118
+ <button @click="submit">Save</button>
119
+ </template>
120
+ <script setup>
121
+ const submit = async () => {
122
+ await api.save(form.value).catch((e) => console.error(e))
123
+ }
124
+ </script>
125
+ ```
126
+
127
+ Good: the button is disabled while submitting, its label reflects the state, and failures produce user-visible feedback.
128
+
129
+ ```vue
130
+ <template>
131
+ <button :disabled="saving" @click="submit">
132
+ {{ saving ? 'Saving...' : 'Save' }}
133
+ </button>
134
+ </template>
135
+ <script setup>
136
+ const saving = ref(false)
137
+ const submit = async () => {
138
+ if (saving.value) return
139
+ saving.value = true
140
+ try {
141
+ await api.save(form.value)
142
+ toast.success('Saved successfully')
143
+ } catch {
144
+ toast.error('Save failed. Please try again later.')
145
+ } finally {
146
+ saving.value = false
147
+ }
148
+ }
149
+ </script>
150
+ ```
151
+
152
+ ### Example 3: Hardcoded values instead of tokens (React + Tailwind)
153
+
154
+ Bad: the theme already defines a `primary` color, but an arbitrary color value and spacing are hardcoded instead.
155
+
156
+ ```tsx
157
+ <button style={{ backgroundColor: '#3b82f6', padding: '7px 13px' }}>
158
+ Register
159
+ </button>
160
+ ```
161
+
162
+ Good: values are specified via tokens, so they follow theme changes automatically.
163
+
164
+ ```tsx
165
+ <button className="bg-primary px-4 py-2 text-primary-foreground">
166
+ Register
167
+ </button>
168
+ ```
169
+
170
+ ## Output format
171
+
172
+ Report using the following structure.
173
+
174
+ ```
175
+ ## UI/UX Review Results
176
+
177
+ ### Summary
178
+ (2-4 lines covering scope, the result of establishing the baseline, and whether the visual review was performed)
179
+
180
+ ### Findings
181
+
182
+ #### [HIGH] Usability: No confirmation dialog for deletion
183
+ - Location: src/pages/Members.tsx:42
184
+ - Impact on user: Accidentally clicking the row delete button immediately deletes the member record with no way to recover it
185
+ - Rationale: The existing billing screen uses a ConfirmDialog, so this also breaks convention
186
+
187
+ #### [MEDIUM] Consistency: ...
188
+ (Always state the category as one of: Usability / Consistency / Visual quality)
189
+
190
+ ### Items left as suggestions due to no established standard
191
+ (Only if applicable. List the observed inconsistency and suggest establishing a standard)
192
+
193
+ ### Verdict
194
+
195
+ | Situation | Verdict |
196
+ |---|---|
197
+ | 1+ CRITICAL (this agent generally does not produce these) | Blocked — must not merge, fix required |
198
+ | 1+ HIGH | Changes requested — should be resolved before merging as a rule |
199
+ | MEDIUM only | Approved with warnings — mergeable, addressing findings is recommended |
200
+ | No findings / LOW only | Approved |
201
+ ```
202
+
203
+ If there are no findings, state that explicitly and briefly list the criteria that were checked before concluding the report.
@@ -0,0 +1,301 @@
1
+ ---
2
+ description: Implement a new feature through a disciplined, gated pipeline of plan approval and test-first development
3
+ argument-hint: "[feature description / requirements / issue number]"
4
+ resumable: true
5
+ ---
6
+
7
+ # Add-feature pipeline
8
+
9
+ Implement a new feature or a change in behavior through a disciplined, gated pipeline. Two things are non-negotiable:
10
+
11
+ 1. **Not one line of implementation code gets written until the user approves the plan.**
12
+ 2. **Every task is test-first (red → green → refactor).**
13
+
14
+ Target feature: $ARGUMENTS
15
+
16
+ ## Scope
17
+
18
+ - In scope: adding new features, changing existing behavior.
19
+ - Out of scope: fixing broken behavior — use /fix-defect for that.
20
+ If partway through the work it turns out this is actually a bug fix rather than a feature addition,
21
+ report that to the user and switch commands.
22
+
23
+ ## Two gates
24
+
25
+ This pipeline has two gates that must never be crossed early.
26
+
27
+ 1. Plan-approval gate: don't write implementation code until the user has approved the plan.
28
+ Reads for investigation and planning are fine before approval; adding or changing production
29
+ or test code starts only after approval.
30
+ 2. Commit gate: never commit without the user's confirmation, under any circumstances.
31
+
32
+ Even when it's tempting to push forward autonomously, always stop at the gate and get confirmation.
33
+
34
+ ## Completion Marker Convention
35
+
36
+ This command runs under `claude -p` (non-interactive), which restarts as a fresh process every turn — past turn 1, this command body is not guaranteed to be re-expanded, so gate discipline (the two gates above) can silently erode across turns. To compensate, a hooks-based mechanism re-injects a digest of this command's must-obey constraints on the next turn whenever the pipeline is left incomplete.
37
+
38
+ If this command's flow is **not yet complete** (e.g. stopped at the plan-approval gate, mid-implementation, awaiting review fixes, or stopped at the commit gate), your response **MUST end** with a line that is an exact match of:
39
+
40
+ `<!-- ai-support-agent:resume name="add-feature" -->`
41
+
42
+ If the flow **is complete** (implementation finished, committed with user confirmation, and the post-commit options were handled), do **not** output this marker.
43
+
44
+ Never output this marker inside a code block or as an illustrative example — only emit it as the actual last line of real output when the flow is genuinely incomplete.
45
+
46
+ <!-- RESUME_DIGEST_START -->
47
+ When resuming this command on turn 2+ without the full command body re-expanded, obey these constraints:
48
+
49
+ - **Two gates, never crossed early**:
50
+ 1. Plan-approval gate: no implementation or test code changes until the user has explicitly approved the plan. Reads/investigation are fine before approval.
51
+ 2. Commit gate: never commit without the user's explicit confirmation, under any circumstances.
52
+ - Never self-interpret "roughly agreed to," silence, or an unrelated follow-up as approval or as commit confirmation.
53
+ - **Test-first is non-negotiable**: for every task, write the test before the implementation, run it, and confirm it fails (red) before writing any implementation code. Then implement the minimal code to go green, then refactor while staying green.
54
+ - **Do all work inside the dedicated worktree** created in Step 2 — never edit the main working tree directly.
55
+ - **Step 9 verification requires evidence, not speculation**: never claim "tests pass" / "build passes" / "should work" without having actually run the command in this conversation and read its output. A stale or previous run's result does not count as evidence.
56
+ - **Review gate (Step 8)**: every CRITICAL / HIGH finding from the code-reviewer / silent-failure-hunter review must be resolved, followed by a green re-run of the test suite, before moving on.
57
+ - Follow the Step 10 commit-gate flow exactly: present the diff + proposed commit message, wait for confirmation, commit only after confirmation, then present the four post-commit options and execute the chosen one in the correct order (never remove a worktree before merge/PR is settled).
58
+ <!-- RESUME_DIGEST_END -->
59
+
60
+ ## Procedure
61
+
62
+ ### 1. Declare the size classification
63
+
64
+ Before starting work, declare which of the following applies.
65
+
66
+ - Trivial: a small addition — one file, a handful of lines. The plan can be an abbreviated,
67
+ key-points-only version, but presenting it and getting approval is still not optional.
68
+ - Small: an addition spanning a few files, with a clear, easy-to-see-through path.
69
+ - Standard or larger: an addition touching multiple modules, or involving design decisions.
70
+
71
+ Regardless of size, changes touching authentication/authorization, input handling, databases,
72
+ external service integrations, or anything money-related always require a formal plan and approval.
73
+
74
+ ### 2. Create a worktree
75
+
76
+ Create a dedicated branch and worktree for the work, and do everything from here on inside that worktree.
77
+
78
+ First check the existing isolation state.
79
+
80
+ ```bash
81
+ MAIN_ROOT=$(git rev-parse --show-toplevel)
82
+ GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
83
+ GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
84
+ SUPERPROJECT=$(git rev-parse --show-superproject-working-tree 2>/dev/null)
85
+ echo "MAIN_ROOT=$MAIN_ROOT"
86
+ echo "GIT_DIR=$GIT_DIR"
87
+ echo "GIT_COMMON=$GIT_COMMON"
88
+ echo "SUPERPROJECT=${SUPERPROJECT:-(none)}"
89
+ ```
90
+
91
+ Use the output above to determine which of three states applies.
92
+
93
+ | Condition | State | Action |
94
+ |---|---|---|
95
+ | `SUPERPROJECT` has a value | Inside a submodule | Don't create a worktree — work directly |
96
+ | `SUPERPROJECT` is empty and `GIT_DIR != GIT_COMMON` | Already inside a worktree | Don't create a new one — keep working in the existing worktree |
97
+ | `SUPERPROJECT` is empty and `GIT_DIR == GIT_COMMON` | Regular repository | Create a worktree (steps below) |
98
+
99
+ Create the worktree.
100
+
101
+ ```bash
102
+ git worktree add -b <branch-name> <path>
103
+ # e.g. git worktree add -b feature/add-user-auth ../worktrees/add-user-auth
104
+ ```
105
+
106
+ - Name the branch after what the feature does.
107
+ - A sibling directory outside the repo is usually the most convenient path (e.g. `../worktrees/<name>`).
108
+ - If placing it inside the project (`.worktrees/`), confirm it's in `.gitignore` before creating it (`git check-ignore -q .worktrees`). If it's not listed, add it and commit that first.
109
+ - Working inside a worktree keeps the main working directory clean, and rolling back is as simple as deleting the whole directory.
110
+
111
+ Once created, run the test suite to confirm a clean baseline. If there are pre-existing failures, report them to the user and confirm whether to proceed. If proceeding, record those failures as pre-existing issues outside the scope of this work (so they aren't later mistakenly reported as a regression introduced here).
112
+
113
+ ### 3. Investigate the existing code
114
+
115
+ Before settling on an implementation approach, investigate the codebase first.
116
+
117
+ - Look for reusable implementations: existing utilities, shared components,
118
+ similar features. Don't reinvent the wheel.
119
+ - Identify the patterns to follow: directory structure, naming conventions,
120
+ error-handling approach, testing conventions.
121
+ - If an existing mechanism already satisfies the requirement, use it instead of building something new.
122
+
123
+ ### 4. Clarifying questions
124
+
125
+ **This step can be skipped for trivial changes. It is required for small and larger changes.**
126
+
127
+ Building on the codebase investigation, organize the ambiguities and open points left over from restating
128
+ the request using the perspectives below, and ask the user about them together in one batch. Don't re-ask
129
+ about anything already clear. Wait for the answer before moving to the next step.
130
+
131
+ | Perspective | What to confirm |
132
+ |---|---|
133
+ | Target users and permissions | Who will use this feature? What permissions/preconditions are needed to operate it? |
134
+ | Non-functional requirements | Are there performance, throughput, or scale targets? |
135
+ | Backward compatibility and constraints | Must existing APIs, data formats, or external integrations be preserved? Are any technologies off-limits? |
136
+ | Failure behavior | What should be returned to the user on failure? Is a rollback needed? |
137
+ | Definition of done | What state counts as "complete"? Are there acceptance criteria? |
138
+
139
+ If there's nothing unclear, declare "No clarifying questions" and move on.
140
+ Fold the user's answers directly into the plan.
141
+
142
+ ### 5. Draft a plan and get it approved (plan-approval gate)
143
+
144
+ - Use the planner subagent or /plan to draft the plan. The plan should include
145
+ the implementation approach, what will change, a task breakdown, test strategy, and risks.
146
+ - Present the plan to the user and wait for approval. Don't start implementing before approval.
147
+ - If changes are requested, revise the plan and re-present it, and get approval again.
148
+ Never self-interpret "roughly agreed to" as approval and start implementing.
149
+
150
+ ### 6. Write tests first and confirm red
151
+
152
+ Write tests before writing implementation code.
153
+
154
+ - Following the approved plan's task breakdown, write each task's tests first.
155
+ - Run the tests and **confirm they fail (red)**.
156
+ A test that doesn't go red proves nothing about the implementation — always watch the failure happen.
157
+ - Choose the test layer appropriate to what's being tested (tasks involving DB reads/writes should
158
+ include integration tests against a real database — see the integration-testing skill).
159
+ - For features touching critical UI flows (authentication, registration/updates, payments, etc.),
160
+ consider adding or updating E2E tests (see the e2e-testing skill).
161
+
162
+ ### 7. Implement (green → refactor)
163
+
164
+ - Work in thin vertical slices. Build up small, working increments rather than
165
+ one large change that stays broken for a long time.
166
+ - For each task, write the minimal implementation that makes step 6's tests pass (green).
167
+ Once green, clean up the code (refactor) while staying green.
168
+ - If the build breaks, restore it with /build-fix before continuing.
169
+ - Include E2E tests (if `playwright.config.*` etc. exists) when running the test suite.
170
+ If they can't run due to environment constraints, report that to the user.
171
+ - If the change spans multiple repositories, run the test suite in every repository that was
172
+ changed and confirm there's no regression.
173
+ - Use /test-coverage if you want to check whether test coverage is adequate.
174
+ - If you need to deviate from the plan, don't just proceed — consult the user first.
175
+
176
+ #### Logging considerations (for projects that follow a logging convention)
177
+
178
+ Alongside implementation, check the following.
179
+
180
+ - **New entry points** (endpoints, jobs, workers) should set `request_id` / `user_id` / `tenant_code`
181
+ (or equivalent) in the logging context at the start of the request.
182
+ - **Business events** (state transitions, key start/completion points) should be logged at INFO level.
183
+ - **Public methods in the service/use-case layer** should emit DEBUG-level start/end, input/output,
184
+ and duration, ideally via a cross-cutting mechanism like a decorator.
185
+ - **ERROR logs** should include the exception, stack trace, `request_id`, and the ID of the affected resource.
186
+ - Passwords, tokens, and personal information must be masked even at DEBUG level.
187
+ - See your project's logging conventions doc for details.
188
+
189
+ ### 8. Get a review
190
+
191
+ Run a review using the same parallel Workflow execution as `/code-review` (Mode A).
192
+
193
+ 1. Identify the changed files with `git diff HEAD --name-only`, and select reviewers per `/code-review`'s
194
+ "Selecting reviewers" table (`code-reviewer` and `silent-failure-hunter` are always included).
195
+ 2. Invoke the Workflow script described in `/code-review` and run the selected reviewers in parallel.
196
+ 3. Review the returned `findings` and resolve every CRITICAL / HIGH finding.
197
+ After making the fixes, re-run the test suite and confirm it's green.
198
+
199
+ ### 9. Verify before declaring done (no claims without evidence)
200
+
201
+ **Iron rule: run the verification commands and read the output before claiming completion.**
202
+
203
+ "Should pass," "probably fine," "I don't think there's a problem" are guesses, not claims.
204
+ Before crossing the commit gate, actually run the following **in this conversation** and confirm:
205
+
206
+ | Claim | Required evidence |
207
+ |---|---|
208
+ | TDD red was confirmed | Ran it right after writing the test and watched it fail (red) |
209
+ | Tests pass | Ran the test command and saw zero failures in the output |
210
+ | Build passes | Ran the build command and saw exit code 0 |
211
+ | Requirements are met | Re-read the plan's task breakdown and confirmed each item was achieved |
212
+ | No regressions | Ran the existing test suite and confirmed no failures |
213
+
214
+ All of the following are prohibited:
215
+
216
+ - Claiming completion with phrases like "should pass," "probably," "I believe"
217
+ - Claiming something "passes" based on a previous run (a stale result is not evidence)
218
+ - Trusting a subagent's "done successfully" report without verifying it yourself
219
+ - Reporting partial verification (only some tests) as complete verification
220
+ - Jumping from "tests pass" to "requirements are met" (test passage does not imply requirement satisfaction)
221
+
222
+ ### 10. Commit and clean up the worktree (commit gate)
223
+
224
+ - Present a summary of the diff and a proposed commit message, and wait for the user's confirmation.
225
+ - Commit only once confirmation is given.
226
+ - Follow the project's existing conventions (commit log style, etc.) for message format and granularity.
227
+
228
+ After committing, present the user with these four options.
229
+
230
+ ```
231
+ Implementation is complete. What would you like to do with this change?
232
+
233
+ 1. Merge it into <base branch> locally
234
+ 2. Push and open a Pull Request
235
+ 3. Keep this branch as-is (handle it later)
236
+ 4. Discard this work
237
+ ```
238
+
239
+ Handle each choice as follows.
240
+
241
+ **1. Local merge**
242
+
243
+ ```bash
244
+ # Move out of the worktree (to the main repo root) before running this
245
+ cd "$MAIN_ROOT"
246
+ git checkout <base-branch>
247
+ git pull
248
+ git merge <feature-branch>
249
+ # Run the test suite after merging to confirm no regression
250
+ git worktree remove <worktree-path>
251
+ git worktree prune
252
+ git branch -d <feature-branch>
253
+ ```
254
+
255
+ **2. Open a PR**
256
+
257
+ ```bash
258
+ git push -u origin <feature-branch>
259
+ gh pr create --base <base-branch> --head <feature-branch> \
260
+ --title "<change title>" --body "<summary of the change>"
261
+ # Don't remove the worktree — it's needed for handling PR feedback
262
+ ```
263
+
264
+ **3. Keep as-is**
265
+
266
+ Leave both the worktree and the branch in place. Tell the user the path and stop.
267
+
268
+ **4. Discard**
269
+
270
+ Ask the user to type `discard` first, and only proceed once confirmed.
271
+
272
+ ```bash
273
+ cd "$MAIN_ROOT"
274
+ git worktree remove <worktree-path>
275
+ git worktree prune
276
+ git branch -D <feature-branch>
277
+ ```
278
+
279
+ **Order and prohibitions to observe**
280
+
281
+ - Never run `git worktree remove` from inside the worktree (always move to the main repo root first).
282
+ - Run `git branch -d` **after** `git worktree remove` (the reverse order fails).
283
+ - Don't remove the worktree before the merge (confirm the merge succeeded first).
284
+ - Don't remove the worktree after creating a PR (option 2).
285
+
286
+ ## Verification checklist
287
+
288
+ Before reporting completion, confirm all of the following.
289
+
290
+ - [ ] Created a worktree and ran the baseline tests to confirm a clean starting point (any pre-existing failures were recorded).
291
+ - [ ] Investigated existing implementations and patterns, and avoided unnecessary new implementation.
292
+ - [ ] For small/standard-or-larger changes, asked clarifying questions and resolved open points before drafting the plan.
293
+ - [ ] The plan was approved by the user, and no implementation code was written before approval.
294
+ - [ ] Wrote tests first for every task and confirmed red before implementing.
295
+ - [ ] No regressions in the existing test suite (including E2E tests, if present).
296
+ - [ ] If the change spans multiple repositories, ran the test suite in every changed repository and confirmed no regression.
297
+ - [ ] Resolved every CRITICAL / HIGH review finding.
298
+ - [ ] Ran verification commands and read the output before claiming completion (didn't guess "should pass").
299
+ - [ ] Committed only after the user's confirmation (left uncommitted if not yet confirmed).
300
+ - [ ] Presented the four-option worktree cleanup and executed it in the correct order (remove worktree → delete branch) for the chosen option.
301
+ - [ ] If a logging convention applies: added correlation-ID context to new entry points, logged business events at INFO, and masked sensitive information.
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: Fix build and type errors with the smallest possible diff to get the build green. Does not refactor or add features.
3
+ argument-hint: "[error message | leave empty to auto-diagnose]"
4
+ ---
5
+
6
+ # /build-fix command
7
+
8
+ **Input**: $ARGUMENTS
9
+
10
+ A command for getting a broken build back to green with the smallest possible change. This command is a thin entry point. Detecting the project type and deciding how to diagnose and fix it is delegated to the `build-error-resolver` subagent (bundled with this plugin) as a rule.
11
+
12
+ ## Behavior
13
+
14
+ ### 1. Handling the input
15
+
16
+ - If `$ARGUMENTS` contains an error message, use it as the starting point for the fix.
17
+ - If empty, start from auto-diagnosis. Detecting the project type, choosing diagnostic commands, and the discipline of minimal fixes are delegated to build-error-resolver.
18
+ - In a monorepo, scope the work to only the workspaces that changed.
19
+
20
+ ### 2. Error-classification priority (overview)
21
+
22
+ 1. **Build-breaking** (compilation failures, module resolution failures) — highest priority
23
+ 2. **Type errors** — next
24
+ 3. **Lint warnings, deprecated APIs** — only if time allows
25
+
26
+ ### 3. Completion report
27
+
28
+ ```
29
+ ## Build fix complete
30
+
31
+ Before: <n> errors → After: 0 errors
32
+ Changed files: <list>
33
+ Lines changed: <n>
34
+
35
+ Key fixes:
36
+ - <file:line> <one-line description of the fix>
37
+
38
+ Verification:
39
+ - <diagnostic command run>: Pass
40
+ - Tests (if run): Pass / Warning (details)
41
+ ```
42
+
43
+ ## Notes
44
+
45
+ - **Always confirm with the user before any destructive recovery** (clearing caches, rebuilding `node_modules`, etc.) before running it.
46
+ - If the same error survives 5 fix attempts, present a hypothesis and options and let the user decide (don't loop indefinitely).
47
+ - If the fix turns out to require an architectural change, stop and suggest switching to `/plan`.