@hopla/claude-setup 1.15.0 → 1.16.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.
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "hopla",
11
11
  "description": "Agentic coding system: PIV loop, TDD, debugging, brainstorming, subagent execution, and team workflows",
12
- "version": "1.15.0",
12
+ "version": "1.16.0",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "Hopla Tools",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hopla",
3
3
  "description": "Agentic coding system for Claude Code: PIV loop (Plan → Implement → Validate), TDD, debugging, brainstorming, subagent execution, and team workflows",
4
- "version": "1.15.0",
4
+ "version": "1.16.0",
5
5
  "author": {
6
6
  "name": "Hopla Tools",
7
7
  "email": "julio@hopla.tools"
package/cli.js CHANGED
@@ -87,6 +87,21 @@ function logRemoved(label) {
87
87
  log(` ${RED}✕${RESET} ${verb}: ${label}`);
88
88
  }
89
89
 
90
+ // Safe parser for settings.json-style files. Returns null when the file is
91
+ // missing. Warns (and returns null) when the file exists but is not valid JSON
92
+ // — previously these failures were silently swallowed, causing cleanup and
93
+ // permission updates to skip with no signal to the user.
94
+ function parseSettingsFile(settingsPath) {
95
+ if (!fs.existsSync(settingsPath)) return null;
96
+ try {
97
+ return JSON.parse(fs.readFileSync(settingsPath, "utf8"));
98
+ } catch (err) {
99
+ log(` ${YELLOW}⚠${RESET} Could not parse ${settingsPath}: ${err.message}`);
100
+ log(` Skipping this file. Fix the JSON and re-run to apply changes.`);
101
+ return null;
102
+ }
103
+ }
104
+
90
105
  function logInstalled(label, exists) {
91
106
  const verb = DRY_RUN
92
107
  ? (exists ? "Would update" : "Would install")
@@ -220,35 +235,34 @@ function removeLegacyFiles() {
220
235
 
221
236
  // hopla hook entries from settings.json AND settings.local.json
222
237
  for (const settingsPath of SETTINGS_FILES) {
223
- if (!fs.existsSync(settingsPath)) continue;
224
- try {
225
- const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
226
- let changed = false;
227
-
228
- if (settings.hooks) {
229
- for (const [event, matchers] of Object.entries(settings.hooks)) {
230
- if (!Array.isArray(matchers)) continue;
231
- const filtered = matchers.filter((m) => {
232
- if (!m.hooks || !Array.isArray(m.hooks)) return true;
233
- const isHopla = m.hooks.every((h) =>
234
- LEGACY_HOOK_COMMANDS.some((cmd) => h.command && h.command.includes(cmd))
235
- );
236
- return !isHopla;
237
- });
238
- if (filtered.length !== matchers.length) {
239
- settings.hooks[event] = filtered;
240
- if (filtered.length === 0) delete settings.hooks[event];
241
- changed = true;
242
- }
238
+ const settings = parseSettingsFile(settingsPath);
239
+ if (!settings) continue;
240
+
241
+ let changed = false;
242
+
243
+ if (settings.hooks) {
244
+ for (const [event, matchers] of Object.entries(settings.hooks)) {
245
+ if (!Array.isArray(matchers)) continue;
246
+ const filtered = matchers.filter((m) => {
247
+ if (!m.hooks || !Array.isArray(m.hooks)) return true;
248
+ const isHopla = m.hooks.every((h) =>
249
+ LEGACY_HOOK_COMMANDS.some((cmd) => h.command && h.command.includes(cmd))
250
+ );
251
+ return !isHopla;
252
+ });
253
+ if (filtered.length !== matchers.length) {
254
+ settings.hooks[event] = filtered;
255
+ if (filtered.length === 0) delete settings.hooks[event];
256
+ changed = true;
243
257
  }
244
- if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
245
258
  }
259
+ if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
260
+ }
246
261
 
247
- if (changed) {
248
- safeWrite(settingsPath, JSON.stringify(settings, null, 2) + "\n");
249
- removed.push(`hooks from ${path.basename(settingsPath)}`);
250
- }
251
- } catch { /* ignore parse errors */ }
262
+ if (changed) {
263
+ safeWrite(settingsPath, JSON.stringify(settings, null, 2) + "\n");
264
+ removed.push(`hooks from ${path.basename(settingsPath)}`);
265
+ }
252
266
  }
253
267
 
254
268
  return removed;
@@ -257,31 +271,27 @@ function removeLegacyFiles() {
257
271
  function removeHoplaPermissions() {
258
272
  const removed = [];
259
273
  for (const settingsPath of SETTINGS_FILES) {
260
- if (!fs.existsSync(settingsPath)) continue;
261
- try {
262
- const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
263
- if (!settings.permissions || !Array.isArray(settings.permissions.allow)) continue;
264
- const before = settings.permissions.allow.length;
265
- settings.permissions.allow = settings.permissions.allow.filter(
266
- (p) => !ALL_HOPLA_PERMISSIONS.has(p)
267
- );
268
- if (settings.permissions.allow.length !== before) {
269
- safeWrite(settingsPath, JSON.stringify(settings, null, 2) + "\n");
270
- removed.push(`permissions from ${path.basename(settingsPath)}`);
271
- }
272
- } catch { /* ignore */ }
274
+ const settings = parseSettingsFile(settingsPath);
275
+ if (!settings) continue;
276
+ if (!settings.permissions || !Array.isArray(settings.permissions.allow)) continue;
277
+ const before = settings.permissions.allow.length;
278
+ settings.permissions.allow = settings.permissions.allow.filter(
279
+ (p) => !ALL_HOPLA_PERMISSIONS.has(p)
280
+ );
281
+ if (settings.permissions.allow.length !== before) {
282
+ safeWrite(settingsPath, JSON.stringify(settings, null, 2) + "\n");
283
+ removed.push(`permissions from ${path.basename(settingsPath)}`);
284
+ }
273
285
  }
274
286
  return removed;
275
287
  }
276
288
 
277
289
  function detectPlugin() {
278
290
  for (const settingsPath of SETTINGS_FILES) {
279
- if (!fs.existsSync(settingsPath)) continue;
280
- try {
281
- const settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
282
- const plugins = settings.enabledPlugins || {};
283
- if (Object.keys(plugins).some((key) => key.startsWith("hopla@"))) return true;
284
- } catch { /* ignore */ }
291
+ const settings = parseSettingsFile(settingsPath);
292
+ if (!settings) continue;
293
+ const plugins = settings.enabledPlugins || {};
294
+ if (Object.keys(plugins).some((key) => key.startsWith("hopla@"))) return true;
285
295
  }
286
296
  return false;
287
297
  }
@@ -373,11 +383,16 @@ async function uninstall() {
373
383
  async function setupPermissions() {
374
384
  const settingsPath = path.join(CLAUDE_DIR, "settings.json");
375
385
 
376
- let settings = { permissions: { allow: [] } };
377
- if (fs.existsSync(settingsPath)) {
378
- try {
379
- settings = JSON.parse(fs.readFileSync(settingsPath, "utf8"));
380
- } catch { /* keep defaults */ }
386
+ // Use parseSettingsFile so malformed JSON is reported instead of silently
387
+ // overwritten. When the file is missing we start from defaults.
388
+ let settings = parseSettingsFile(settingsPath);
389
+ if (!settings) {
390
+ if (fs.existsSync(settingsPath)) {
391
+ // Malformed JSON — do NOT overwrite (user needs to fix first)
392
+ log(` ${YELLOW}↷${RESET} Skipped permissions setup — settings.json is not valid JSON.`);
393
+ return;
394
+ }
395
+ settings = { permissions: { allow: [] } };
381
396
  }
382
397
  if (!settings.permissions) settings.permissions = {};
383
398
  if (!settings.permissions.allow) settings.permissions.allow = [];
@@ -98,7 +98,7 @@ Work through each task in the plan sequentially. For each task:
98
98
 
99
99
  1. **Announce** the task you are starting (e.g., "Starting Task 2: Create the filter component")
100
100
  2. **Follow the pattern** referenced in the plan — do not invent new patterns
101
- 3. **Check for existing implementations** — before creating new functions, constants, or utility modules, search the codebase for existing implementations that serve the same purpose. Reuse or extend rather than duplicate. DRY violations were the #1 code quality issue across 28 implementations.
101
+ 3. **Check for existing implementations** — before creating new functions, constants, or utility modules, search the codebase for existing implementations that serve the same purpose. Reuse or extend rather than duplicate.
102
102
  4. **Implement** only what the task specifies — nothing more
103
103
  5. **Validate** the task using the method specified in the plan's validate field
104
104
  6. **Report completion** with a brief status: what was done, what was skipped, any decision made
@@ -137,54 +137,15 @@ If the user requests changes that are NOT in the plan during execution:
137
137
  - Suggest committing the current planned work first
138
138
  - Then create a new branch or add it to the backlog
139
139
  - Say: "This looks like a separate feature. I recommend we commit the current work first, then handle this in a new branch. Should I add it to `.agents/plans/backlog/` instead?"
140
- 5. **Never** silently add significant unplanned work — scope creep caused the lowest alignment score (6/10) in past implementations
140
+ 5. **Never** silently add significant unplanned work — it mixes unreviewed changes into an otherwise reviewed plan and breaks the audit trail
141
141
 
142
142
  ## Step 5: Run Full Validation Pyramid
143
143
 
144
- After all tasks are complete, run the full validation sequence in order.
145
- **Do not skip levels. Do not proceed if a level fails.**
144
+ After all tasks are complete, run **Levels 1–7** from `commands/guides/validation-pyramid.md` (same repo). Do not skip levels. Do not proceed if a level fails.
146
145
 
147
- Use the exact commands from the plan's **Validation Checklist**. If not specified, read `CLAUDE.md` section "Development Commands" to find the correct commands.
146
+ Use the exact commands from the plan's **Validation Checklist**. If not specified, read `CLAUDE.md` "Development Commands" to find the correct commands.
148
147
 
149
- ### Level 1 Lint & Format
150
- Run the project's lint and format check (e.g. `npm run lint`, `uv run ruff check .`).
151
- Fix any issues before continuing.
152
-
153
- ### Level 2 — Type Check
154
- Run the project's type checker (e.g. `npm run type-check`, `uv run mypy .`).
155
- Fix all type errors before continuing.
156
-
157
- ### Level 3 — Unit Tests
158
- Run the project's unit test suite (e.g. `npm run test`, `uv run pytest`).
159
- If tests fail:
160
- - Investigate the root cause
161
- - Fix the code (not the tests)
162
- - Re-run until all pass
163
-
164
- ### Level 4 — Integration Tests
165
- Run integration tests or manual verification as specified in the plan (e.g. `npm run test:e2e`, manual curl).
166
- Verify the feature works end-to-end.
167
-
168
- ### Level 5 — Code Review
169
- Run a code review on all changed files following the the `code-review` skill process. This catches bugs that linting, types, and tests miss (security issues, logic errors, pattern violations).
170
-
171
- If the review finds critical or high severity issues, **fix them before proceeding**.
172
-
173
- ### Level 6 — File Drift Check
174
- Compare the files actually changed against the plan's task list:
175
-
176
- ```bash
177
- git diff --name-only
178
- git ls-files --others --exclude-standard
179
- ```
180
-
181
- Flag any files that were changed but are **not listed in any task**. These are potential scope leaks — unplanned additions that didn't get the same scrutiny as planned tasks. Report them in the completion summary so the user can review.
182
-
183
- ### Level 7 — Human Review (flag for user)
184
- List what the user should manually verify:
185
- - Specific behaviors to test in the browser or CLI
186
- - Edge cases to check
187
- - Any decisions made during implementation that the user should review
148
+ Level 5 triggers the `code-review` skill (not a slash command). Level 6 is the file-drift check specific to plan execution. Level 7 surfaces items for human verification.
188
149
 
189
150
  ## Step 6: Completion Report
190
151
 
@@ -0,0 +1,74 @@
1
+ # Validation Pyramid
2
+
3
+ Shared reference for the full validation sequence. Callers (`commands/execute.md`, `commands/validate.md`, `skills/verify/SKILL.md`, plus plans' `Validation Checklist`) pick the levels that apply to their scope.
4
+
5
+ Run levels **in order**. Do not skip a level. Do not proceed if a level fails — fix it first.
6
+
7
+ Commands below are generic examples; use the exact commands from the project's `CLAUDE.md` "Development Commands" section or the plan's checklist.
8
+
9
+ ## Level 1 — Lint & Format
10
+
11
+ Run the project's lint and format commands (e.g. `npm run lint`, `uv run ruff check .`).
12
+
13
+ If issues are found:
14
+
15
+ - Fix them automatically where the tool supports it (e.g. `--fix`)
16
+ - Re-run to confirm clean
17
+
18
+ ## Level 2 — Type Check
19
+
20
+ Run the project's type checker (e.g. `npm run typecheck`, `tsc --noEmit`, `uv run mypy .`).
21
+
22
+ Fix all type errors before continuing.
23
+
24
+ ## Level 3 — Unit Tests
25
+
26
+ Run the project's unit test suite (e.g. `npm run test`, `uv run pytest`).
27
+
28
+ If tests fail:
29
+
30
+ - Investigate the root cause
31
+ - Fix the code (not the tests, unless the test is wrong)
32
+ - Re-run until all pass
33
+
34
+ ## Level 4 — Integration Tests
35
+
36
+ Run integration tests if the project has them (e.g. `npm run test:e2e`, manual curl).
37
+
38
+ If not available, skip and note it in the report.
39
+
40
+ ## Level 5 — Code Review
41
+
42
+ Trigger the `code-review` skill on the changed files. This catches bugs that lint, types, and tests miss (security issues, logic errors, pattern violations).
43
+
44
+ If the review finds `critical` or `high` severity issues, **fix them before proceeding**.
45
+
46
+ ## Level 6 — File Drift Check (post-execution only)
47
+
48
+ Compare the files actually changed against the plan's task list:
49
+
50
+ ```bash
51
+ git diff --name-only
52
+ git ls-files --others --exclude-standard
53
+ ```
54
+
55
+ Flag any files that were changed but are **not listed in any task**. These are potential scope leaks — report them in the completion summary so the user can review.
56
+
57
+ Skip this level when validating outside of a plan (`/hopla:validate` or the `verify` skill without a plan).
58
+
59
+ ## Level 7 — Human Review
60
+
61
+ Flag for the user what they should verify manually:
62
+
63
+ - Specific behaviors to test in the browser or CLI
64
+ - Edge cases to check
65
+ - Any decisions made during implementation that the user should review
66
+
67
+ ## Which levels apply when
68
+
69
+ | Caller | Levels |
70
+ |---|---|
71
+ | `/hopla:validate` | 1–4 |
72
+ | `verify` skill | 1–4 + 7 |
73
+ | `/hopla:execute` | 1–7 |
74
+ | Plan's `Validation Checklist` | as specified by the plan, typically 1–5 or 1–7 |
@@ -47,7 +47,7 @@ Investigate the areas of the codebase relevant to this feature:
47
47
  - Locate similar features already implemented to use as reference
48
48
  - Find the entry points that will need to be modified or extended
49
49
  - Identify potential conflicts or dependencies
50
- - **DRY check:** Before specifying new utility functions, constants, or helpers in the plan, search for existing implementations that can be reused or extended. DRY violations were the #1 code review finding across 28 implementations.
50
+ - **DRY check:** Before specifying new utility functions, constants, or helpers in the plan, search for existing implementations that can be reused or extended.
51
51
 
52
52
  Use the Grep tool to find relevant files (pattern: relevant keyword, case-insensitive).
53
53
 
@@ -60,7 +60,7 @@ For each existing table, API endpoint, or component the plan will modify, verify
60
60
  - **API endpoints:** Read the actual route handler. Confirm the request/response shape matches your assumptions.
61
61
  - **Components:** Read the component file. Confirm props, state, and data flow match your assumptions.
62
62
 
63
- Document verified assumptions in the plan's **Context References** with the exact file and line number. This prevents the #1 cause of mid-implementation redesigns: plans that assumed a field name, type, or constraint that didn't match reality.
63
+ Document verified assumptions in the plan's **Context References** with the exact file and line number. This prevents mid-implementation redesigns caused by plans that assumed a field name, type, or constraint that did not match reality.
64
64
 
65
65
  ### Data audit (required for features that consume existing data)
66
66
 
@@ -79,17 +79,17 @@ Based on research, define:
79
79
  - Any risks, edge cases, or gotchas to flag
80
80
  - What tests are needed
81
81
  - **Derived/computed values:** If any value is calculated from other fields, specify the exact formula including how stored values are interpreted (sign, units, semantics), AND how derived values propagate when inputs change (event system, reactivity, polling, etc.)
82
- - **Interaction states & edge cases:** For features involving interactive UI (forms, grids, keyboard navigation, wizards, CLI interactions), define a matrix of user interactions and their expected behavior. Cover: all keyboard shortcuts (both directions — e.g., Tab AND Shift+Tab), state transitions (empty → editing → saved → error), and boundary conditions (first item, last item, empty list, maximum items). This prevents iterative fix rounds that consumed up to 40% of session time in past implementations.
83
- - **API input validation:** For every API endpoint being created or modified, specify: required fields, field format constraints (e.g., "IMEI must be exactly 15 digits"), payload size limits, and what the user sees on validation failure. This was the #2 most common gap in past plans — validation was only added after code review in 4 of 7 implementations.
84
- - **Bidirectional data interactions:** If feature A updates data that feature B displays, does B need to react? If adding an item triggers validation, does editing trigger re-validation? Map all data mutation → side effect chains, not just keyboard navigation. Missed bidirectional interactions were a recurring planning blind spot.
82
+ - **Interaction states & edge cases:** For features involving interactive UI (forms, grids, keyboard navigation, wizards, CLI interactions), define a matrix of user interactions and their expected behavior. Cover: all keyboard shortcuts (both directions — e.g., Tab AND Shift+Tab), state transitions (empty → editing → saved → error), and boundary conditions (first item, last item, empty list, maximum items).
83
+ - **API input validation:** For every API endpoint being created or modified, specify: required fields, field format constraints (e.g., "IMEI must be exactly 15 digits"), payload size limits, and what the user sees on validation failure.
84
+ - **Bidirectional data interactions:** If feature A updates data that feature B displays, does B need to react? If adding an item triggers validation, does editing trigger re-validation? Map all data mutation → side effect chains, not just keyboard navigation.
85
85
  - **AI/LLM prompt tasks:** If the plan involves creating or modifying AI prompts (system prompts, prompt templates, LLM-based features), add an explicit task for testing against real data with 2-3 iteration cycles budgeted. AI prompt engineering rarely works on the first attempt.
86
- - **User preferences check:** Before specifying UI architecture (modal vs. inline, page vs. panel, dialog vs. drawer), verify against MEMORY.md and conversation history for established preferences. In past implementations, plans that specified modals were rejected because the user preferred inline panels — this caused rework. When no preference exists, note it as a decision point for the user to confirm.
87
- - **Reuse context analysis:** When a new view reuses an existing component in a different context (e.g., a list component in a "history" view vs. an "active" view), the plan MUST list what's different about the new context's requirements: different columns, different data filters, different interactions, different toolbar layout. Missed context differences caused 40%+ of unplanned work in past implementations.
86
+ - **User preferences check:** Before specifying UI architecture (modal vs. inline, page vs. panel, dialog vs. drawer), verify against `MEMORY.md` and conversation history for established preferences. When no preference exists, note it as a decision point for the user to confirm.
87
+ - **Reuse context analysis:** When a new view reuses an existing component in a different context (e.g., a list component in a "history" view vs. an "active" view), the plan MUST list what's different about the new context's requirements: different columns, different data filters, different interactions, different toolbar layout.
88
88
  - **Multi-phase plan guidance:** For features requiring 3+ phases, create an architectural plan (`backlog/NN-feature.md`) with schema, phase boundaries, and target architecture. When executing each phase, create a standalone plan (`phase-NX-description.md`) with full task-level detail following this template. The architectural plan is the spec; phase plans are the execution instructions. Each phase should have its own feature branch and PR.
89
- - **API surface enumeration (security/access control plans):** When the plan modifies access control, authorization, or data visibility, enumerate ALL API surfaces that serve the same data — REST endpoints, WebSocket handlers, Durable Object methods, and any other data paths. Each surface must be updated consistently. In past implementations, updating only the WebSocket path while missing the parallel REST endpoint caused a security gap that was only caught by code review. Add a task for each surface, not just the primary one.
90
- - **Role access matrix:** For features involving multiple user roles or multi-tenant access (admin, member, viewer, buyer, external user), define a matrix: what data does each role see? What endpoints does each role call? What filters apply per role? In past implementations, plans that didn't specify role-level access had authorization bugs discovered only during code review.
91
- - **External integration buffer:** If the feature integrates an external API or third-party service, budget 2x the estimated time. Document: do we have working test credentials? Is the SDK tested in our runtime (Workers, Node, edge, etc.)? Are there known deprecations or version constraints? External integrations consistently took 2-3x longer than planned in past implementations.
92
- - **UI iteration budget:** For features with significant UI (new pages, complex forms, interactive grids), note that UI specifications are provisional — expect 30-50% additional work for visual refinement based on user feedback. Specify what "good enough for v1" looks like vs. future polish. This prevents scope creep from being classified as plan failure.
89
+ - **API surface enumeration (security/access control plans):** When the plan modifies access control, authorization, or data visibility, enumerate ALL API surfaces that serve the same data — REST endpoints, WebSocket handlers, Durable Object methods, and any other data paths. Each surface must be updated consistently. Add a task for each surface, not just the primary one.
90
+ - **Role access matrix:** For features involving multiple user roles or multi-tenant access (admin, member, viewer, buyer, external user), define a matrix: what data does each role see? What endpoints does each role call? What filters apply per role?
91
+ - **External integration buffer:** If the feature integrates an external API or third-party service, budget 2x the estimated time. Document: do we have working test credentials? Is the SDK tested in our runtime (Workers, Node, edge, etc.)? Are there known deprecations or version constraints?
92
+ - **UI iteration budget:** For features with significant UI (new pages, complex forms, interactive grids), note that UI specifications are provisional — visual polish typically needs iteration on user feedback. Specify what "good enough for v1" looks like vs. future polish so scope creep is not classified as plan failure.
93
93
 
94
94
  ## Phase 5: Generate the Plan
95
95
 
@@ -112,7 +112,7 @@ Use this structure:
112
112
  - [Anything explicitly excluded]
113
113
 
114
114
  ## Likely Follow-ups
115
- [Features or changes naturally adjacent to this work that the user may request during or after execution. Historical data: 71% of sessions had scope expansion. Listing these upfront helps the executing agent handle them via the Scope Guard rather than improvising.]
115
+ [Features or changes naturally adjacent to this work that the user may request during or after execution. Listing these upfront helps the executing agent handle scope expansion via the Scope Guard rather than improvising.]
116
116
  - [Follow-up 1]
117
117
  - [Follow-up 2]
118
118
 
@@ -195,7 +195,7 @@ Scoring guide:
195
195
  ## Notes for Executing Agent
196
196
  [Any important context, warnings, or decisions made during planning that the executing agent needs to know]
197
197
 
198
- > **UI Styling Note:** UI styling specifications (colors, sizes, variants, labels, spacing) are `[provisional]` proposals. Historical data shows these change in 50%+ of implementations based on user feedback. Implement as specified but do not over-invest in pixel-perfect adherence expect iteration.
198
+ > **UI Styling Note:** UI styling specifications (colors, sizes, variants, labels, spacing) are `[provisional]` proposals expect them to change once the user sees the implementation. Implement as specified but do not over-invest in pixel-perfect adherence; plan for iteration.
199
199
  ```
200
200
 
201
201
  ---
@@ -206,7 +206,7 @@ After generating the plan, count the implementation tasks (excluding test tasks)
206
206
 
207
207
  - **3–7 tasks:** Optimal size. Proceed as-is.
208
208
  - **8–11 tasks:** Consider grouping tasks into logical phases with intermediate commit points. Add a `## Phase Boundaries` section to the plan listing where commits should happen.
209
- - **12+ tasks:** The plan should be split into multiple plans or phased with mandatory intermediate commits. Historical data: plans with 12+ tasks scored 6/10 alignment vs 10/10 for 3–7 task plans. Add phase boundaries and consider whether independent task groups can be separate plans.
209
+ - **12+ tasks:** The plan should be split into multiple plans or phased with mandatory intermediate commits. Large plans tend to drift during execution; phase boundaries give reviewers and the executing agent natural checkpoints. Consider whether independent task groups can be separate plans.
210
210
 
211
211
  ---
212
212
 
@@ -231,7 +231,7 @@ Before saving the draft, review the plan against these criteria:
231
231
  - [ ] **Plan size checked:** If >8 tasks, phase boundaries are defined with intermediate commit points. If >12 tasks, split justification is provided or phases are created.
232
232
  - [ ] **Likely follow-ups listed:** If the Out of Scope section has items, the Likely Follow-ups section is populated with naturally adjacent work the user may request
233
233
  - [ ] **API surface enumeration (if security/access plan):** All parallel API surfaces (REST, WebSocket, DO) that serve the same data are listed with a task for each
234
- - [ ] **N+1 query check:** For every task that writes database queries or API calls, verify: is any call inside a loop? Could it be batched? Are there duplicate existence checks before mutations? N+1 queries were found in 5 of 13 recent implementations.
234
+ - [ ] **N+1 query check:** For every task that writes database queries or API calls, verify: is any call inside a loop? Could it be batched? Are there duplicate existence checks before mutations?
235
235
 
236
236
  ## Phase 7: Save Draft and Enter Review Loop
237
237
 
@@ -14,36 +14,9 @@ If a `.claude/commands/validate.md` exists at the project root, use the commands
14
14
 
15
15
  ## Step 2: Run the Validation Pyramid
16
16
 
17
- Execute each level in order. **Do not skip levels. Do not proceed if a level fails — fix it first.**
17
+ Execute levels **1–4** from `commands/guides/validation-pyramid.md` (same repo). Do not skip levels. Do not proceed if a level fails — fix it first.
18
18
 
19
- ### Level 1 Lint & Format
20
-
21
- Run the project's lint and format commands (e.g. `npm run lint`, `uv run ruff check .`).
22
-
23
- If issues are found:
24
- - Fix them automatically if the tool supports it (e.g. `--fix`)
25
- - Re-run to confirm clean
26
-
27
- ### Level 2 — Type Check
28
-
29
- Run the project's type checker (e.g. `npm run typecheck`, `uv run mypy .`).
30
-
31
- Fix all type errors before continuing.
32
-
33
- ### Level 3 — Unit Tests
34
-
35
- Run the project's test suite (e.g. `npm run test`, `uv run pytest`).
36
-
37
- If tests fail:
38
- - Investigate the root cause
39
- - Fix the code (not the tests, unless the test is wrong)
40
- - Re-run until all pass
41
-
42
- ### Level 4 — Integration Tests
43
-
44
- Run integration tests if the project has them (e.g. `npm run test:e2e`).
45
-
46
- If not available, skip and note it in the report.
19
+ Use the exact commands from the project's `CLAUDE.md` "Development Commands" section. If a `.claude/commands/validate.md` exists at the project root, use the commands defined there instead.
47
20
 
48
21
  ## Step 3: Summary Report
49
22
 
@@ -72,4 +45,4 @@ If anything failed and could not be fixed, list the remaining issues and suggest
72
45
  ## Next Step
73
46
 
74
47
  After validation passes, suggest:
75
- > "All validation levels passed. Consider running the `code-review` skill for a deeper analysis — code review catches bugs in 79% of implementations that pass automated validation (stale closures, missing input validation, route shadowing, unhandled promise rejections). Run the `code-review` skill to check, or the `git` skill (say "commit") to commit directly."
48
+ > "All validation levels passed. Consider triggering the `code-review` skill for a deeper analysis — it catches classes of bugs that lint/types/tests miss (stale closures, missing input validation, route shadowing, unhandled promise rejections). Say 'review the code' to trigger it, or say 'commit' to use the `git` skill directly."
@@ -13,6 +13,18 @@ function run(cmd) {
13
13
  }
14
14
  }
15
15
 
16
+ function excerptClaudeMd(content) {
17
+ const lines = content.split("\n");
18
+ // Prefer the first `---` separator after the opening heading and first section
19
+ for (let i = 5; i < Math.min(lines.length, 120); i++) {
20
+ if (lines[i].trim() === "---") {
21
+ return lines.slice(0, i).join("\n").trimEnd();
22
+ }
23
+ }
24
+ // No separator within a reasonable window — cap at 60 lines
25
+ return lines.slice(0, Math.min(lines.length, 60)).join("\n").trimEnd();
26
+ }
27
+
16
28
  function discoverSkills() {
17
29
  // Try plugin context first: ../skills/ relative to this script
18
30
  const hookDir = import.meta.dirname;
@@ -85,11 +97,11 @@ async function main() {
85
97
  }
86
98
  }
87
99
 
88
- // CLAUDE.md summary (first 20 lines)
100
+ // CLAUDE.md excerpt cut at a natural boundary, not a fixed line count
89
101
  const claudeMdPath = path.join(process.cwd(), "CLAUDE.md");
90
102
  if (fs.existsSync(claudeMdPath)) {
91
- const content = fs.readFileSync(claudeMdPath, "utf8").split("\n").slice(0, 20).join("\n");
92
- lines.push(`Project rules (CLAUDE.md excerpt):\n${content}`);
103
+ const excerpt = excerptClaudeMd(fs.readFileSync(claudeMdPath, "utf8"));
104
+ lines.push(`Project rules (CLAUDE.md excerpt):\n${excerpt}`);
93
105
  }
94
106
 
95
107
  // Auto-discover available skills
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hopla/claude-setup",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Hopla team agentic coding system for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,6 +16,10 @@
16
16
  "hooks/",
17
17
  ".claude-plugin/"
18
18
  ],
19
+ "scripts": {
20
+ "prepublishOnly": "node scripts/check-versions.js",
21
+ "check-versions": "node scripts/check-versions.js"
22
+ },
19
23
  "engines": {
20
24
  "node": ">=18"
21
25
  },
@@ -14,7 +14,7 @@ Read `CLAUDE.md` or `AGENTS.md` to understand project standards and patterns.
14
14
 
15
15
  If `.agents/guides/` exists, read any guides relevant to the files being reviewed (e.g. `@.agents/guides/api-guide.md` when reviewing API changes). These guides define the expected patterns for specific task types.
16
16
 
17
- If `.agents/guides/review-checklist.md` exists, read it and apply the project-specific checks it defines in addition to the standard checks below. Project-specific checklists cover framework gotchas and domain anti-patterns unique to the project (e.g., AG Grid stale closures, Hono route ordering).
17
+ If `.agents/guides/review-checklist.md` exists, read it and apply the project-specific checks it defines in addition to the standard checks. Project-specific checklists cover framework gotchas and domain anti-patterns unique to the project (e.g., grid stale closures, route ordering).
18
18
 
19
19
  ## Step 2: Identify Changed Files
20
20
 
@@ -28,42 +28,16 @@ Read each changed or new file in its entirety — not just the diff.
28
28
 
29
29
  ## Step 3: Analyze for Issues
30
30
 
31
- For each changed file, look for:
32
-
33
- **1. Logic Errors**
34
- - Off-by-one errors, incorrect conditionals
35
- - Missing error handling, unhandled edge cases
36
- - Race conditions or async issues
37
- - Stale closures — callbacks passed to imperative APIs (grids, charts, maps) that capture stale state instead of using refs or stable references
38
- - Unhandled promise rejections — `.then()` without `.catch()`, async calls without `try/catch` in non-void contexts
39
- - Side effects inside JSX render — mutations of arrays/objects inside `.map()` in JSX (breaks React strict mode, causes double-execution bugs)
40
- - Stale dependency arrays — for every new `useState`/`useRef` variable introduced in the diff, verify it appears in the dependency arrays of `useEffect`, `useCallback`, or `useMemo` that reference it. Missing deps cause stale closures — this was the #1 React bug category across 28 implementations
41
-
42
- **2. Security Issues**
43
- - Exposed secrets or API keys
44
- - SQL/command injection vulnerabilities
45
- - Missing input validation on API endpoints — required fields, format constraints (regex, length), payload size limits
46
- - Insecure data handling — raw user input in queries, responses exposing internal data or stack traces
47
- - XSS vulnerabilities (frontend)
48
- - Multi-user authorization context — for multi-tenant apps, verify each endpoint filters by the correct context (e.g., active org vs personal org, admin vs viewer). Check that middleware/auth guards match the intended audience for each route
49
-
50
- **3. Performance Problems**
51
- - Unnecessary re-renders (React)
52
- - N+1 queries — database queries or API calls inside loops (`for`, `.map`, `.forEach`), duplicate existence checks before mutations, sequential operations that could use `Promise.all()` or batch SQL. This was found in 5 of 13 recent implementations
53
- - Memory leaks
54
-
55
- **4. Code Quality**
56
- - DRY violations — before flagging, search for similar functions/constants elsewhere in the codebase; suggest extraction to a shared module if the same logic exists in multiple places
57
- - Poor naming or overly complex functions
58
- - Missing TypeScript types or `any` usage
59
-
60
- **5. Pattern Adherence**
61
- - Follows project conventions from CLAUDE.md
62
- - Consistent with existing codebase style
63
-
64
- **6. Route & Middleware Ordering**
65
- - Static routes defined AFTER parameterized routes (e.g., `/users/all` after `/users/:id`) causing shadowing — the parameterized route captures requests meant for the static one
66
- - Middleware applied in incorrect order (e.g., auth after route handler, CORS after response sent)
31
+ Apply the full checklist in `checklist.md` (same directory). It covers:
32
+
33
+ 1. Logic errors (stale closures, unhandled rejections, missing deps)
34
+ 2. Security (secrets, injection, input validation, multi-tenant auth)
35
+ 3. Performance (N+1, re-renders, memory leaks)
36
+ 4. Code quality (DRY, naming, types)
37
+ 5. Pattern adherence (project conventions)
38
+ 6. Route & middleware ordering
39
+
40
+ Read `checklist.md` before reviewing so you apply every category.
67
41
 
68
42
  ## Step 4: Verify Issues Are Real
69
43
 
@@ -73,9 +47,10 @@ Before reporting, confirm each issue is legitimate:
73
47
 
74
48
  ## Step 5: Output Report
75
49
 
76
- Save to `.agents/code-reviews/[descriptive-name].md`
50
+ Save to `.agents/code-reviews/[descriptive-name].md`.
77
51
 
78
52
  **Format for each issue:**
53
+
79
54
  ```
80
55
  severity: critical | high | medium | low
81
56
  file: path/to/file.ts
@@ -88,6 +63,7 @@ suggestion: [how to fix it]
88
63
  If no issues found: "Code review passed. No technical issues detected."
89
64
 
90
65
  **Rules:**
66
+
91
67
  - Be specific — line numbers, not vague complaints
92
68
  - Focus on real bugs, not style preferences (linting handles that)
93
69
  - Flag security issues as `critical`
@@ -96,4 +72,5 @@ If no issues found: "Code review passed. No technical issues detected."
96
72
  ## Next Step
97
73
 
98
74
  After the review, suggest:
75
+
99
76
  > "Code review saved to `.agents/code-reviews/[name].md`. If issues were found, run `/hopla:code-review-fix .agents/code-reviews/[name].md` to fix them. If the review passed clean, proceed to the `execution-report` skill."
@@ -0,0 +1,44 @@
1
+ # Code Review Checklist
2
+
3
+ Apply every category to every changed file. Severity guidance is in the parent `SKILL.md`.
4
+
5
+ ## 1. Logic Errors
6
+
7
+ - Off-by-one errors, incorrect conditionals
8
+ - Missing error handling, unhandled edge cases
9
+ - Race conditions or async issues
10
+ - Stale closures — callbacks passed to imperative APIs (grids, charts, maps) that capture stale state instead of using refs or stable references
11
+ - Unhandled promise rejections — `.then()` without `.catch()`, async calls without `try/catch` in non-void contexts
12
+ - Side effects inside JSX render — mutations of arrays/objects inside `.map()` in JSX (breaks React strict mode, causes double-execution bugs)
13
+ - Stale dependency arrays — for every new `useState`/`useRef` variable introduced in the diff, verify it appears in the dependency arrays of `useEffect`, `useCallback`, or `useMemo` that reference it. Missing deps cause stale closures and are a recurring source of React bugs.
14
+
15
+ ## 2. Security Issues
16
+
17
+ - Exposed secrets or API keys
18
+ - SQL/command injection vulnerabilities
19
+ - Missing input validation on API endpoints — required fields, format constraints (regex, length), payload size limits
20
+ - Insecure data handling — raw user input in queries, responses exposing internal data or stack traces
21
+ - XSS vulnerabilities (frontend)
22
+ - Multi-user authorization context — for multi-tenant apps, verify each endpoint filters by the correct context (e.g., active org vs personal org, admin vs viewer). Check that middleware/auth guards match the intended audience for each route.
23
+
24
+ ## 3. Performance Problems
25
+
26
+ - Unnecessary re-renders (React)
27
+ - N+1 queries — database queries or API calls inside loops (`for`, `.map`, `.forEach`), duplicate existence checks before mutations, sequential operations that could use `Promise.all()` or batch SQL
28
+ - Memory leaks (event listeners not detached, timers not cleared, closures holding large objects)
29
+
30
+ ## 4. Code Quality
31
+
32
+ - DRY violations — before flagging, search for similar functions/constants elsewhere in the codebase; suggest extraction to a shared module if the same logic exists in multiple places
33
+ - Poor naming or overly complex functions
34
+ - Missing TypeScript types or `any` usage
35
+
36
+ ## 5. Pattern Adherence
37
+
38
+ - Follows project conventions from `CLAUDE.md`
39
+ - Consistent with existing codebase style
40
+
41
+ ## 6. Route & Middleware Ordering
42
+
43
+ - Static routes defined AFTER parameterized routes (e.g., `/users/all` after `/users/:id`) causing shadowing — the parameterized route captures requests meant for the static one
44
+ - Middleware applied in incorrect order (e.g., auth after route handler, CORS after response sent)
@@ -22,97 +22,30 @@ Also check for recent code reviews:
22
22
  ls -t .agents/code-reviews/ 2>/dev/null | head -5
23
23
  ```
24
24
 
25
- If a code review exists for this feature, note its path for the Code Review Findings section below.
25
+ If a code review exists for this feature, note its path for the Code Review Findings section.
26
26
 
27
- ## Step 2: Generate Report
27
+ ## Step 2: Generate the Report
28
28
 
29
- Save to: `.agents/execution-reports/[feature-name].md`
29
+ Save to: `.agents/execution-reports/[feature-name].md`.
30
30
 
31
- Use the following structure:
31
+ Use the full structure documented in `report-structure.md` (same directory). It covers:
32
32
 
33
- ---
34
-
35
- ### Meta Information
36
-
37
- - **Plan file:** [path to the plan that guided this implementation]
38
- - **Files added:** [list with paths]
39
- - **Files modified:** [list with paths]
40
- - **Lines changed:** +X -Y
41
-
42
- ### Validation Results
43
-
44
- - Syntax & Linting: ✓/✗ [details if failed]
45
- - Type Checking: ✓/✗ [details if failed]
46
- - Unit Tests: ✓/✗ [X passed, Y failed]
47
- - Integration Tests: ✓/✗ [X passed, Y failed]
48
-
49
- ### Code Review Findings
50
-
51
- - **Code review file:** [path to `.agents/code-reviews/[name].md`, or "Not run"]
52
- - **Issues found:** [count by severity: X critical, Y high, Z medium, W low]
53
- - **Issues fixed before this report:** [count]
54
- - **Key findings:** [1-2 sentence summary of the most significant issues found]
55
-
56
- ### What Went Well
57
-
58
- List specific things that worked smoothly:
59
- - [concrete examples]
60
-
61
- ### Challenges Encountered
62
-
63
- List specific difficulties encountered:
64
- - [what was difficult and why]
65
-
66
- ### Bugs Encountered
67
-
68
- Categorize each bug found during implementation:
69
-
70
- | Bug | Category | Found By | Severity |
71
- |-----|----------|----------|----------|
72
- | [description] | stale closure / validation / race condition / styling / scope mismatch / type error / route ordering / other | lint / types / tests / code review / manual testing | critical / high / medium / low |
33
+ - Meta information (plan file, files added/modified, lines changed)
34
+ - Validation results
35
+ - Code review findings
36
+ - What went well
37
+ - Challenges encountered
38
+ - Bugs encountered (with categorization table)
39
+ - Divergences from plan
40
+ - Scope assessment
41
+ - Skipped items
42
+ - Technical patterns discovered (with ready-to-paste CLAUDE.md entry)
43
+ - Recommendations
73
44
 
74
- If no bugs were encountered, write "No bugs encountered during implementation."
75
-
76
- ### Divergences from Plan
77
-
78
- For each divergence from the original plan:
79
-
80
- **[Divergence Title]**
81
- - **Planned:** [what the plan specified]
82
- - **Actual:** [what was implemented instead]
83
- - **Reason:** [why this divergence occurred]
84
- - **Type:** Better approach found | Plan assumption wrong | Security concern | Performance issue | Other
85
-
86
- ### Scope Assessment
87
-
88
- - **Planned tasks:** [number of tasks in the original plan]
89
- - **Executed tasks:** [number of tasks actually completed]
90
- - **Unplanned additions:** [count and brief description of work not in the original plan]
91
- - **Scope accuracy:** On target | Under-scoped (took more work than planned) | Over-scoped (simpler than expected)
92
-
93
- ### Skipped Items
94
-
95
- List anything from the plan that was not implemented:
96
- - [what was skipped] — Reason: [why]
97
-
98
- ### Technical Patterns Discovered
99
-
100
- New gotchas, patterns, or conventions learned during this implementation that should be documented:
101
-
102
- - **Pattern/Gotcha:** [description]
103
- - **Where it applies:** [what type of feature or context triggers this]
104
- - **Ready-to-paste CLAUDE.md entry:** [Write the EXACT text that should be added to the project's CLAUDE.md to prevent this gotcha in future features. Format it as a bullet point under the appropriate section. If it belongs in a guide instead, write the exact text for the guide. Do not write vague suggestions like "document this" — write the actual content so the system reviewer can apply it directly.]
105
-
106
- If nothing new was discovered, write "No new patterns discovered."
107
-
108
- ### Recommendations
109
-
110
- Based on this implementation, what should change for next time?
111
- - Plan command improvements: [suggestions]
112
- - Execute command improvements: [suggestions]
113
- - CLAUDE.md additions: [suggestions]
45
+ Read `report-structure.md` before writing so every section is filled correctly.
114
46
 
115
47
  ## Next Step
116
48
 
117
49
  After the report is saved, suggest:
118
- > "Execution report saved to `.agents/execution-reports/[name].md`. Run the `git` skill (say "commit") to commit your changes."
50
+
51
+ > "Execution report saved to `.agents/execution-reports/[name].md`. Use the `git` skill (say 'commit') to save your changes."
@@ -0,0 +1,88 @@
1
+ # Execution Report Structure
2
+
3
+ Fill every section. Write "Not applicable" rather than leaving a section blank — empty sections make it unclear whether the check was performed.
4
+
5
+ ## Meta Information
6
+
7
+ - **Plan file:** [path to the plan that guided this implementation]
8
+ - **Files added:** [list with paths]
9
+ - **Files modified:** [list with paths]
10
+ - **Lines changed:** +X −Y
11
+
12
+ ## Validation Results
13
+
14
+ - Syntax & Linting: ✓/✗ [details if failed]
15
+ - Type Checking: ✓/✗ [details if failed]
16
+ - Unit Tests: ✓/✗ [X passed, Y failed]
17
+ - Integration Tests: ✓/✗ [X passed, Y failed]
18
+
19
+ ## Code Review Findings
20
+
21
+ - **Code review file:** [path to `.agents/code-reviews/[name].md`, or "Not run"]
22
+ - **Issues found:** [count by severity: X critical, Y high, Z medium, W low]
23
+ - **Issues fixed before this report:** [count]
24
+ - **Key findings:** [1-2 sentence summary of the most significant issues found]
25
+
26
+ ## What Went Well
27
+
28
+ List specific things that worked smoothly:
29
+
30
+ - [concrete examples]
31
+
32
+ ## Challenges Encountered
33
+
34
+ List specific difficulties:
35
+
36
+ - [what was difficult and why]
37
+
38
+ ## Bugs Encountered
39
+
40
+ Categorize each bug found during implementation:
41
+
42
+ | Bug | Category | Found By | Severity |
43
+ |-----|----------|----------|----------|
44
+ | [description] | stale closure / validation / race condition / styling / scope mismatch / type error / route ordering / other | lint / types / tests / code review / manual testing | critical / high / medium / low |
45
+
46
+ If no bugs were encountered, write "No bugs encountered during implementation."
47
+
48
+ ## Divergences from Plan
49
+
50
+ For each divergence:
51
+
52
+ **[Divergence Title]**
53
+
54
+ - **Planned:** [what the plan specified]
55
+ - **Actual:** [what was implemented instead]
56
+ - **Reason:** [why this divergence occurred]
57
+ - **Type:** Better approach found | Plan assumption wrong | Security concern | Performance issue | Other
58
+
59
+ ## Scope Assessment
60
+
61
+ - **Planned tasks:** [number in the original plan]
62
+ - **Executed tasks:** [number actually completed]
63
+ - **Unplanned additions:** [count and brief description of work not in the original plan]
64
+ - **Scope accuracy:** On target | Under-scoped (took more work than planned) | Over-scoped (simpler than expected)
65
+
66
+ ## Skipped Items
67
+
68
+ List anything from the plan that was not implemented:
69
+
70
+ - [what was skipped] — Reason: [why]
71
+
72
+ ## Technical Patterns Discovered
73
+
74
+ New gotchas, patterns, or conventions learned during this implementation that should be documented:
75
+
76
+ - **Pattern/Gotcha:** [description]
77
+ - **Where it applies:** [what type of feature or context triggers this]
78
+ - **Ready-to-paste CLAUDE.md entry:** [Write the EXACT text that should be added to the project's CLAUDE.md to prevent this gotcha in future features. Format it as a bullet point under the appropriate section. If it belongs in a guide instead, write the exact text for the guide. Do not write vague suggestions like "document this" — write the actual content so the system reviewer can apply it directly.]
79
+
80
+ If nothing new was discovered, write "No new patterns discovered."
81
+
82
+ ## Recommendations
83
+
84
+ Based on this implementation, what should change for next time?
85
+
86
+ - Plan command improvements: [suggestions]
87
+ - Execute command improvements: [suggestions]
88
+ - CLAUDE.md additions: [suggestions]
@@ -47,13 +47,7 @@ Instead, run the verification and report actual results.
47
47
 
48
48
  ## Integration with Validation Pyramid
49
49
 
50
- When completing a feature (not just a single file edit), run the full validation pyramid:
51
-
52
- 1. **Level 1**: Lint & format
53
- 2. **Level 2**: Type check
54
- 3. **Level 3**: Unit tests
55
- 4. **Level 4**: Integration tests (if applicable)
56
- 5. **Level 5**: Human review suggestion
50
+ When completing a feature (not just a single file edit), run levels **1–4 + 7** from `commands/guides/validation-pyramid.md` (Lint, Types, Unit, Integration, Human review).
57
51
 
58
52
  Reference `/hopla:validate` for project-specific validation commands.
59
53
 
@@ -72,3 +66,14 @@ When verifying completion of a plan execution (not just a standalone task):
72
66
  3. **All acceptance criteria met?** — Read the plan's acceptance criteria and verify each one has fresh evidence.
73
67
 
74
68
  These checks prevent the common pattern where implementation is "done" but divergences are silently omitted from the report.
69
+
70
+ ## Authoritative post-implementation sequence
71
+
72
+ When verification passes, follow this order to avoid redundant work and skill overlap:
73
+
74
+ 1. **`verify`** (this skill) — confirm fresh evidence for every completion claim.
75
+ 2. **`code-review`** — run technical review on changed files. Fix `critical`/`high` issues before proceeding.
76
+ 3. **`execution-report`** — document what was built, bugs found, divergences, patterns discovered.
77
+ 4. **`git`** — commit (and PR when ready).
78
+
79
+ Each step cites the next, so at any point you should be routing to exactly one subsequent skill. If multiple skills are triggering simultaneously on a completion claim, this is the canonical ordering.