@hopla/claude-setup 1.12.1 → 1.14.1

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 (40) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +209 -144
  4. package/agents/system-reviewer.md +13 -0
  5. package/cli.js +301 -399
  6. package/commands/code-review-fix.md +1 -1
  7. package/commands/create-prd.md +1 -1
  8. package/commands/execute.md +27 -8
  9. package/commands/guide.md +14 -8
  10. package/commands/guides/ai-optimized-codebase.md +1 -1
  11. package/commands/guides/mcp-integration.md +3 -3
  12. package/commands/guides/remote-coding.md +3 -3
  13. package/commands/guides/review-checklist.md +5 -5
  14. package/commands/guides/scaling-beyond-engineering.md +6 -9
  15. package/commands/init-project.md +12 -10
  16. package/commands/plan-feature.md +18 -2
  17. package/commands/rca.md +9 -4
  18. package/commands/review-plan.md +2 -2
  19. package/commands/validate.md +2 -2
  20. package/global-rules.md +18 -50
  21. package/hooks/env-protect.js +39 -8
  22. package/hooks/hooks.json +1 -1
  23. package/hooks/session-prime.js +39 -12
  24. package/hooks/tsc-check.js +21 -10
  25. package/package.json +1 -1
  26. package/skills/brainstorm/SKILL.md +7 -2
  27. package/skills/code-review/SKILL.md +4 -2
  28. package/skills/debug/SKILL.md +8 -0
  29. package/skills/execution-report/SKILL.md +2 -2
  30. package/skills/git/commit.md +20 -3
  31. package/skills/git/flow-detection.md +68 -0
  32. package/skills/git/pr.md +46 -16
  33. package/skills/prime/SKILL.md +1 -1
  34. package/skills/subagent-execution/SKILL.md +1 -1
  35. package/skills/tdd/SKILL.md +1 -1
  36. package/skills/verify/SKILL.md +11 -1
  37. package/skills/worktree/SKILL.md +83 -38
  38. package/commands/end-to-end.md +0 -67
  39. package/commands/git-commit.md +0 -76
  40. package/commands/git-pr.md +0 -138
@@ -58,4 +58,4 @@ Provide a summary of:
58
58
  ## Next Step
59
59
 
60
60
  After all fixes pass validation, suggest:
61
- > "All review issues fixed and validation passed. Run `/hopla-execution-report` to document the implementation, then `/hopla-git-commit` to commit."
61
+ > "All review issues fixed and validation passed. Run the `execution-report` skill to document the implementation, then the `git` skill (say "commit") to commit."
@@ -222,4 +222,4 @@ Do not ask clarifying questions about changes — just apply them and confirm wh
222
222
  1. Rename `PRD.draft.md` → `PRD.md` (overwrite if it existed)
223
223
  2. Rename any `.draft` context documents to their final names
224
224
  3. Delete all `.draft` files
225
- 4. Confirm: "✅ `PRD.md` saved. Run `/hopla-git-commit` to save it to the repository."
225
+ 4. Confirm: "✅ `PRD.md` saved. Run the `git` skill (say "commit") to save it to the repository."
@@ -29,6 +29,13 @@ Verify that the plan's documented assumptions still hold. **You are not re-audit
29
29
 
30
30
  See `.agents/guides/data-audit.md` for detailed criteria on what to check.
31
31
 
32
+ **Concrete verification:** For each table or API endpoint mentioned in the plan's tasks, run ONE verification command before writing code. Examples:
33
+ - Schema: `grep -n 'CREATE TABLE\|ALTER.*tablename' migrations/*.sql | tail -3`
34
+ - API route: Read the route file and confirm the endpoint signature
35
+ - Component: Read the component and confirm its props interface
36
+
37
+ If ANY assumption from the plan doesn't match current code, file a Blocker Report immediately. Do not proceed with tasks that depend on incorrect assumptions.
38
+
32
39
  If a discrepancy is found, stop immediately and file a Blocker Report below. You may continue with tasks that are not blocked by the discrepancy.
33
40
 
34
41
  #### Blocker Report
@@ -60,10 +67,12 @@ Do not proceed until the working tree is clean.
60
67
 
61
68
  ### Branch check
62
69
 
63
- Check that the current branch follows Git Flow:
64
- - **Never execute on `main` or `master`** — stop and warn the user
65
- - **If on `develop`/`dev`** — ask: "You're on `develop`. Should I create a feature branch first? (recommended: `feature/[plan-name]`)"
70
+ Check the current branch and determine the appropriate action:
66
71
  - **If on a `feature/`, `fix/`, or `hotfix/` branch** — proceed
72
+ - **If on `develop`/`dev`** — ask: "You're on `develop`. Should I create a feature branch first? (recommended: `feature/[plan-name]`)"
73
+ - **If on `main` or `master`** — check if `develop`/`dev` exists:
74
+ - If `develop`/`dev` exists: warn "You're on `main` but `develop` exists. Switch to `develop` first, or create a feature branch from `main` if this is a hotfix."
75
+ - If NO `develop`/`dev` exists (GitHub Flow project): ask "You're on `main` (no develop branch detected). Should I create a feature branch? (recommended: `feature/[plan-name]`)"
67
76
  - **If the plan specifies a base branch** (in `## Git Strategy`) — verify the current branch was created from that base. If not, warn the user:
68
77
  > "The plan specifies base branch `[X]` but the current branch was created from `[Y]`. This may cause the PR to target the wrong branch. Continue anyway?"
69
78
 
@@ -98,6 +107,7 @@ Work through each task in the plan sequentially. For each task:
98
107
  **Git strategy:**
99
108
  - **Plans with 1–7 tasks:** Do not commit after individual tasks. Keep all changes staged but uncommitted until the full plan passes validation (Step 5). This allows a clean revert if later tasks fail.
100
109
  - **Plans with 8+ tasks (or plans with `## Phase Boundaries`):** Commit at each phase boundary defined in the plan. Run Level 1–2 validation (lint + types) before each intermediate commit. Use commit message format: `feat(<scope>): <feature> — phase N of M`. This prevents losing work on large implementations if later phases fail.
110
+ For plans with 8+ tasks, the **first intermediate commit** should happen after the first 3-4 tasks pass validation — do not wait until a full phase boundary if one isn't defined. Losing work on large implementations was a recurring problem when commits were deferred too long.
101
111
 
102
112
  **Pause and report if, during implementation:**
103
113
  - A task is ambiguous or has multiple valid implementations
@@ -107,6 +117,15 @@ Work through each task in the plan sequentially. For each task:
107
117
 
108
118
  Do not improvise silently. When in doubt, stop and ask.
109
119
 
120
+ ### Destructive Command Guard
121
+
122
+ **NEVER** run destructive database or state commands during plan execution:
123
+ - `db:reset`, `db:push --force`, `DROP TABLE`, `DELETE FROM` without WHERE
124
+ - `rm -rf` on data directories
125
+ - `git reset --hard`, `git clean -fd`
126
+
127
+ If a migration fails or data needs to be reset, **stop and report to the user**. The cost of pausing is low; the cost of data loss is catastrophic. This rule exists because a `db:reset` during execution caused complete local data loss in a past implementation.
128
+
110
129
  ### Scope Guard
111
130
 
112
131
  If the user requests changes that are NOT in the plan during execution:
@@ -147,7 +166,7 @@ Run integration tests or manual verification as specified in the plan (e.g. `npm
147
166
  Verify the feature works end-to-end.
148
167
 
149
168
  ### Level 5 — Code Review
150
- Run a code review on all changed files following the `/hopla-code-review` process. This catches bugs that linting, types, and tests miss (security issues, logic errors, pattern violations).
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).
151
170
 
152
171
  If the review finds critical or high severity issues, **fix them before proceeding**.
153
172
 
@@ -201,7 +220,7 @@ Provide a summary of what was done:
201
220
  ## Step 7: Suggest Next Steps
202
221
 
203
222
  After the summary, suggest:
204
- 1. Run `/hopla-code-review` for a standalone review of the changes (recommended — a fresh review catches issues the executing agent may have missed)
205
- 2. If issues are found, run `/hopla-code-review-fix` to fix them
206
- 3. Run `/hopla-execution-report` to document the implementation
207
- 4. Run `/hopla-git-commit` to commit the changes
223
+ 1. Run the `code-review` skill for a standalone review of the changes (recommended — a fresh review catches issues the executing agent may have missed)
224
+ 2. If issues are found, run `/hopla:code-review-fix` to fix them
225
+ 3. Run the `execution-report` skill to document the implementation
226
+ 4. Run the `git` skill (say "commit") to commit the changes
package/commands/guide.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ description: 4D Framework guide for non-technical users working with AI coding assistants
3
+ ---
4
+
5
+ > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
6
+
1
7
  # HOPLA Guide for Non-Technical Users
2
8
 
3
9
  > A guided framework for working effectively with your AI coding assistant.
@@ -39,19 +45,19 @@ Three categories for every task:
39
45
  ## Your Available Commands
40
46
 
41
47
  ### For Planning & Product
42
- - `/hopla-create-prd` — Create a Product Requirements Document through guided conversation
43
- - `/hopla-plan-feature` — Create an implementation plan (AI researches, you approve)
44
- - `/hopla-review-plan` — Review a plan before execution
48
+ - `/hopla:create-prd` — Create a Product Requirements Document through guided conversation
49
+ - `/hopla:plan-feature` — Create an implementation plan (AI researches, you approve)
50
+ - `/hopla:review-plan` — Review a plan before execution
45
51
 
46
52
  ### For Oversight
47
- - `/hopla-system-review` — Analyze how well the AI followed the plan
48
- - `/hopla-guide` — Show this guide again
53
+ - `/hopla:system-review` — Analyze how well the AI followed the plan
54
+ - `/hopla:guide` — Show this guide again
49
55
 
50
56
  ## Getting Started
51
57
 
52
- 1. Start with `/hopla-create-prd` to define your project scope
53
- 2. Use `/hopla-plan-feature "your feature idea"` to plan each feature
54
- 3. Review the plan with `/hopla-review-plan`
58
+ 1. Start with `/hopla:create-prd` to define your project scope
59
+ 2. Use `/hopla:plan-feature "your feature idea"` to plan each feature
60
+ 3. Review the plan with `/hopla:review-plan`
55
61
  4. Hand off to a developer for execution, or ask the AI to execute
56
62
 
57
63
  ## Tips for Better Results
@@ -1,7 +1,7 @@
1
1
  # AI-Optimized Codebase Guide
2
2
 
3
3
  ## When to Use This Guide
4
- Reference this guide when initializing a project with `/hopla-init-project` or when optimizing an existing codebase for better AI-assisted development.
4
+ Reference this guide when initializing a project with `/hopla:init-project` or when optimizing an existing codebase for better AI-assisted development.
5
5
 
6
6
  ## Principles
7
7
 
@@ -5,17 +5,17 @@ Reference this guide when planning features that involve external tools or servi
5
5
 
6
6
  ## MCP in the PIV Loop
7
7
 
8
- ### During Planning (`/hopla-plan-feature`)
8
+ ### During Planning (`/hopla:plan-feature`)
9
9
  - Check what MCP servers are configured (listed in CLAUDE.md under "MCP Servers")
10
10
  - For each external integration point, specify which MCP tool to use
11
11
  - Example: "Step 3: Use Playwright MCP to verify the component renders correctly"
12
12
 
13
- ### During Execution (`/hopla-execute`)
13
+ ### During Execution (`/hopla:execute`)
14
14
  - Before starting, verify MCP servers are available and responsive
15
15
  - When a task involves an MCP tool, use it explicitly (don't fall back to manual alternatives)
16
16
  - If an MCP server is unavailable, document it and skip that validation step
17
17
 
18
- ### During Validation (`/hopla-validate`)
18
+ ### During Validation (`/hopla:validate`)
19
19
  - Use Playwright MCP for E2E browser validation if configured
20
20
  - Use database MCPs to verify data state after migrations
21
21
  - Document which validations were done via MCP vs. manual
@@ -50,9 +50,9 @@ jobs:
50
50
  run: |
51
51
  npx claude-code --print "
52
52
  Read issue #${{ github.event.issue.number }}.
53
- /hopla-plan-feature based on the issue requirements.
54
- /hopla-execute the plan.
55
- /hopla-validate
53
+ /hopla:plan-feature based on the issue requirements.
54
+ /hopla:execute the plan.
55
+ /hopla:validate
56
56
  Create a PR with the results.
57
57
  "
58
58
  ```
@@ -1,6 +1,6 @@
1
1
  # Guide: Creating a Project-Specific Review Checklist
2
2
 
3
- Use this guide to create a `.agents/guides/review-checklist.md` file in your project with code review checks specific to your tech stack, domain, and known anti-patterns. The `/hopla-code-review` command loads this file automatically when it exists, applying your custom checks alongside the standard review categories.
3
+ Use this guide to create a `.agents/guides/review-checklist.md` file in your project with code review checks specific to your tech stack, domain, and known anti-patterns. The the `code-review` skill command loads this file automatically when it exists, applying your custom checks alongside the standard review categories.
4
4
 
5
5
  ---
6
6
 
@@ -9,8 +9,8 @@ Use this guide to create a `.agents/guides/review-checklist.md` file in your pro
9
9
  Create a review checklist when:
10
10
  - The same bug pattern appears in **2+ code reviews** (e.g., stale closures in grid callbacks)
11
11
  - Your project uses a framework with non-obvious gotchas (AG Grid, Hono, Prisma, D3, etc.)
12
- - A `/hopla-system-review` flags a recurring issue that should be caught during code review
13
- - A `/hopla-execution-report` documents a new technical pattern in its "Technical Patterns Discovered" section
12
+ - A `/hopla:system-review` flags a recurring issue that should be caught during code review
13
+ - A the `execution-report` skill documents a new technical pattern in its "Technical Patterns Discovered" section
14
14
 
15
15
  ---
16
16
 
@@ -67,8 +67,8 @@ Patterns that have caused bugs in this project before:
67
67
  ## Maintenance
68
68
 
69
69
  Update this file when:
70
- - `/hopla-system-review` flags a recurring bug pattern (3+ occurrences across reviews)
71
- - `/hopla-execution-report` discovers a new technical pattern in "Technical Patterns Discovered"
70
+ - `/hopla:system-review` flags a recurring bug pattern (3+ occurrences across reviews)
71
+ - the `execution-report` skill discovers a new technical pattern in "Technical Patterns Discovered"
72
72
  - A code review finds a bug that should have been caught by a checklist item
73
73
  - A framework is upgraded and known gotchas change
74
74
 
@@ -10,21 +10,18 @@ According to Anthropic's 2026 Agentic Coding Trends Report:
10
10
  - The barrier between "people who code" and "people who don't" is becoming permeable
11
11
  - Domain experts implementing solutions directly removes bottlenecks
12
12
 
13
- ## HOPLA's Planning Mode
13
+ ## HOPLA for Non-Technical Users
14
14
 
15
- HOPLA already supports non-technical users via `--planning` mode:
16
- - Restricted command set (planning and review only)
17
- - Limited git permissions (read-only)
18
- - Focus on product decisions, not implementation
15
+ Non-technical users can adopt HOPLA today by installing the plugin and focusing on product-planning commands. The 4D Framework guide (`/hopla:guide`) walks them through Description → Discernment → Delegation → Diligence without requiring them to write or review code directly.
19
16
 
20
17
  ## Expanding the Model
21
18
 
22
19
  ### Phase 1: Product Planning (Current)
23
20
  Non-technical users can:
24
- - Create PRDs with `/hopla-create-prd`
25
- - Plan features with `/hopla-plan-feature`
26
- - Review plans with `/hopla-review-plan`
27
- - Guide workflow with `/hopla-guide` (4D Framework)
21
+ - Create PRDs with `/hopla:create-prd`
22
+ - Plan features with `/hopla:plan-feature`
23
+ - Review plans with `/hopla:review-plan`
24
+ - Guide workflow with `/hopla:guide` (4D Framework)
28
25
 
29
26
  ### Phase 2: Assisted Creation (Future)
30
27
  Non-technical users could:
@@ -427,18 +427,20 @@ Create the following directories (with `.gitkeep` where needed):
427
427
 
428
428
  ```
429
429
  .agents/
430
- ├── plans/ <- /hopla-plan-feature saves here (commit these)
431
- ├── guides/ <- on-demand reference guides (commit these)
432
- ├── execution-reports/ <- /hopla-execution-report saves here (do NOT commit)
433
- ├── code-reviews/ <- /hopla-code-review saves here (do NOT commit)
434
- └── system-reviews/ <- /hopla-system-review saves here (do NOT commit)
430
+ ├── plans/ <- /hopla:plan-feature saves here (commit)
431
+ ├── done/ <- /hopla:system-review archives completed plans here (commit)
432
+ │ └── backlog/ <- /hopla:execute Scope Guard defers ideas here (commit)
433
+ ├── specs/ <- brainstorm skill saves design docs here (commit)
434
+ ├── guides/ <- on-demand reference guides (commit)
435
+ ├── rca/ <- /hopla:rca saves root cause analysis docs here (commit)
436
+ ├── execution-reports/ <- the `execution-report` skill saves here (commit — needed for cross-session learning)
437
+ ├── system-reviews/ <- /hopla:system-review saves here (commit — needed for feedback loop)
438
+ └── code-reviews/ <- the `code-review` skill saves here (do NOT commit — ephemeral, consumed by code-review-fix)
435
439
  ```
436
440
 
437
441
  Add to `.gitignore` (create if it doesn't exist):
438
442
  ```
439
- .agents/execution-reports/
440
443
  .agents/code-reviews/
441
- .agents/system-reviews/
442
444
  ```
443
445
 
444
446
  ## Step 7: Create .claude/commands/ (optional but recommended)
@@ -474,6 +476,6 @@ Once confirmed:
474
476
  1. Save `CLAUDE.md` to the project root
475
477
  2. Create `.agents/` directory structure
476
478
  3. Update `.gitignore`
477
- 4. If no PRD exists yet, tell the user: "Project initialized. Run `/hopla-create-prd` next to define the product scope, or `/hopla-plan-feature` to start planning a feature."
478
- If a PRD already exists, tell the user: "Project initialized. Run `/hopla-plan-feature` to start planning the first feature."
479
- 5. Suggest running `/hopla-git-commit` to save everything
479
+ 4. If no PRD exists yet, tell the user: "Project initialized. Run `/hopla:create-prd` next to define the product scope, or `/hopla:plan-feature` to start planning a feature."
480
+ If a PRD already exists, tell the user: "Project initialized. Run `/hopla:plan-feature` to start planning the first feature."
481
+ 5. Suggest running the `git` skill (say "commit") to save everything
@@ -28,6 +28,7 @@ Read the following to understand the project:
28
28
  3. `package.json` or `pyproject.toml` — stack, dependencies, scripts
29
29
  4. `.agents/guides/` — if this directory exists, read any guides relevant to the feature being planned (e.g. `@.agents/guides/api-guide.md` when planning an API endpoint)
30
30
  5. `MEMORY.md` (if it exists at project root or `~/.claude/`) — check for user preferences that affect this feature (UI patterns like modal vs inline, keyboard shortcuts, component conventions)
31
+ 6. `.agents/execution-reports/` — if this directory exists, scan recent reports (last 3-5) for technical patterns discovered and gotchas relevant to the feature being planned. These contain real-world learnings from previous implementations that prevent re-discovering known issues.
31
32
 
32
33
  Then run:
33
34
 
@@ -52,6 +53,15 @@ Use the Grep tool to find relevant files (pattern: relevant keyword, case-insens
52
53
 
53
54
  Read the key files in their entirety — not just the parts that seem relevant.
54
55
 
56
+ ### Assumption verification (required)
57
+
58
+ For each existing table, API endpoint, or component the plan will modify, verify the current state during planning — do not defer to execution:
59
+ - **Database/schema:** Read the most recent migration or schema definition. Confirm column names, types, and constraints match your assumptions.
60
+ - **API endpoints:** Read the actual route handler. Confirm the request/response shape matches your assumptions.
61
+ - **Components:** Read the component file. Confirm props, state, and data flow match your assumptions.
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.
64
+
55
65
  ### Data audit (required for features that consume existing data)
56
66
 
57
67
  Follow the full checklist in `.agents/guides/data-audit.md`.
@@ -76,6 +86,10 @@ Based on research, define:
76
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.
77
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.
78
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.
79
93
 
80
94
  ## Phase 5: Generate the Plan
81
95
 
@@ -156,7 +170,7 @@ Run in this order — do not proceed if a level fails:
156
170
 
157
171
  - [ ] **Level 1 — Lint & Format:** `[project lint command]`
158
172
  - [ ] **Level 2 — Type Check:** `[project type check command]`
159
- - [ ] **Level 2.5 — Code Review:** Run `/hopla-code-review` on changed files
173
+ - [ ] **Level 2.5 — Code Review:** Run the `code-review` skill on changed files
160
174
  - [ ] **Level 3 — Unit Tests:** `[project unit test command]`
161
175
  - [ ] **Level 4 — Integration Tests:** `[project integration test or manual curl/check]`
162
176
  - [ ] **Level 5 — Human Review:** Verify behavior matches requirements above
@@ -216,6 +230,8 @@ Before saving the draft, review the plan against these criteria:
216
230
  - [ ] **Time-box on risky tasks:** Any task involving unfamiliar libraries, heuristic parsing, or known-complex behavior (auto-sizing, animation, real-time sync) has a Time-box with a fallback strategy
217
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.
218
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
+ - [ ] **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.
219
235
 
220
236
  ## Phase 7: Save Draft and Enter Review Loop
221
237
 
@@ -244,4 +260,4 @@ Before saving the draft, review the plan against these criteria:
244
260
 
245
261
  **Finalize:**
246
262
  1. Rename `.agents/plans/[feature-name].draft.md` → `.agents/plans/[feature-name].md` (overwrite if it already exists)
247
- 2. Confirm: "✅ Plan saved to `.agents/plans/[feature-name].md`. Run `/hopla-review-plan .agents/plans/[feature-name].md` to review it, then `/hopla-execute .agents/plans/[feature-name].md` to implement it."
263
+ 2. Confirm: "✅ Plan saved to `.agents/plans/[feature-name].md`. Run `/hopla:review-plan .agents/plans/[feature-name].md` to review it, then `/hopla:execute .agents/plans/[feature-name].md` to implement it."
package/commands/rca.md CHANGED
@@ -1,6 +1,11 @@
1
- # Root Cause Analysis
1
+ ---
2
+ description: Investigate a bug or issue and produce a structured RCA document
3
+ argument-hint: "<issue-description-or-github-url>"
4
+ ---
5
+
6
+ > 🌐 **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
2
7
 
3
- > Investigate a bug or issue and produce a structured RCA document.
8
+ # Root Cause Analysis
4
9
 
5
10
  > 💡 **Tip**: Use Extended Thinking mode for complex bugs with multiple possible causes.
6
11
 
@@ -55,9 +60,9 @@ What needs to change to resolve this
55
60
  How to prevent similar issues in the future
56
61
 
57
62
  ## Next Steps
58
- - [ ] Implement fix (run `/hopla-execute` with a plan, or fix directly if simple)
63
+ - [ ] Implement fix (run `/hopla:execute` with a plan, or fix directly if simple)
59
64
  - [ ] Add regression test
60
- - [ ] Validate with `/hopla-validate`
65
+ - [ ] Validate with `/hopla:validate`
61
66
  ```
62
67
 
63
68
  ## Output
@@ -48,5 +48,5 @@ After the summary, ask (in the user's language):
48
48
 
49
49
  **Review loop:**
50
50
  - If the user has questions → answer them based on the plan content
51
- - If the user requests changes → note them and tell the user to ask Robert to update the plan, or apply minor clarifications directly if they are unambiguous
52
- - If the user approves → confirm: "✅ Plan approved. Run `/hopla-execute $1` to start."
51
+ - If the user requests changes → note them and suggest re-running `/hopla:plan-feature` to update the plan, or apply minor clarifications directly if they are unambiguous
52
+ - If the user approves → confirm: "✅ Plan approved. Run `/hopla:execute $1` to start."
@@ -66,10 +66,10 @@ If anything failed and could not be fixed, list the remaining issues and suggest
66
66
 
67
67
  ## After Validation Passes
68
68
 
69
- - Suggest running `/hopla-code-review` if not already done
69
+ - Suggest running the `code-review` skill if not already done
70
70
  - Remind that completion claims must be backed by this fresh validation evidence (see hopla-verify skill)
71
71
 
72
72
  ## Next Step
73
73
 
74
74
  After validation passes, suggest:
75
- > "All validation levels passed. Consider running `/hopla-code-review` 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 `/hopla-code-review` to check, or `/hopla-git-commit` to commit directly."
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."
package/global-rules.md CHANGED
@@ -24,6 +24,7 @@
24
24
  ## 3. Behavior & Autonomy
25
25
 
26
26
  **Always ask before:**
27
+
27
28
  - Running `git commit`
28
29
  - Running `git push`
29
30
  - Installing new dependencies (`npm install <pkg>`, `pip install <pkg>`, etc.)
@@ -31,59 +32,33 @@
31
32
  - Any destructive or hard-to-reverse operation
32
33
 
33
34
  **Proactively suggest commits** at logical save points:
35
+
34
36
  - After completing a feature or fix
35
37
  - Before starting a risky refactor
36
38
  - After passing all validation checks
37
39
  - Explain WHY it's a good moment to commit so the team understands
38
40
 
39
41
  **Never:**
42
+
40
43
  - Auto-commit or auto-push without explicit approval
41
44
  - Skip validation steps to save time
42
45
  - Add features, refactors, or improvements beyond what was asked
43
46
 
44
47
  ---
45
48
 
46
- ## 4. Git Workflow (Git Flow)
47
-
48
- ### Branch Strategy
49
- - `main` → production only, never commit directly
50
- - `develop` / `dev` active development branch
51
- - Feature branches: `feature/short-description`
52
- - Bug fix branches: `fix/short-description`
53
- - Hotfix branches: `hotfix/short-description`
54
-
55
- ### Commit Format — Conventional Commits
56
- ```
57
- <type>(<optional scope>): <short description>
58
-
59
- [optional body]
60
- ```
61
-
62
- **Types:**
63
- - `feat:` — new feature
64
- - `fix:` — bug fix
65
- - `refactor:` — code restructure without behavior change
66
- - `docs:` — documentation only
67
- - `test:` — adding or fixing tests
68
- - `chore:` — build, config, dependencies
69
- - `style:` — formatting, no logic change
70
-
71
- **Examples:**
72
- ```
73
- feat(auth): add JWT token validation
74
- fix(api): handle null response from products endpoint
75
- chore: update dependencies to latest versions
76
- ```
77
-
78
- ### When to Suggest a Commit
79
- Explain in plain language when suggesting a commit, adapting to the user's language, e.g.:
80
- > "This would be a good moment to commit — we finished feature X and all tests pass. Should we commit before continuing?"
49
+ ## 4. Git Workflow
50
+
51
+ Follow **Conventional Commits** (`type(scope): description`). Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `style`.
52
+
53
+ Branch strategy (GitHub Flow vs Git Flow) is **auto-detected** by the git skill based on whether `origin/develop` or `origin/dev` exists. See the git skill for full details.
54
+
55
+ When suggesting a commit, explain in plain language why it's a good moment, adapting to the user's language.
81
56
 
82
57
  ---
83
58
 
84
59
  ## 5. Code Quality
85
60
 
86
- - Validate before considering anything done (lint → types → tests)
61
+ - Validate before declaring done (lint → types → tests). The verify skill enforces this at completion.
87
62
  - Write tests alongside implementation, not after
88
63
  - Flag security issues immediately — never leave them for later
89
64
  - If the same validation failure repeats, signal it as a system improvement opportunity
@@ -93,11 +68,13 @@ Explain in plain language when suggesting a commit, adapting to the user's langu
93
68
  ## 📋 Context Management
94
69
 
95
70
  ### Three levels of CLAUDE.md
71
+
96
72
  - **Machine-level** (`~/.claude/CLAUDE.md`): These global rules — apply to all projects
97
73
  - **Project-level** (`CLAUDE.md` at repo root): Shared with team via git — project-specific rules
98
74
  - **Local-level** (`CLAUDE.local.md`): Personal overrides — NOT committed to git
99
75
 
100
76
  ### Context control
77
+
101
78
  - Use `@filename` to include specific files in context (works in chat and inside CLAUDE.md)
102
79
  - Use `/compact` between related tasks (preserves learned knowledge)
103
80
  - Use `/clear` between unrelated tasks (full reset)
@@ -116,19 +93,10 @@ Explain in plain language when suggesting a commit, adapting to the user's langu
116
93
 
117
94
  ---
118
95
 
119
- ## 🛠️ Available HOPLA Commands
96
+ ## 🛠️ HOPLA Skills
97
+
98
+ HOPLA skills are auto-triggered based on context — no slash command needed. The session-prime hook lists available skills at the start of each session.
99
+
120
100
  When a skill applies to your current task, you MUST use it. Check available skills before responding.
121
101
 
122
- ### Workflow: Plan → Implement → Validate
123
- 1. `/hopla-plan-feature` — Research codebase and create implementation plan
124
- 2. `/hopla-review-plan` — Review plan before execution
125
- 3. `/hopla-execute` — Execute plan with validation
126
- 4. `/hopla-validate` — Run full validation pyramid
127
- 5. `/hopla-git-commit` — Create conventional commit
128
- 6. `/hopla-git-pr` — Create GitHub PR
129
-
130
- ### Other commands
131
- - `/hopla-create-prd` — Create or update Product Requirements Document
132
- - `/hopla-init-project` — Initialize project with CLAUDE.md and .agents/ structure
133
- - `/hopla-code-review-fix` — Fix issues from code review report
134
- - `/hopla-system-review` — Analyze plan vs execution for process improvements
102
+ Use the `plan-feature` command to start the full Plan → Implement → Validate workflow.
@@ -1,19 +1,50 @@
1
1
  #!/usr/bin/env node
2
- // PreToolUse hook: blocks reads/greps targeting .env files
2
+ // PreToolUse hook: blocks reads/greps/Bash commands that expose .env secrets.
3
+ // Hooks.json matcher must include Bash so Bash calls reach this script.
4
+
5
+ function isEnvPath(p) {
6
+ if (typeof p !== "string" || !p) return false;
7
+ // Matches: .env, ./.env, path/.env, .env.local, .env.production, path/.env.X
8
+ return /(^|\/)\.env(\.\w+)?$/.test(p);
9
+ }
10
+
11
+ function commandReadsEnv(cmd) {
12
+ if (typeof cmd !== "string" || !cmd) return false;
13
+ // Split on shell word separators so we inspect each argument/path token
14
+ const tokens = cmd.split(/[\s<>|&;"'`()]+/);
15
+ return tokens.some(isEnvPath);
16
+ }
3
17
 
4
18
  async function main() {
5
19
  const chunks = [];
6
- for await (const chunk of process.stdin) {
7
- chunks.push(chunk);
20
+ for await (const chunk of process.stdin) chunks.push(chunk);
21
+
22
+ let toolCall;
23
+ try {
24
+ toolCall = JSON.parse(Buffer.concat(chunks).toString());
25
+ } catch {
26
+ // Malformed input — fail open so we never block legitimate tool use
27
+ process.exit(0);
8
28
  }
9
29
 
10
- const toolCall = JSON.parse(Buffer.concat(chunks).toString());
11
- const filePath = toolCall.tool_input?.file_path || toolCall.tool_input?.path || "";
30
+ const name = toolCall.tool_name || "";
31
+ const input = toolCall.tool_input || {};
32
+
33
+ // Read / Grep / Glob / Edit / Write — check file_path or path
34
+ const filePath = input.file_path || input.path || "";
35
+ if (isEnvPath(filePath)) {
36
+ process.stderr.write(
37
+ `Access denied: reading or editing .env files is blocked to prevent accidental secret exposure. ` +
38
+ `If you need env var names, check the README or ask the user.\n`
39
+ );
40
+ process.exit(2);
41
+ }
12
42
 
13
- if (filePath.includes(".env")) {
43
+ // Bash — inspect the command string for tokens that read an .env file
44
+ if (name === "Bash" && commandReadsEnv(input.command)) {
14
45
  process.stderr.write(
15
- `Access denied: Reading .env files is blocked to prevent accidental secret exposure. ` +
16
- `If you need environment variable names, check the README or ask the user.\n`
46
+ `Access denied: this Bash command reads a .env file, which is blocked to prevent secret exposure. ` +
47
+ `If you need env var names, ask the user.\n`
17
48
  );
18
49
  process.exit(2);
19
50
  }
package/hooks/hooks.json CHANGED
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "PreToolUse": [
16
16
  {
17
- "matcher": "Read|Grep",
17
+ "matcher": "Read|Grep|Glob|Edit|Write|Bash",
18
18
  "hooks": [
19
19
  {
20
20
  "type": "command",
@@ -13,6 +13,38 @@ function run(cmd) {
13
13
  }
14
14
  }
15
15
 
16
+ function discoverSkills() {
17
+ // Try plugin context first: ../skills/ relative to this script
18
+ const hookDir = import.meta.dirname;
19
+ const skillsDir = path.join(hookDir, "..", "skills");
20
+
21
+ if (!fs.existsSync(skillsDir)) {
22
+ return null;
23
+ }
24
+
25
+ const skills = [];
26
+ for (const entry of fs.readdirSync(skillsDir).sort()) {
27
+ const skillDir = path.join(skillsDir, entry);
28
+ if (!fs.statSync(skillDir).isDirectory()) continue;
29
+
30
+ const skillFile = path.join(skillDir, "SKILL.md");
31
+ if (!fs.existsSync(skillFile)) continue;
32
+
33
+ // Extract description from SKILL.md frontmatter
34
+ const content = fs.readFileSync(skillFile, "utf8");
35
+ const descMatch = content.match(/^description:\s*"?(.+?)"?\s*$/m);
36
+ if (descMatch) {
37
+ // Truncate to first sentence for brevity
38
+ const desc = descMatch[1].split(".")[0];
39
+ skills.push(`- ${entry}: ${desc}`);
40
+ } else {
41
+ skills.push(`- ${entry}`);
42
+ }
43
+ }
44
+
45
+ return skills.length > 0 ? skills : null;
46
+ }
47
+
16
48
  async function main() {
17
49
  const lines = [];
18
50
 
@@ -40,18 +72,13 @@ async function main() {
40
72
  lines.push(`Project rules (CLAUDE.md excerpt):\n${content}`);
41
73
  }
42
74
 
43
- // Available skills reminder
44
- lines.push(`📦 HOPLA Skills Available:
45
- - prime: Project orientation (trigger: "orient", "get context", "load project")
46
- - git: Git operations (trigger: "commit", "PR", "push")
47
- - code-review: Code review (trigger: "review code", "code review")
48
- - execution-report: Post-implementation docs (trigger: "generate report")
49
- - verify: Completion verification (trigger: any "done"/"listo"/"finished" claim)
50
- - brainstorm: Design exploration (trigger: "new feature", "brainstorm", "explore options")
51
- - debug: Systematic debugging (trigger: "bug", "error", "debug")
52
- - tdd: Test-driven development (trigger: implementing with tests)
53
-
54
- ⚠️ If a skill applies to the current task, you MUST use it.`);
75
+ // Auto-discover available skills
76
+ const skills = discoverSkills();
77
+ if (skills) {
78
+ lines.push(`📦 HOPLA Skills Available:\n${skills.join("\n")}\n\n⚠️ If a skill applies to the current task, you MUST use it.`);
79
+ } else {
80
+ lines.push(`📦 HOPLA skills are available. Check your session's skill list for details.\n\n⚠️ If a skill applies to the current task, you MUST use it.`);
81
+ }
55
82
 
56
83
  if (lines.length > 0) {
57
84
  process.stdout.write(lines.join("\n\n"));