Skip to content

Commit 05c4d06

Browse files
chore(templates): merge Karpathy principles into Process Discipline
Fold Andrej Karpathy's four LLM-coding principles (Think before coding, Simplicity first, Surgical changes, Goal-driven execution) into CLAUDE.md.tmpl's Process Discipline section as phase anchors. Add a Discipline Inheritance intro to AGENTS.md.tmpl and sharpen five workflow skills with concrete inserts (new-feature, spec-feature, codebase-walkthrough, finish-feature, pre-push-check). Mirror copies in skills/ updated in lockstep. Editorial change; no version bump. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9843795 commit 05c4d06

12 files changed

Lines changed: 116 additions & 43 deletions

File tree

devflow-plugin/commands/codebase-walkthrough.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Guide the user through a deep technical walkthrough of the codebase areas affect
5151
- State what you believe to be true
5252
- Verify it against the ticket, Confluence docs, or codebase — do NOT present unverified assumptions as facts
5353
- If you can't verify, say "I need to verify this" and check
54+
- Better to surface a confused assumption than hide it. Name what's unclear before proceeding.
5455

5556
7. **Present the walkthrough.** Structure it so it takes ~30 minutes to read:
5657

devflow-plugin/commands/finish-feature.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@ You are finishing a feature. Run the full completion pipeline before handing off
3535

3636
**If checks fail**, report the failures clearly and stop. Do NOT continue past this step with failing checks. Help the user fix issues if they ask.
3737

38-
3. **Stage and commit.** If there are uncommitted changes:
38+
3. **Diff self-test (Surgical Changes).** Run `git diff origin/main...HEAD` and scan for:
39+
40+
- Changes unrelated to the feature (formatting, adjacent refactors, comment cleanup).
41+
- Dead-code removals beyond orphans YOUR changes created.
42+
- "Improvements" made in passing.
43+
44+
If any exist, surface them to the user. Offer to move them to a separate PR or revert. Don't silently ship them.
45+
46+
4. **Stage and commit.** If there are uncommitted changes:
3947
- Stage relevant changes: `git add -A`
4048
- Analyze the full diff to generate a commit message:
4149
- Follow conventional commits format (`feat:`, `fix:`, `refactor:`, etc.)
4250
- Be concise (1-2 lines)
4351
- Reference the ticket ID if present in the branch name
4452
- Present the commit message to the user for approval before committing.
4553
46-
4. **Push and create PR.** Push the branch and create a pull request:
54+
5. **Push and create PR.** Push the branch and create a pull request:
4755
4856
```bash
4957
git push -u origin HEAD
@@ -62,13 +70,13 @@ You are finishing a feature. Run the full completion pipeline before handing off
6270
6371
Present the PR URL to the user.
6472
65-
5. **Retain session learnings.** Review the session and retain important discoveries:
73+
6. **Retain session learnings.** Review the session and retain important discoveries:
6674
- Architecture decisions made during this feature
6775
- Gotchas or non-obvious patterns encountered
6876
- Bug root causes and fixes
6977
- Use Hindsight `retain` for each learning, tagged with the project name
7078
71-
6. **Present the summary and hand off cleanup:**
79+
7. **Present the summary and hand off cleanup:**
7280
7381
```
7482
## Feature Complete

devflow-plugin/commands/new-feature.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ You have been launched inside a feature worktree. Your job is to orient yourself
4646

4747
4. **Ask what the feature is about.** If the branch name is descriptive enough, summarize your understanding and ask for confirmation. Otherwise, ask the user to describe the feature.
4848

49+
**Don't guess from the branch name.** If the branch is descriptive, summarize your reading in one sentence and ask for confirmation. If it leaves gaps (what behavior changes, what success looks like), ask BEFORE recalling more. Silent interpretations compound.
50+
4951
5. **Offer codebase walkthrough (optional).** Ask the user:
5052

5153
> "Would you like a codebase walkthrough before we start? This traces the full end-to-end flow affected by this task, shows you the actual code at each step, and identifies the key files. Useful if this is an unfamiliar area of the codebase."
@@ -61,5 +63,6 @@ You have been launched inside a feature worktree. Your job is to orient yourself
6163
- Never skip the brainstorming step for non-trivial features.
6264
- The codebase walkthrough is optional but recommended for unfamiliar areas.
6365
- If the branch name contains a ticket ID, use it as a namespace prefix in all Hindsight interactions.
66+
- Surface any assumption the branch name or recalled memories lead you to make. The user is one line away — ask before guessing.
6467

6568
$ARGUMENTS

devflow-plugin/commands/pre-push-check.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You are about to push code. Run the full pre-push quality pipeline before pushin
1717
Capture and parse the output. This uses Claude Code (primary) or OpenCode (fallback) to review against `.devflow/checks/*.md` rules. If neither CLI is available, fall back to running the project's lint and type-check commands directly (e.g., `yarn lint`, `yarn build`).
1818

1919
3. **Self-review the diff against CLAUDE.md**. Read the project's `CLAUDE.md` file and review the staged changes against its rules:
20+
- **Scope discipline**: every changed line traces to the task. No speculative abstractions, no adjacent refactors, no dead-code removals beyond orphans created by this change.
2021
- Are naming conventions followed?
2122
- Are the architectural patterns respected (clean architecture layers)?
2223
- Are imports using the correct path aliases?
@@ -44,6 +45,7 @@ You are about to push code. Run the full pre-push quality pipeline before pushin
4445
- [PASS/FAIL] [details]
4546
4647
### CLAUDE.md Compliance
48+
- [PASS/WARN/FAIL] Scope discipline (every line traces to task)
4749
- [PASS/WARN/FAIL] Naming conventions
4850
- [PASS/WARN/FAIL] Architecture patterns
4951
- [PASS/WARN/FAIL] Import paths

devflow-plugin/commands/spec-feature.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ You are speccing a new feature. This command enforces a structured planning proc
1111
- Why it's needed (motivation, problem it solves)
1212
- Any constraints or requirements mentioned
1313
- If arguments are vague, ask clarifying questions before proceeding.
14+
- If the feature request has multiple valid interpretations, list them and ask the user to pick — don't silently commit to one.
1415

1516
2. **Recall architecture knowledge**. Use the Hindsight `recall` tool to retrieve:
1617
- Past architectural decisions related to this domain
@@ -51,6 +52,12 @@ You are speccing a new feature. This command enforces a structured planning proc
5152
- [recalled hard rules that apply]
5253
- [architectural decisions that constrain the approach]
5354

55+
## Non-goals
56+
57+
Explicitly out of scope:
58+
- [thing we are NOT building]
59+
- [thing we are NOT refactoring]
60+
5461
## Edge Cases
5562

5663
- [edge case 1]
@@ -76,6 +83,7 @@ You are speccing a new feature. This command enforces a structured planning proc
7683
6. **Present the spec** to the user for review. Ask:
7784
- Does this match your intent?
7885
- Are there constraints I'm missing?
86+
- Is there a simpler approach we're missing?
7987
- Should we adjust the scope?
8088

8189
7. **Retain the architectural decisions** from this spec using the Hindsight `retain` tool, so they're available in future sessions.

skills/code-review/pre-push-check.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You are about to push code. Run the full pre-push quality pipeline before pushin
1717
Capture and parse the output. This uses Claude Code (primary) or OpenCode (fallback) to review against `.devflow/checks/*.md` rules. If neither CLI is available, fall back to running the project's lint and type-check commands directly (e.g., `yarn lint`, `yarn build`).
1818

1919
3. **Self-review the diff against CLAUDE.md**. Read the project's `CLAUDE.md` file and review the staged changes against its rules:
20+
- **Scope discipline**: every changed line traces to the task. No speculative abstractions, no adjacent refactors, no dead-code removals beyond orphans created by this change.
2021
- Are naming conventions followed?
2122
- Are the architectural patterns respected (clean architecture layers)?
2223
- Are imports using the correct path aliases?
@@ -44,6 +45,7 @@ You are about to push code. Run the full pre-push quality pipeline before pushin
4445
- [PASS/FAIL] [details]
4546
4647
### CLAUDE.md Compliance
48+
- [PASS/WARN/FAIL] Scope discipline (every line traces to task)
4749
- [PASS/WARN/FAIL] Naming conventions
4850
- [PASS/WARN/FAIL] Architecture patterns
4951
- [PASS/WARN/FAIL] Import paths

skills/process-discipline/codebase-walkthrough.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Guide the user through a deep technical walkthrough of the codebase areas affect
5151
- State what you believe to be true
5252
- Verify it against the ticket, Confluence docs, or codebase — do NOT present unverified assumptions as facts
5353
- If you can't verify, say "I need to verify this" and check
54+
- Better to surface a confused assumption than hide it. Name what's unclear before proceeding.
5455

5556
7. **Present the walkthrough.** Structure it so it takes ~30 minutes to read:
5657

skills/process-discipline/spec-feature.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ You are speccing a new feature. This command enforces a structured planning proc
1111
- Why it's needed (motivation, problem it solves)
1212
- Any constraints or requirements mentioned
1313
- If arguments are vague, ask clarifying questions before proceeding.
14+
- If the feature request has multiple valid interpretations, list them and ask the user to pick — don't silently commit to one.
1415

1516
2. **Recall architecture knowledge**. Use the Hindsight `recall` tool to retrieve:
1617
- Past architectural decisions related to this domain
@@ -51,6 +52,12 @@ You are speccing a new feature. This command enforces a structured planning proc
5152
- [recalled hard rules that apply]
5253
- [architectural decisions that constrain the approach]
5354

55+
## Non-goals
56+
57+
Explicitly out of scope:
58+
- [thing we are NOT building]
59+
- [thing we are NOT refactoring]
60+
5461
## Edge Cases
5562

5663
- [edge case 1]
@@ -76,6 +83,7 @@ You are speccing a new feature. This command enforces a structured planning proc
7683
6. **Present the spec** to the user for review. Ask:
7784
- Does this match your intent?
7885
- Are there constraints I'm missing?
86+
- Is there a simpler approach we're missing?
7987
- Should we adjust the scope?
8088

8189
7. **Retain the architectural decisions** from this spec using the Hindsight `retain` tool, so they're available in future sessions.

skills/worktree-flow/finish-feature.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,23 @@ You are finishing a feature. Run the full completion pipeline before handing off
3535

3636
**If checks fail**, report the failures clearly and stop. Do NOT continue past this step with failing checks. Help the user fix issues if they ask.
3737

38-
3. **Stage and commit.** If there are uncommitted changes:
38+
3. **Diff self-test (Surgical Changes).** Run `git diff origin/main...HEAD` and scan for:
39+
40+
- Changes unrelated to the feature (formatting, adjacent refactors, comment cleanup).
41+
- Dead-code removals beyond orphans YOUR changes created.
42+
- "Improvements" made in passing.
43+
44+
If any exist, surface them to the user. Offer to move them to a separate PR or revert. Don't silently ship them.
45+
46+
4. **Stage and commit.** If there are uncommitted changes:
3947
- Stage relevant changes: `git add -A`
4048
- Analyze the full diff to generate a commit message:
4149
- Follow conventional commits format (`feat:`, `fix:`, `refactor:`, etc.)
4250
- Be concise (1-2 lines)
4351
- Reference the ticket ID if present in the branch name
4452
- Present the commit message to the user for approval before committing.
4553
46-
4. **Push and create PR.** Push the branch and create a pull request:
54+
5. **Push and create PR.** Push the branch and create a pull request:
4755
4856
```bash
4957
git push -u origin HEAD
@@ -62,13 +70,13 @@ You are finishing a feature. Run the full completion pipeline before handing off
6270
6371
Present the PR URL to the user.
6472
65-
5. **Retain session learnings.** Review the session and retain important discoveries:
73+
6. **Retain session learnings.** Review the session and retain important discoveries:
6674
- Architecture decisions made during this feature
6775
- Gotchas or non-obvious patterns encountered
6876
- Bug root causes and fixes
6977
- Use Hindsight `retain` for each learning, tagged with the project name
7078
71-
6. **Present the summary and hand off cleanup:**
79+
7. **Present the summary and hand off cleanup:**
7280
7381
```
7482
## Feature Complete

skills/worktree-flow/new-feature.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ You have been launched inside a feature worktree. Your job is to orient yourself
4646

4747
4. **Ask what the feature is about.** If the branch name is descriptive enough, summarize your understanding and ask for confirmation. Otherwise, ask the user to describe the feature.
4848

49+
**Don't guess from the branch name.** If the branch is descriptive, summarize your reading in one sentence and ask for confirmation. If it leaves gaps (what behavior changes, what success looks like), ask BEFORE recalling more. Silent interpretations compound.
50+
4951
5. **Offer codebase walkthrough (optional).** Ask the user:
5052

5153
> "Would you like a codebase walkthrough before we start? This traces the full end-to-end flow affected by this task, shows you the actual code at each step, and identifies the key files. Useful if this is an unfamiliar area of the codebase."
@@ -61,5 +63,6 @@ You have been launched inside a feature worktree. Your job is to orient yourself
6163
- Never skip the brainstorming step for non-trivial features.
6264
- The codebase walkthrough is optional but recommended for unfamiliar areas.
6365
- If the branch name contains a ticket ID, use it as a namespace prefix in all Hindsight interactions.
66+
- Surface any assumption the branch name or recalled memories lead you to make. The user is one line away — ask before guessing.
6467

6568
$ARGUMENTS

0 commit comments

Comments
 (0)