You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/skills/add-model/SKILL.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,26 @@ Before any implementation, collect all required information. If called from `iss
29
29
30
30
If any item is missing, ask the user to provide it. Do NOT proceed until the checklist is complete.
31
31
32
+
### Associated Rule Check
33
+
34
+
Before implementation, verify that at least one reduction rule exists or is planned for this problem — otherwise it will be an orphan node in the reduction graph.
35
+
36
+
**Check both directions:**
37
+
38
+
1.**Outbound (this issue → rule issues):** Look for rule issue numbers in the model issue's "Reduction Rule Crossref" section.
39
+
2.**Inbound (rule issues → this problem):** Search open rule issues that reference this problem as source or target:
40
+
```bash
41
+
gh issue list --label rule --state open --limit 500 --json number,title | \
Copy file name to clipboardExpand all lines: .claude/skills/final-review/SKILL.md
+50-10Lines changed: 50 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,6 +102,41 @@ Use `AskUserQuestion` to confirm:
102
102
> - "I see an issue" — reviewer describes the problem
103
103
> - "Skip" — skip this check
104
104
105
+
### Step 3b: File whitelist check
106
+
107
+
Check that the PR only touches files expected for its type. Any file outside the whitelist is flagged for review — it may be a legacy pattern or an unrelated change.
108
+
109
+
**Whitelist for [Model] PRs:**
110
+
-`src/models/<category>/<name>.rs` — model implementation
111
+
-`src/unit_tests/models/<category>/<name>.rs` — unit tests
112
+
-`src/example_db/model_builders.rs` — canonical example registration
113
+
-`src/example_db/rule_builders.rs` — only if updating nonempty-style assertions
> - "OnHold" — move to OnHold column with a reason
185
229
186
-
> **What would you like to do with this PR?**
187
-
> - "Merge" — approve and show merge link for browser
188
-
> - "OnHold" — move to OnHold column with a reason comment
189
-
> - "Quick fix" — fix specific issues before merging (describe what to fix)
190
-
> - "Reject" — close the PR with explanation
230
+
This lets the reviewer cherry-pick exactly which issues to fix. If the reviewer selects fixes, proceed to Step 7 Quick fix. If "Merge as-is", proceed to Step 7 Merge.
191
231
192
232
### Step 7: Execute decision
193
233
@@ -208,7 +248,7 @@ Use `AskUserQuestion`:
208
248
```
209
249
210
250
**If Quick fix:**
211
-
1.Ask the reviewer what needs fixing (use `AskUserQuestion`).
251
+
1.Apply only the fixes the reviewer selected in Step 6.
212
252
2. Checkout the PR branch in a worktree, apply fixes, commit, push.
213
253
3. After push, go back to Step 6 to re-confirm the decision.
"Auto-fill from literature" -> "Present draft(s)";
55
+
"Study models" -> "Literature check";
56
+
"Literature check" -> "Guided brainstorming" [label="pre-fill if found"];
60
57
"Guided brainstorming" -> "Present draft(s)";
61
58
"Brainstorm Model" -> "Topology analysis";
62
59
"Topology analysis" -> "Propose rules?";
@@ -249,7 +246,7 @@ Work through these topics in order, using `AskUserQuestion` where multiple-choic
249
246
description: "I'll describe the variable structure"
250
247
```
251
248
252
-
4.**Complexity & Reference** — Before asking, use WebSearch to research the best known exact algorithms and canonical references for this problem. Then present 3 candidates via `AskUserQuestion`, each combining the complexity bound with its source:
249
+
4.**Complexity & Reference** — Before asking, use WebSearch to research the best known exact algorithms and canonical references for this problem. Then present up to 3 candidates via `AskUserQuestion`, each combining the complexity bound with its source:
253
250
254
251
```
255
252
AskUserQuestion:
@@ -296,7 +293,7 @@ Work through these topics in order, using `AskUserQuestion` where multiple-choic
296
293
297
294
**Important:** If the user chooses "Reduce to ILP" or "Reduce to QUBO", remind them that this requires a reduction rule issue. Either cross-reference an existing rule issue, or plan to file one as a companion rule (which will be proposed in Step 3b Topology Analysis). The model issue's "How to solve" section must reference the rule issue number.
298
295
299
-
6.**Example** — Generate 3 candidate examples yourself (varying in size and structure), then present via `AskUserQuestion`:
296
+
6.**Example** — Generate **at least 3** candidate examples yourself (varying in size and structure), then present via `AskUserQuestion`. **3 options is the minimum — never fewer.** Always include a "Generate new batch" escape hatch:
300
297
301
298
```
302
299
AskUserQuestion:
@@ -309,9 +306,13 @@ Work through these topics in order, using `AskUserQuestion` where multiple-choic
description: "<brief description — richer, more illustrative>"
309
+
- label: "Generate new batch"
310
+
description: "None of these work — generate a fresh set of examples"
312
311
```
313
312
314
-
After the user picks one, provide a complete instance with its known optimal solution.
313
+
If the user picks "Generate new batch", create 3 new examples with different sizes/structures and re-present.
314
+
315
+
After the user picks a concrete example, provide a complete instance with its known optimal solution.
315
316
- Must exercise the problem's core structure
316
317
- Must be small enough to verify by hand
317
318
@@ -444,41 +445,68 @@ gh issue list --label rule --state open --json number,title | jq '.[] | select(.
444
445
445
446
This information is essential for writing correct overhead tables and identifying implementation concerns.
446
447
447
-
#### Step 3.3: Well-known reduction fast path
448
+
#### Step 3.3: Literature check
448
449
449
-
After studying the models, determine whether this is a **well-known textbook reduction**:
450
+
After studying the models, check whether this is a **well-known textbook reduction**:
450
451
- Use WebSearch to check standard references (Garey & Johnson, Karp's 21, CLRS, Sipser, Arora & Barak)
451
452
- Check if an existing GitHub issue already describes this reduction
452
453
453
-
**If the reduction is well-known** (found in at least one textbook or survey):
454
-
-**Do NOT ask brainstorming questions** (motivation, algorithm, correctness, overhead, example, reference) — the answers are in the literature
455
-
- Auto-fill every section by researching the literature and using the model data from Step 3.2
456
-
- Jump directly to **Step 4: Present Draft Issue(s)**
457
-
- The draft presentation is the user's review point — they can revise any section there
458
-
459
-
**If the reduction is NOT well-known** (novel or obscure):
460
-
- Proceed to **Step 3.4: Guided brainstorming** below
461
-
462
-
> **Rationale:** Domain experts proposing a textbook reduction should not be quizzed on facts they already know. The skill's value is producing a well-formatted, correct issue — not asking obvious questions. For novel reductions, guided brainstorming helps the user think through the design.
454
+
If the reduction is well-known, use the literature to **pre-fill** answers in Step 3.4 — but still present each step to the user for confirmation. Do NOT skip the guided brainstorming.
Only reach this step if the reduction is novel or obscure. Work through these topics in order. **Do not use `AskUserQuestion` when the answer is determinable from topology analysis, model inspection, or literature search** — just auto-fill and note what you filled. Only ask when genuine user input is needed.
458
+
**Always run this step**, whether the reduction is well-known or novel. For well-known reductions, pre-fill answers from literature and present them for confirmation. For novel reductions, ask the user to provide answers. Work through these topics in order, **one at a time**.
467
459
468
-
1.**Why useful?** — If the topology analysis already shows this connects an orphan, fills an NP-hardness gap, or provides a shorter path, **state the motivation directly** — do not ask. Only use `AskUserQuestion` if the motivation is genuinely ambiguous.
460
+
1.**Why useful?** — State the motivation (e.g., connects orphan, fills NP-hardness gap) and present for confirmation via `AskUserQuestion`:
461
+
```
462
+
AskUserQuestion:
463
+
question: "What's the main motivation for this reduction?"
464
+
header: "Motivation"
465
+
options:
466
+
- label: "<inferred motivation> (Recommended)"
467
+
description: "<why — e.g., connects orphan PaintShop to QUBO hub>"
468
+
- label: "<alternative motivation>"
469
+
description: "<why>"
470
+
- label: "<alternative motivation>"
471
+
description: "<why>"
472
+
```
469
473
470
-
2.**Algorithm** — Ask as a free-text question (no multiple choice here):
471
-
> "How does the reduction work? Given a source instance, how do you construct the target instance? Please describe step by step."
474
+
2.**Algorithm** — Research the reduction algorithm (use WebSearch for well-known reductions, ask the user for novel ones). Present candidate approaches via `AskUserQuestion`:
475
+
```
476
+
AskUserQuestion:
477
+
question: "Which reduction approach should we use?"
478
+
header: "Algorithm"
479
+
options:
480
+
- label: "<approach 1> (Recommended)"
481
+
description: "<brief summary of how it works>"
482
+
- label: "<approach 2>"
483
+
description: "<brief summary>"
484
+
- label: "<approach 3>"
485
+
description: "<brief summary>"
486
+
```
487
+
After the user picks one, present the full algorithm write-up for confirmation.
472
488
- Must define all symbols before using them
473
489
- Must be detailed enough that someone could implement it
474
-
- If the user is unsure, use WebSearch to find known reductions in the literature
475
490
476
-
3.**Correctness** — Ask as free text:
477
-
> "Why does this work? Why does an optimal solution to the target correspond to an optimal solution of the source?"
491
+
3.**Explanation** — Present a correctness argument explaining why the reduction preserves optimal solutions, then ask for feedback via `AskUserQuestion`:
492
+
```
493
+
AskUserQuestion:
494
+
question: "How does this explanation look?"
495
+
header: "Explanation"
496
+
options:
497
+
- label: "Looks good"
498
+
description: "The correctness argument is clear and complete"
499
+
- label: "More detail"
500
+
description: "Please expand the argument with more steps or formal reasoning"
501
+
- label: "Less detail"
502
+
description: "Too verbose — please shorten to the key insight"
503
+
```
504
+
If the user asks for more or less detail, revise and re-present.
478
505
479
-
4.**Size overhead** — Auto-fill from the algorithm description using the target's size fields from `pred show <target> --json`. Ask the user to confirm only if the overhead is unclear from the algorithm.
506
+
4.**Size overhead** — Compute overhead from the algorithm using the target's size fields from `pred show <target> --json`. Present the overhead table and ask for confirmation:
507
+
> "Based on the algorithm, the size overhead is: [table]. Does this look correct?"
480
508
481
-
5.**Example** — Generate 3 candidate examples yourself (varying in size and structure), then present via `AskUserQuestion`:
509
+
5.**Example** — Generate **at least 3** candidate examples yourself (varying in size and structure), then present via `AskUserQuestion`. **3 options is the minimum — never fewer.** Always include a "Generate new batch" escape hatch:
482
510
483
511
```
484
512
AskUserQuestion:
@@ -491,23 +519,30 @@ Only reach this step if the reduction is novel or obscure. Work through these to
491
519
description: "<brief description — shows a non-obvious optimum>"
492
520
- label: "<larger instance summary>"
493
521
description: "<brief description — richer structure, more trade-offs>"
522
+
- label: "Generate new batch"
523
+
description: "None of these work — generate a fresh set of examples"
494
524
```
495
525
496
-
After the user picks one, fully work out the example: show source instance, each construction step, resulting target instance, and the optimal solution.
526
+
If the user picks "Generate new batch", create 3 new examples with different sizes/structures and re-present.
527
+
528
+
After the user picks a concrete example, fully work out the example: show source instance, each construction step, resulting target instance, and the optimal solution.
497
529
- Must be non-trivial but hand-verifiable
498
530
- Must exercise the core structure of the reduction
499
531
500
-
6.**Reference** — Use WebSearch to find references first. Only use `AskUserQuestion` if no reference is found:
532
+
6.**Reference** — Use WebSearch to find references. Present candidate references via `AskUserQuestion`:
501
533
```
502
534
AskUserQuestion:
503
-
question: "Is there a paper or textbook that describes this reduction?"
535
+
question: "Which reference should we cite?"
504
536
header: "Reference"
505
537
options:
506
-
- label: "Yes, I have a reference"
507
-
description: "I'll provide the citation"
508
-
- label: "This is a novel reduction"
509
-
description: "I designed this myself — no existing reference"
538
+
- label: "<reference 1> (Recommended)"
539
+
description: "<paper title, year> — <URL>"
540
+
- label: "<reference 2>"
541
+
description: "<paper title, year> — <URL>"
542
+
- label: "<reference 3>"
543
+
description: "<paper title, year> — <URL>"
510
544
```
545
+
If no references are found, ask the user if this is a novel reduction.
511
546
512
547
---
513
548
@@ -696,7 +731,7 @@ Print all issue URLs when done.
696
731
697
732
-**Use `AskUserQuestion` only when genuine user input is needed** — use it for choices where the answer is NOT determinable from context (type detection, problem selection, example selection, approval). Do NOT use it when the answer is already clear from topology analysis, model inspection, or literature (e.g., don't ask "why is this useful?" when the topology analysis already shows it connects an orphan).
698
733
-**Study models before brainstorming** — always run `pred show <source> --json` and `pred show <target> --json` before asking questions. This reveals field types, size getters, and schema details that are essential for correct overhead tables.
699
-
-**Fast-path well-known reductions** — if the reduction appears in standard textbooks, skip all brainstorming questions and auto-fill the draft from literature + model data. Present the draft directly for review.
734
+
-**Pre-fill well-known reductions** — if the reduction appears in standard textbooks, pre-fill answers from literature but still present each step to the user for confirmation. Never skip brainstorming steps.
700
735
-**One question at a time** — don't overwhelm; each `AskUserQuestion` call has one focused question
701
736
-**Mathematical language only** — never mention Rust types, traits, macros, or code patterns to the user
702
737
-**Help find references** — use WebSearch to help locate papers, verify claims
@@ -710,7 +745,7 @@ Print all issue URLs when done.
710
745
711
746
-**Don't ask questions with obvious answers.** If the topology analysis shows the rule connects an orphan, don't ask "What makes this reduction valuable?" — state it. Only use `AskUserQuestion` when the answer requires genuine user input.
712
747
-**Don't skip model inspection.** Always run `pred show <source> --json` and `pred show <target> --json` before brainstorming. Missing this leads to wrong overhead tables and missed type mismatches (e.g., `BigUint` vs `i64`).
713
-
-**Don't quiz users on textbook reductions.**If SubsetSum → Knapsack is in Garey & Johnson, don't ask the user to explain the algorithm step by step — look it up and draft the issue.
748
+
-**Don't skip confirmation for textbook reductions.**Even if SubsetSum → Knapsack is in Garey & Johnson, still present each brainstorming step with pre-filled answers for the user to confirm or revise. Never jump straight to the draft.
714
749
-**Don't rebuild `pred` unnecessarily.** Use `command -v pred` to check if it's installed before running `make cli` (which takes >1 minute).
715
750
-**Don't ask all questions at once.** One `AskUserQuestion` call per message.
716
751
-**Don't use programming jargon.** Say "list of weights" not "Vec<W>". Say "graph" not "SimpleGraph". Say "integer" not "i32".
0 commit comments