.github/skills/deepen-plan/SKILL.md
Enhance a plan with parallel research agents grounded in user story, architectural context, and success criteria to add depth without losing purpose
npx skillsauth add the-rabak/compound-engineering-plugin deepen-planInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
[path to plan file]
Note: The current year is 2026. Use this when searching for recent documentation and best practices.
This command takes an existing plan (from /workflows-plan) and enhances each section with parallel research agents. Every enhancement is grounded in the plan's WHY artifacts -- the problem narrative, user story, architectural context, and success criteria -- so that deepening adds purpose-aligned depth, not generic complexity.
Each major element gets its own dedicated research sub-agent to find:
The result is a deeply grounded, production-ready plan that remains tightly coupled to WHY we're building it.
<plan_path> #$ARGUMENTS </plan_path>
If the plan path above is empty:
ls -la docs/plans/docs/plans/2026-01-15-feat-my-feature-plan.md)."Do not proceed until you have a valid plan file path.
Read the plan file and extract WHY artifacts first:
handoff frontmatter -- check all fields are true; if any are false or missing, flag: "Plan is missing [X]. Deepening may add technically correct but purpose-misaligned enhancements. Consider running /workflows-plan to fill gaps first."Check for brainstorm reference:
brainstorm_ref from plan frontmatterThen extract plan structure:
Create a section manifest with WHY linkage:
Section 1: [Title] - [Brief description of what to research] - Serves: [user story aspect / success criterion]
Section 2: [Title] - [Brief description of what to research] - Serves: [user story aspect / success criterion]
...
The "Serves" column ensures every deepening activity traces back to WHY we're building this.
Scan each implementation task/phase for these required fields:
Validate WHY tracing:
Expected task format:
##### Task N.1: [Task Name]
**Files:** `path/to/file1.php`, `path/to/file2.php`
**Depends on:** Task N-1.2 (or "None")
**Success criteria:**
- [ ] Criterion 1
- [ ] Criterion 2
**Test command:** `command to run`
Scoring:
Count how many implementation tasks have all four fields. Report:
Execution Readiness: X/Y tasks have complete structure (Z%)
Actions based on score:
| Score | Action |
|-------|--------|
| 80-100% | Plan is execution-ready. Proceed with deepening. |
| 50-79% | Flag incomplete tasks. During deepening, add missing fields. |
| 0-49% | Plan needs significant restructuring. Add an "Execution Readiness" enhancement pass that decomposes vague phases into structured tasks with all required fields. Note: /workflows-work will refuse to execute plans that lack this structure. |
For tasks missing structure, the deepening process should:
feat(scope): description)For each task, check complexity:
| Metric | Threshold | Action | |--------|-----------|--------| | Files touched | > 3 files | Flag for splitting | | Success criteria | > 5 criteria | Flag for splitting | | Multiple concerns | Mixes backend + frontend | Flag for splitting | | Vague scope | "Implement the feature" | Flag for clarification |
If any tasks exceed thresholds:
Report:
Task Complexity Warning: X tasks may be too large for reliable subagent execution.
Task 2.1: "Build user auth" -- touches 5 files, 7 success criteria
Suggestion: Split into "Create auth service" (3 files) and "Add auth middleware" (2 files)
Task 3.2: "Build dashboard UI" -- mixes backend API + frontend component
Suggestion: Split into "Create dashboard API endpoint" and "Build dashboard component"
Suggest splits that create self-contained tasks with non-overlapping file sets. Each split task should be completable by one subagent in a single session. When splitting, ensure each new task retains its "Serves:" tracing to the user story -- a split should never orphan a task from its purpose.
This validation ensures the plan is ready for /workflows-work's subagent orchestration model, where each task is delegated to a focused subagent with clear scope and termination criteria.
Check the plan's YAML frontmatter for source_docs:. If present, re-fetch the original documents for deeper analysis:
For each source doc URL in source_docs.tickets, source_docs.docs, source_docs.figma:
Launch parallel subagents to re-read the full documents (not just summaries this time):
Task general-purpose: "Re-read this source document in full detail for plan deepening.
URL: [url]
Type: [tickets|docs|figma]
Fetch the complete document content using this strategy:
1. Try ToolSearch to find any relevant MCP tools available
2. If MCP tools found, use them to fetch the document
3. If no MCP tools, try WebFetch on the URL
4. Last resort: output 'MANUAL_INPUT_NEEDED: Could not access [url]. Ask user to paste content.'
Focus on extracting:
- Detailed acceptance criteria and edge cases
- Technical constraints not captured in the summary
- Dependencies and integration points
- Any updates since the plan was created (check timestamps)
- Any user story or problem context that was missed or summarized too aggressively in the plan
Return the FULL content, not a summary. This will be used to ground the plan in source-of-truth documents."
Feed the full document contents to all subsequent deepening agents as additional context, alongside the WHY artifacts extracted in Step 1.
Step 1: Discover ALL available skills from ALL sources
# 1. Project-local skills (highest priority - project-specific)
ls .github/skills/
# 2. User's global skills (~/.copilot/)
ls ~/.copilot/skills/
# 3. compound-engineering plugin skills
ls ~/.copilot/plugins/cache/*/compound-engineering/*/skills/
# 4. ALL other installed plugins - check every plugin for skills
find ~/.copilot/plugins/cache -type d -name "skills" 2>/dev/null
# 5. Also check installed_plugins.json for all plugin locations
cat ~/.copilot/plugins/installed_plugins.json
Important: Check EVERY source. Don't assume compound-engineering is the only plugin. Use skills from ANY installed plugin that's relevant.
Step 2: For each discovered skill, read its SKILL.md to understand what it does
# For each skill directory found, read its documentation
cat [skill-path]/skill.md
Step 3: Match skills to plan content
For each skill discovered:
Step 4: Spawn a sub-agent for EVERY matched skill
CRITICAL: For EACH skill that matches, spawn a separate sub-agent and instruct it to USE that skill.
For each matched skill:
Task general-purpose: "You have the [skill-name] skill available at [skill-path].
YOUR JOB: Use this skill on the plan.
1. Read the skill: cat [skill-path]/skill.md
2. Follow the skill's instructions exactly
3. Apply the skill to this content:
[relevant plan section or full plan]
WHY CONTEXT (use this to ground the skill's recommendations):
- Problem: [problem narrative]
- User Story: [user story]
- Success Criteria: [success criteria]
4. Return the skill's full output. Filter recommendations that don't serve the user story.
The skill tells you what to do - follow it. Execute the skill completely."
Spawn ALL skill sub-agents in PARALLEL:
Each sub-agent:
Example spawns:
Task general-purpose: "Use the laravel-conventions skill at ~/.copilot/plugins/.../laravel-conventions. Read SKILL.md and apply it to: [Laravel sections of plan]"
Task general-purpose: "Use the frontend-design skill at ~/.copilot/plugins/.../frontend-design. Read SKILL.md and apply it to: [UI sections of plan]"
Task general-purpose: "Use the agent-native-architecture skill at ~/.copilot/plugins/.../agent-native-architecture. Read SKILL.md and apply it to: [agent/tool sections of plan]"
Task general-purpose: "Use the security-patterns skill at ~/.copilot/skills/security-patterns. Read SKILL.md and apply it to: [full plan]"
No limit on skill sub-agents. Spawn one for every skill that could possibly be relevant.
LEARNINGS LOCATION - Check these exact folders:
docs/solutions/ <-- PRIMARY: Project-level learnings (created by /workflows-compound)
├── performance-issues/
│ └── *.md
├── debugging-patterns/
│ └── *.md
├── configuration-fixes/
│ └── *.md
├── integration-issues/
│ └── *.md
├── deployment-issues/
│ └── *.md
└── [other-categories]/
└── *.md
Step 1: Find ALL learning markdown files
Run these commands to get every learning file:
# PRIMARY LOCATION - Project learnings
find docs/solutions -name "*.md" -type f 2>/dev/null
# If docs/solutions doesn't exist, check alternate locations:
find .github/docs -name "*.md" -type f 2>/dev/null
find ~/.copilot/docs -name "*.md" -type f 2>/dev/null
Step 2: Read frontmatter of each learning to filter
Each learning file has YAML frontmatter with metadata. Read the first ~20 lines of each file to get:
---
title: "N+1 Query Fix for Briefs"
category: performance-issues
tags: [eloquent, n-plus-one, eager-loading, with]
module: Briefs
symptom: "Slow page load, multiple queries in logs"
root_cause: "Missing eager loading with() on relationship"
---
For each .md file, quickly scan its frontmatter:
# Read first 20 lines of each learning (frontmatter + summary)
head -20 docs/solutions/**/*.md
Step 3: Filter - only spawn sub-agents for LIKELY relevant learnings
Compare each learning's frontmatter against the plan (both technical content AND WHY artifacts):
tags: - Do any tags match technologies/patterns in the plan?category: - Is this category relevant? (e.g., skip deployment-issues if plan is UI-only)module: - Does the plan touch this module?symptom: / root_cause: - Could this problem occur with the plan?SKIP learnings that are clearly not applicable:
database-migrations/ learningslaravel-specific/ learningsauthentication-issues/ learningsSPAWN sub-agents for learnings that MIGHT apply:
Step 4: Spawn sub-agents for filtered learnings
For each learning that passes the filter:
Task general-purpose: "
LEARNING FILE: [full path to .md file]
1. Read this learning file completely
2. This learning documents a previously solved problem
Check if this learning applies to this plan:
USER STORY: [user story]
SUCCESS CRITERIA: [success criteria]
PLAN:
---
[full plan content]
---
If relevant:
- Explain specifically how it applies
- Quote the key insight or solution
- Note which success criterion or user story aspect it protects
- Suggest where/how to incorporate it
If NOT relevant after deeper analysis:
- Say 'Not applicable: [reason]'
"
Example filtering:
# Found 15 learning files, plan is about "Laravel API caching"
# SPAWN (likely relevant):
docs/solutions/performance-issues/n-plus-one-queries.md # tags: [eloquent] ✓
docs/solutions/performance-issues/redis-cache-stampede.md # tags: [caching, redis] ✓
docs/solutions/configuration-fixes/redis-connection-pool.md # tags: [redis] ✓
# SKIP (clearly not applicable):
docs/solutions/deployment-issues/heroku-memory-quota.md # not about caching
docs/solutions/frontend-issues/vue-reactivity-issue.md # plan is API, not frontend
docs/solutions/authentication-issues/jwt-expiry.md # plan has no auth
Spawn sub-agents in PARALLEL for all filtered learnings.
These learnings are institutional knowledge - applying them prevents repeating past mistakes.
For each identified section, launch parallel research with WHY context:
Task Explore: "Research best practices, patterns, and real-world examples for: [section topic].
CONTEXT -- WHY we're building this:
- Problem: [problem narrative summary]
- User Story: [user story]
- This section serves: [which success criterion / user story aspect]
- Architectural context: [relevant arch context for this section]
Find:
- Industry standards and conventions relevant to this user's problem
- Performance considerations that could affect the stated success criteria
- Common pitfalls that could threaten the user story outcome
- Documentation and tutorials for this architectural context
Return concrete, actionable recommendations. Filter out recommendations that don't serve the user story or success criteria."
Also use Context7 MCP for framework documentation:
For any technologies/frameworks mentioned in the plan, query Context7:
mcp__plugin_compound-engineering_context7__resolve-library-id: Find library ID for [framework]
mcp__plugin_compound-engineering_context7__query-docs: Query documentation for specific patterns
Use WebSearch for current best practices:
Search for recent (2024-2026) articles, blog posts, and documentation on topics in the plan.
Step 1: Discover ALL available agents from ALL sources
# 1. Project-local agents (highest priority - project-specific)
find .github/agents -name "*.md" 2>/dev/null
# 2. User's global agents (~/.copilot/)
find ~/.copilot/agents -name "*.md" 2>/dev/null
# 3. compound-engineering plugin agents (all subdirectories)
find ~/.copilot/plugins/cache/*/compound-engineering/*/agents -name "*.md" 2>/dev/null
# 4. ALL other installed plugins - check every plugin for agents
find ~/.copilot/plugins/cache -path "*/agents/*.md" 2>/dev/null
# 5. Check installed_plugins.json to find all plugin locations
cat ~/.copilot/plugins/installed_plugins.json
# 6. For local plugins (isLocal: true), check their source directories
# Parse installed_plugins.json and find local plugin paths
Important: Check EVERY source. Include agents from:
.github/agents/~/.copilot/agents/For compound-engineering plugin specifically:
agents/review/* (all reviewers)agents/research/* (all researchers)agents/design/* (design agents)agents/docs/* (documentation agents)agents/workflow/* (these are workflow orchestrators, not reviewers)Step 2: For each discovered agent, read its description
Read the first few lines of each agent file to understand what it reviews/analyzes.
Step 3: Launch ALL agents in parallel
For EVERY agent discovered, launch a Task in parallel with WHY context:
Task [agent-name]: "Review this plan using your expertise.
WHY CONTEXT (use this to evaluate whether the plan solves the right problem):
- Problem Narrative: [problem narrative]
- User Story: [user story]
- Success Criteria: [success criteria list]
- Architectural Context: [arch context summary]
Apply all your checks and patterns. Flag anything that could prevent the user story from being achieved. Plan content: [full plan content]"
CRITICAL RULES:
Step 4: Also discover and run research agents
Research agents (like best-practices-researcher, framework-docs-researcher, git-history-analyzer, repo-research-analyst) should also be run for relevant plan sections.
Collect outputs from ALL sources:
For each agent's findings, extract and classify by WHY alignment:
For each finding also extract:
Deduplicate, prioritize, and trace:
RULE: Never modify these WHY sections (they are the contract from planning):
If research suggests changes to these, add a ### WHY Reassessment note at the end of the plan for the user to review manually. Do not edit the originals.
Enhancement format for each section:
## [Original Section Title]
[Original content preserved -- including any "Serves:" lines]
### Research Insights
**Best Practices** (serves: [which success criterion]):
- [Concrete recommendation 1]
- [Concrete recommendation 2]
**Performance Considerations** (serves: [which success criterion]):
- [Optimization opportunity]
- [Benchmark or metric to target]
**Implementation Details:**
```[language]
// Concrete code example from research
Edge Cases (risk to: [which user story aspect]):
References:
### 8. Add Enhancement Summary
At the top of the plan, add a summary section:
```markdown
## Enhancement Summary
**Deepened on:** [Date]
**Sections enhanced:** [Count]
**Research agents used:** [List]
### WHY Integrity Check
- Problem Narrative: [preserved / flagged for reassessment]
- User Story: [preserved / flagged for reassessment]
- Architectural Context: [preserved / expanded / flagged for reassessment]
- Success Criteria: [preserved / flagged for reassessment]
- Phase tracing: [all phases still trace to user story: yes/no]
### Key Improvements
1. [Major improvement 1] (serves: [success criterion])
2. [Major improvement 2] (serves: [success criterion])
3. [Major improvement 3] (serves: [success criterion])
### New Considerations Discovered
- [Important finding 1]
- [Important finding 2]
### Scope Warnings (if any)
- [Enhancement that was flagged as beyond current user story]
Write the enhanced plan:
-deepened suffix if user prefers a new fileUpdate the plan file in place (or if user requests a separate file, append -deepened after -plan, e.g., 2026-01-15-feat-auth-plan-deepened.md).
Before finalizing:
Content integrity:
WHY integrity:
After writing the enhanced plan, use the AskUserQuestion tool to present these options:
Question: "Plan deepened at [plan_path]. What would you like to do next?"
Options:
/technical_review - Get feedback from reviewers on enhanced plan/workflows-work - Begin implementing this enhanced planBased on selection:
git diff [plan_path] or show before/after/technical_review → Call the /technical_review command with the plan file path/workflows-work → Call the /workflows-work command with the plan file pathBefore (from /workflows-plan):
## Technical Approach
Use React Query for data fetching with optimistic updates.
After (from /workflows-deepen-plan):
## Technical Approach
Use React Query for data fetching with optimistic updates.
### Research Insights
**Best Practices:**
- Configure `staleTime` and `cacheTime` based on data freshness requirements
- Use `queryKey` factories for consistent cache invalidation
- Implement error boundaries around query-dependent components
**Performance Considerations:**
- Enable `refetchOnWindowFocus: false` for stable data to reduce unnecessary requests
- Use `select` option to transform and memoize data at query level
- Consider `placeholderData` for instant perceived loading
**Implementation Details:**
```typescript
// Recommended query configuration
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 5 * 60 * 1000, // 5 minutes
retry: 2,
refetchOnWindowFocus: false,
},
},
});
Edge Cases:
cancelQueries on component unmountpersistQueryClientReferences:
NEVER CODE! Just research and enhance the plan.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
tools
Package one plan execution packet into a compact ticket-local execution packet with parent refs, scope fences, feature-home ownership, and evidence commands. Use when converting plans into local tickets or when execution needs one ticket-sized context pack without the full plan.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.
testing
Run a deep adversarial review of plans and architecture before implementation. Use when validating strategy docs, contracts, roadmaps, and competitive positioning with scored findings and prioritized recommendations.