worclaude 1.0.0
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/LICENSE +21 -0
- package/README.md +278 -0
- package/package.json +62 -0
- package/src/commands/backup.js +55 -0
- package/src/commands/diff.js +76 -0
- package/src/commands/init.js +628 -0
- package/src/commands/restore.js +95 -0
- package/src/commands/status.js +141 -0
- package/src/commands/upgrade.js +208 -0
- package/src/core/backup.js +94 -0
- package/src/core/config.js +54 -0
- package/src/core/detector.js +43 -0
- package/src/core/file-categorizer.js +177 -0
- package/src/core/merger.js +413 -0
- package/src/core/scaffolder.js +60 -0
- package/src/data/agents.js +164 -0
- package/src/index.js +51 -0
- package/src/prompts/agent-selection.js +99 -0
- package/src/prompts/claude-md-merge.js +153 -0
- package/src/prompts/conflict-resolution.js +24 -0
- package/src/prompts/project-type.js +75 -0
- package/src/prompts/tech-stack.js +35 -0
- package/src/utils/display.js +41 -0
- package/src/utils/file.js +70 -0
- package/src/utils/hash.js +13 -0
- package/src/utils/time.js +22 -0
- package/templates/agents/optional/backend/api-designer.md +61 -0
- package/templates/agents/optional/backend/auth-auditor.md +63 -0
- package/templates/agents/optional/backend/database-analyst.md +61 -0
- package/templates/agents/optional/data/data-pipeline-reviewer.md +68 -0
- package/templates/agents/optional/data/ml-experiment-tracker.md +67 -0
- package/templates/agents/optional/data/prompt-engineer.md +75 -0
- package/templates/agents/optional/devops/ci-fixer.md +64 -0
- package/templates/agents/optional/devops/dependency-manager.md +55 -0
- package/templates/agents/optional/devops/deploy-validator.md +68 -0
- package/templates/agents/optional/devops/docker-helper.md +63 -0
- package/templates/agents/optional/docs/changelog-generator.md +69 -0
- package/templates/agents/optional/docs/doc-writer.md +60 -0
- package/templates/agents/optional/frontend/style-enforcer.md +47 -0
- package/templates/agents/optional/frontend/ui-reviewer.md +51 -0
- package/templates/agents/optional/quality/bug-fixer.md +54 -0
- package/templates/agents/optional/quality/performance-auditor.md +65 -0
- package/templates/agents/optional/quality/refactorer.md +61 -0
- package/templates/agents/optional/quality/security-reviewer.md +74 -0
- package/templates/agents/universal/build-validator.md +15 -0
- package/templates/agents/universal/code-simplifier.md +17 -0
- package/templates/agents/universal/plan-reviewer.md +20 -0
- package/templates/agents/universal/test-writer.md +17 -0
- package/templates/agents/universal/verify-app.md +16 -0
- package/templates/claude-md.md +40 -0
- package/templates/commands/commit-push-pr.md +9 -0
- package/templates/commands/compact-safe.md +8 -0
- package/templates/commands/end.md +9 -0
- package/templates/commands/review-plan.md +10 -0
- package/templates/commands/setup.md +112 -0
- package/templates/commands/start.md +3 -0
- package/templates/commands/status.md +6 -0
- package/templates/commands/techdebt.md +9 -0
- package/templates/commands/update-claude-md.md +9 -0
- package/templates/commands/verify.md +8 -0
- package/templates/mcp-json.json +3 -0
- package/templates/progress-md.md +21 -0
- package/templates/settings/base.json +64 -0
- package/templates/settings/docker.json +9 -0
- package/templates/settings/go.json +10 -0
- package/templates/settings/node.json +17 -0
- package/templates/settings/python.json +16 -0
- package/templates/settings/rust.json +11 -0
- package/templates/skills/templates/backend-conventions.md +57 -0
- package/templates/skills/templates/frontend-design-system.md +48 -0
- package/templates/skills/templates/project-patterns.md +48 -0
- package/templates/skills/universal/claude-md-maintenance.md +110 -0
- package/templates/skills/universal/context-management.md +71 -0
- package/templates/skills/universal/git-conventions.md +95 -0
- package/templates/skills/universal/planning-with-files.md +114 -0
- package/templates/skills/universal/prompt-engineering.md +97 -0
- package/templates/skills/universal/review-and-handoff.md +106 -0
- package/templates/skills/universal/subagent-usage.md +108 -0
- package/templates/skills/universal/testing.md +116 -0
- package/templates/skills/universal/verification.md +120 -0
- package/templates/spec-md-backend.md +85 -0
- package/templates/spec-md-cli.md +79 -0
- package/templates/spec-md-data.md +74 -0
- package/templates/spec-md-devops.md +87 -0
- package/templates/spec-md-frontend.md +81 -0
- package/templates/spec-md-fullstack.md +81 -0
- package/templates/spec-md-library.md +87 -0
- package/templates/spec-md.md +22 -0
- package/templates/workflow-meta.json +10 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How Claude writes rules for itself, when to update CLAUDE.md, keeping it lean and effective"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# CLAUDE.md Maintenance
|
|
6
|
+
|
|
7
|
+
## The Self-Healing Pattern
|
|
8
|
+
|
|
9
|
+
When Claude makes the same mistake twice, it should update CLAUDE.md to prevent a
|
|
10
|
+
third occurrence. This is "self-healing" — the system learns from its errors.
|
|
11
|
+
|
|
12
|
+
The cycle:
|
|
13
|
+
1. Claude makes mistake X
|
|
14
|
+
2. User corrects Claude
|
|
15
|
+
3. Claude makes mistake X again
|
|
16
|
+
4. Claude (or user) adds a rule to CLAUDE.md: "Don't do X. Do Y instead."
|
|
17
|
+
5. Mistake X doesn't happen again
|
|
18
|
+
|
|
19
|
+
This is why the Gotchas section exists. It grows organically from real problems
|
|
20
|
+
encountered during development.
|
|
21
|
+
|
|
22
|
+
## The 50-Line Target
|
|
23
|
+
|
|
24
|
+
CLAUDE.md should stay under 50 lines of actual content (excluding blank lines and
|
|
25
|
+
section headers). This is a target, not a hard limit, but exceeding it significantly
|
|
26
|
+
means CLAUDE.md is trying to do too much.
|
|
27
|
+
|
|
28
|
+
Claude reads CLAUDE.md at the start of every session and after every /compact.
|
|
29
|
+
Long CLAUDE.md files waste context on every single interaction.
|
|
30
|
+
|
|
31
|
+
## What Belongs in CLAUDE.md
|
|
32
|
+
|
|
33
|
+
YES:
|
|
34
|
+
- Project identity (name, one-line description)
|
|
35
|
+
- Key file pointers (PROGRESS.md, SPEC.md)
|
|
36
|
+
- Tech stack and build/test/run commands
|
|
37
|
+
- Session protocol (start/during/end)
|
|
38
|
+
- Critical rules (5-10 maximum)
|
|
39
|
+
- Gotchas (grows, but prune regularly)
|
|
40
|
+
- Skills pointer (list of available skills)
|
|
41
|
+
|
|
42
|
+
NO:
|
|
43
|
+
- Detailed coding standards (put in a skill)
|
|
44
|
+
- Architecture documentation (put in a skill or docs/)
|
|
45
|
+
- API documentation (put in docs/)
|
|
46
|
+
- Full workflow descriptions (put in a skill)
|
|
47
|
+
- Things Claude already knows (common language features, standard libraries)
|
|
48
|
+
|
|
49
|
+
## What Belongs in Skills vs CLAUDE.md
|
|
50
|
+
|
|
51
|
+
CLAUDE.md: things Claude needs to know EVERY session, regardless of task.
|
|
52
|
+
Skills: things Claude needs to know SOMETIMES, for specific types of work.
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
- "Use conventional commits" -> CLAUDE.md (applies to every commit)
|
|
56
|
+
- "Commit message format: type(scope): description, body explains why..." -> skill
|
|
57
|
+
(only needed when actually writing commits)
|
|
58
|
+
|
|
59
|
+
## Maintaining the Gotchas Section
|
|
60
|
+
|
|
61
|
+
The Gotchas section captures project-specific traps. Format:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
## Gotchas
|
|
65
|
+
- The settings merger must handle comment strings in JSON arrays (they're not valid
|
|
66
|
+
JSON but we support them for readability)
|
|
67
|
+
- Always use path.join(), never string concatenation for file paths — breaks on Windows
|
|
68
|
+
- The backup directory uses timestamps with colons replaced by hyphens for Windows compat
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Each gotcha should be:
|
|
72
|
+
- Specific (not "be careful with paths")
|
|
73
|
+
- Actionable (says what to do, not just what's wrong)
|
|
74
|
+
- Born from real experience (don't pre-populate with hypotheticals)
|
|
75
|
+
|
|
76
|
+
## When to Prune
|
|
77
|
+
|
|
78
|
+
Review CLAUDE.md when:
|
|
79
|
+
- It exceeds 50 lines
|
|
80
|
+
- You notice rules that no longer apply
|
|
81
|
+
- A rule has been absorbed into a skill
|
|
82
|
+
- Two rules say the same thing differently
|
|
83
|
+
|
|
84
|
+
Pruning checklist:
|
|
85
|
+
- Remove rules for code that no longer exists
|
|
86
|
+
- Consolidate duplicate rules
|
|
87
|
+
- Move detailed guidance to skills
|
|
88
|
+
- Remove gotchas that have been fixed at the code level
|
|
89
|
+
|
|
90
|
+
## Using /update-claude-md
|
|
91
|
+
|
|
92
|
+
The /update-claude-md command helps at session end:
|
|
93
|
+
1. Reviews what happened during the session
|
|
94
|
+
2. Identifies mistakes that should become rules
|
|
95
|
+
3. Identifies patterns worth documenting
|
|
96
|
+
4. Proposes additions with diffs
|
|
97
|
+
|
|
98
|
+
Always review proposed changes before applying. Not every mistake needs a rule.
|
|
99
|
+
Only add rules for recurring problems.
|
|
100
|
+
|
|
101
|
+
## Gotchas
|
|
102
|
+
|
|
103
|
+
- CLAUDE.md is read as system context, not as a document. Write it as instructions,
|
|
104
|
+
not as documentation. "Use path.join for file paths" not "The project uses
|
|
105
|
+
path.join for file paths because..."
|
|
106
|
+
- Don't add rules preemptively. Wait for the mistake to happen twice. Premature
|
|
107
|
+
rules clutter the file without proven value.
|
|
108
|
+
- If CLAUDE.md contradicts a skill file, CLAUDE.md wins. Keep them consistent.
|
|
109
|
+
- Skills are loaded on demand. CLAUDE.md is always loaded. Use this asymmetry
|
|
110
|
+
intentionally.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Context budget awareness, when to compact, when to clear, subagent offloading"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Context Management
|
|
6
|
+
|
|
7
|
+
## The 70% Rule
|
|
8
|
+
|
|
9
|
+
Context windows are finite. When you estimate you've used roughly 70% of available
|
|
10
|
+
context, it's time to act. Don't wait until you're out of room — you lose the ability
|
|
11
|
+
to reason well before you hit the hard limit.
|
|
12
|
+
|
|
13
|
+
Signs you're running low:
|
|
14
|
+
- You've read many large files in this session
|
|
15
|
+
- You've had a long back-and-forth conversation
|
|
16
|
+
- You're working on a second or third major task
|
|
17
|
+
- Responses are getting slower or less coherent
|
|
18
|
+
|
|
19
|
+
## Three Tools, Different Jobs
|
|
20
|
+
|
|
21
|
+
### /compact — Compress and continue
|
|
22
|
+
Use when: you're mid-task and need more room but want to keep working.
|
|
23
|
+
What it does: summarizes conversation history, freeing context.
|
|
24
|
+
Pair with: PostCompact hook that re-reads CLAUDE.md and PROGRESS.md automatically.
|
|
25
|
+
|
|
26
|
+
After compaction, always re-orient:
|
|
27
|
+
- What task am I working on?
|
|
28
|
+
- What branch am I on?
|
|
29
|
+
- What did I just do?
|
|
30
|
+
|
|
31
|
+
### /clear — Fresh start
|
|
32
|
+
Use when: you're starting a genuinely new task with no relationship to the current one.
|
|
33
|
+
What it does: wipes conversation entirely.
|
|
34
|
+
Caution: you lose ALL context. Make sure PROGRESS.md is updated first.
|
|
35
|
+
|
|
36
|
+
### Subagents — Offload without losing context
|
|
37
|
+
Use when: a side task would pollute your main context (research, testing, file generation).
|
|
38
|
+
What it does: spawns a separate context that does work and returns results.
|
|
39
|
+
Your main context stays clean.
|
|
40
|
+
|
|
41
|
+
## Decision Matrix
|
|
42
|
+
|
|
43
|
+
| Situation | Action |
|
|
44
|
+
|---|---|
|
|
45
|
+
| ~70% context, mid-task | /compact |
|
|
46
|
+
| Task complete, starting unrelated work | /clear |
|
|
47
|
+
| Need to research something tangential | Subagent |
|
|
48
|
+
| Need to run tests while continuing design | Subagent |
|
|
49
|
+
| Context feels sluggish, responses degrading | /compact |
|
|
50
|
+
| Long debugging session, found the fix | /compact, then implement |
|
|
51
|
+
|
|
52
|
+
## PostCompact Hook
|
|
53
|
+
|
|
54
|
+
The workflow installs a PostCompact hook that runs:
|
|
55
|
+
```
|
|
56
|
+
cat CLAUDE.md && cat docs/spec/PROGRESS.md 2>/dev/null || true
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This ensures you never lose your bearings after compaction. The hook fires
|
|
60
|
+
automatically — you don't need to re-read these files manually.
|
|
61
|
+
|
|
62
|
+
## Gotchas
|
|
63
|
+
|
|
64
|
+
- Compacting doesn't free as much context as you think. If you've read 20 large files,
|
|
65
|
+
compaction helps but won't get you back to fresh. Consider /clear if the task is done.
|
|
66
|
+
- Subagents don't share your conversation context. They start fresh. Give them explicit
|
|
67
|
+
instructions and file paths — don't assume they know what you know.
|
|
68
|
+
- Don't compact right before a complex merge or refactor. You'll lose the nuanced
|
|
69
|
+
understanding of the changes you've been building up.
|
|
70
|
+
- After /compact, always verify your understanding before making changes. The summary
|
|
71
|
+
may have lost important details.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Branch naming, commit message format, PR workflow, worktree conventions"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Git Conventions
|
|
6
|
+
|
|
7
|
+
## Branch Naming
|
|
8
|
+
|
|
9
|
+
Pattern: `{type}/{short-description}`
|
|
10
|
+
|
|
11
|
+
Types:
|
|
12
|
+
- `feature/` — New functionality
|
|
13
|
+
- `fix/` — Bug fixes
|
|
14
|
+
- `refactor/` — Code restructuring without behavior change
|
|
15
|
+
- `docs/` — Documentation only
|
|
16
|
+
- `test/` — Test additions or fixes
|
|
17
|
+
- `chore/` — Tooling, dependencies, config
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
- `feature/auth-flow`
|
|
21
|
+
- `fix/login-timeout`
|
|
22
|
+
- `refactor/extract-merger-module`
|
|
23
|
+
|
|
24
|
+
Keep branch names under 50 characters. Use hyphens, not underscores.
|
|
25
|
+
|
|
26
|
+
## Commit Messages
|
|
27
|
+
|
|
28
|
+
Follow conventional commits format:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
type(scope): short description
|
|
32
|
+
|
|
33
|
+
Longer explanation if needed. Focus on WHY, not WHAT.
|
|
34
|
+
The diff already shows what changed.
|
|
35
|
+
|
|
36
|
+
Closes #123
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `perf`, `ci`
|
|
40
|
+
|
|
41
|
+
Scope is optional but helpful: `feat(auth): add OAuth2 token refresh`
|
|
42
|
+
|
|
43
|
+
Rules:
|
|
44
|
+
- Subject line under 72 characters
|
|
45
|
+
- Imperative mood ("add" not "added" or "adds")
|
|
46
|
+
- No period at the end of the subject line
|
|
47
|
+
- Blank line between subject and body
|
|
48
|
+
- Body explains motivation, not mechanics
|
|
49
|
+
|
|
50
|
+
## When to Commit
|
|
51
|
+
|
|
52
|
+
Commit after each logical unit of work:
|
|
53
|
+
- A function is complete and tested
|
|
54
|
+
- A refactor is done and tests pass
|
|
55
|
+
- A bug is fixed and verified
|
|
56
|
+
|
|
57
|
+
Don't batch unrelated changes into one commit. Don't commit broken code.
|
|
58
|
+
|
|
59
|
+
## PR Workflow
|
|
60
|
+
|
|
61
|
+
1. Push your branch
|
|
62
|
+
2. Create PR with `gh pr create`
|
|
63
|
+
3. PR title follows same format as commit subject: `type(scope): description`
|
|
64
|
+
4. PR body includes: what changed, why, how to test, anything reviewers should know
|
|
65
|
+
5. Request review if the project has reviewers configured
|
|
66
|
+
|
|
67
|
+
## Squash vs Merge
|
|
68
|
+
|
|
69
|
+
- Squash when: the branch has many small "wip" commits that don't individually matter
|
|
70
|
+
- Merge when: each commit in the branch is a meaningful, atomic change
|
|
71
|
+
- Rebase when: you need a linear history and commits are clean
|
|
72
|
+
|
|
73
|
+
Default preference: squash merge for feature branches, regular merge for release branches.
|
|
74
|
+
|
|
75
|
+
## Worktree Conventions
|
|
76
|
+
|
|
77
|
+
When using `git worktree` for parallel work:
|
|
78
|
+
|
|
79
|
+
- Worktrees go in a sibling directory, not inside the repo
|
|
80
|
+
- Naming: `{repo}-{branch-name}` for the worktree directory
|
|
81
|
+
- Always clean up worktrees when done: `git worktree remove {path}`
|
|
82
|
+
- Don't leave stale worktrees — they hold refs and can cause confusion
|
|
83
|
+
|
|
84
|
+
Agents that use worktree isolation (code-simplifier, test-writer, ci-fixer, etc.)
|
|
85
|
+
create and clean up their own worktrees automatically.
|
|
86
|
+
|
|
87
|
+
## Gotchas
|
|
88
|
+
|
|
89
|
+
- Never force-push to main/master. Force-push to feature branches only when you
|
|
90
|
+
own the branch and have communicated with collaborators.
|
|
91
|
+
- If a rebase goes wrong, `git reflog` is your friend. The old state is still there.
|
|
92
|
+
- Don't commit generated files (build output, node_modules, .pyc) — check .gitignore.
|
|
93
|
+
- When working in worktrees, remember that stashes are shared across the repo.
|
|
94
|
+
A stash in one worktree is visible in another.
|
|
95
|
+
- Commit messages are documentation. Future you will read them. Write for that person.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "How to structure implementation plans as files, progressive implementation, plan review process"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Planning with Files
|
|
6
|
+
|
|
7
|
+
## The IMPLEMENTATION-PROMPT Pattern
|
|
8
|
+
|
|
9
|
+
Large tasks need a written plan before code. The plan lives as a file so it can be
|
|
10
|
+
reviewed, versioned, and referenced across sessions.
|
|
11
|
+
|
|
12
|
+
File naming: `IMPLEMENTATION-PROMPT-{FEATURE}.md` in the project root or `docs/` directory.
|
|
13
|
+
|
|
14
|
+
Structure:
|
|
15
|
+
```markdown
|
|
16
|
+
# Implementation: {Feature Name}
|
|
17
|
+
|
|
18
|
+
## Goal
|
|
19
|
+
One sentence. What does success look like?
|
|
20
|
+
|
|
21
|
+
## Context
|
|
22
|
+
What exists today. What needs to change. Links to relevant spec sections.
|
|
23
|
+
|
|
24
|
+
## Plan
|
|
25
|
+
|
|
26
|
+
### Phase 1: {Name}
|
|
27
|
+
- Step 1: {specific action}
|
|
28
|
+
- Verify: {how to confirm it worked}
|
|
29
|
+
- Step 2: {specific action}
|
|
30
|
+
- Verify: {how to confirm it worked}
|
|
31
|
+
|
|
32
|
+
### Phase 2: {Name}
|
|
33
|
+
...
|
|
34
|
+
|
|
35
|
+
## Edge Cases
|
|
36
|
+
- {case}: {how to handle}
|
|
37
|
+
|
|
38
|
+
## Out of Scope
|
|
39
|
+
- {thing we're explicitly NOT doing}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Breaking Large Tasks into Phases
|
|
43
|
+
|
|
44
|
+
Each phase should be:
|
|
45
|
+
- Independently testable
|
|
46
|
+
- Committable on its own
|
|
47
|
+
- Small enough for one session (or one focused block within a session)
|
|
48
|
+
|
|
49
|
+
Signs a phase is too big:
|
|
50
|
+
- More than 5-7 steps
|
|
51
|
+
- Touches more than 3-4 files substantially
|
|
52
|
+
- You can't describe the verification in one sentence
|
|
53
|
+
|
|
54
|
+
Signs a phase is too small:
|
|
55
|
+
- It's just one line change
|
|
56
|
+
- The verification is "it compiles"
|
|
57
|
+
- It doesn't move the feature forward meaningfully
|
|
58
|
+
|
|
59
|
+
## The Plan-Review Workflow
|
|
60
|
+
|
|
61
|
+
Before implementing, send the plan through the plan-reviewer agent:
|
|
62
|
+
|
|
63
|
+
1. Write the IMPLEMENTATION-PROMPT file
|
|
64
|
+
2. Use `/review-plan` to trigger review
|
|
65
|
+
3. The plan-reviewer (Opus) acts as a staff engineer:
|
|
66
|
+
- Flags ambiguity
|
|
67
|
+
- Identifies missing verification steps
|
|
68
|
+
- Checks SPEC.md alignment
|
|
69
|
+
- Questions unrealistic scope
|
|
70
|
+
- Points out edge cases
|
|
71
|
+
4. Address ALL feedback before proceeding
|
|
72
|
+
5. Update the plan file with revisions
|
|
73
|
+
|
|
74
|
+
Don't skip review for non-trivial work. The 5 minutes spent reviewing saves hours
|
|
75
|
+
of rework.
|
|
76
|
+
|
|
77
|
+
## Progressive Implementation
|
|
78
|
+
|
|
79
|
+
Execute one phase at a time:
|
|
80
|
+
1. Read the plan
|
|
81
|
+
2. Implement the phase
|
|
82
|
+
3. Run verification for that phase
|
|
83
|
+
4. Commit
|
|
84
|
+
5. Update PROGRESS.md
|
|
85
|
+
6. Move to next phase
|
|
86
|
+
|
|
87
|
+
If a phase reveals the plan was wrong, STOP. Update the plan first. Don't improvise
|
|
88
|
+
your way through a broken plan.
|
|
89
|
+
|
|
90
|
+
## When to Plan vs When to Just Do It
|
|
91
|
+
|
|
92
|
+
Plan (write an IMPLEMENTATION-PROMPT):
|
|
93
|
+
- Multi-file changes
|
|
94
|
+
- New features
|
|
95
|
+
- Architectural changes
|
|
96
|
+
- Anything touching more than 2 modules
|
|
97
|
+
|
|
98
|
+
Just do it:
|
|
99
|
+
- Bug fixes with obvious cause
|
|
100
|
+
- Single-file refactors
|
|
101
|
+
- Documentation updates
|
|
102
|
+
- Config changes
|
|
103
|
+
|
|
104
|
+
## Gotchas
|
|
105
|
+
|
|
106
|
+
- Plans rot fast. If a plan is more than 2 sessions old and hasn't been started,
|
|
107
|
+
re-review it before implementing. The codebase may have changed.
|
|
108
|
+
- Don't over-plan. The plan should be specific enough to implement without guessing
|
|
109
|
+
but not so detailed that it's pseudo-code. Trust the implementer to make
|
|
110
|
+
tactical decisions.
|
|
111
|
+
- Every step needs a verification. "Implement the auth module" is not a plan step.
|
|
112
|
+
"Implement the auth module; verify: login endpoint returns 200 with valid creds
|
|
113
|
+
and 401 with invalid" is a plan step.
|
|
114
|
+
- Keep plans in version control. They're documentation of decisions and intent.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Effective prompting patterns for working with Claude, demanding quality, writing specs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Prompt Engineering
|
|
6
|
+
|
|
7
|
+
## Challenge Claude to Do Better
|
|
8
|
+
|
|
9
|
+
Claude will give you a reasonable answer. You often want an excellent one.
|
|
10
|
+
The difference is in how you ask.
|
|
11
|
+
|
|
12
|
+
Weak: "Write a function to parse dates."
|
|
13
|
+
Strong: "Write a date parser that handles ISO 8601, RFC 2822, and common US/EU
|
|
14
|
+
formats. It should return a consistent internal representation and throw specific
|
|
15
|
+
error types for invalid input. Make it elegant — no regex spaghetti."
|
|
16
|
+
|
|
17
|
+
The strong version sets quality expectations, specifies edge cases, and demands
|
|
18
|
+
craft. Claude responds to these signals.
|
|
19
|
+
|
|
20
|
+
## Demand Elegance
|
|
21
|
+
|
|
22
|
+
When Claude produces a working but mediocre solution, push back:
|
|
23
|
+
|
|
24
|
+
- "This works but it's not elegant. Simplify it."
|
|
25
|
+
- "There's duplication between these three functions. Refactor."
|
|
26
|
+
- "This is too clever. Make it readable."
|
|
27
|
+
- "A junior engineer should understand this. Rewrite for clarity."
|
|
28
|
+
|
|
29
|
+
Don't accept the first output as final. Iterate.
|
|
30
|
+
|
|
31
|
+
## When to Be Specific vs When to Delegate
|
|
32
|
+
|
|
33
|
+
Be specific about:
|
|
34
|
+
- Requirements (what the code MUST do)
|
|
35
|
+
- Constraints (performance, compatibility, patterns to follow)
|
|
36
|
+
- Verification criteria (how to know it works)
|
|
37
|
+
|
|
38
|
+
Delegate to Claude:
|
|
39
|
+
- Implementation approach (unless you have a strong preference)
|
|
40
|
+
- Variable naming and code organization details
|
|
41
|
+
- Which standard library functions to use
|
|
42
|
+
- Test case generation (give the categories, let Claude enumerate)
|
|
43
|
+
|
|
44
|
+
## Writing Detailed Specs
|
|
45
|
+
|
|
46
|
+
A good spec eliminates ambiguity. The SPEC.md pattern works because it forces
|
|
47
|
+
specificity before implementation begins.
|
|
48
|
+
|
|
49
|
+
Spec checklist:
|
|
50
|
+
- Every feature described with concrete examples
|
|
51
|
+
- Input/output pairs for non-obvious behavior
|
|
52
|
+
- Error cases listed explicitly
|
|
53
|
+
- "Out of scope" section to prevent feature creep
|
|
54
|
+
- Success criteria that can be mechanically verified
|
|
55
|
+
|
|
56
|
+
## The IMPLEMENTATION-PROMPT as a Prompt
|
|
57
|
+
|
|
58
|
+
The implementation prompt IS your prompt to Claude for a work session. Write it
|
|
59
|
+
like you're briefing a skilled contractor:
|
|
60
|
+
|
|
61
|
+
1. Here's what exists (context)
|
|
62
|
+
2. Here's what we need (goal)
|
|
63
|
+
3. Here's how to do it (plan)
|
|
64
|
+
4. Here's how to check your work (verification)
|
|
65
|
+
5. Here's what NOT to do (constraints)
|
|
66
|
+
|
|
67
|
+
## Prompting Anti-Patterns
|
|
68
|
+
|
|
69
|
+
- Vague asks: "Make the code better" — better HOW?
|
|
70
|
+
- Kitchen sink: asking for 10 things at once with no priority order
|
|
71
|
+
- Assuming context: referencing decisions made 500 messages ago without restating them
|
|
72
|
+
- Over-constraining: specifying the exact implementation when only the interface matters
|
|
73
|
+
- Under-specifying errors: "handle errors appropriately" — define what appropriate means
|
|
74
|
+
|
|
75
|
+
## Working with Models at Different Levels
|
|
76
|
+
|
|
77
|
+
Opus: Use for judgment calls, architectural decisions, plan review. Give it the full
|
|
78
|
+
picture and ask for analysis.
|
|
79
|
+
|
|
80
|
+
Sonnet: Use for implementation, testing, code review. Give it specific tasks with
|
|
81
|
+
clear scope.
|
|
82
|
+
|
|
83
|
+
Haiku: Use for validation, formatting checks, simple queries. Give it narrow tasks
|
|
84
|
+
with yes/no or pass/fail outcomes.
|
|
85
|
+
|
|
86
|
+
Match the task complexity to the model capability.
|
|
87
|
+
|
|
88
|
+
## Gotchas
|
|
89
|
+
|
|
90
|
+
- Claude remembers everything in the conversation. You don't need to repeat instructions
|
|
91
|
+
that are already in context. But after /compact, re-state critical constraints.
|
|
92
|
+
- If Claude keeps making the same mistake, the problem is probably in your instructions,
|
|
93
|
+
not in Claude. Rephrase, add an example, or add a rule to CLAUDE.md.
|
|
94
|
+
- Long prompts aren't always better. A focused 3-line instruction often outperforms
|
|
95
|
+
a rambling paragraph. Be concise about what matters.
|
|
96
|
+
- When Claude says "I'll do X" but you wanted Y, correct immediately. Don't let
|
|
97
|
+
wrong assumptions propagate through a chain of actions.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Session ending protocol, HANDOFF document format, seamless continuation between sessions"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Review and Handoff
|
|
6
|
+
|
|
7
|
+
## Session Ending Protocol
|
|
8
|
+
|
|
9
|
+
Every session should end cleanly. The /end command triggers this, but understanding
|
|
10
|
+
the protocol matters more than the command.
|
|
11
|
+
|
|
12
|
+
Before ending:
|
|
13
|
+
1. Commit any working code (don't leave uncommitted changes)
|
|
14
|
+
2. Run tests to confirm nothing is broken
|
|
15
|
+
3. Update PROGRESS.md
|
|
16
|
+
4. If mid-task, write a HANDOFF document
|
|
17
|
+
|
|
18
|
+
## PROGRESS.md Update
|
|
19
|
+
|
|
20
|
+
PROGRESS.md is the single source of truth for project state across sessions.
|
|
21
|
+
|
|
22
|
+
Update these sections:
|
|
23
|
+
```markdown
|
|
24
|
+
## Current Status
|
|
25
|
+
{What phase/feature is active}
|
|
26
|
+
|
|
27
|
+
## Completed This Session
|
|
28
|
+
- {Specific thing done}
|
|
29
|
+
- {Another specific thing done}
|
|
30
|
+
|
|
31
|
+
## In Progress
|
|
32
|
+
- {What's partially done, and where it stands}
|
|
33
|
+
|
|
34
|
+
## Blockers
|
|
35
|
+
- {Anything preventing forward progress}
|
|
36
|
+
|
|
37
|
+
## Next Steps
|
|
38
|
+
- {Ordered list of what to do next}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Be specific. "Worked on auth" is useless. "Implemented JWT token generation and
|
|
42
|
+
validation in src/auth/tokens.js; unit tests passing; integration tests not yet
|
|
43
|
+
written" is useful.
|
|
44
|
+
|
|
45
|
+
## HANDOFF Document Format
|
|
46
|
+
|
|
47
|
+
When ending mid-task, PROGRESS.md isn't enough. Write a handoff at
|
|
48
|
+
`docs/handoffs/HANDOFF_{date}.md`.
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# Handoff: {Date}
|
|
52
|
+
|
|
53
|
+
## What I Was Doing
|
|
54
|
+
{1-2 sentences on the exact task}
|
|
55
|
+
|
|
56
|
+
## Current State
|
|
57
|
+
- Branch: {branch name}
|
|
58
|
+
- Last commit: {hash and message}
|
|
59
|
+
- Tests: {passing/failing, which ones}
|
|
60
|
+
- Files changed: {list of modified files}
|
|
61
|
+
|
|
62
|
+
## What's Left
|
|
63
|
+
1. {Next specific step}
|
|
64
|
+
2. {Step after that}
|
|
65
|
+
3. {Final step for this task}
|
|
66
|
+
|
|
67
|
+
## Context That Matters
|
|
68
|
+
- {Decision made during this session and why}
|
|
69
|
+
- {Gotcha discovered that isn't documented elsewhere}
|
|
70
|
+
- {Assumption being made that should be validated}
|
|
71
|
+
|
|
72
|
+
## How to Verify When Done
|
|
73
|
+
{What "done" looks like for this task}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## What Context Matters
|
|
77
|
+
|
|
78
|
+
Include in handoffs:
|
|
79
|
+
- WHY decisions were made, not just what
|
|
80
|
+
- Failed approaches and why they failed (prevents re-trying dead ends)
|
|
81
|
+
- Dependencies discovered during implementation
|
|
82
|
+
- Anything that surprised you about the codebase
|
|
83
|
+
|
|
84
|
+
Don't include:
|
|
85
|
+
- Obvious things a fresh session can figure out from the code
|
|
86
|
+
- Full code dumps (the code is in version control)
|
|
87
|
+
- Speculation about future tasks unrelated to the current work
|
|
88
|
+
|
|
89
|
+
## The Fresh Session Test
|
|
90
|
+
|
|
91
|
+
A good handoff passes this test: could a fresh Claude session, reading only
|
|
92
|
+
PROGRESS.md and the HANDOFF file, continue the work without asking clarifying
|
|
93
|
+
questions?
|
|
94
|
+
|
|
95
|
+
If no, the handoff is missing context.
|
|
96
|
+
|
|
97
|
+
## Gotchas
|
|
98
|
+
|
|
99
|
+
- Don't skip the handoff because "it's almost done." You might not get back to
|
|
100
|
+
this task for days. What's obvious now will be opaque later.
|
|
101
|
+
- HANDOFF files are ephemeral. Delete them once the task is complete. Don't let
|
|
102
|
+
stale handoffs accumulate — they become misleading.
|
|
103
|
+
- Always commit before writing the handoff. The handoff references a commit hash.
|
|
104
|
+
If the code isn't committed, the handoff points to nothing.
|
|
105
|
+
- Update PROGRESS.md even if you write a HANDOFF. PROGRESS.md is the persistent
|
|
106
|
+
state; HANDOFF is the detailed supplement.
|