skills/deep-plan/SKILL.md
Use when an implementation plan is proposed but requires a deep architectural audit for risks, side effects, and ambiguities before writing any code.
npx skillsauth add till-crazy-tears-us-apart/claude-code-engineering-suite deep-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.
This skill enforces a rigorous Zero-Decision pre-implementation review. It follows a strict Decision-First logic: resolve ambiguities -> define invariants -> audit logic -> verify physical changes.
Goal: Eliminate ALL ambiguity and architectural risk before a single line of code is written.
Step 0: Context Infrastructure Check Before saturating context, check whether structured call graph data is available.
Bash("test -f .claude/logic_index.json && echo EXISTS || echo MISSING").AskUserQuestion to ask:
"
.claude/logic_index.jsondoes not exist. Run/update-logic-indexto initialize? This enables automated impact analysis. Choosing No uses manual grep-based exploration instead."
update-logic-index skill, then proceed to Step 1.Step 1: Structured Context Saturation (requires logic_index.json)
1a — Impact Radius Scan: Identify the target files from the task description, then run:
Bash("python \"~/.claude/skills/update-logic-index/impact.py\" <target_file_1> <target_file_2> ...")
1b — Forced Read: For every file listed at Upstream Depth 1 and Downstream Depth 1 in the Impact Report:
[L120-L155]) and the file exceeds PRECISION_READ_THRESHOLD lines (default: 500), use Read(file_path, offset=start_line, limit=end_line - start_line + 1) for each listed function instead of reading the full file. Group adjacent functions into a single Read when their ranges overlap or are within 10 lines of each other.Read the entire file.1c — Cross-Layer Risk Flag: If the Impact Report shows ⚠ Cross-layer impact, record the affected layers. You MUST add a "Cross-layer interface compatibility" check item to Table 3 during the audit phase.
1d — Supplementary Checks (still mandatory):
db.connect()), you MUST read the definition (e.g., class DBConnection).Grep the project for existing implementations with similar names or purposes. If a reusable function exists, the plan MUST reference it (Modify/extend) rather than proposing a new one.After completing Step 1, proceed to Step 2: Recursive Ambiguity Elimination.
Step 1-Fallback: Manual Context Saturation (no logic_index.json)
Use this path when logic_index.json is unavailable or contains no call graph data.
db.connect()), you MUST read the definition (e.g., class DBConnection).Read, Grep, or Glob to saturate your context.Step 2: Recursive Ambiguity Elimination (Loop-Until-Saturated) You MUST execute the following loop until NO ambiguities remain:
Scan: Identify current architectural decision points based on saturated context. You MUST explicitly check each of the following 5 categories and mark each as either "ambiguity identified" or "N/A (no decision needed)":
MANDATORY FORMAT — Output the scan result as a fenced block BEFORE any AskUserQuestion call:
**Ambiguity Scan:**
1. Interface Contract — ambiguity identified: <brief description>
2. Resource & Dependency — ambiguity identified: <brief description>
3. Behavioral Boundary — N/A (no decision needed)
4. Execution Order — ambiguity identified: <brief description>
5. Change Boundary — N/A (no decision needed)
Skipping this output block is a protocol violation.
Check: Are there unresolved ambiguities?
Ask: Use AskUserQuestion to resolve current layer ambiguities.
REMY_LANG environment variable (zh-CN → Chinese, en → English).(推荐) to the recommended label and include a 1-sentence reason in its description. Omitting the recommendation is a protocol violation.Saturate (Again) - ACTION REQUIRED:
Grep/Glob targeting the specific keywords of the choice (e.g., if user selected "Redis", grep for "redis", "cache", "sentinel").invalidated and re-present it in the next loop iteration.Repeat: Go back to sub-step 1.
Step 2.8: Assumption Manifest & Scenario Probes (Post-Loop Second Pass)
This step targets unknown unknowns — assumptions Claude considers obvious but which may conflict with the user's intent. It runs ONCE after the Step 2 loop exits. A re-entry counter (_manifest_pass) tracks executions; if _manifest_pass >= 1, skip this step entirely and proceed to Step 2.9.
Generate Assumption Manifest: List ALL implicit assumptions (implementation-level and behavioral-level) that are NOT already locked in Table 1. Each assumption MUST include:
MANDATORY FORMAT — Output the manifest as a numbered list BEFORE the AskUserQuestion call:
**Assumption Manifest:**
1. [Level 3 | Behavior] Redis 连接失败时 fallback 到本地缓存而非直接抛出异常。
2. [Level 4 | Interface] 缓存 key 使用 UTF-8 编码,不含二进制数据。
3. [Level 5 | Resource] 生产环境 Redis 版本 ≥ 6.0。
Each entry MUST include the [Level N | Category] prefix. Omitting the level number is a protocol violation.
Exclusion Rule: Do NOT duplicate entries already present in Table 1 (resolved ambiguities).
Contradiction Detection: Before presenting to the user, cross-check every assumption against every locked decision in Table 1. If a contradiction is found, flag it as a new ambiguity (do not present it as an assumption — route it directly to re-entry in sub-step 5).
Conditional Scenario Probes: For each assumption with confidence ≤ Level 4, construct a concrete scenario that illustrates the behavioral consequence of that assumption. The scenario is embedded in the AskUserQuestion option description (inline format).
Present to User: Use AskUserQuestion to present assumptions in batches of ≤ 4 items per call, sorted by confidence (lowest first). Each item offers:
Re-entry Decision:
_manifest_pass, proceed to Step 2.9._manifest_pass, return to Step 2 loop to resolve the new ambiguities. After this re-entry, the loop will eventually exit again; since _manifest_pass >= 1, Step 2.8 is skipped and flow proceeds directly to Step 2.9.Step 2.9: Plan-Code Alignment Check Before generating the final tables, verify that your plan assumptions still match the code:
Read the target function's current signature and first 5 lines of body.Step 3: Finalize (Load Templates) Only when the loop terminates (ZERO ambiguities remain):
Read tool to read the template file: skills/deep-plan/audit_template.md.CRITICAL CONSTRAINT: You DO NOT have the output schema yet. You MUST read skills/deep-plan/audit_template.md in Step 3 to get it.
Read to load the schema dynamically ONLY after ambiguities are resolved.You MUST read ~/.claude/skills/deep-plan/output_schema.json (if available) to understand the required verification depth.
After generating the 5 analysis tables (Section 3), you MUST produce and write an AgentTaskPacketLite JSON file before the stop prompt. This packet is the executable contract for /code-modification.
Steps (execute in order):
date +"%Y%m%d_%H%M%S" → use result as {TIMESTAMP}git rev-parse HEAD → use result as {COMMIT}mkdir -p ".claude/temp_task".claude/temp_task/task_{TIMESTAMP}.json:{
"v": "1.0.0",
"task": {
"id": "task_{TIMESTAMP}",
"mode": "write",
"summary": "<one sentence describing the change scope from Table 4>",
"read_only_until_evidence": true
},
"sender_payload": {
"plan": ["<step 1 from Table 4>", "<step 2>"],
"analysis": "<key constraints and risks distilled from Table 3>",
"assumptions": ["<any unresolved item from Table 1>"]
},
"evidence_packet": {
"source_revision": {
"type": "git",
"commit": "{COMMIT}",
"retrieved_at": "<current ISO-8601 datetime>"
},
"evidence": [
{
"id": "E-001",
"file_type": "source",
"path": "<repo-relative path>",
"range": {"start": 1, "end": 50},
"why": "<why this file/range is relevant to the planned change>",
"status": "confirmed",
"confidence": 0.9,
"excerpt": "<verbatim text from that range — do NOT summarize>"
}
],
"proposed_changes": [
{
"id": "C-001",
"description": "<from Table 4 '简述' column>",
"evidence_refs": ["E-001"]
}
]
}
}
rm -f ".claude/temp_task/.active_packet" && echo "task_{TIMESTAMP}.json" > ".claude/temp_task/.active_packet"Strict Rules:
evidence[]: one item per file you ACTUALLY READ during this audit. Unread files MUST NOT appear.excerpt: MANDATORY verbatim text. Summaries are prohibited.status: use "confirmed" only for files read in this session; use "suspected" for inferred but unread files.proposed_changes[].evidence_refs: MUST reference at least one evidence ID with status: "confirmed"."type": "filesystem" and omit "commit".📦 Packet: task_{TIMESTAMP}.json | 执行: /code-modification task_{TIMESTAMP}.jsonCRITICAL: You MUST generate ALL tables and analysis text in your response.
After generating the analysis tables (loaded from template), you MUST STOP.
AskUserQuestion tool."审计完成 (Audit Complete). [🟢开始执行 (Proceed)] / [🟡修改计划 (Revise)] / [🔴取消 (Cancel)]?"
data-ai
Deep repository analysis with multi-agent parallel perspectives. Requires /init + /remy-index as prerequisites. Produces structured research reports.
tools
Analyze CI/CD failure logs to diagnose build, test, and gate failures. Supports GitHub Actions (gh CLI), local log files, and pasted logs. Produces evidence packets for /remy-patch.
development
Generate persistent unit tests for existing or stub code. Supports post-hoc testing (default) and TDD mode (--tdd). Multi-angle agent analysis at medium/high effort levels.
tools
--- name: remy-secure description: Review branch changes for security vulnerabilities. Multi-stage: regex pre-scan, parallel agents, and false-positive filtering. allowed-tools: Read, Grep, Glob, Bash, AskUserQuestion, Agent argument-hint: "[low|medium|high] [diff_range (optional, e.g. HEAD~3...HEAD)]" disable-model-invocation: true --- # Security Audit Protocol Security-focused review of code changes on the current branch. Identifies exploitable vulnerabilities with high confidence (≥ 8/10),