Skip to content

Commit 9727236

Browse files
authored
feat(skills): add fix-findings skill, move outputs to .chalk/
1 parent 46ca4b8 commit 9727236

4 files changed

Lines changed: 185 additions & 25 deletions

File tree

skills/create-handoff/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Derive a session name from context:
2525
Create the session directory and handoff file:
2626

2727
```sh
28-
SESSION_DIR=".reviews/${session_name}"
28+
SESSION_DIR=".chalk/reviews/${session_name}"
2929
HANDOFF_PATH="$SESSION_DIR/handoff.md"
3030
mkdir -p "$SESSION_DIR"
3131
```

skills/create-review/SKILL.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ Bootstrap the review pipeline and generate a paste-ready review prompt for any A
1717
**Reviewer:** If the user provided `$ARGUMENTS`, sanitize it to a safe kebab-case string (lowercase, strip any characters that aren't alphanumeric or hyphens, collapse multiple hyphens) and use that as the reviewer name (e.g. `codex`, `gemini`, `gpt4`, `claude`). If no argument, use `generic`.
1818

1919
**Session:** Detect from context:
20-
1. If `.reviews/` exists, check for the most recent session directory
20+
1. If `.chalk/reviews/` exists, check for the most recent session directory
2121
2. Otherwise, infer from the current branch name (kebab-case)
2222
3. If on `main`/`master`, ask the user
2323

2424
Store as `{reviewer}` and `{session}`.
2525

2626
## Step 2: Bootstrap the review pipeline
2727

28-
Check if `.reviews/scripts/pack.sh` exists. If not, bootstrap the full pipeline:
28+
Check if `.chalk/reviews/scripts/pack.sh` exists. If not, bootstrap the full pipeline:
2929

3030
```sh
31-
mkdir -p .reviews/scripts .reviews/templates .reviews/sessions
31+
mkdir -p .chalk/reviews/scripts .chalk/reviews/templates .chalk/reviews/sessions
3232
```
3333

34-
### Create `.reviews/scripts/pack.sh`
34+
### Create `.chalk/reviews/scripts/pack.sh`
3535

3636
This script generates a review context pack from git state:
3737

@@ -41,7 +41,7 @@ set -euo pipefail
4141

4242
BASE_REF="${1:-origin/main}"
4343
SESSION="${2:-adhoc}"
44-
OUTPUT_PATH="${3:-.reviews/sessions/${SESSION}/pack.md}"
44+
OUTPUT_PATH="${3:-.chalk/reviews/sessions/${SESSION}/pack.md}"
4545

4646
# Resolve base ref
4747
if ! git rev-parse --verify "$BASE_REF" >/dev/null 2>&1; then
@@ -96,7 +96,7 @@ mkdir -p "$(dirname "$OUTPUT_PATH")"
9696
echo "PACK_PATH=$OUTPUT_PATH"
9797
```
9898

99-
### Create `.reviews/scripts/render-prompt.sh`
99+
### Create `.chalk/reviews/scripts/render-prompt.sh`
100100

101101
This script combines pack + handoff + reviewer template into a prompt:
102102

@@ -162,7 +162,7 @@ mkdir -p "$(dirname "$OUTPUT_PATH")"
162162
echo "PROMPT_PATH=$OUTPUT_PATH"
163163
```
164164

165-
### Create `.reviews/scripts/copy-prompt.sh`
165+
### Create `.chalk/reviews/scripts/copy-prompt.sh`
166166

167167
```sh
168168
#!/usr/bin/env bash
@@ -194,7 +194,7 @@ if [ "$COPIED" -eq 0 ]; then
194194
fi
195195
```
196196

197-
### Create `.reviews/templates/generic-review.template.md`
197+
### Create `.chalk/reviews/templates/generic-review.template.md`
198198

199199
Only create if it does not already exist (preserve user customizations):
200200

@@ -222,7 +222,7 @@ Rules:
222222
- If no blocking issues exist, explicitly state: `No blocking findings`.
223223
```
224224

225-
### Create `.reviews/templates/codex-review.template.md`
225+
### Create `.chalk/reviews/templates/codex-review.template.md`
226226

227227
Only create if it does not already exist:
228228

@@ -252,7 +252,7 @@ Rules:
252252
- Keep recommendations patch-oriented and specific.
253253
```
254254

255-
### Create `.reviews/templates/gemini-review.template.md`
255+
### Create `.chalk/reviews/templates/gemini-review.template.md`
256256

257257
Only create if it does not already exist:
258258

@@ -286,10 +286,10 @@ Rules:
286286
### Make scripts executable
287287

288288
```sh
289-
chmod +x .reviews/scripts/pack.sh .reviews/scripts/render-prompt.sh .reviews/scripts/copy-prompt.sh
289+
chmod +x .chalk/reviews/scripts/pack.sh .chalk/reviews/scripts/render-prompt.sh .chalk/reviews/scripts/copy-prompt.sh
290290
```
291291

292-
### Create `.reviews/PIPELINE.md`
292+
### Create `.chalk/reviews/PIPELINE.md`
293293

294294
Write a brief usage guide explaining the pipeline, available scripts, and how to add custom reviewer templates. Refresh this on every run.
295295

@@ -301,31 +301,31 @@ Write a brief usage guide explaining the pipeline, available scripts, and how to
301301

302302
## Step 4: Check for a handoff
303303

304-
Look for `.reviews/sessions/{session}/handoff.md`. If it exists, it will be included in the prompt. If not, warn the user that no handoff was found and suggest running `/create-handoff` first, but continue anyway.
304+
Look for `.chalk/reviews/sessions/{session}/handoff.md`. If it exists, it will be included in the prompt. If not, warn the user that no handoff was found and suggest running `/create-handoff` first, but continue anyway.
305305

306306
## Step 5: Generate the review pack
307307

308308
```sh
309-
bash .reviews/scripts/pack.sh "{base}" "{session}" ".reviews/sessions/{session}/pack.md"
309+
bash .chalk/reviews/scripts/pack.sh "{base}" "{session}" ".chalk/reviews/sessions/{session}/pack.md"
310310
```
311311

312312
## Step 6: Generate the review prompt
313313

314314
```sh
315-
bash .reviews/scripts/render-prompt.sh "{reviewer}" \
316-
".reviews/sessions/{session}/pack.md" \
317-
".reviews/sessions/{session}/handoff.md" \
318-
".reviews/sessions/{session}/{reviewer}.prompt.md" \
315+
bash .chalk/reviews/scripts/render-prompt.sh "{reviewer}" \
316+
".chalk/reviews/sessions/{session}/pack.md" \
317+
".chalk/reviews/sessions/{session}/handoff.md" \
318+
".chalk/reviews/sessions/{session}/{reviewer}.prompt.md" \
319319
"{session}"
320320
```
321321

322322
## Step 7: Copy to clipboard
323323

324324
```sh
325-
bash .reviews/scripts/copy-prompt.sh "{reviewer}" \
326-
".reviews/sessions/{session}/pack.md" \
327-
".reviews/sessions/{session}/handoff.md" \
328-
".reviews/sessions/{session}/{reviewer}.prompt.md" \
325+
bash .chalk/reviews/scripts/copy-prompt.sh "{reviewer}" \
326+
".chalk/reviews/sessions/{session}/pack.md" \
327+
".chalk/reviews/sessions/{session}/handoff.md" \
328+
".chalk/reviews/sessions/{session}/{reviewer}.prompt.md" \
329329
"{session}"
330330
```
331331

@@ -338,12 +338,12 @@ Show:
338338
- Suggest: paste the prompt into the target model, or run with a different provider (e.g. `/create-review gemini`)
339339

340340
Also mention:
341-
- To add a custom reviewer, create `.reviews/templates/{name}-review.template.md`
341+
- To add a custom reviewer, create `.chalk/reviews/templates/{name}-review.template.md`
342342
- To review with multiple providers: run the skill again with a different argument
343343

344344
## Step 9: Save current session
345345

346-
Write the session name to `.reviews/.current-session` so subsequent runs can pick it up.
346+
Write the session name to `.chalk/reviews/.current-session` so subsequent runs can pick it up.
347347

348348
## Rules
349349

skills/fix-findings/SKILL.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
name: fix-findings
3+
description: Fix findings from the active review session — reads reviewer findings files, applies fixes by priority, and updates the resolution log. Use after pasting reviewer output into findings files.
4+
owner: chalk
5+
version: "1.0.0"
6+
metadata-version: "1"
7+
allowed-tools: Bash, Read, Edit, Grep, Glob, Write
8+
argument-hint: "[reviewer-name|all] e.g. codex, gemini, gpt4, or omit for all"
9+
---
10+
11+
# Fix Review Session Findings
12+
13+
Read findings from the active review session and apply fixes to the codebase, then update the resolution log.
14+
15+
## Step 1: Resolve the active session
16+
17+
Look for the current session:
18+
19+
1. Check `.chalk/reviews/.current-session`
20+
2. If not found, check for the most recent session directory under `.chalk/reviews/sessions/`
21+
3. If nothing found, stop and tell the user to run `/create-review` first to start a session
22+
23+
Store the session ID as `{session}`.
24+
25+
## Step 2: Determine which findings to load
26+
27+
Based on `$ARGUMENTS`:
28+
29+
- If a reviewer name is provided (e.g. `codex`, `gemini`, `gpt4`, `claude`), sanitize it to kebab-case and load only `.chalk/reviews/sessions/{session}/{reviewer}.findings.md`
30+
- If `all` or no argument → load all `*.findings.md` files in the session directory
31+
32+
Discover available findings dynamically using the Glob tool:
33+
34+
```
35+
.chalk/reviews/sessions/{session}/*.findings.md
36+
```
37+
38+
Do NOT use shell `ls` for discovery — use the Glob tool to avoid command injection and handle special characters safely.
39+
40+
If a findings file doesn't exist or contains only template placeholder text, skip it and note that no findings are available from that reviewer.
41+
42+
If no findings are available from any reviewer, stop and tell the user to paste reviewer output into the findings files first. Show the expected path: `.chalk/reviews/sessions/{session}/{reviewer-name}.findings.md`
43+
44+
## Step 3: Parse findings
45+
46+
From each findings file, extract the findings table. Each row typically has:
47+
48+
- **ID** — finding identifier (e.g. `F-001`, `G-001`, or any prefix)
49+
- **Severity**`P0`, `P1`, `P2`, `P3`
50+
- **File:Line** — source location (e.g. `src/main/auth.ts:172`)
51+
- **Issue** — description of the problem
52+
- **Failure mode** or **Impact** — what goes wrong
53+
- **Recommended fix** or **Suggested fix** — how to fix it
54+
- **Confidence** — reviewer confidence score (if present)
55+
56+
Sort all findings across all reviewers by severity: P0 > P1 > P2 > P3.
57+
58+
Deduplicate findings that target the same file and line (or overlapping line range) across reviewers. Two findings are duplicates if they reference the same file path AND the same line number (or lines within 5 of each other) AND describe a similar category of issue. When deduplicating, keep all IDs, use the more detailed description, and note both reviewers as sources.
59+
60+
## Step 4: Present findings and get confirmation
61+
62+
Before applying any fixes, present the user with a prioritized summary:
63+
64+
| Priority | ID(s) | Source | File:Line | Issue (1-line) | Action |
65+
|----------|--------|--------|-----------|----------------|--------|
66+
| P0 | G-001 | gemini | src/main/auth.ts:31 | Plaintext token storage | Fix |
67+
| P1 | F-001 | codex | src/main/index.ts:182 | Stale auth target | Fix |
68+
| ... | ... | ... | ... | ... | ... |
69+
70+
Ask the user which findings to fix. Options:
71+
- **All** — fix everything P0-P2 (skip P3 unless trivial)
72+
- **Blocking only** — fix P0 and P1 only
73+
- **Let me choose** — user picks specific finding IDs
74+
75+
## Step 5: Apply fixes
76+
77+
For each finding to fix (in priority order):
78+
79+
1. **Validate the file path** — confirm the path is relative and within the repository root. Reject any absolute paths or paths containing `..` that escape the repo
80+
2. **Read the file** at the specified path and line — read at least 30 lines of surrounding context (15 above, 15 below) to understand the code structure
81+
3. **Design the fix** using the reviewer's suggested fix as guidance, but verify it makes sense in context
82+
4. **Show the proposed fix to the user and ask for explicit confirmation before applying it**
83+
5. **Apply the fix** using Edit tool
84+
6. **Verify** the fix doesn't break surrounding code or introduce new issues
85+
86+
Rules:
87+
- Do NOT blindly copy suggested fixes — they're guidance, not exact patches
88+
- If a fix requires changes across multiple files, make all related changes together
89+
- If a fix is unclear or would require significant refactoring beyond the finding's scope, skip it and mark as `deferred` in the resolution log
90+
- For P3 findings: only fix if the change is a single-line or obvious one-liner (e.g. rename, add a null check, fix a typo). Otherwise skip
91+
- After fixing deduplicated findings, note all IDs as resolved
92+
93+
## Step 6: Update the resolution log
94+
95+
Write or update `.chalk/reviews/sessions/{session}/resolution.md`.
96+
97+
If the file already exists, preserve any metadata comments at the top. Fill in:
98+
99+
```markdown
100+
# Finding Resolution Log
101+
102+
## Summary
103+
- Session: {session}
104+
- Item: {inferred from session name}
105+
- Reviewers: {list of reviewer sources found — e.g. codex, gemini}
106+
- Decision owner:
107+
108+
## Findings
109+
110+
| ID | Severity | Source | File:Line | Decision | Notes |
111+
|---|---|---|---|---|---|
112+
| G-001 | P0 | gemini | src/main/auth.ts:31 | fixed | Wrapped token persistence with safeStorage |
113+
| F-001 | P1 | codex | src/main/index.ts:182 | fixed | Rebind auth target in createWindow |
114+
115+
Decision values:
116+
- fixed
117+
- accepted-risk
118+
- deferred
119+
- not-repro
120+
121+
## Follow-up Tasks
122+
- {deferred work, test gaps, items needing manual verification}
123+
124+
## Final Gate
125+
- Build:
126+
- Tests:
127+
- Ready to merge: yes/no
128+
```
129+
130+
## Step 7: Summary
131+
132+
After all fixes are applied, show:
133+
134+
1. A results table:
135+
136+
| ID(s) | Severity | Source | Status | What was done |
137+
|--------|----------|--------|--------|---------------|
138+
| G-001 | P0 | gemini | Fixed | Wrapped token persistence with safeStorage |
139+
| F-001 | P1 | codex | Fixed | Rebind auth target in createWindow |
140+
| G-004 | P3 | gemini | Skipped | Trivial but not blocking |
141+
142+
2. The resolution log path
143+
3. Suggest next steps:
144+
- Run build/tests to verify nothing broke
145+
- Run `/commit` to commit the fixes
146+
- If all blocking findings are resolved, create or update the PR
147+
148+
## Rules
149+
150+
- ALWAYS validate that file paths from findings are relative and within the repository root — reject absolute paths or paths with `..` escaping the repo
151+
- ALWAYS read the file with surrounding context before applying any fix
152+
- Do NOT modify files that aren't referenced in findings
153+
- Do NOT fix things that aren't in the findings — stay scoped
154+
- If multiple reviewers suggest conflicting fixes for the same issue, present both suggestions to the user and let them choose which approach to take
155+
- Keep fixes minimal — address the finding, don't refactor surrounding code
156+
- If build or typecheck breaks after a fix, attempt to resolve but note it in the resolution log

skills/skills-index.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ skills:
1616
path: skills/create-review/SKILL.md
1717
owner: chalk
1818
version: "1.0.0"
19+
- name: fix-findings
20+
path: skills/fix-findings/SKILL.md
21+
owner: chalk
22+
version: "1.0.0"
1923
- name: fix-review
2024
path: skills/fix-review/SKILL.md
2125
owner: chalk

0 commit comments

Comments
 (0)