Create optimized prompts for Claude-to-Claude pipelines with research, planning, and execution stages. Use when building prompts that produce outputs for other prompts to consume, or when running multi-stage workflows (research -> plan -> implement).
Create optimized prompts for Claude-to-Claude pipelines with research, planning, and execution stages. Use when building prompts that produce outputs for other prompts to consume, or when running multi-stage workflows (research -> plan -> implement).
Create prompts optimized for Claude-to-Claude communication in multi-stage workflows. Outputs are structured with XML and metadata for efficient parsing by subsequent prompts.
Every execution produces a SUMMARY.md for quick human scanning without reading full outputs.
Each prompt gets its own folder in .prompts/ with its output artifacts, enabling clear provenance and chain detection.
→ If unclear, ask the Purpose question above as first contextual question
→ If clear, proceed to adaptive_analysis with inferred purpose
</critical_first_action>
<adaptive_analysis>
Extract and infer:
Purpose: Do, Plan, Research, or Refine
Topic identifier: Kebab-case identifier for file naming (e.g., auth, stripe-payments)
Complexity: Simple vs complex (affects prompt depth)
Prompt structure: Single vs multiple prompts
Target (Refine only): Which existing output to improve
If topic identifier not obvious, ask:
header: "Topic"
question: "What topic/feature is this for? (used for file naming)"
Let user provide via "Other" option
Enforce kebab-case (convert spaces/underscores to hyphens)
For Refine purpose, also identify target output from .prompts/*/ to improve.
</adaptive_analysis>
<chain_detection>
Scan .prompts/*/ for existing *-research.md and *-plan.md files.
If found:
List them: "Found existing files: auth-research.md (in 001-auth-research/), stripe-plan.md (in 005-stripe-plan/)"
Use AskUserQuestion:
header: "Reference"
question: "Should this prompt reference any existing research or plans?"
options: List found files + "None"
multiSelect: true
Match by topic keyword when possible (e.g., "auth plan" → suggest auth-research.md).
</chain_detection>
<contextual_questioning>
Generate 2-4 questions using AskUserQuestion based on purpose and gaps.
Write prompt to: .prompts/{number}-{topic}-{purpose}/{number}-{topic}-{purpose}.md
Prompt instructs output to: .prompts/{number}-{topic}-{purpose}/{topic}-{purpose}.md
</file_creation>
</step_1_generate>
<step_2_present>
After saving prompt(s), present inline (not AskUserQuestion):
<single_prompt_presentation>
Prompt created: .prompts/{number}-{topic}-{purpose}/{number}-{topic}-{purpose}.md
What's next?
1. Run prompt now
2. Review/edit prompt first
3. Save for later
4. Other
Choose (1-4): _
</single_prompt_presentation>
<multi_prompt_presentation>
Prompts created:
- .prompts/001-auth-research/001-auth-research.md
- .prompts/002-auth-plan/002-auth-plan.md
- .prompts/003-auth-implement/003-auth-implement.md
Detected execution order: Sequential (002 references 001 output, 003 references 002 output)
What's next?
1. Run all prompts (sequential)
2. Review/edit prompts first
3. Save for later
4. Other
Choose (1-4): _
</multi_prompt_presentation>
</step_2_present>
<step_3_execute>
<execution_modes>
<single_prompt>
Straightforward execution of one prompt.
Read prompt file contents
Spawn Task agent with subagent_type="general-purpose"
Report results with next-step options
</single_prompt>
<sequential_execution>
For chained prompts where each depends on previous output.
Build execution queue from dependency order
For each prompt in queue:
a. Read prompt file
b. Spawn Task agent
c. Wait for completion
d. Validate output
e. If validation fails → stop, report failure, offer recovery options
f. If success → archive prompt, continue to next
Report consolidated results
<progress_reporting>
Show progress during execution:
Output file stays in place (not moved).
</archive_operation>
<result_presentation>
<single_result>
✓ Executed: 001-auth-research
✓ Created: .prompts/001-auth-research/SUMMARY.md
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# Auth Research Summary
**JWT with jose library and httpOnly cookies recommended**
## Key Findings
• jose outperforms jsonwebtoken with better TypeScript support
• httpOnly cookies required (localStorage is XSS vulnerable)
• Refresh rotation is OWASP standard
## Decisions Needed
None - ready for planning
## Blockers
None
## Next Step
Create auth-plan.md
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
What's next?
1. Create planning prompt (auth-plan)
2. View full research output
3. Done
4. Other
Display the actual SUMMARY.md content inline so user sees findings without opening files.
</single_result>
<chain_result>
✓ Chain completed: auth workflow
Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
001-auth-research
**JWT with jose library and httpOnly cookies recommended**
Decisions: None • Blockers: None
002-auth-plan
**4-phase implementation: types → JWT core → refresh → tests**
Decisions: Approve 15-min token expiry • Blockers: None
003-auth-implement
**JWT middleware complete with 6 files created**
Decisions: Review before Phase 2 • Blockers: None
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All prompts archived. Full summaries in .prompts/*/SUMMARY.md
What's next?
1. Review implementation
2. Run tests
3. Create new prompt chain
4. Other
For chains, show condensed one-liner from each SUMMARY.md with decisions/blockers flagged.
</chain_result>
</result_presentation>
<special_cases>
<re_running_completed>
If user wants to re-run an already-completed prompt:
Check if prompt is in completed/ subfolder
Move it back to parent folder
Optionally backup existing output: {output}.bak
Execute normally
</re_running_completed>
<output_conflicts>
If output file already exists:
For re-runs: Backup existing → {filename}.bak
For new runs: Should not happen (unique numbering)
If conflict detected: Ask user - Overwrite? / Rename? / Cancel?
</output_conflicts>
<commit_handling>
After successful execution:
Do NOT auto-commit (user controls git workflow)
Mention what files were created/modified
User can commit when ready
Exception: If user explicitly requests commit, stage and commit:
Output files created
Prompts archived
Any implementation changes (for Do prompts)
</commit_handling>
<recursive_prompts>
If a prompt's output includes instructions to create more prompts:
This is advanced usage - don't auto-detect
Present the output to user
User can invoke skill again to create follow-up prompts
Maintains user control over prompt creation
</recursive_prompts>
</special_cases>
</step_3_execute>