ported/20260304-102613/core-tools/skills/deep-analysis/SKILL.md
Deep exploration and synthesis workflow with dynamic planning and hub-and-spoke coordination. Use for deep analysis, deep understanding, or codebase investigation.
npx skillsauth add sequenzia/agent-alchemy deep-analysisInstall 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.
Execute a structured exploration + synthesis workflow using hub-and-spoke coordination. The lead performs rapid reconnaissance to generate dynamic focus areas, composes a team plan for review, workers explore independently, and a synthesizer merges findings with deep investigation.
This skill can be invoked standalone or loaded by other skills as a reusable building block. Approval behavior is configurable.
Goal: Determine whether the team plan requires user approval before execution.
Read settings:
deep-analysis section with nested settings:
direct-invocation-approval: Whether to require plan approval when invoked directly (default: true)invocation-by-skill-approval: Whether to require approval when loaded by another skill (default: false)Determine invocation mode:
Resolve settings:
Set REQUIRE_APPROVAL:
direct-invocation-approval value (default: true)invocation-by-skill-approval value (default: false)Parse session settings (also under the deep-analysis section):
cache-ttl-hours: Number of hours before exploration cache expires. Default: 24. Set to 0 to disable caching entirely.enable-checkpointing: Whether to write session checkpoints at phase boundaries. Default: true.enable-progress-indicators: Whether to display phase progress messages. Default: true.Set behavioral flags:
CACHE_TTL = value of cache-ttl-hours (default: 24)ENABLE_CHECKPOINTING = value of enable-checkpointing (default: true)ENABLE_PROGRESS = value of enable-progress-indicators (default: true)Goal: Check for cached exploration results, detect interrupted sessions, and initialize the session directory.
Skip this phase entirely if
CACHE_TTL = 0ANDENABLE_CHECKPOINTING = false.
If CACHE_TTL > 0:
.agents/sessions/exploration-cache/manifest.md existsanalysis_context matches the current analysis context (or is a superset)codebase_path matches the current working directorytimestamp is within CACHE_TTL hours of nowconfig_checksum haven't been modified since the cache was written (check mod-times of package.json, tsconfig.json, pyproject.toml, etc.)CACHE_HIT = true. Read cached synthesis.md and recon_summary.md. Skip to Phase 6 step 2 (present/return results).CACHE_HIT = true, skip to Phase 6 step 2CACHE_HIT = false, proceed normallyCACHE_HIT = falseIf ENABLE_CHECKPOINTING = true:
.agents/sessions/__da_live__/checkpoint.md existslast_completed_phase.agents/sessions/da-interrupted-{timestamp}/ and proceed normallyIf ENABLE_CHECKPOINTING = true AND CACHE_HIT = false:
.agents/sessions/__da_live__/ directorycheckpoint.md:
## Deep Analysis Session
- **analysis_context**: [context from arguments or caller]
- **codebase_path**: [current working directory]
- **started**: [ISO timestamp]
- **current_phase**: 0
- **status**: initialized
progress.md:
## Deep Analysis Progress
- **Phase**: 0 of 6
- **Status**: Session initialized
### Phase Log
- [timestamp] Phase 0: Session initialized
Goal: Perform codebase reconnaissance, generate dynamic focus areas, and compose a team plan.
Determine analysis context:
PATH = current working directoryPATH" with the analysis contextRapid codebase reconnaissance: Quickly map the codebase structure. This should take 1-2 minutes, not deep investigation.
package.json, tsconfig.json, pyproject.toml, Cargo.toml, go.mod, etc.) to identify primary language(s) and framework(s)src/**/*.ts, **/*.py to gauge the size and shape of different areasREADME.md, CLAUDE.md, or similar docs if they exist for project contextFallback: If reconnaissance fails (empty project, unusual structure, errors), use the static focus area templates from Step 3b.
Generate dynamic focus areas:
Based on reconnaissance findings, create focus areas tailored to the actual codebase. Default to 3 focus areas, but adjust based on codebase size and complexity (2 for small projects, up to 4 for large ones).
a) Dynamic focus areas (default):
Each focus area should include:
b) Static fallback focus areas (only if recon failed):
For feature-focused analysis:
Focus 1: Explore entry points and user-facing code related to the context
Focus 2: Explore data models, schemas, and storage related to the context
Focus 3: Explore utilities, helpers, and shared infrastructure
For general codebase understanding:
Focus 1: Explore application structure, entry points, and core logic
Focus 2: Explore configuration, infrastructure, and shared utilities
Focus 3: Explore shared utilities, patterns, and cross-cutting concerns
Compose the team plan:
Assemble a structured plan document from the reconnaissance and focus area findings:
## Team Plan: Deep Analysis
### Analysis Context
[context from Step 1]
### Reconnaissance Summary
- **Project:** [name/type]
- **Primary language/framework:** [detected]
- **Codebase size:** [file counts, key directories]
- **Key observations:** [2-3 bullets]
### Focus Areas
#### Focus Area 1: [Label]
- **Directories:** [list]
- **Starting files:** [2-3 files]
- **Search patterns:** [patterns]
- **Complexity:** [Low/Medium/High]
- **Assigned to:** explorer-1
#### Focus Area 2: [Label]
- **Directories:** [list]
- **Starting files:** [2-3 files]
- **Search patterns:** [patterns]
- **Complexity:** [Low/Medium/High]
- **Assigned to:** explorer-2
[... repeated for each focus area]
### Worker Composition
| Role | Count | Purpose |
|------|-------|---------|
| Explorer | [N] | Independent focus area exploration |
| Synthesizer | 1 | Merge findings, deep investigation |
### Task Dependencies
- Exploration Tasks 1-[N]: parallel (no dependencies)
- Synthesis Task: blocked by all exploration tasks
Checkpoint (if ENABLE_CHECKPOINTING = true):
.agents/sessions/__da_live__/checkpoint.md: set current_phase: 1.agents/sessions/__da_live__/team_plan.md with the full team plan from Step 4.agents/sessions/__da_live__/recon_summary.md with reconnaissance findings from Step 2progress.md: [timestamp] Phase 1: Reconnaissance complete -- [N] focus areas identifiedGoal: Present the team plan for user review and approval before allocating resources.
REQUIRE_APPROVAL = falseSkip to Phase 3 with a brief note: "Auto-approving team plan (skill-invoked mode). Proceeding with [N] explorers and 1 synthesizer."
REQUIRE_APPROVAL = truePresent the team plan to the user (output the plan from Phase 1 Step 4), then prompt the user to choose:
If "Modify" (up to 3 cycles):
If "Regenerate" (up to 2 cycles):
Checkpoint (if ENABLE_CHECKPOINTING = true):
.agents/sessions/__da_live__/checkpoint.md: set current_phase: 2, record approval_mode (approved/auto-approved)progress.md: [timestamp] Phase 2: Plan approved (mode: [approval_mode])Goal: Set up workers, create tasks, and assign work using the approved plan.
Prepare workers: Based on the approved plan, prepare the following workers:
Create tasks: For each focus area, create an exploration task with: subject ("Explore: [Focus area label]"), detailed exploration instructions including directories, starting files, search terms, and complexity estimate.
Create a synthesis task: "Synthesize and evaluate exploration findings" -- blocked by all exploration tasks.
Assign exploration tasks: For each exploration task, delegate to the corresponding explorer worker with the task details: focus area label, directories, starting files, and search patterns.
Checkpoint (if ENABLE_CHECKPOINTING = true):
.agents/sessions/__da_live__/checkpoint.md: set current_phase: 3, record worker names, task assignmentsprogress.md: [timestamp] Phase 3: Team assembled -- [N] explorers, 1 synthesizerGoal: Workers explore their assigned areas independently.
After assigning exploration tasks, monitor progress:
ENABLE_CHECKPOINTING = true, write explorer-{N}-findings.md to .agents/sessions/__da_live__/ and update checkpoint.Goal: Verify exploration completeness, launch synthesis with deep investigation.
This is a structural check, not a quality assessment:
Assign the synthesis task to the synthesizer worker
Provide the synthesizer with:
The synthesizer has shell access for deep investigation -- git history analysis, dependency trees, static analysis, or any investigation that basic file reading cannot handle
Wait for the synthesizer to complete
Checkpoint (if ENABLE_CHECKPOINTING = true):
.agents/sessions/__da_live__/checkpoint.md: set current_phase: 5.agents/sessions/__da_live__/synthesis.md with the synthesis resultsprogress.md: [timestamp] Phase 5: Synthesis completeGoal: Collect results, present to user, and clean up.
Collect synthesis output:
Write exploration cache (if CACHE_TTL > 0):
.agents/sessions/exploration-cache/ directory (overwrite if exists)manifest.md:
## Exploration Cache Manifest
- **analysis_context**: [the analysis context used]
- **codebase_path**: [current working directory]
- **timestamp**: [ISO timestamp]
- **config_checksum**: [comma-separated list of config files and their mod-times]
- **ttl_hours**: [CACHE_TTL value]
- **explorer_count**: [N]
synthesis.md with the full synthesis outputrecon_summary.md with the Phase 1 reconnaissance findingsexplorer-{N}-findings.md for each explorer's findings (if not already persisted from Phase 4 checkpoints)Present or return results:
Shut down workers: Signal all workers that analysis is complete and they can stop.
Archive session and cleanup:
ENABLE_CHECKPOINTING = true: Move .agents/sessions/__da_live__/ to .agents/sessions/da-{timestamp}/If any phase fails:
When resuming from an interrupted session (detected in Phase 0 Step 2), use the following per-phase strategy:
| Interrupted At | Recovery Strategy |
|----------------|-------------------|
| Phase 1 | Restart from Phase 1 (reconnaissance is fast, ~1-2 min) |
| Phase 2 | Load saved team_plan.md from session dir, re-present for approval |
| Phase 3 | Load approved plan from checkpoint, restart team assembly |
| Phase 4 | Read completed explorer-{N}-findings.md files from session dir. Only assign explorers whose findings files are missing. Add existing findings to synthesizer context. |
| Phase 5 | Load all explorer findings from session dir. Launch a fresh synthesizer with the persisted findings. |
| Phase 6 | Load synthesis.md from session dir. Proceed directly to present/return results and cleanup. |
Recovery procedure:
checkpoint.md to determine last_completed_phase and session state (worker names, task assignments)last_completed_phase + 1 using the loaded stateexplorer-{N}-findings.md files against expected explorer list to determine which explorers still need to runWhat this component does: Orchestrates a multi-phase deep analysis workflow: reconnaissance, dynamic planning, user approval, parallel exploration via independent workers, synthesis with deep investigation, caching, and session checkpointing/recovery.
Origin: Skill (orchestrator, keystone)
Capabilities needed:
Adaptation guidance:
.agents/sessions/__da_live__/. If the target harness has its own session/state management, adapt accordingly.development
Systematic, hypothesis-driven debugging workflow with triage-based track routing. Use when asked to "fix this bug", "debug this", "why is this failing", "this is broken", "investigate this error", "track down this issue", or any debugging situation. Supports --deep flag to force full investigation.
development
Executes diagnostic investigation tasks to test debugging hypotheses. Runs tests, traces execution, checks git history, and reports evidence. (converted from agent)
content-media
Provides architectural pattern knowledge for designing feature implementations including MVC, event-driven, microservices, and CQRS patterns. Use when designing system architecture or choosing implementation patterns.
documentation
Provides Mermaid diagram syntax, best practices, and styling rules for technical visualizations. Use when creating diagrams, flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, architecture diagrams, C4 diagrams, or any visual documentation in markdown.