ワンクリックで
edc-module-context-impl
Enables ultra-granular, line-by-line code analysis to build deep architectural context for any codebase.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Enables ultra-granular, line-by-line code analysis to build deep architectural context for any codebase.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Reviews whether code changes deliver the stated goal/spec and fit the repository architecture. Use this for PRs, branches, task implementations, plans, or diffs when the question is whether the implementation built the right thing in the right place: requirement coverage, scope creep, module ownership, source-of-truth choices, contracts, migrations, docs, and rollout.
Performs security/adversarial differential review of code changes (PRs, commits, diffs). Use this for auth, validation, trust-boundary, injection, crypto, memory-safety, external-call, state-mutation, or security-regression risk. It leverages git history and edc-context for blast radius and writes markdown security reports.
Builds or updates deep architectural context for any codebase (v2 layout)
Incrementally updates edc-context/ files based on branch changes (v2 layout)
Identifies code quality, maintainability, overengineering, bloat, duplication, and test-value risks by comparing EDC context expectations to actual code
Constrained doc-only edit pass for generated EDC context after report-only curation.
| name | edc-module-context-impl |
| description | Enables ultra-granular, line-by-line code analysis to build deep architectural context for any codebase. |
This skill governs how the agent thinks during the context-building phase of an audit.
When active, the agent will:
Ultra-granular analysis depth is the reasoning method, not the persisted artifact shape. The final module doc must be distilled high-signal module context: persist only what saves a future agent time or prevents wrong assumptions. If an agent can discover it with one Read, Grep, or Glob, leave it out.
This skill defines a structured analysis format (see Example: Function Micro-Analysis below) and runs before the vulnerability-hunting phase.
When invoked from a v2 build, the per-module distilled-context output is written to edc-context/modules/<name>.md (one file per module, kebab-case names). Do not write per-module docs at the top level of edc-context/.
Use when:
Do not use for:
When active, the agent will:
Goal: deep, accurate understanding, then a concise persisted doc containing non-obvious contracts and hazards, not exhaustive code narration.
| Rationalization | Why It's Wrong | Required Action |
|---|---|---|
| "I get the gist" | Gist-level understanding misses edge cases | Line-by-line analysis required |
| "This function is simple" | Simple functions compose into complex bugs | Apply 5 Whys anyway |
| "I'll remember this invariant" | You won't. Context degrades. | Write it down explicitly |
| "External call is probably fine" | External = adversarial until proven otherwise | Jump into code or model as hostile |
| "I can skip this helper" | Helpers contain assumptions that propagate | Trace the full call chain |
| "This is taking too long" | Rushed context = hallucinated vulnerabilities later | Slow is fast |
Before deep analysis, the agent performs a minimal mapping:
This establishes anchors for detailed analysis.
Every non-trivial function receives full micro analysis.
For each function:
Purpose
Inputs & Assumptions
Outputs & Effects
Block-by-Block / Line-by-Line Analysis For each logical block:
Apply per-block:
State Machine Analysis (when function is part of a state machine or non-blocking protocol)
Flag/Boolean Variable Tracing (for every flag or boolean that controls behavior)
Integer Arithmetic & Size Calculation Analysis (for every expression that produces a value used as a size, offset, index, or length)
+, -, *, /, << whose result feeds malloc/calloc/realloc, memcpy/memmove/memset, array subscript, pointer arithmetic, or a length-checked comparisonsize_t the wrap is at SIZE_MAX; for int it is undefined behavior AND wraps in practice. Ask: if both operands are attacker-controlled, what value makes a + b < a (overflow) or a - b > a (underflow)?count * element_size is the canonical overflow vector. Check: is calloc(count, size) used (safe) or manual malloc(count * size) (unsafe without prior check)?attacker input → arithmetic → allocation/index → write target.Error-Path Memory Safety (for every function that allocates memory or holds a pointer)
return, goto, break, or exception path. For each, verify that every allocation made BEFORE that exit is freed exactly once on that path.free(p) / curl_free(p) / Curl_safefree(p) dereference p? Check: error handlers, retry loops, fallback branches that run after cleanup.free(p) for the same pointer? Common in cleanup functions that call sub-cleaners which also free shared state.realloc(p, n) may move the buffer — are there other pointers (cached offsets, substring pointers, iterator cursors) that still point into the OLD location?if (p)) will pass on the dangling value and proceed unsafely.free(p) to the next dereference of p, naming the variable, the line of free, and the line of use.Recursive Call Analysis (for every function that calls itself directly or transitively)
*, on [, on (, and on nested calls — each is a separate entry. Do NOT stop after finding the first recursive path.[ triggers bracket-expression recursion, * triggers wildcard recursion, ( triggers group recursion. Name them explicitly.(Full Integration of Jump-Into-External-Code Rule)
When encountering calls, continue the same micro-first analysis across boundaries.
Case A — Dependency Whose Implementation Is Available Treat as an internal call:
Case B — External Dependency Without Available Code (True External / Black Box) Analyze as adversarial:
Treat the entire call chain as one continuous execution flow. Never reset context. All invariants, assumptions, and data dependencies must propagate across calls.
See FUNCTION_MICRO_ANALYSIS_EXAMPLE.md for a complete walkthrough demonstrating:
This example demonstrates the level of depth and structure required for all analyzed functions.
When performing ultra-granular analysis, use OUTPUT_REQUIREMENTS.md as the private scratch/reasoning structure. Do not dump that scratch structure directly into the final module doc unless a detail passes the signal filter.
The final persisted doc MUST be distilled high-signal module context. Keep:
Use explicit headings such as ## When To Read This or ## Source Pointers for ambiguous or high-blast-radius modules when they help scanning. Equivalent concise prose is acceptable for tiny/obvious modules. Do not add empty template sections just to satisfy a shape.
Avoid exact reference material. Do not copy numeric constants, enum values, schema fields, service lists, file modes, timeout/count tables, generated artifact lists, command inventories, or protocol message maps unless the exact literal is necessary to explain a non-obvious invariant. Prefer category-level prose plus a source pointer. If keeping a literal, mark it as a snapshot and name the authoritative source file.
Submodule/gitlink boundary rule: when the target is a git submodule/gitlink or otherwise only represented by a boundary pointer, write boundary-only context unless the task explicitly provides indexed submodule files. do not infer internal architecture, package structure, APIs, IPC, framework choices, permissions, or workflows from a submodule name. State that the parent repo owns only the visible integration boundary and that future agents must inspect the submodule checkout/source before relying on internals.
Drop:
Quality thresholds apply to the reasoning pass, not to persisted prose:
Before concluding micro-analysis of a function, verify against the COMPLETENESS_CHECKLIST.md:
Analysis is complete when all checklist items are satisfied and no unresolved "unclear" items remain.
After sufficient micro-analysis:
State & Invariant Reconstruction
Workflow Reconstruction
Trust Boundary Mapping
Complexity & Fragility Clustering
These clusters help guide the vulnerability-hunting phase.
(Anti-Hallucination, Anti-Contradiction)
The agent must:
Never reshape evidence to fit earlier assumptions. When contradicted:
Periodically anchor key facts Summarize core:
Avoid vague guesses Use:
Cross-reference constantly Connect new insights to previous state, flows, and invariants to maintain global coherence.
This skill governs analysis of a single target. The target may be a whole repository, one module, or one submodule. The invoking orchestrator decides granularity; this skill does not pick its own scope.
When invoked from the v2 build orchestrator (edc-build-impl), this skill is spawned per-module: the agent's target is one module, sibling modules are accessed only through their signature index (no sibling source bodies), and the orchestrator never reads source code itself.
Large target rule. If the target is broad or exceeds the agent's working budget (heuristic: > ~30k LOC, > ~80 source files, or any single file > ~3k LOC), preserve the whole-target mental model first. Produce a concise parent context that explains the shared authority, invariants, coupling, and failure modes across the target. For broad test/tooling/support targets, add internal sub-routing or harness/workflow guidance so future agents can choose the right source/test area without losing the general context.
Do not split solely because LOC or file count is high. Large coherent modules often need one general context doc so agents can reason across files. Split or promote only when subareas have independent durable ownership contracts, separate authority boundaries, or unrelated verification workflows that would make one parent doc misleading. If splitting would produce filesystem shards or inventory docs, keep the parent doc and add internal routing guidance instead.
Subagents (nested or top-level) must:
Within a single-target run, the agent may also spawn nested subagents for:
This skill runs before:
It exists solely to build:
While active, the agent should NOT:
This is pure context building only.