cc-dev-template 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/bin/install.js +165 -0
- package/package.json +24 -0
- package/src/agents/claude-md-agent.md +71 -0
- package/src/agents/decomposition-agent.md +103 -0
- package/src/agents/execution-agent.md +133 -0
- package/src/agents/rca-agent.md +158 -0
- package/src/agents/tdd-agent.md +163 -0
- package/src/commands/finalize.md +83 -0
- package/src/commands/prime.md +5 -0
- package/src/scripts/adr-list.js +170 -0
- package/src/scripts/adr-tags.js +125 -0
- package/src/scripts/merge-settings.js +187 -0
- package/src/scripts/statusline-config.json +7 -0
- package/src/scripts/statusline.js +365 -0
- package/src/scripts/validate-yaml.js +128 -0
- package/src/scripts/yaml-validation-hook.json +15 -0
- package/src/skills/orchestration/SKILL.md +127 -0
- package/src/skills/orchestration/references/debugging/describe.md +122 -0
- package/src/skills/orchestration/references/debugging/fix.md +110 -0
- package/src/skills/orchestration/references/debugging/learn.md +162 -0
- package/src/skills/orchestration/references/debugging/rca.md +84 -0
- package/src/skills/orchestration/references/debugging/verify.md +95 -0
- package/src/skills/orchestration/references/execution/complete.md +161 -0
- package/src/skills/orchestration/references/execution/start.md +66 -0
- package/src/skills/orchestration/references/execution/tasks.md +92 -0
- package/src/skills/orchestration/references/planning/draft.md +195 -0
- package/src/skills/orchestration/references/planning/explore.md +129 -0
- package/src/skills/orchestration/references/planning/finalize.md +169 -0
- package/src/skills/orchestration/references/planning/start.md +115 -0
- package/src/skills/orchestration/scripts/plan-status.js +283 -0
- package/src/skills/prompting/SKILL.md +123 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Planning Phase 4: Finalize
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Validate the plan against architectural constraints and get user approval. This is the last step before the plan is ready for the execution workflow.
|
|
6
|
+
|
|
7
|
+
Validation catches ADR conflicts while they're cheap to fix. Approval ensures the user agrees with what's about to be built.
|
|
8
|
+
|
|
9
|
+
**Success looks like**: The plan complies with all relevant ADRs, the user has approved it, and it's ready for the execution workflow.
|
|
10
|
+
|
|
11
|
+
## What To Do
|
|
12
|
+
|
|
13
|
+
Complete each step in order before proceeding to the next.
|
|
14
|
+
|
|
15
|
+
<steps>
|
|
16
|
+
|
|
17
|
+
<step name="Validate Against ADRs">
|
|
18
|
+
Spawn the adr-agent to validate the plan. The agent will:
|
|
19
|
+
- Read the plan.yaml
|
|
20
|
+
- Find ALL ADRs that might be relevant (not just the ones declared in the plan)
|
|
21
|
+
- Check compliance for each: COMPLIANT, TENSION, or CONFLICT
|
|
22
|
+
- Report what needs attention
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Spawn adr-agent: "Validate the plan at .claude/plans/[slug]/plan.yaml.
|
|
26
|
+
|
|
27
|
+
Find all ADRs that could be relevant to this work—check beyond what's
|
|
28
|
+
declared in the plan's relevant_adrs field. Better to surface extra
|
|
29
|
+
ADRs than miss important ones.
|
|
30
|
+
|
|
31
|
+
For each relevant ADR, report:
|
|
32
|
+
- COMPLIANT: Plan follows this ADR
|
|
33
|
+
- TENSION: Potential friction, worth noting
|
|
34
|
+
- CONFLICT: Plan violates this ADR, must resolve
|
|
35
|
+
|
|
36
|
+
Return a validation report with findings for each ADR."
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Show the validation report to the user** before proceeding.
|
|
40
|
+
</step>
|
|
41
|
+
|
|
42
|
+
<step name="Handle Validation Results">
|
|
43
|
+
**If all COMPLIANT (or only TENSION):**
|
|
44
|
+
- Note any tensions for awareness
|
|
45
|
+
- Proceed to user approval
|
|
46
|
+
|
|
47
|
+
**If CONFLICT found:**
|
|
48
|
+
- Present the conflicts to the user clearly
|
|
49
|
+
- For each conflict, explain:
|
|
50
|
+
- Which ADR is violated
|
|
51
|
+
- What the ADR requires
|
|
52
|
+
- How the plan conflicts
|
|
53
|
+
- Work with the user to resolve:
|
|
54
|
+
- Adjust the plan to comply
|
|
55
|
+
- Or discuss whether the ADR needs updating (spawn adr-agent to supersede if so)
|
|
56
|
+
- Re-validate after changes
|
|
57
|
+
|
|
58
|
+
Use AskUserQuestion to discuss conflicts:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
AskUserQuestion:
|
|
62
|
+
Question: "The plan conflicts with [ADR-XXX]. How should we resolve this?"
|
|
63
|
+
Options:
|
|
64
|
+
- "Adjust the plan" - I'll describe what to change
|
|
65
|
+
- "The ADR is outdated" - Let's update or supersede the ADR
|
|
66
|
+
- "Let's discuss" - I need more context before deciding
|
|
67
|
+
- "Something else" - I have a different approach
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Iterate until validation passes (no CONFLICT items).
|
|
71
|
+
</step>
|
|
72
|
+
|
|
73
|
+
<checkpoint>
|
|
74
|
+
Before proceeding to approval:
|
|
75
|
+
- adr-agent was spawned and returned results
|
|
76
|
+
- Validation report was shown to user
|
|
77
|
+
- Any CONFLICT items have been resolved
|
|
78
|
+
</checkpoint>
|
|
79
|
+
|
|
80
|
+
<step name="Present Final Plan">
|
|
81
|
+
Once validation passes, present the plan summary to the user:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
## Plan Ready for Approval
|
|
85
|
+
|
|
86
|
+
**Title**: [plan title]
|
|
87
|
+
**Type**: [feature / enhancement / refactor]
|
|
88
|
+
|
|
89
|
+
**Problem**: [1-2 sentence summary]
|
|
90
|
+
|
|
91
|
+
**Goals**:
|
|
92
|
+
- [Goal 1]
|
|
93
|
+
- [Goal 2]
|
|
94
|
+
|
|
95
|
+
**Success Criteria**:
|
|
96
|
+
- [Criterion 1]
|
|
97
|
+
- [Criterion 2]
|
|
98
|
+
|
|
99
|
+
**Key Components**:
|
|
100
|
+
- [Data models, API contracts, integration points - high level]
|
|
101
|
+
|
|
102
|
+
**Relevant ADRs**: [list with compliance status]
|
|
103
|
+
|
|
104
|
+
The plan has been validated against architectural constraints.
|
|
105
|
+
```
|
|
106
|
+
</step>
|
|
107
|
+
|
|
108
|
+
<step name="Get Approval">
|
|
109
|
+
Use AskUserQuestion to get explicit approval:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
AskUserQuestion:
|
|
113
|
+
Question: "Approve this plan?"
|
|
114
|
+
Options:
|
|
115
|
+
- "Approved" - Mark as approved
|
|
116
|
+
- "Needs changes" - I'll explain what to adjust
|
|
117
|
+
- "Let's discuss first" - I have questions
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**If approved:**
|
|
121
|
+
1. Update plan.yaml: `status: approved`
|
|
122
|
+
2. Update plan.yaml: `updated: [today's date]`
|
|
123
|
+
|
|
124
|
+
**If changes requested:**
|
|
125
|
+
- Make the requested changes
|
|
126
|
+
- Re-validate if changes affect ADR compliance
|
|
127
|
+
- Present again and get approval
|
|
128
|
+
</step>
|
|
129
|
+
|
|
130
|
+
<checkpoint>
|
|
131
|
+
Before proceeding to execution handoff:
|
|
132
|
+
- Plan summary was presented to user
|
|
133
|
+
- User explicitly selected "Approved"
|
|
134
|
+
- plan.yaml status is now `approved`
|
|
135
|
+
</checkpoint>
|
|
136
|
+
|
|
137
|
+
<step name="Offer Next Steps">
|
|
138
|
+
Ask what the user wants to do next:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
AskUserQuestion:
|
|
142
|
+
Question: "Plan approved. What's next?"
|
|
143
|
+
Options:
|
|
144
|
+
- "Start the execution workflow" - Proceed to decomposition phase
|
|
145
|
+
- "Stop here for now" - Save and exit
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**If "Start the execution workflow":**
|
|
149
|
+
Read `references/execution/start.md` to begin. The execution workflow starts with decomposition—breaking the plan into tasks. Agents handle implementation; you orchestrate.
|
|
150
|
+
|
|
151
|
+
**If "Stop here for now":**
|
|
152
|
+
End with: "Plan saved and approved. Run `/prime` when you're ready to start the execution workflow."
|
|
153
|
+
</step>
|
|
154
|
+
|
|
155
|
+
</steps>
|
|
156
|
+
|
|
157
|
+
## Key Principles
|
|
158
|
+
|
|
159
|
+
**Validate thoroughly.** The adr-agent should find ADRs beyond what's declared. Missing a relevant ADR now means discovering violations during execution.
|
|
160
|
+
|
|
161
|
+
**Resolve conflicts before approval.** A plan with known ADR conflicts shouldn't be approved. Either fix the plan or update the ADR.
|
|
162
|
+
|
|
163
|
+
**Get explicit approval.** The plan represents a commitment. Make sure the user consciously agrees before marking it approved.
|
|
164
|
+
|
|
165
|
+
**Approval and next steps are separate decisions.** Get approval first. Then ask about execution. Don't combine these into one question.
|
|
166
|
+
|
|
167
|
+
<transition>
|
|
168
|
+
When the user chooses to start execution, read `references/execution/start.md` to begin the execution workflow.
|
|
169
|
+
</transition>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Planning Phase 1: Requirements
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Transform a vague idea into a crystal clear understanding of WHAT we're building and what SUCCESS looks like.
|
|
6
|
+
|
|
7
|
+
This phase is about understanding the problem, not solving it. Stay focused on goals, success criteria, and removing ambiguity. Implementation details (the HOW) come later in exploration and drafting phases.
|
|
8
|
+
|
|
9
|
+
**Success looks like**: You can articulate exactly what the user wants to build, why it matters, and how we'll know when it's done—with zero ambiguity.
|
|
10
|
+
|
|
11
|
+
## What To Do
|
|
12
|
+
|
|
13
|
+
Complete each step in order before proceeding to the next.
|
|
14
|
+
|
|
15
|
+
<steps>
|
|
16
|
+
|
|
17
|
+
<step name="Ask What They Want to Plan">
|
|
18
|
+
Start with a simple, open-ended question. Let the user describe their idea in their own words.
|
|
19
|
+
|
|
20
|
+
Just ask: **"What do you want to plan?"**
|
|
21
|
+
|
|
22
|
+
Let them write freely here (save AskUserQuestion for the clarifying questions). They'll dump out their thoughts, context, and initial ideas. Your job is to listen and absorb.
|
|
23
|
+
</step>
|
|
24
|
+
|
|
25
|
+
<step name="Probe for Clarity">
|
|
26
|
+
After the user describes what they want, your job is to remove all ambiguity. Use `AskUserQuestion` to dig into anything that's unclear.
|
|
27
|
+
|
|
28
|
+
**Focus on these areas:**
|
|
29
|
+
|
|
30
|
+
1. **Goals**: What are they trying to achieve? What problem does this solve?
|
|
31
|
+
2. **Success criteria**: How will we know when this is done? What does "working" look like?
|
|
32
|
+
3. **Scope boundaries**: What's included? What's explicitly NOT included?
|
|
33
|
+
4. **Ambiguities**: Anything in their description that could be interpreted multiple ways
|
|
34
|
+
|
|
35
|
+
**Ask one clarifying question at a time.** After each answer, assess: Is there still ambiguity? If yes, ask another question. If no, move on.
|
|
36
|
+
|
|
37
|
+
**Example clarifying questions:**
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
"You mentioned [X]. What specifically should happen when [X]?"
|
|
41
|
+
|
|
42
|
+
"What does success look like for this? How will you know it's working?"
|
|
43
|
+
|
|
44
|
+
"Is [Y] part of this work, or should we consider that out of scope?"
|
|
45
|
+
|
|
46
|
+
"When you say [Z], do you mean [interpretation A] or [interpretation B]?"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Always include an escape hatch** in your AskUserQuestion options—something like "Something else" or "Let me explain" so the user can provide context that doesn't fit your options.
|
|
50
|
+
</step>
|
|
51
|
+
|
|
52
|
+
<step name="Keep Going Until Clear">
|
|
53
|
+
Continue asking clarifying questions until ONE of these is true:
|
|
54
|
+
|
|
55
|
+
- **You have no more questions**: Every aspect of what they want is crystal clear
|
|
56
|
+
- **The user says stop**: They indicate they've clarified enough ("I think that covers it", "Let's move on", etc.)
|
|
57
|
+
|
|
58
|
+
Take your time here. Ambiguity discovered now is cheap to resolve. Ambiguity discovered during implementation is expensive.
|
|
59
|
+
</step>
|
|
60
|
+
|
|
61
|
+
<step name="Summarize What You Learned">
|
|
62
|
+
Before moving on, summarize your understanding back to the user:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
## Here's what I understand:
|
|
66
|
+
|
|
67
|
+
**What we're building**: [1-2 sentence summary]
|
|
68
|
+
|
|
69
|
+
**Goals**:
|
|
70
|
+
- [Goal 1]
|
|
71
|
+
- [Goal 2]
|
|
72
|
+
|
|
73
|
+
**Success criteria** (how we'll know it's done):
|
|
74
|
+
- [Criterion 1]
|
|
75
|
+
- [Criterion 2]
|
|
76
|
+
|
|
77
|
+
**Scope**:
|
|
78
|
+
- Includes: [what's in]
|
|
79
|
+
- Excludes: [what's out]
|
|
80
|
+
|
|
81
|
+
**Type**: [feature / enhancement / refactor / bug fix]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then confirm:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
AskUserQuestion:
|
|
88
|
+
Question: "Does this capture what you want to build?"
|
|
89
|
+
Options:
|
|
90
|
+
- "Yes, that's right" - Proceed to codebase exploration
|
|
91
|
+
- "Mostly, but..." - I'll clarify what needs adjustment
|
|
92
|
+
- "No, let's try again" - Start over with a fresh description
|
|
93
|
+
```
|
|
94
|
+
</step>
|
|
95
|
+
|
|
96
|
+
<checkpoint>
|
|
97
|
+
Before proceeding to the next phase:
|
|
98
|
+
- User has described what they want
|
|
99
|
+
- All ambiguities have been clarified
|
|
100
|
+
- Summary has been presented and confirmed
|
|
101
|
+
</checkpoint>
|
|
102
|
+
|
|
103
|
+
</steps>
|
|
104
|
+
|
|
105
|
+
## Key Principles
|
|
106
|
+
|
|
107
|
+
**Stay focused on WHAT, not HOW.** Keep questions about goals, success criteria, and scope. Save implementation questions ("Which framework? What database?") for later phases.
|
|
108
|
+
|
|
109
|
+
**Ask when uncertain.** If something is unclear, ask. Let the user fill in the blanks rather than assuming.
|
|
110
|
+
|
|
111
|
+
**Invest time here.** This phase sets the foundation. A few extra minutes of clarity now saves hours of rework later.
|
|
112
|
+
|
|
113
|
+
<transition>
|
|
114
|
+
When the user confirms your summary is accurate, read `references/planning/explore.md` to continue to codebase exploration.
|
|
115
|
+
</transition>
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* plan-status.js - List active plans and debug sessions in the project
|
|
5
|
+
*
|
|
6
|
+
* This CLI script scans .claude/plans/ and .claude/debug/ for active work
|
|
7
|
+
* and outputs structured information. Completed items are filtered out
|
|
8
|
+
* since they're no longer actionable. Designed to support /prime command
|
|
9
|
+
* by quickly surfacing "where are we" and "what can we do" without manual
|
|
10
|
+
* file scanning.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* node ~/.claude/scripts/plan-status.js
|
|
14
|
+
*
|
|
15
|
+
* Output:
|
|
16
|
+
* JSON object to stdout:
|
|
17
|
+
* {
|
|
18
|
+
* "plans": [
|
|
19
|
+
* {
|
|
20
|
+
* "id": "plan-feature-auth",
|
|
21
|
+
* "title": "Authentication Feature",
|
|
22
|
+
* "status": "approved",
|
|
23
|
+
* "path": ".claude/plans/feature-auth/"
|
|
24
|
+
* }
|
|
25
|
+
* ],
|
|
26
|
+
* "debugSessions": [
|
|
27
|
+
* {
|
|
28
|
+
* "id": "debug-001",
|
|
29
|
+
* "title": "Avatar not updating",
|
|
30
|
+
* "status": "investigating",
|
|
31
|
+
* "phase": "rca",
|
|
32
|
+
* "path": ".claude/debug/avatar-not-updating/"
|
|
33
|
+
* }
|
|
34
|
+
* ]
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* Directory structure:
|
|
38
|
+
* .claude/plans/[slug]/
|
|
39
|
+
* plan.yaml - Plan definition (id, title, status)
|
|
40
|
+
* manifest.yaml - Task manifest with completion status (optional)
|
|
41
|
+
*
|
|
42
|
+
* .claude/debug/[slug]/
|
|
43
|
+
* debug.yaml - Debug session (id, title, status, hypotheses)
|
|
44
|
+
*
|
|
45
|
+
* Note: This script uses process.cwd() to find project-local files, since
|
|
46
|
+
* scripts install globally to ~/.claude/scripts/ but need to access the
|
|
47
|
+
* project's .claude/ directories.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
const fs = require('fs');
|
|
51
|
+
const path = require('path');
|
|
52
|
+
const yaml = require('js-yaml');
|
|
53
|
+
|
|
54
|
+
// Directories are in the project's .claude/ directory (relative to CWD)
|
|
55
|
+
const PLANS_DIR = path.join(process.cwd(), '.claude', 'plans');
|
|
56
|
+
const DEBUG_DIR = path.join(process.cwd(), '.claude', 'debug');
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Read and parse a YAML file
|
|
60
|
+
* @param {string} filePath - Absolute path to the YAML file
|
|
61
|
+
* @returns {object | null} - Parsed YAML data or null on error
|
|
62
|
+
*/
|
|
63
|
+
function parseYamlFile(filePath) {
|
|
64
|
+
try {
|
|
65
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
66
|
+
return yaml.load(content);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
// Log to stderr so it doesn't pollute JSON output
|
|
69
|
+
console.error(`Warning: Failed to parse ${filePath}: ${error.message}`);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Count completed and total tasks from a manifest
|
|
76
|
+
* @param {object} manifest - Parsed manifest.yaml data
|
|
77
|
+
* @returns {{ total: number, completed: number } | null}
|
|
78
|
+
*/
|
|
79
|
+
function countTasks(manifest) {
|
|
80
|
+
if (!manifest || !Array.isArray(manifest.tasks)) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const total = manifest.tasks.length;
|
|
85
|
+
const completed = manifest.tasks.filter(task => task.status === 'completed').length;
|
|
86
|
+
|
|
87
|
+
return { total, completed };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get plan information from a plan directory
|
|
92
|
+
* @param {string} planDir - Absolute path to the plan directory
|
|
93
|
+
* @param {string} slug - Directory name (slug)
|
|
94
|
+
* @returns {object | null} - Plan info object or null if invalid
|
|
95
|
+
*/
|
|
96
|
+
function getPlanInfo(planDir, slug) {
|
|
97
|
+
const planPath = path.join(planDir, 'plan.yaml');
|
|
98
|
+
const manifestPath = path.join(planDir, 'manifest.yaml');
|
|
99
|
+
|
|
100
|
+
// plan.yaml is required
|
|
101
|
+
if (!fs.existsSync(planPath)) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const plan = parseYamlFile(planPath);
|
|
106
|
+
if (!plan) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Build plan info object
|
|
111
|
+
const planInfo = {
|
|
112
|
+
id: plan.id || `plan-${slug}`,
|
|
113
|
+
title: plan.title || '',
|
|
114
|
+
status: plan.status || 'unknown',
|
|
115
|
+
path: `.claude/plans/${slug}/`
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// If manifest exists, use its status and add task counts
|
|
119
|
+
// The manifest represents actual execution progress, so it overrides plan.yaml status
|
|
120
|
+
if (fs.existsSync(manifestPath)) {
|
|
121
|
+
const manifest = parseYamlFile(manifestPath);
|
|
122
|
+
|
|
123
|
+
// Use manifest status if present (represents actual progress)
|
|
124
|
+
if (manifest && manifest.status) {
|
|
125
|
+
planInfo.status = manifest.status;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Add task counts from manifest
|
|
129
|
+
const taskCounts = countTasks(manifest);
|
|
130
|
+
if (taskCounts) {
|
|
131
|
+
planInfo.tasks = taskCounts;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return planInfo;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Scan plans directory and collect all plan information
|
|
140
|
+
* @returns {Array<object>} - Array of plan info objects
|
|
141
|
+
*/
|
|
142
|
+
function collectPlans() {
|
|
143
|
+
const plans = [];
|
|
144
|
+
|
|
145
|
+
// Check if plans directory exists - return empty array if not
|
|
146
|
+
if (!fs.existsSync(PLANS_DIR)) {
|
|
147
|
+
return plans;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Get all subdirectories in plans directory
|
|
151
|
+
let entries;
|
|
152
|
+
try {
|
|
153
|
+
entries = fs.readdirSync(PLANS_DIR, { withFileTypes: true });
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.error(`Warning: Failed to read plans directory: ${error.message}`);
|
|
156
|
+
return plans;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Process each plan directory
|
|
160
|
+
const planDirs = entries
|
|
161
|
+
.filter(entry => entry.isDirectory())
|
|
162
|
+
.map(entry => entry.name)
|
|
163
|
+
.sort(); // Sort alphabetically for consistent ordering
|
|
164
|
+
|
|
165
|
+
for (const slug of planDirs) {
|
|
166
|
+
const planDir = path.join(PLANS_DIR, slug);
|
|
167
|
+
const planInfo = getPlanInfo(planDir, slug);
|
|
168
|
+
|
|
169
|
+
// Only include non-completed plans
|
|
170
|
+
if (planInfo && planInfo.status !== 'completed') {
|
|
171
|
+
plans.push(planInfo);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return plans;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Determine which debug phase based on debug.yaml state
|
|
180
|
+
* @param {object} debug - Parsed debug.yaml data
|
|
181
|
+
* @returns {string} - Phase name (describe, rca, verify, fix, learn)
|
|
182
|
+
*/
|
|
183
|
+
function determineDebugPhase(debug) {
|
|
184
|
+
if (!debug || debug.status === 'closed') {
|
|
185
|
+
return 'closed';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const hypotheses = debug.hypotheses || [];
|
|
189
|
+
if (hypotheses.length === 0) {
|
|
190
|
+
return 'rca';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Check the latest hypothesis status
|
|
194
|
+
const latest = hypotheses[hypotheses.length - 1];
|
|
195
|
+
switch (latest.status) {
|
|
196
|
+
case 'investigating':
|
|
197
|
+
return 'rca';
|
|
198
|
+
case 'verified':
|
|
199
|
+
return 'fix';
|
|
200
|
+
case 'disproven':
|
|
201
|
+
return 'rca';
|
|
202
|
+
case 'fixed':
|
|
203
|
+
return 'learn';
|
|
204
|
+
default:
|
|
205
|
+
return 'rca';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Get debug session information from a debug directory
|
|
211
|
+
* @param {string} debugDir - Absolute path to the debug directory
|
|
212
|
+
* @param {string} slug - Directory name (slug)
|
|
213
|
+
* @returns {object | null} - Debug info object or null if invalid
|
|
214
|
+
*/
|
|
215
|
+
function getDebugInfo(debugDir, slug) {
|
|
216
|
+
const debugPath = path.join(debugDir, 'debug.yaml');
|
|
217
|
+
|
|
218
|
+
if (!fs.existsSync(debugPath)) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const debug = parseYamlFile(debugPath);
|
|
223
|
+
if (!debug) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return {
|
|
228
|
+
id: debug.id || `debug-${slug}`,
|
|
229
|
+
title: debug.title || '',
|
|
230
|
+
status: debug.status || 'unknown',
|
|
231
|
+
phase: determineDebugPhase(debug),
|
|
232
|
+
path: `.claude/debug/${slug}/`
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Scan debug directory and collect all active debug sessions
|
|
238
|
+
* @returns {Array<object>} - Array of debug info objects
|
|
239
|
+
*/
|
|
240
|
+
function collectDebugSessions() {
|
|
241
|
+
const sessions = [];
|
|
242
|
+
|
|
243
|
+
if (!fs.existsSync(DEBUG_DIR)) {
|
|
244
|
+
return sessions;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let entries;
|
|
248
|
+
try {
|
|
249
|
+
entries = fs.readdirSync(DEBUG_DIR, { withFileTypes: true });
|
|
250
|
+
} catch (error) {
|
|
251
|
+
console.error(`Warning: Failed to read debug directory: ${error.message}`);
|
|
252
|
+
return sessions;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const debugDirs = entries
|
|
256
|
+
.filter(entry => entry.isDirectory())
|
|
257
|
+
.map(entry => entry.name)
|
|
258
|
+
.sort();
|
|
259
|
+
|
|
260
|
+
for (const slug of debugDirs) {
|
|
261
|
+
const debugDir = path.join(DEBUG_DIR, slug);
|
|
262
|
+
const debugInfo = getDebugInfo(debugDir, slug);
|
|
263
|
+
|
|
264
|
+
// Only include non-closed sessions
|
|
265
|
+
if (debugInfo && debugInfo.status !== 'closed') {
|
|
266
|
+
sessions.push(debugInfo);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return sessions;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Main execution
|
|
274
|
+
function main() {
|
|
275
|
+
const plans = collectPlans();
|
|
276
|
+
const debugSessions = collectDebugSessions();
|
|
277
|
+
|
|
278
|
+
// Output JSON to stdout
|
|
279
|
+
const output = { plans, debugSessions };
|
|
280
|
+
console.log(JSON.stringify(output, null, 2));
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
main();
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prompting
|
|
3
|
+
description: Best practices for creating effective Claude prompts. Use when creating, reviewing, or modifying prompts for agents or commands.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prompting Skill
|
|
7
|
+
|
|
8
|
+
Actionable guidance for crafting effective prompts for Claude 4.x models. Apply these principles when creating or reviewing agent prompts, command specifications, or any structured Claude interactions.
|
|
9
|
+
|
|
10
|
+
## Core Principles
|
|
11
|
+
|
|
12
|
+
Apply in order of importance:
|
|
13
|
+
|
|
14
|
+
### 1. Explain WHY, Not Just WHAT (Most Important)
|
|
15
|
+
|
|
16
|
+
Provide purpose and context rather than exhaustive implementation details. Trust Claude's intelligence.
|
|
17
|
+
|
|
18
|
+
**Mental Model**: Treat Claude like a brilliant senior colleague, not a junior who needs hand-holding.
|
|
19
|
+
|
|
20
|
+
**Provide**:
|
|
21
|
+
- The goal or purpose of the task
|
|
22
|
+
- Why this matters (business context, use case)
|
|
23
|
+
- Constraints that exist (technical, business, regulatory)
|
|
24
|
+
- What success looks like
|
|
25
|
+
|
|
26
|
+
**Avoid providing**:
|
|
27
|
+
- Every possible edge case
|
|
28
|
+
- Step-by-step implementation unless genuinely needed
|
|
29
|
+
- Obvious best practices for the domain
|
|
30
|
+
|
|
31
|
+
### 2. Use Positive Framing
|
|
32
|
+
|
|
33
|
+
Tell Claude what TO do, not what NOT to do. Negatives require extra processing and can prime unwanted behavior.
|
|
34
|
+
|
|
35
|
+
| Negative Framing | Positive Framing |
|
|
36
|
+
|------------------|------------------|
|
|
37
|
+
| "Don't hallucinate facts" | "Only use information from the provided documents" |
|
|
38
|
+
| "Don't be too formal" | "Write in a conversational, friendly tone" |
|
|
39
|
+
| "Avoid long paragraphs" | "Keep paragraphs to 3-4 sentences" |
|
|
40
|
+
| "Don't skip error handling" | "Include comprehensive error handling" |
|
|
41
|
+
| "Don't make it complicated" | "Keep the solution simple and maintainable" |
|
|
42
|
+
| "Avoid making assumptions" | "Base responses on the provided data" |
|
|
43
|
+
|
|
44
|
+
### 3. Be Clear and Direct
|
|
45
|
+
|
|
46
|
+
Claude 4.x models are more literal than previous versions. State exactly what you want without hedging.
|
|
47
|
+
|
|
48
|
+
| Vague | Clear |
|
|
49
|
+
|-------|-------|
|
|
50
|
+
| "Can you maybe help me think about..." | "Redesign the authentication flow to support SSO" |
|
|
51
|
+
| "It might be nice to have..." | "Add rate limiting to the login endpoint" |
|
|
52
|
+
| "Create a dashboard" | "Create a fully-featured dashboard with charts, filters, export, and user preferences" |
|
|
53
|
+
|
|
54
|
+
### 4. Provide Context
|
|
55
|
+
|
|
56
|
+
Answer these questions:
|
|
57
|
+
1. **Why does this matter?** (Purpose, goal, business context)
|
|
58
|
+
2. **Who is this for?** (Audience, user type, skill level)
|
|
59
|
+
3. **What does success look like?** (Outcomes, metrics, acceptance criteria)
|
|
60
|
+
4. **What constraints exist?** (Technical limits, requirements, policies)
|
|
61
|
+
|
|
62
|
+
## The Complete Framework Checklist
|
|
63
|
+
|
|
64
|
+
Every good prompt should answer:
|
|
65
|
+
|
|
66
|
+
- [ ] **WHAT** are you asking Claude to do?
|
|
67
|
+
- [ ] **WHY** does this matter? (Purpose, goal)
|
|
68
|
+
- [ ] **WHO** is this for? (Audience, user type)
|
|
69
|
+
- [ ] **SUCCESS** looks like what?
|
|
70
|
+
- [ ] Frame everything **POSITIVELY** (what TO do, not what NOT to do)
|
|
71
|
+
|
|
72
|
+
Then trust Claude to:
|
|
73
|
+
- Handle edge cases intelligently
|
|
74
|
+
- Apply best practices for the domain
|
|
75
|
+
- Make reasonable implementation choices
|
|
76
|
+
- Ask clarifying questions if truly ambiguous
|
|
77
|
+
|
|
78
|
+
## Quick Diagnostics
|
|
79
|
+
|
|
80
|
+
When Claude's response is problematic:
|
|
81
|
+
|
|
82
|
+
| Problem | Likely Cause | Fix |
|
|
83
|
+
|---------|--------------|-----|
|
|
84
|
+
| Too minimal/basic | Not explicit about expectations | Add "Create a fully-featured..." or "Go beyond basics..." |
|
|
85
|
+
| Off-topic | Missing context about purpose | Explain WHY you need this and what it's for |
|
|
86
|
+
| Inconsistent | Vague or ambiguous instructions | Be more direct and specific about requirements |
|
|
87
|
+
| Overly cautious | Negative framing ("don't do X") | Reframe positively ("do Y instead") |
|
|
88
|
+
| Missing key details | Didn't explain what success looks like | Define concrete success criteria |
|
|
89
|
+
|
|
90
|
+
## Common Antipatterns
|
|
91
|
+
|
|
92
|
+
### The Micromanager
|
|
93
|
+
Providing step-by-step implementation instead of goals.
|
|
94
|
+
|
|
95
|
+
**Fix**: Explain the goal, let Claude handle implementation.
|
|
96
|
+
|
|
97
|
+
### The Negative Nancy
|
|
98
|
+
String of "don't do X" instructions.
|
|
99
|
+
|
|
100
|
+
**Fix**: Reframe every negative as a positive instruction.
|
|
101
|
+
|
|
102
|
+
### The Context-Free Zone
|
|
103
|
+
Bare instruction with no purpose or audience.
|
|
104
|
+
|
|
105
|
+
**Fix**: Explain who will use it, why it exists, what success looks like.
|
|
106
|
+
|
|
107
|
+
### The Vague Suggestion
|
|
108
|
+
Hedged language like "maybe we could possibly..."
|
|
109
|
+
|
|
110
|
+
**Fix**: Be direct and explicit about what you want.
|
|
111
|
+
|
|
112
|
+
## Structural Elements
|
|
113
|
+
|
|
114
|
+
For multi-step tasks where order matters, use numbered lists.
|
|
115
|
+
|
|
116
|
+
For complex prompts with distinct sections, consider XML-style tags:
|
|
117
|
+
- `<instructions>`, `<context>`, `<data>`
|
|
118
|
+
- `<examples>`, `<input>`, `<output>`
|
|
119
|
+
- `<requirements>`, `<constraints>`
|
|
120
|
+
|
|
121
|
+
## ADR Compliance
|
|
122
|
+
|
|
123
|
+
This skill implements the practices mandated by ADR-002 (Structured Prompting Practices for Agents and Commands). All agents and commands in this framework must follow these principles.
|