@kiwidata/grimoire 0.1.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.
- package/.claude-plugin/plugin.json +8 -0
- package/AGENTS.md +217 -0
- package/README.md +748 -0
- package/bin/grimoire.js +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +42 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/archive.d.ts +3 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +22 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/branch-check.d.ts +3 -0
- package/dist/commands/branch-check.d.ts.map +1 -0
- package/dist/commands/branch-check.js +16 -0
- package/dist/commands/branch-check.js.map +1 -0
- package/dist/commands/check.d.ts +3 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +22 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/ci.d.ts +3 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +18 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/diff.d.ts +3 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +10 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/docs.d.ts +3 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +11 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +13 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +21 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +22 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/log.d.ts +3 -0
- package/dist/commands/log.d.ts.map +1 -0
- package/dist/commands/log.js +15 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/map.d.ts +3 -0
- package/dist/commands/map.d.ts.map +1 -0
- package/dist/commands/map.js +17 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/pr.d.ts +3 -0
- package/dist/commands/pr.d.ts.map +1 -0
- package/dist/commands/pr.js +17 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +12 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/test-quality.d.ts +3 -0
- package/dist/commands/test-quality.d.ts.map +1 -0
- package/dist/commands/test-quality.js +37 -0
- package/dist/commands/test-quality.js.map +1 -0
- package/dist/commands/trace.d.ts +3 -0
- package/dist/commands/trace.d.ts.map +1 -0
- package/dist/commands/trace.js +12 -0
- package/dist/commands/trace.js.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +22 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +17 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/archive.d.ts +9 -0
- package/dist/core/archive.d.ts.map +1 -0
- package/dist/core/archive.js +92 -0
- package/dist/core/archive.js.map +1 -0
- package/dist/core/branch-check.d.ts +27 -0
- package/dist/core/branch-check.d.ts.map +1 -0
- package/dist/core/branch-check.js +205 -0
- package/dist/core/branch-check.js.map +1 -0
- package/dist/core/check.d.ts +24 -0
- package/dist/core/check.d.ts.map +1 -0
- package/dist/core/check.js +372 -0
- package/dist/core/check.js.map +1 -0
- package/dist/core/ci.d.ts +24 -0
- package/dist/core/ci.d.ts.map +1 -0
- package/dist/core/ci.js +162 -0
- package/dist/core/ci.js.map +1 -0
- package/dist/core/detect.d.ts +10 -0
- package/dist/core/detect.d.ts.map +1 -0
- package/dist/core/detect.js +368 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/diff.d.ts +29 -0
- package/dist/core/diff.d.ts.map +1 -0
- package/dist/core/diff.js +197 -0
- package/dist/core/diff.js.map +1 -0
- package/dist/core/doc-style.d.ts +16 -0
- package/dist/core/doc-style.d.ts.map +1 -0
- package/dist/core/doc-style.js +192 -0
- package/dist/core/doc-style.js.map +1 -0
- package/dist/core/docs.d.ts +6 -0
- package/dist/core/docs.d.ts.map +1 -0
- package/dist/core/docs.js +478 -0
- package/dist/core/docs.js.map +1 -0
- package/dist/core/health.d.ts +7 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +489 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/hooks.d.ts +5 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +168 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/init.d.ts +9 -0
- package/dist/core/init.d.ts.map +1 -0
- package/dist/core/init.js +563 -0
- package/dist/core/init.js.map +1 -0
- package/dist/core/list.d.ts +4 -0
- package/dist/core/list.d.ts.map +1 -0
- package/dist/core/list.js +170 -0
- package/dist/core/list.js.map +1 -0
- package/dist/core/log.d.ts +8 -0
- package/dist/core/log.d.ts.map +1 -0
- package/dist/core/log.js +150 -0
- package/dist/core/log.js.map +1 -0
- package/dist/core/map.d.ts +9 -0
- package/dist/core/map.d.ts.map +1 -0
- package/dist/core/map.js +302 -0
- package/dist/core/map.js.map +1 -0
- package/dist/core/pr.d.ts +9 -0
- package/dist/core/pr.d.ts.map +1 -0
- package/dist/core/pr.js +273 -0
- package/dist/core/pr.js.map +1 -0
- package/dist/core/shared-setup.d.ts +52 -0
- package/dist/core/shared-setup.d.ts.map +1 -0
- package/dist/core/shared-setup.js +221 -0
- package/dist/core/shared-setup.js.map +1 -0
- package/dist/core/status.d.ts +6 -0
- package/dist/core/status.d.ts.map +1 -0
- package/dist/core/status.js +114 -0
- package/dist/core/status.js.map +1 -0
- package/dist/core/test-quality.d.ts +33 -0
- package/dist/core/test-quality.d.ts.map +1 -0
- package/dist/core/test-quality.js +378 -0
- package/dist/core/test-quality.js.map +1 -0
- package/dist/core/trace.d.ts +6 -0
- package/dist/core/trace.d.ts.map +1 -0
- package/dist/core/trace.js +211 -0
- package/dist/core/trace.js.map +1 -0
- package/dist/core/update.d.ts +10 -0
- package/dist/core/update.d.ts.map +1 -0
- package/dist/core/update.js +149 -0
- package/dist/core/update.js.map +1 -0
- package/dist/core/validate.d.ts +20 -0
- package/dist/core/validate.d.ts.map +1 -0
- package/dist/core/validate.js +275 -0
- package/dist/core/validate.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/config.d.ts +61 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +172 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/fs.d.ts +17 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +38 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/paths.d.ts +10 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +35 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/spawn.d.ts +5 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +34 -0
- package/dist/utils/spawn.js.map +1 -0
- package/package.json +68 -0
- package/skills/grimoire-apply/SKILL.md +274 -0
- package/skills/grimoire-audit/SKILL.md +129 -0
- package/skills/grimoire-branch-guard/SKILL.md +111 -0
- package/skills/grimoire-bug/SKILL.md +160 -0
- package/skills/grimoire-bug-explore/SKILL.md +242 -0
- package/skills/grimoire-bug-report/SKILL.md +237 -0
- package/skills/grimoire-bug-session/SKILL.md +222 -0
- package/skills/grimoire-bug-triage/SKILL.md +274 -0
- package/skills/grimoire-commit/SKILL.md +150 -0
- package/skills/grimoire-discover/SKILL.md +297 -0
- package/skills/grimoire-draft/SKILL.md +202 -0
- package/skills/grimoire-plan/SKILL.md +329 -0
- package/skills/grimoire-pr/SKILL.md +134 -0
- package/skills/grimoire-pr-review/SKILL.md +240 -0
- package/skills/grimoire-refactor/SKILL.md +251 -0
- package/skills/grimoire-remove/SKILL.md +112 -0
- package/skills/grimoire-review/SKILL.md +247 -0
- package/skills/grimoire-verify/SKILL.md +223 -0
- package/skills/references/bug-classification.md +154 -0
- package/skills/references/build-vs-buy.md +77 -0
- package/skills/references/elicitation-personas.md +118 -0
- package/skills/references/refactor-register-format.md +88 -0
- package/skills/references/refactor-scan-categories.md +102 -0
- package/skills/references/schema-format.md +68 -0
- package/skills/references/security-compliance.md +110 -0
- package/skills/references/testing-contracts.md +93 -0
- package/templates/context.yml +110 -0
- package/templates/debt-exceptions.yml +61 -0
- package/templates/decision.md +50 -0
- package/templates/dupignore +93 -0
- package/templates/example.feature +24 -0
- package/templates/manifest.md +29 -0
- package/templates/mapignore +58 -0
- package/templates/mapkeys +65 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire-branch-guard
|
|
3
|
+
description: Enforce branch hygiene when starting a new feature. Use when the user requests a new feature and the current branch is dirty, mid-feature, or otherwise unfit for piggy-backing. Creates an appropriately named branch before any drafting or planning begins.
|
|
4
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
5
|
+
metadata:
|
|
6
|
+
author: kiwi-data
|
|
7
|
+
version: "0.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# grimoire-branch-guard
|
|
11
|
+
|
|
12
|
+
Force a clean, appropriately named branch before a new feature is drafted. Prevents piggy-backing new scope onto an in-progress branch or dirty tree.
|
|
13
|
+
|
|
14
|
+
## Triggers
|
|
15
|
+
- User requests a new feature, capability, or behavior change
|
|
16
|
+
- The `grimoire branch-check` UserPromptSubmit hook emits a warning into the prompt context
|
|
17
|
+
- Before `grimoire-draft` runs for a *net-new* change (not an edit to an existing draft)
|
|
18
|
+
- User says: "new feature", "add feature", "build X", "implement X", "let's add", "i want to add"
|
|
19
|
+
|
|
20
|
+
## Routing
|
|
21
|
+
- Continuing an existing change (editing manifest, revising scenarios) → skip this skill; go straight to `grimoire-draft`
|
|
22
|
+
- Bug fix or refactor → skip; route to `grimoire-bug` or leave branch alone
|
|
23
|
+
- User is on `main`/`master`/`develop`/`trunk` with a clean tree → no hygiene issue; suggest a branch name but do not block
|
|
24
|
+
- User explicitly opts out ("stay on this branch", "piggy-back is fine") → respect it, but surface the risk once and record it in the manifest's Assumptions
|
|
25
|
+
|
|
26
|
+
## Preconditions
|
|
27
|
+
- Project is a git repository
|
|
28
|
+
- Current working directory is inside the project root (`.grimoire/` or `features/` discoverable upward)
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
### 1. Snapshot branch state
|
|
33
|
+
Run:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
git branch --show-current
|
|
37
|
+
git status --porcelain
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then enumerate active grimoire changes:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
grimoire list --changes --json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Record: current branch, dirty-file count, and any active change whose `manifest.md` frontmatter `branch:` matches the current branch.
|
|
47
|
+
|
|
48
|
+
### 2. Classify the situation
|
|
49
|
+
|
|
50
|
+
| Condition | Action |
|
|
51
|
+
|-----------|--------|
|
|
52
|
+
| Clean tree + on protected branch (main/master/develop/trunk) | Propose a new branch name, create it, proceed |
|
|
53
|
+
| Clean tree + on feature branch tied to a matching active change | **Block.** This branch belongs to an existing change. Ask: is the request related to that change (edit) or truly new (branch)? |
|
|
54
|
+
| Clean tree + on feature branch with **no** matching active change | Warn that the branch appears stale. Offer: rebase onto main, or create a new branch |
|
|
55
|
+
| Dirty tree (any branch) | **Block.** Require the user to commit, stash, or discard before proceeding |
|
|
56
|
+
| Dirty tree + active change on this branch | **Block hard.** Finish the in-progress change (or commit WIP) before drafting a new one |
|
|
57
|
+
|
|
58
|
+
### 3. Propose a branch name
|
|
59
|
+
Derive a slug from the user's request. Use the `feat/` prefix for features, `chore/` for chores, `refactor/` for refactors. Examples:
|
|
60
|
+
|
|
61
|
+
- "Add password reset flow" → `feat/password-reset`
|
|
62
|
+
- "Let's build a CSV export" → `feat/csv-export`
|
|
63
|
+
- "I want to add rate limiting to the API" → `feat/api-rate-limiting`
|
|
64
|
+
|
|
65
|
+
Keep slugs short (≤40 chars), lowercase, hyphen-separated. Prefer nouns from the request. Avoid including the verb ("add", "new") in the slug.
|
|
66
|
+
|
|
67
|
+
Confirm the name with the user before creating the branch.
|
|
68
|
+
|
|
69
|
+
### 4. Create the branch
|
|
70
|
+
|
|
71
|
+
If dirty, first help the user resolve:
|
|
72
|
+
|
|
73
|
+
- **Commit WIP**: `git commit -am "wip: <summary>"` (only if changes belong to the current feature)
|
|
74
|
+
- **Stash**: `git stash push -m "wip before <new-feature-slug>"`
|
|
75
|
+
- **Discard**: only if user explicitly says so
|
|
76
|
+
|
|
77
|
+
Then create and switch:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
git switch -c <proposed-slug>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or, if starting from something other than the default branch:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
git switch main && git pull --ff-only && git switch -c <proposed-slug>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 5. Hand off to `grimoire-draft`
|
|
90
|
+
Once on the new branch with a clean tree, invoke `grimoire-draft`. In the draft's `manifest.md`, set the `branch:` frontmatter field to the new branch name so future prompts can match.
|
|
91
|
+
|
|
92
|
+
## Do-not
|
|
93
|
+
- **Do not** draft, plan, or edit specs while the branch guard is active and the conditions above are not met.
|
|
94
|
+
- **Do not** silently create a branch without confirming the name with the user.
|
|
95
|
+
- **Do not** force-delete uncommitted work. When in doubt, stash.
|
|
96
|
+
- **Do not** piggy-back features onto a branch whose manifest describes a different change. This violates grimoire's one-branch-one-change assumption and breaks the `Change:` trailer audit trail.
|
|
97
|
+
- **Do not** override the guard for a single clarifying exchange (e.g., "what's the schema for X?" is not a new-feature request).
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
- Intent patterns live in `src/core/branch-check.ts` (`NEW_FEATURE_PATTERNS`). If the hook is over- or under-triggering, adjust there.
|
|
101
|
+
- Protected branches: `main`, `master`, `develop`, `trunk`. Add project-specific defaults in `.grimoire/config.yaml` under `project.protected_branches` (if/when implemented).
|
|
102
|
+
|
|
103
|
+
## Rationale
|
|
104
|
+
A branch that bundles two features makes every downstream grimoire artifact ambiguous:
|
|
105
|
+
|
|
106
|
+
- The `Change:` commit trailer points at one change, not both
|
|
107
|
+
- `manifest.md` frontmatter has one `branch:` field, so only one change can claim it
|
|
108
|
+
- `grimoire check --changed` cannot tell which scenarios back which code
|
|
109
|
+
- PR review (`grimoire-pr-review`) cannot isolate the diff for a single change
|
|
110
|
+
|
|
111
|
+
Forcing a dedicated branch up front is cheaper than untangling a mixed branch later.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire-bug
|
|
3
|
+
description: Disciplined bug fix workflow with reproduction-first methodology. Use when the user reports a bug or defect that needs fixing.
|
|
4
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
5
|
+
metadata:
|
|
6
|
+
author: kiwi-data
|
|
7
|
+
version: "0.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# grimoire-bug
|
|
11
|
+
|
|
12
|
+
Disciplined bug fix workflow: reproduce first, then fix. Every bug gets a failing test before any code changes.
|
|
13
|
+
|
|
14
|
+
## Triggers
|
|
15
|
+
- User reports a bug, defect, or unexpected behavior
|
|
16
|
+
- User says something is "broken", "wrong", "not working"
|
|
17
|
+
- Loose match: "bug", "fix", "broken", "defect", "issue", "regression"
|
|
18
|
+
|
|
19
|
+
## Routing
|
|
20
|
+
- Tester/non-developer reporting a bug → `grimoire-bug-report`
|
|
21
|
+
- Feature request disguised as a bug → `grimoire-draft`
|
|
22
|
+
- Performance issue → handle directly (profiling, not repro test)
|
|
23
|
+
- Configuration error → just fix the config
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### 1. Understand the Bug
|
|
28
|
+
Get enough information to reproduce:
|
|
29
|
+
- **What happened** — the actual behavior
|
|
30
|
+
- **What should happen** — the expected behavior
|
|
31
|
+
- **How to trigger it** — steps to reproduce
|
|
32
|
+
|
|
33
|
+
If the user's report is vague, ask one clarifying question. Don't start fixing until you can describe the reproduction steps.
|
|
34
|
+
|
|
35
|
+
### 2. Classify the Bug
|
|
36
|
+
|
|
37
|
+
**Check existing feature files** — `grep -rn '<keyword from bug>' features/` to find scenarios describing the expected behavior.
|
|
38
|
+
|
|
39
|
+
**Scenario exists** → The spec is right, the code is wrong. This is a pure implementation bug. Skip to step 3.
|
|
40
|
+
|
|
41
|
+
**No scenario covers this behavior** → The bug reveals a gap in the specs. This is a missing scenario. Before fixing:
|
|
42
|
+
1. Write a new scenario (or add to an existing feature) that describes the correct behavior
|
|
43
|
+
2. Add it directly to `features/` (not through a full grimoire change — this is a gap fill, not new functionality)
|
|
44
|
+
3. Note in a comment or commit message that this scenario was added to cover a discovered bug
|
|
45
|
+
|
|
46
|
+
**Scenario is wrong** → Rare, but possible. The spec itself describes incorrect behavior. Flag this to the user — it may need a grimoire draft to update the feature properly.
|
|
47
|
+
|
|
48
|
+
### 3. Write a Reproduction Test
|
|
49
|
+
Before touching any production code:
|
|
50
|
+
|
|
51
|
+
1. Write a step definition (or unit test if no BDD scenario applies) that exercises the exact bug conditions
|
|
52
|
+
2. Run it — **it MUST FAIL**, reproducing the bug
|
|
53
|
+
3. If it passes, your test doesn't actually reproduce the bug. Fix the test until it fails for the right reason.
|
|
54
|
+
|
|
55
|
+
This is non-negotiable. A bug fix without a reproduction test is a guess that might work. A failing test is proof you understand the problem.
|
|
56
|
+
|
|
57
|
+
### 4. Document the Bug
|
|
58
|
+
Create a brief record in the test or commit. No separate tracking file needed — the test IS the documentation.
|
|
59
|
+
|
|
60
|
+
The reproduction test should make the bug obvious:
|
|
61
|
+
```gherkin
|
|
62
|
+
# Bug: users with special characters in email can't reset password
|
|
63
|
+
Scenario: Password reset with plus-sign email
|
|
64
|
+
Given a user exists with email "test+alias@example.com"
|
|
65
|
+
When they request a password reset
|
|
66
|
+
Then they should receive a reset email
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or as a unit test comment:
|
|
70
|
+
```python
|
|
71
|
+
def test_password_reset_special_chars():
|
|
72
|
+
"""Bug: email addresses with + were being URL-encoded in the reset
|
|
73
|
+
link, causing lookup failures. Reported 2026-04-05."""
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The commit message should reference the bug:
|
|
77
|
+
```
|
|
78
|
+
fix(auth): handle special characters in password reset emails
|
|
79
|
+
|
|
80
|
+
Plus signs in email addresses were URL-encoded during reset link
|
|
81
|
+
generation, causing user lookup to fail on the reset page.
|
|
82
|
+
|
|
83
|
+
Added scenario: "Password reset with plus-sign email"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 5. Create Fix Branch
|
|
87
|
+
Before writing any code, create a branch for the fix:
|
|
88
|
+
```
|
|
89
|
+
fix/<short-description>
|
|
90
|
+
```
|
|
91
|
+
For example: `fix/special-chars-password-reset`, `fix/null-pricing-response`.
|
|
92
|
+
|
|
93
|
+
### 6. Fix the Bug
|
|
94
|
+
Now — and only now — modify production code:
|
|
95
|
+
|
|
96
|
+
1. Make the smallest change that fixes the failing test
|
|
97
|
+
2. Run the reproduction test — it should pass
|
|
98
|
+
3. Run ALL existing tests — no regressions
|
|
99
|
+
4. If the fix is more than a few lines, pause and consider whether the approach is the simplest one
|
|
100
|
+
|
|
101
|
+
**Escalation guard:** If the fix requires changes to more than 3 files, introduces new abstractions, modifies data models, or crosses service boundaries — STOP. This is not a bug fix, it's a change that needs design. Tell the user: "This fix is larger than a typical bug fix. I recommend routing to `grimoire-draft` to handle this as a proper change with specs and a plan." The user can override.
|
|
102
|
+
|
|
103
|
+
### 7. Verify
|
|
104
|
+
- Reproduction test passes (`config.tools.bdd_test`)
|
|
105
|
+
- All existing feature scenarios pass (`config.tools.bdd_test`)
|
|
106
|
+
- All existing unit/integration tests pass (`config.tools.unit_test`)
|
|
107
|
+
- If a new scenario was added in step 2, it passes with the fix
|
|
108
|
+
|
|
109
|
+
### 8. Tester Verification Checklist
|
|
110
|
+
|
|
111
|
+
After the fix, generate a checklist for testers to verify the fix and check for regressions. This bridges the gap between "developer says it's fixed" and "tester confirms it's fixed."
|
|
112
|
+
|
|
113
|
+
1. **Confirm the original bug** — restate the exact reproduction steps from the report and what the tester should now see instead.
|
|
114
|
+
|
|
115
|
+
2. **Check related areas** — identify 3-5 areas that could have been affected by the fix:
|
|
116
|
+
- Other scenarios in the same feature file
|
|
117
|
+
- Features that share the same code path or data (check what the fix touched)
|
|
118
|
+
- Edge cases near the fix — if you fixed a null check, what about empty strings? If you fixed one role, what about other roles?
|
|
119
|
+
|
|
120
|
+
3. **Generate the checklist:**
|
|
121
|
+
```markdown
|
|
122
|
+
## Verification Checklist: <bug-id>
|
|
123
|
+
Fix branch: `fix/<name>`
|
|
124
|
+
|
|
125
|
+
### Original Bug
|
|
126
|
+
- [ ] Reproduce the original steps: <steps>
|
|
127
|
+
- [ ] Confirm expected behavior: <what should happen now>
|
|
128
|
+
|
|
129
|
+
### Regression Checks
|
|
130
|
+
- [ ] <related scenario or area>: <what to verify>
|
|
131
|
+
- [ ] <related scenario or area>: <what to verify>
|
|
132
|
+
- [ ] <related scenario or area>: <what to verify>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
4. **Include in bug report** — append the checklist to `.grimoire/bugs/<bug-id>/report.md` (or the triage file if it exists) so the tester can find it.
|
|
136
|
+
|
|
137
|
+
5. If an external ticket exists, post the checklist as a comment so the tester doesn't need to look at local files.
|
|
138
|
+
|
|
139
|
+
### 9. Summary
|
|
140
|
+
Report to the user:
|
|
141
|
+
- What the bug was (root cause, not symptoms)
|
|
142
|
+
- What was changed (files and what specifically)
|
|
143
|
+
- Whether a new scenario was added to cover the gap
|
|
144
|
+
- Test results
|
|
145
|
+
- The verification checklist for testers (from step 8)
|
|
146
|
+
|
|
147
|
+
## When NOT to Use This Skill
|
|
148
|
+
- **Feature requests disguised as bugs** — "it's broken because it doesn't do X" when X was never specified. Route to `grimoire-draft`.
|
|
149
|
+
- **Performance issues** — these usually need profiling, not a repro test. Handle directly.
|
|
150
|
+
- **Configuration errors** — wrong env vars, missing dependencies, bad setup. Just fix the config.
|
|
151
|
+
|
|
152
|
+
## Important
|
|
153
|
+
- **Reproduce before you fix.** No exceptions. If you can't reproduce it, you don't understand it, and your fix is a guess.
|
|
154
|
+
- **Small fixes only.** If the bug fix requires significant architectural changes, it's not a bug fix — route to `grimoire-draft` for a proper change.
|
|
155
|
+
- **Don't over-document.** The test is the documentation. A one-line comment in the test explaining the bug is enough. Don't create tracking files, bug reports, or manifests for a bug fix.
|
|
156
|
+
- **The feature file is truth.** If a scenario describes behavior the user now says is wrong, that's a spec change, not a bug. Handle it through `grimoire-draft`.
|
|
157
|
+
- **One bug, one fix.** Don't bundle "while I'm in here" improvements with a bug fix. Fix the bug, nothing more.
|
|
158
|
+
|
|
159
|
+
## Done
|
|
160
|
+
When the bug is fixed, tests pass (reproduction + regression), and the summary is presented, the workflow is complete. Suggest `grimoire-commit` for the fix commit.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: grimoire-bug-explore
|
|
3
|
+
description: AI-guided exploratory testing that finds gaps in feature coverage, generates edge case scenarios, and identifies untested paths. Use when you want to proactively find bugs before users do.
|
|
4
|
+
compatibility: Designed for Claude Code (or similar products)
|
|
5
|
+
metadata:
|
|
6
|
+
author: kiwi-data
|
|
7
|
+
version: "0.1"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# grimoire-bug-explore
|
|
11
|
+
|
|
12
|
+
AI-guided exploratory testing. Systematically analyze feature specs and code to find untested edge cases, missing negative scenarios, and potential failure modes — before they become bug reports.
|
|
13
|
+
|
|
14
|
+
## Triggers
|
|
15
|
+
- User wants to find gaps in test coverage
|
|
16
|
+
- User says "what are we missing?", "explore for bugs", "what could break?"
|
|
17
|
+
- Loose match: "exploratory testing", "edge cases", "negative scenarios", "what's untested", "find gaps"
|
|
18
|
+
- User says "onboard", "where do I start testing?", "what's risky?" → onboard mode
|
|
19
|
+
|
|
20
|
+
## Routing
|
|
21
|
+
- Want a focused, timeboxed testing session with live tracking → `grimoire-bug-session`
|
|
22
|
+
- Found a specific bug during exploration → `grimoire-bug-report` to file it
|
|
23
|
+
- Want to fix a known bug → `grimoire-bug`
|
|
24
|
+
- Analyzing a filed bug report → `grimoire-bug-triage`
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
- A grimoire project with feature files in `features/`
|
|
28
|
+
- For developer mode: code exists to analyze (not just specs)
|
|
29
|
+
- For tester/onboard mode: feature files are sufficient
|
|
30
|
+
|
|
31
|
+
## Modes
|
|
32
|
+
|
|
33
|
+
This skill operates in three modes:
|
|
34
|
+
|
|
35
|
+
- **Tester mode** (default) — Spec-only analysis. Gap analysis, negative scenarios, cross-feature risks, and existing automation coverage. No code reading required. Suitable for testers who don't read source code.
|
|
36
|
+
- **Developer mode** — activated by `--deep`, or when the user is a developer. Adds code-level analysis (Step 3) on top of everything in tester mode.
|
|
37
|
+
- **Onboard mode** — activated by `--onboard` or when a tester is new to the project. Generates a tester's guide: feature areas ranked by risk, what's automated vs manual, recent changes, and open bugs.
|
|
38
|
+
|
|
39
|
+
## Workflow
|
|
40
|
+
|
|
41
|
+
### 1. Choose Scope
|
|
42
|
+
|
|
43
|
+
Ask the user what to explore:
|
|
44
|
+
|
|
45
|
+
- **Specific feature area** — e.g., "explore auth" → focus on `features/auth/` and its implementation
|
|
46
|
+
- **Recent changes** — explore areas touched by recent commits (use `git log --since` to find them)
|
|
47
|
+
- **Full sweep** — analyze all feature areas (warn that this takes longer)
|
|
48
|
+
|
|
49
|
+
If the user doesn't specify, default to recent changes — that's where bugs most likely live.
|
|
50
|
+
|
|
51
|
+
### 2. Analyze Feature Specs
|
|
52
|
+
|
|
53
|
+
For each feature file in scope:
|
|
54
|
+
|
|
55
|
+
**Gap analysis:**
|
|
56
|
+
- Read every scenario. What behaviors are specified?
|
|
57
|
+
- What behaviors are conspicuously absent?
|
|
58
|
+
- **Error cases** — what happens when input is invalid, empty, too long, wrong type?
|
|
59
|
+
- **Boundary conditions** — what about zero, one, max, max+1? Empty lists? Unicode? Special characters?
|
|
60
|
+
- **State transitions** — what about concurrent access? Partial failures? Interrupted operations?
|
|
61
|
+
- **Permissions** — what about unauthorized users? Wrong role? Expired session?
|
|
62
|
+
- **Timing** — what about timeouts? Retries? Race conditions? Clock skew?
|
|
63
|
+
|
|
64
|
+
**Negative scenario generation:**
|
|
65
|
+
For each scenario that describes a happy path, generate the corresponding negative scenarios:
|
|
66
|
+
```
|
|
67
|
+
Happy: "User logs in with valid credentials"
|
|
68
|
+
Missing negatives:
|
|
69
|
+
- Login with wrong password
|
|
70
|
+
- Login with nonexistent email
|
|
71
|
+
- Login with empty fields
|
|
72
|
+
- Login with account locked
|
|
73
|
+
- Login with expired password
|
|
74
|
+
- Login after too many failed attempts
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2b. Map Automation Coverage
|
|
78
|
+
|
|
79
|
+
Help the tester understand what's already automated and what requires manual testing.
|
|
80
|
+
|
|
81
|
+
For each feature file in scope:
|
|
82
|
+
1. **Find step definitions** — grep the test directory for step text patterns from each scenario (e.g., `grep -rn 'valid credentials' tests/` for a step `Given I have entered valid credentials`)
|
|
83
|
+
2. **Classify each scenario:**
|
|
84
|
+
- **Automated** — has step definitions with real assertions (not `pass` or `assert True`)
|
|
85
|
+
- **Partially automated** — has step definitions but some steps are stubs or have weak assertions
|
|
86
|
+
- **Not automated** — no step definitions found, or all steps are stubs
|
|
87
|
+
3. **Identify automation gaps** — scenarios that exist in specs but have no test automation. These are the things that must be tested manually today.
|
|
88
|
+
4. **Identify manual-only areas** — behaviors that are hard to automate (visual layout, UX feel, accessibility, real-device behavior). Flag these as intentionally manual.
|
|
89
|
+
|
|
90
|
+
Present this as a coverage map:
|
|
91
|
+
```markdown
|
|
92
|
+
## Automation Coverage: <area>
|
|
93
|
+
|
|
94
|
+
### Automated (N scenarios)
|
|
95
|
+
- ✅ "Scenario name" — `test_file.py:42` (strong assertions)
|
|
96
|
+
|
|
97
|
+
### Partially Automated (N scenarios)
|
|
98
|
+
- ⚠️ "Scenario name" — `test_file.py:58` (weak: only checks `is not None`)
|
|
99
|
+
- Manual check needed: verify the actual values match expected behavior
|
|
100
|
+
|
|
101
|
+
### Not Automated (N scenarios)
|
|
102
|
+
- ❌ "Scenario name" — needs manual testing
|
|
103
|
+
- Suggested manual test: <brief description of what to check>
|
|
104
|
+
|
|
105
|
+
### Intentionally Manual
|
|
106
|
+
- 🖐 Visual/UX checks, accessibility, cross-device behavior
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This map tells the tester: "Here's what the robots check for you. Here's what only you can catch."
|
|
110
|
+
|
|
111
|
+
### 3. Analyze Implementation (Developer Mode Only)
|
|
112
|
+
|
|
113
|
+
> **Skip this step in tester mode.** This requires reading source code.
|
|
114
|
+
|
|
115
|
+
Read the code that implements the features in scope:
|
|
116
|
+
|
|
117
|
+
**Code-level gap detection:**
|
|
118
|
+
- Find error handling paths — are they tested by any scenario?
|
|
119
|
+
- Find conditional branches — is every branch exercised by a scenario?
|
|
120
|
+
- Find input validation — is each validation rule covered by both a passing and failing test?
|
|
121
|
+
- Find external calls (APIs, databases, file I/O) — are failure modes covered?
|
|
122
|
+
- Find configuration-dependent behavior — are different config values tested?
|
|
123
|
+
|
|
124
|
+
**Anti-pattern detection:**
|
|
125
|
+
- Catch blocks that swallow errors silently
|
|
126
|
+
- Default values that mask missing data
|
|
127
|
+
- Type coercion that could hide mismatches
|
|
128
|
+
- Fallback behavior that's never tested
|
|
129
|
+
|
|
130
|
+
### 4. Cross-Feature Interaction
|
|
131
|
+
|
|
132
|
+
Look for interactions between features that might not be tested:
|
|
133
|
+
|
|
134
|
+
- Feature A changes state that Feature B depends on — is that handoff tested?
|
|
135
|
+
- Shared data models modified by multiple features — are conflicts possible?
|
|
136
|
+
- Ordering dependencies — does Feature B assume Feature A ran first?
|
|
137
|
+
|
|
138
|
+
### 5. Generate Findings Report
|
|
139
|
+
|
|
140
|
+
Present findings organized by risk, not by area:
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
# Exploratory Testing: <scope>
|
|
144
|
+
Date: <YYYY-MM-DD>
|
|
145
|
+
|
|
146
|
+
## Critical Gaps (likely bugs or high-impact missing coverage)
|
|
147
|
+
- **<area>**: <description of what's missing and why it matters>
|
|
148
|
+
- Missing scenario: `<suggested Given/When/Then>`
|
|
149
|
+
- Risk: <what could go wrong>
|
|
150
|
+
|
|
151
|
+
## Edge Cases (boundary conditions not covered)
|
|
152
|
+
- **<area>**: <description>
|
|
153
|
+
- Missing scenario: `<suggested Given/When/Then>`
|
|
154
|
+
|
|
155
|
+
## Negative Scenarios (error paths not tested)
|
|
156
|
+
- **<area>**: <description>
|
|
157
|
+
- Missing scenario: `<suggested Given/When/Then>`
|
|
158
|
+
|
|
159
|
+
## Cross-Feature Risks (interaction effects)
|
|
160
|
+
- **<area A> × <area B>**: <description of potential interaction issue>
|
|
161
|
+
|
|
162
|
+
## Summary
|
|
163
|
+
- <N> critical gaps found
|
|
164
|
+
- <N> edge cases identified
|
|
165
|
+
- <N> negative scenarios missing
|
|
166
|
+
- <N> cross-feature risks noted
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 6. Act on Findings
|
|
170
|
+
|
|
171
|
+
For each finding, offer the user a choice:
|
|
172
|
+
|
|
173
|
+
- **Write the scenario now** — add a `.feature` scenario covering the gap. This can be done directly (gap fill, like `grimoire-bug` does for spec gaps) without a full grimoire change.
|
|
174
|
+
- **File a bug report** — if the finding looks like it might already be broken, use `grimoire-bug-report` to file it.
|
|
175
|
+
- **Add to backlog** — note it for later. Don't force action on everything.
|
|
176
|
+
- **Dismiss** — the user decides this isn't worth covering.
|
|
177
|
+
|
|
178
|
+
Batch similar findings — "these 5 missing negative scenarios can all go in one new scenario outline" is better than creating 5 separate items.
|
|
179
|
+
|
|
180
|
+
### 7. Browser-Based Exploration (Optional)
|
|
181
|
+
|
|
182
|
+
If a Playwright MCP server or browser automation tool is available:
|
|
183
|
+
|
|
184
|
+
1. Read the feature scenarios to understand expected flows
|
|
185
|
+
2. Execute the flows in an actual browser
|
|
186
|
+
3. Try variations: wrong inputs, fast clicking, back button, expired sessions
|
|
187
|
+
4. Capture any unexpected behavior as findings
|
|
188
|
+
|
|
189
|
+
This is optional and only available if the project has browser testing infrastructure configured. Don't suggest it if there's no way to run it.
|
|
190
|
+
|
|
191
|
+
### 8. Onboard Mode (--onboard)
|
|
192
|
+
|
|
193
|
+
When a tester is new to the project, generate a tester's orientation guide instead of a gap analysis.
|
|
194
|
+
|
|
195
|
+
1. **Inventory feature areas** — read all feature files and group by area/directory. For each area, summarize what it covers in one sentence.
|
|
196
|
+
|
|
197
|
+
2. **Rank by risk** — assign a risk level to each area based on:
|
|
198
|
+
- **Recent changes** — `git log --since="2 weeks ago"` the feature area's implementation files. Recently changed = higher risk.
|
|
199
|
+
- **Open bugs** — check `.grimoire/bugs/` for unresolved reports in each area.
|
|
200
|
+
- **Sparse coverage** — areas with few scenarios relative to their complexity (e.g., 2 scenarios covering an entire payment flow).
|
|
201
|
+
- **No automation** — areas where scenarios have no step definitions (from step 2b).
|
|
202
|
+
|
|
203
|
+
3. **Map automation coverage** — for each area, run step 2b and summarize: "Auth: 12 scenarios, 10 automated, 2 manual. Payments: 8 scenarios, 3 automated, 5 manual."
|
|
204
|
+
|
|
205
|
+
4. **Highlight recent changes** — list files changed in the last 2 weeks with their feature area. These are where regressions most likely live.
|
|
206
|
+
|
|
207
|
+
5. **Generate the guide:**
|
|
208
|
+
```markdown
|
|
209
|
+
# Tester's Guide: <project name>
|
|
210
|
+
Generated: <YYYY-MM-DD>
|
|
211
|
+
|
|
212
|
+
## Feature Areas (ranked by risk)
|
|
213
|
+
|
|
214
|
+
### 🔴 High Risk
|
|
215
|
+
- **<area>** — <summary>. <N> scenarios (<N> automated, <N> manual). <reason for high risk>.
|
|
216
|
+
|
|
217
|
+
### 🟡 Medium Risk
|
|
218
|
+
- **<area>** — <summary>. <N> scenarios (<N> automated, <N> manual). <reason>.
|
|
219
|
+
|
|
220
|
+
### 🟢 Low Risk
|
|
221
|
+
- **<area>** — <summary>. <N> scenarios (<N> automated, <N> manual).
|
|
222
|
+
|
|
223
|
+
## Recent Changes (last 2 weeks)
|
|
224
|
+
- <area>: <what changed> (<commit date>)
|
|
225
|
+
|
|
226
|
+
## Open Bugs
|
|
227
|
+
- <bug-id>: <title> (<area>, <severity>)
|
|
228
|
+
|
|
229
|
+
## Where to Start
|
|
230
|
+
<Recommend the tester start with the highest-risk area that has the least automation — that's where manual testing adds the most value.>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Important
|
|
234
|
+
- **This is exploration, not audit.** The goal is to find what's missing, not to grade coverage. Frame findings as opportunities, not failures.
|
|
235
|
+
- **Prioritize by risk.** A missing error scenario on a payment flow matters more than a missing edge case on a settings page. Lead with what could hurt users.
|
|
236
|
+
- **Suggest scenarios, don't just flag gaps.** "Missing negative scenario for login" is less useful than a concrete Given/When/Then that the team can evaluate.
|
|
237
|
+
- **Respect existing coverage.** If an area is well-covered, say so. Don't manufacture findings for completeness.
|
|
238
|
+
- **Don't duplicate test-quality.** `grimoire verify` already checks assertion strength and test anti-patterns. This skill focuses on missing coverage, not weak tests.
|
|
239
|
+
- **Scope matters.** A full-sweep exploration of a large codebase will produce a lot of findings. Help the user prioritize rather than dumping everything on them.
|
|
240
|
+
|
|
241
|
+
## Done
|
|
242
|
+
When the findings report is presented and the user has acted on findings (write scenarios, file bugs, defer, or dismiss), the workflow is complete. Suggest follow-up actions based on findings.
|