{"slug":"gap-analysis-2","title":"gap-analysis","summary":"Performs a gap analysis between two artifacts (a current state and a desired state) and produces a plain-language, stakeholder-readable report indexed by stable gap IDs. Use when the user wants to compare, evaluate, audit, or reconcile one artifact against another. Does not inves","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-10-15T13:11:55.279017Z","repo":{"url":"https://github.com/testdouble/han","stars":303,"forks":24,"license":"MIT","updatedAt":"2026-10-14T20:22:28Z"},"bodyHtml":"<hr>\n<h2>name: \"gap-analysis\"\ndescription: &gt;\nPerforms a gap analysis between two artifacts (a current state and a desired state) and produces a plain-language,\nstakeholder-readable report indexed by stable gap IDs. Use when the user wants to compare, evaluate, audit, or\nreconcile one artifact against another. Does not investigate runtime bugs — use investigate. Does not assess\nmodule-level architecture — use architectural-analysis. Does not research open-ended options with no second artifact\nto compare against — use research.\narguments: size\nargument-hint:\n\"[size: small | medium | large | dynamic] [current state artifact, desired state artifact, optional: scope and modes]\"\nallowed-tools:\nRead, Write, Glob, Grep, Agent, Bash(find *), Bash(git *),\nBash(bash \"$/scripts/han-config-dir.sh\")</h2>\n<h2>Project Context</h2>\n<ul>\n<li>CLAUDE.md: !<code>find . -maxdepth 1 -name \"CLAUDE.md\" -type f</code></li>\n<li>project-discovery.md: !<code>find . -maxdepth 3 -name \"project-discovery.md\" -type f</code></li>\n<li>personal config directory: !<code>bash \"${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh\" 2&gt;/dev/null || echo \"$HOME/.claude\"</code></li>\n<li>project .han/config.md: !<code>cat .han/config.md 2&gt;/dev/null || echo \"\"</code></li>\n</ul>\n<p>As your first action, use the Read tool on <code>.han/config.md</code> inside the <code>personal config directory</code> path above. A read\nthat returns no file is no personal configuration: continue silently. When that file or the <code>project .han/config.md</code>\nprobe supplies content, apply it per <a href=\"../../references/config-rule.md\">config-rule.md</a>, which governs precedence\nbetween the two files, relative-path resolution, and what to do with a file that reads but cannot be used.</p>\n<h2>Operating Principles</h2>\n<ul>\n<li><strong>The <code>han-core:gap-analyzer</code> agent owns the primary analysis.</strong> This skill does not classify gaps itself. It calls\n<code>han-core:gap-analyzer</code> once, reads the analyzer's full output file, and synthesizes a stakeholder-readable report\nfrom it.</li>\n<li><strong>Plain language is the default surface.</strong> Sections 1 and 2 of the report never contain file paths, line numbers,\nfunction or class names, library mechanics, or language primitives. Technical fidelity is quarantined to Section 3 and\nonly appears when the user has explicitly requested technical details.</li>\n<li><strong>The swarm runs by default.</strong> A minimum viable swarm ships at every size: <code>han-core:adversarial-validator</code> and\n<code>han-core:junior-developer</code> always, plus <code>han-core:evidence-based-investigator</code> when the current state is concrete\nenough to verify against. The user may opt out with <code>no swarm</code> to fall back to a lightweight gap-analyzer-only pass.</li>\n<li><strong>Evidence rule applies to every gap.</strong> Apply the evidence rule from\n<a href=\"../../references/evidence-rule.md\">../../references/evidence-rule.md</a> when characterizing the evidence that\nestablishes each gap. Name the trust class of every citation pair (codebase, web, provided); apply the corroboration\ngate to web-source claims that establish a gap; and label gaps where the desired-state evidence is absent (\"the spec\nis silent on X\") as a distinct state, not as a weak gap. The <code>han-core:evidence-based-investigator</code> dispatched in the\nswarm carries codebase findings; the gap analyzer carries the spec-side citations.</li>\n<li><strong>Artifact-level analysis caveats are surfaced once, not per gap.</strong> Some validator observations apply uniformly to the\nwhole comparison rather than to any one gap — most commonly a provenance concern about the desired-state artifact as a\nwhole (for example, \"the desired state is a provided, uncommitted, same-session source,\" which the evidence rule's\n<code>provided</code> trust class genuinely warrants flagging). Surface such an observation a single time as an artifact-level\nanalysis caveat. Do not repeat it as a per-gap verdict on every gap that rests on that artifact, and do not let it\nraise or lower any gap's confidence — it bears on the whole report equally, so per-gap weighting would double-count\none fact. Provenance concerns specific to a <em>single</em> gap's evidence still belong to that gap's verdict.</li>\n<li><strong><code>han-core:junior-developer</code> runs the actor-perspective sweep.</strong> Gap analysis lives at the feature and behavioral\nlevel from a user's or actor's perspective — human end users (and sub-roles like customer, admin, auditor, support\nagent), API callers, AI agents, integration partners, batch processes, internal services. The\nhan-core:junior-developer's job in the swarm is to check that each gap holds for every actor type the desired state\naddresses or implies, and to surface gaps the analyzer missed because it only considered one actor type.</li>\n<li><strong><code>han-core:plan-synthesizer</code> coordinates Section 4 synthesis at medium and large only.</strong> When the swarm reaches four\nor more agents, the synthesizer consolidates the swarm's confirmations, contradictions, augmentations, and per-gap confidence\nvalues for the skill to render. At small swarm size (two or three agents), the skill consolidates deterministically\nwithout the synthesizer.</li>\n<li><strong>Optional sections must not be load-bearing.</strong> A report with only Sections 1 and 2 must stand on its own. Sections 3\nand 4 are additive — never required for Sections 1 and 2 to make sense.</li>\n<li><strong>Purpose-conditioned prioritization is a labeled skill judgment, never the analyzer's.</strong> The <code>han-core:gap-analyzer</code>\nproduces a neutral, unprioritized gap list and must stay that way. When the user states <em>why</em> they are running the\ncomparison (e.g., \"before a redesign pass,\" \"to scope the next sprint\"), the skill may add one explicitly-labeled\n\"Where to start\" pointer view that names the few gaps most blocking that stated purpose. This is the skill's own\nsynthesis judgment — the same kind it already makes when it clusters gaps into themes and derives confidence — layered\non top of the neutral list, never replacing it, and omitted entirely when no purpose was given.</li>\n<li><strong>Gap IDs are stable for the life of the report.</strong> Map <code>GAP-NNN</code> from the <code>han-core:gap-analyzer</code> output to <code>G-NNN</code> in\nthe report, preserving order. Cross-references in Sections 3 and 4 use the same <code>G-NNN</code> IDs.</li>\n<li><strong>The report template lives at <a href=\"./references/gap-analysis-report-template.md\">gap-analysis-report-template.md</a>.</strong> It\nwas designed by the <code>han-core:information-architect</code> agent. The skill renders the template by filling placeholders and\nremoving the optional sections that were not requested or generated.</li>\n<li><strong>The report is written to the shared readability standard.</strong> The skill sources the standard by invoking\n<code>han-communication:readability-guidance</code> and applies it as it writes the report, holding the default audience frame: a\ncapable reader who did not do this work and lacks the author's context. The stable gap IDs (<code>G-NNN</code>) are citation\nidentifiers and survive any rewrite or self-check unchanged.</li>\n</ul>\n<h1>Run a Gap Analysis</h1>\n<h2>Step 1: Identify Inputs and Project Context</h2>\n<p>Read the user's argument and conversation context to identify two artifacts:</p>\n<ul>\n<li>The <strong>current state</strong> — what exists today (e.g., the implementation, the shipped feature, the legacy design).</li>\n<li>The <strong>desired state</strong> — what is expected (e.g., the spec, the PRD, the new design).</li>\n</ul>\n<p>Inputs may be file paths, directory paths, URLs, or inline text. If the user named only one artifact and a comparison\ntarget is implied (e.g., \"compare the auth module to the auth spec\"), search the project for the implied second artifact\nusing <code>Glob</code> and <code>Grep</code> against <code>docs/</code>, <code>specs/</code>, <code>requirements/</code>, or directories surfaced via CLAUDE.md /\n<code>project-discovery.md</code>. If the implied artifact cannot be located, ask the user for the path before proceeding.</p>\n<p>State the resolved comparison direction to the user in one line: \"Comparing <strong></strong> against <strong></strong>.\" If the\nuser wants the direction reversed, accept the override.</p>\n<p><strong>Capture the purpose, if one was stated.</strong> Note <em>why</em> the user is running this comparison when they said so (e.g.,\n\"before a redesign pass,\" \"to scope the next sprint,\" \"to decide whether to ship\"). If no purpose is evident, you may\noffer to capture one in the same one-line confirmation — for example, \"If you tell me what this comparison is for, I'll\nflag which gaps block that goal.\" Do not block on it: a purpose is optional and only drives the optional \"Where to\nstart\" view in Step 6. Record the purpose verbatim if given.</p>\n<p>Resolve project config: read CLAUDE.md's <code>## Project Discovery</code> section if present; fall back to <code>project-discovery.md</code>;\nfall back to the working directory's <code>docs/</code> tree. The output report will be written to the project's documentation root\nif one exists (<code>docs/</code>, <code>documentation/</code>, or a folder surfaced by project config), otherwise to the current working\ndirectory. Default report filename: <code>gap-analysis-report.md</code>. If a same-named file already exists, append a short\ntimestamp suffix to avoid overwriting.</p>\n<h2>Step 2: Run the <code>han-core:gap-analyzer</code> Agent</h2>\n<p>Launch <code>han-core:gap-analyzer</code> with a single Agent tool call. Provide:</p>\n<ul>\n<li>The current state and the desired state (paths, URLs, or inline text exactly as resolved in Step 1), with explicit\nlabeling of which is which.</li>\n<li>Any scope the user provided (specific subsystems, features, sections).</li>\n<li>A directive to write its full analysis to a file alongside the future report (e.g.,\n<code>{report-dir}/gap-analysis-source.md</code>) so the skill can read the structured findings and translate them.</li>\n<li>A directive to use unidirectional comparison (current → desired) unless the user explicitly asked for bidirectional\nanalysis.</li>\n<li>A directive to report the <strong>actors and modes it observed</strong> in the desired state — named roles and sub-roles,\ninteractive vs. batch/automated modes, and API / agent / integration surfaces — as a neutral observation in its\noutput. The analyzer already reads the desired state's full surface area while building the correspondence map; this\nonly asks it to surface what it saw. It is an observation, not a prioritization or classification, so it does not\ntouch the analyzer's neutral posture.</li>\n</ul>\n<p>Read the observed-actor list from the analyzer's output once it returns; it seeds the <code>han-core:junior-developer</code> actor\nsweep in Step 5.</p>\n<p>Wait for the agent's return. The summary it returns names the file path and gap counts by category. Read the full\nanalysis file from disk before proceeding — the per-gap entries (<code>GAP-001</code>, <code>GAP-002</code>, ...) are in the file, not the\nreturned summary.</p>\n<h2>Step 3: Classify Size and Build the Swarm</h2>\n<p><strong>Default to small.</strong> Start the classification at <strong>small</strong> and only escalate to medium or large when the signals below\nclearly require it. When a signal is borderline, stay at the smaller band. Use these signals from the\n<code>han-core:gap-analyzer</code> output:</p>\n<ul>\n<li><strong>Small</strong> <em>(default)</em> — 0–3 total gaps, single domain (e.g., one feature, one module, one document section), no\nsecurity / data / cross-service / architectural signals in any gap. Swarm: <strong>2–3 agents</strong> (validator +\nhan-core:junior-developer, plus investigator when the current state is concrete).</li>\n<li><strong>Medium</strong> — 4–10 total gaps, two or three adjacent domains, may touch one cross-cutting concern (a single auth\nsurface, a single integration boundary, a single data-contract change). Swarm: <strong>4–6 agents</strong> (validator +\nhan-core:junior-developer + investigator + 1–2 domain specialists + han-core:plan-synthesizer).</li>\n<li><strong>Large</strong> — 11+ gaps, OR cross-cutting concerns across multiple domains (security + data + architecture, or\ncross-service integration), OR the user explicitly requested a full swarm. Swarm: <strong>6–8 agents</strong> (validator +\nhan-core:junior-developer + investigator + 2–4 domain specialists + han-core:plan-synthesizer).</li>\n</ul>\n<p><strong>Always required, at every size:</strong></p>\n<ul>\n<li><code>han-core:adversarial-validator</code> — attacks the han-core:gap-analyzer's findings with counter-evidence to surface\ninvalid gaps and produce per-gap confidence verdicts.</li>\n<li><code>han-core:junior-developer</code> — runs the actor-perspective sweep. For every gap, enumerates every actor the desired\nstate addresses or implies (human end users and sub-roles, API callers, AI agents, integration partners, batch\nprocesses, internal services) and checks whether the gap holds for every actor type. Surfaces gaps the analyzer missed\nbecause it only considered one actor type.</li>\n</ul>\n<p><strong>Required when the current state is concrete</strong> (codebase, document on disk, fetchable URL — not inline-text-only\ncomparison):</p>\n<ul>\n<li><code>han-core:evidence-based-investigator</code> — verifies each gap against the actual current state with file-level or\ndocument-level evidence. Effectively always required at medium and large; the inline-text-only path is the rare\nexception.</li>\n</ul>\n<p><strong>Required at medium and large:</strong></p>\n<ul>\n<li><code>han-core:plan-synthesizer</code> — consolidates swarm output into Section 4 of the report during synthesis (Step 5.6). Not\ncalled per-round.</li>\n</ul>\n<p>Add domain specialists up to the size cap based on what the gaps actually touch. Read the gap entries to decide. Draw\nfrom:</p>\n<ul>\n<li><code>han-core:adversarial-security-analyst</code> — gaps touching auth, authorization, PII, secrets, untrusted input, supply\nchain.</li>\n<li><code>han-core:user-experience-designer</code> — gaps touching user-facing flows, UI, interaction, accessibility.</li>\n<li><code>han-core:data-engineer</code> — gaps touching schemas, migrations, data movement, analytics.</li>\n<li><code>han-core:devops-engineer</code> — gaps touching deployment, observability, rollout, scale, SLO impact, cost.</li>\n<li><code>han-core:on-call-engineer</code> — gaps where the current application source is missing the named code-level resilience\npatterns the desired state implies: timeouts, retry safety, idempotency, backpressure, kill switches, correlation-id\npropagation, observability of failure paths. Application source only — defer infrastructure and pipeline gaps to\n<code>han-core:devops-engineer</code>.</li>\n<li><code>han-core:system-architect</code> — gaps crossing service or bounded-context boundaries, integration patterns, data\nownership.</li>\n<li><code>han-core:software-architect</code> — gaps inside a single codebase touching module boundaries, abstractions, SOLID\nconcerns.</li>\n<li><code>han-core:content-auditor</code> — gaps where the desired state is documentation and content preservation is in question.</li>\n<li><code>han-core:codebase-explorer</code> — gaps where the current state is unfamiliar code that needs deeper discovery before the\nvalidators can act.</li>\n</ul>\n<p>Extra agents named in the project config's <code>## Extra Agents</code> list join this domain-specialist pool and compete under\nthe same gap-driven selection and size caps, per\n<a href=\"../../references/config-rule.md\">../../references/config-rule.md</a>: add one only when a gap touches its stated\nspecialty, count it against the size cap, and skip an entry that does not resolve to a dispatchable agent with a\none-line note.</p>\n<p>State the size, the chosen swarm composition, and the per-specialist justification to the user in a short message — for\nexample:</p>\n<blockquote>\n<p><strong>Size: medium.</strong> Detected 7 gaps across the auth surface and the user-profile data contract. <strong>Swarm (5 agents):</strong></p>\n<ul>\n<li><code>han-core:adversarial-validator</code> — required at every size.</li>\n<li><code>han-core:junior-developer</code> — required at every size; actor sweep across the auth surface (human users, API callers,\ninternal service callers).</li>\n<li><code>han-core:evidence-based-investigator</code> — required; verifies the auth-surface gaps against <code>src/auth/</code>.</li>\n<li><code>han-core:adversarial-security-analyst</code> — three gaps touch session-token handling.</li>\n<li><code>han-core:plan-synthesizer</code> — required at medium; consolidates swarm output into Section 4.</li>\n</ul>\n</blockquote>\n<p><strong>Size override.</strong> If <code>$size</code> is non-empty (the user passed <code>small</code>, <code>medium</code>, <code>large</code>, or <code>dynamic</code> as the first\nargument), use it: a band value is the size and skips the signal-based classification above, while <code>dynamic</code> forces the\nsignal-based classification even when the project config sets a default band. If <code>$size</code> is empty and the project\nconfig supplies a band via <code>default-swarm-size</code> (per the config rule in\n<a href=\"../../references/config-rule.md\">../../references/config-rule.md</a>), use that band, skip the signal-based\nclassification, and announce the config as the source. The swarm composition still scales to the chosen size. If the\nuser named specific specialists, honor those. If the user requested a different size in conversation rather than via\n<code>$size</code>, accept the override.</p>\n<h2>Step 4: Confirm Swarm and Technical-Detail Modes</h2>\n<p>Surface both decisions to the user in one combined message:</p>\n<blockquote>\n<p><strong>Swarm: running by default with [team above].</strong> Reply <code>no swarm</code> to skip the swarm entirely, <code>lightweight</code> to drop to\nthe minimum two (validator + han-core:junior-developer), or name specialists to add or remove.</p>\n<p><strong>Technical details: not included by default.</strong> Reply <code>include technical details</code> to add Section 3 with file-level\nfidelity, or <code>plain language only</code> to omit it.</p>\n</blockquote>\n<p>If the user already specified either mode in their original request (e.g., \"run a gap analysis with technical details\"\nor \"skip the swarm\"), honor that and skip this confirmation.</p>\n<p>Default behavior when the user does not respond or says \"proceed\": <strong>swarm runs as recommended, plain language only.</strong>\nRecord the chosen modes — they determine which sections appear in the final report.</p>\n<h2>Step 5: Run the Swarm (unless opted out)</h2>\n<p>If the user passed <code>no swarm</code>, skip to Step 6.</p>\n<p>Launch every selected swarm agent in parallel — a single Agent-tool message with one tool call per agent so they run\nconcurrently — except <code>han-core:plan-synthesizer</code>, which is held for synthesis after the other agents return (see Step\n5.6). Use domain-scoped briefs:</p>\n<ul>\n<li>Pass each agent the path to the <code>han-core:gap-analyzer</code>'s full analysis file plus the gap entries relevant to its\ndomain inline. For <code>han-core:adversarial-validator</code>, <code>han-core:evidence-based-investigator</code>, and\n<code>han-core:junior-developer</code>, pass the entire gap list — they are generalist by design for this use case.</li>\n<li>Pass each agent the resolved current-state and desired-state paths so it can re-read them on demand.</li>\n<li>Frame the question precisely:\n<ul>\n<li><strong>Validator</strong> (<code>han-core:adversarial-validator</code>) — \"For each gap below, attempt to disprove it. Cite\ncounter-evidence. Return a per-gap verdict: <code>confirmed</code>, <code>contradicted</code>, or <code>inconclusive</code>, with reasoning. Apply\nfull provenance scrutiny to the inputs. When a provenance concern applies <em>uniformly to the desired-state artifact\nas a whole</em> (for example, the desired state is a provided, uncommitted, same-session source), return it <strong>once</strong> as\na single artifact-level <code>analysis_caveat</code> — not as a per-gap verdict repeated across every gap that rests on that\nartifact. Keep provenance concerns specific to an <em>individual</em> gap's evidence inside that gap's verdict.\"</li>\n<li><strong>Investigator</strong> (<code>han-core:evidence-based-investigator</code>) — \"For each gap below, verify whether the current state\nactually shows what the analyzer claimed. Cite file paths and line numbers in your reasoning, but return a per-gap\nverdict: <code>confirmed</code>, <code>contradicted</code>, or <code>unverifiable</code>.\"</li>\n<li><strong>Junior-developer (actor sweep)</strong> — \"For every gap in the analyzer's output, run an actor-perspective sweep.\nCandidate actors the analyzer observed in the desired state: [paste the observed-actor list from Step 2; write\n<code>none observed</code> if the analyzer reported none]. Treat that list as a floor, not a ceiling — expand it with every\nactor type the desired state addresses or implies: human end users (and sub-roles like customer / admin / auditor /\nsupport agent), API callers, AI agents, integration partners, batch processes, internal services. For each gap,\ncheck whether it holds for every actor type or only the one the analyzer compared against. Surface as\n<code>proposed_new_gap</code> any case where the analyzer's gap is correct for one actor but a <em>different</em> gap exists for\nanother actor that the analyzer missed. Apply Protocol 8 plain-language reframing to each gap from the most-affected\nactor's vantage point and flag any gap that would not be recognizable as a gap to that actor.\"</li>\n<li><strong>Augmenters</strong> (every domain specialist) — \"For each gap that touches your domain, add concrete context the\nhan-core:gap-analyzer may have missed: related risks, secondary effects, or refinements to the gap's framing. Do not\nintroduce new gaps; if you find one, raise it as <code>proposed_new_gap</code> with evidence.\"</li>\n</ul>\n</li>\n<li>Direct every agent to cite gap IDs as <code>GAP-NNN</code> (the analyzer's IDs) so the skill can map them back to <code>G-NNN</code> in the\nreport.</li>\n</ul>\n<p>Collect every agent's verbatim output. If an agent returned a <code>proposed_new_gap</code> with evidence, append it to the\nanalyzer's findings as a new <code>GAP-NNN</code> entry before report rendering — do not silently drop it. Mark it in the report\nwith a footnote noting it was surfaced by the swarm and by which agent (<code>han-core:junior-developer (actor sweep)</code>,\n<code>han-core:adversarial-security-analyst</code>, etc.).</p>\n<h2>Step 5.5: Conditional Second Round</h2>\n<p>Inspect the first-round swarm output for signals that the analyzer's correspondence map systematically excluded an actor\ntype or behavior class:</p>\n<ul>\n<li><strong>Trigger A:</strong> the swarm returned <strong>≥ 3 <code>proposed_new_gap</code></strong> entries.</li>\n<li><strong>Trigger B:</strong> the swarm returned <strong>contradictions on ≥ 20%</strong> of the analyzer's original gaps.</li>\n</ul>\n<p>If neither trigger fires, skip to Step 5.6.</p>\n<p>A fired trigger is a <em>proxy</em> for the same underlying signal — the first pass systematically under-covered an actor type\nor behavior class. The proposed gaps the swarm already surfaced are a <em>symptom</em> of that under-covered class, not the\nwhole of it. So the round's job is to re-scan that class for <em>additional</em> gaps and to catch recategorizations and\nwithdrawals — not to re-confirm the gaps the swarm already corroborated.</p>\n<p>If a trigger fires, run one additional pass — bounded to one extra round, never more:</p>\n<ol>\n<li>Re-dispatch <code>han-core:gap-analyzer</code> with the new findings and the actor types <code>han-core:junior-developer</code> surfaced.\nBrief: \"Your first pass produced N gaps. The validator-augmenter swarm surfaced [new gaps / contradictions], which\npoint to the actor or behavior classes [list] being under-covered in your first pass. <strong>Do not re-confirm gaps the\nswarm has already corroborated.</strong> Re-scan both artifacts focused on those classes and return only the delta: (a)\n<em>additional</em> new gaps in those classes that neither your first pass nor the swarm has surfaced, (b) gaps that need\nrecategorization, and (c) gaps that should be withdrawn.\"</li>\n<li>Read the delta. Merge new gaps into the source file with fresh <code>GAP-NNN</code> IDs in append order. Record\nrecategorizations and withdrawals.</li>\n<li>Do <strong>not</strong> re-run the full swarm. The second round is for the analyzer; the swarm verdicts on existing gaps carry\nforward.</li>\n</ol>\n<p>Record in the in-channel summary that a second round ran and why (which trigger, what changed).</p>\n<h2>Step 5.6: Plan-Synthesizer Consolidation (medium and large only)</h2>\n<p>If <code>han-core:plan-synthesizer</code> is not on the team, skip to Step 6.</p>\n<p>Launch <code>han-core:plan-synthesizer</code> with:</p>\n<ul>\n<li>The full <code>han-core:gap-analyzer</code> source file (including any second-round delta).</li>\n<li>The verbatim output from every other swarm agent.</li>\n<li>The four-section template at <a href=\"./references/gap-analysis-report-template.md\">gap-analysis-report-template.md</a>.</li>\n<li>The chosen modes (swarm: yes, technical details: yes/no).</li>\n</ul>\n<p>Ask the han-core:plan-synthesizer to produce <strong>only Section 4 content</strong> — Confirmations, Contradictions, Augmentations,\nany artifact-level Analysis caveats the validator returned, and the Confidence summary table — plus per-gap confidence\nvalues for the skill to fold into Section 2. Direct the synthesizer to keep analysis caveats out of the per-gap confidence values\n(they apply to the whole report, not to any one gap). The synthesizer does not write the report file directly; it returns the\nconsolidated Section 4 content and confidence values to the skill, which renders them into the template in Step 6.</p>\n<h2>Step 6: Synthesize the Report</h2>\n<p>Read <a href=\"./references/gap-analysis-report-template.md\">gap-analysis-report-template.md</a>. Render the report by filling\nplaceholders and removing optional sections that do not apply.</p>\n<p><strong>Render rules:</strong></p>\n<ol>\n<li><strong>Map IDs.</strong> For each <code>GAP-NNN</code> from the analyzer (and any <code>proposed_new_gap</code> from the swarm, plus any second-round\ndelta), produce a corresponding <code>G-NNN</code> entry in the report. Preserve order. Do not skip IDs.</li>\n<li><strong>Translate to plain language for Sections 1 and 2.</strong> The analyzer's per-gap content is technical (file paths, code\nidentifiers, document headings). For Sections 1 and 2, restate each gap's <code>Expected</code>, <code>Current</code>, and <code>Why it matters</code>\nfields in plain language a non-technical stakeholder can read. Strip every file path, line number, function name,\nclass name, schema field name, library name, and language primitive. Replace technology terms with capability or\nbehavior descriptions (\"the part of the system that authenticates users\" rather than <code>auth/middleware.ts:42</code>).</li>\n<li><strong>Set confidence per gap.</strong> If the swarm ran, derive confidence from swarm verdicts: <code>High</code> when ≥ 2 swarm agents\nconfirmed the gap with evidence; <code>Medium</code> when one agent confirmed or augmenters added context without contradiction;\n<code>Low</code> when at least one agent contradicted it. If the synthesizer was on the team, use the per-gap confidence values it returned\nin Step 5.6. If no swarm ran (<code>no swarm</code> path), mark every gap <code>Medium</code> — confidence rests on the analyzer alone —\nand state this in the executive summary.</li>\n<li><strong>Inline swarm augmentations into Section 2.</strong> For each gap that received augmenter context (added risks, secondary\neffects, refined framing, actor-perspective notes from han-core:junior-developer), add an\n<code>Additional context (swarm):</code> line to that gap's Section 2 entry in plain language. The same augmentation is\npreserved verbatim in Section 4's Augmentations list for audit trail. Augmentations enrich understanding; they do not\nchange the gap's category or confidence.</li>\n<li><strong>Compose the executive summary's \"shape of the gap\" bullets</strong> by clustering related gaps thematically. Each bullet\nis a plain-language theme covering one or more gaps. Do not enumerate every gap here — that is Section 2's job.</li>\n<li><strong>Render Section 3 (Technical Details) only if the user opted in.</strong> For each gap, fill <code>Locations</code>,\n<code>Relevant identifiers</code>, <code>Specifics of the divergence</code>, <code>Remediation direction</code>, <code>Effort signal</code>, and\n<code>Risks / dependencies</code>. Pull <code>Locations</code> and <code>Relevant identifiers</code> directly from the analyzer's evidence pairs. The\nskill itself produces the <code>Effort signal</code> only when the analyzer or the swarm provided enough information; otherwise\nmark it <code>Unknown</code> with a one-sentence basis. If a gap is <code>Implicit</code> and has no concrete location, omit its Section 3\nentry and note it in the section-3 preface as expected.</li>\n<li><strong>Render Section 4 (Swarm Findings) by default.</strong> Section 4 is omitted only when the user passed <code>no swarm</code>. Group\nentries into Confirmations, Contradictions, and Augmentations using the swarm agents' verbatim verdicts. Build the\nConfidence summary table from the per-gap confidence values set in step 3. If the synthesizer was on the team, use the\nconsolidated Section 4 content it returned in Step 5.6.</li>\n<li><strong>Render artifact-level analysis caveats once.</strong> Collect every <code>analysis_caveat</code> the validator returned (Step 5) into\nSection 4's <strong>Analysis caveats</strong> subsection, rendered once as a plain reminder that applies to the whole report —\nexplicitly not a gap finding. Do not let any caveat feed the per-gap confidence values set in step 3. If no\n<code>analysis_caveat</code> was returned, omit the subsection. (On the <code>no swarm</code> path there is no validator, so there are no\nanalysis caveats.)</li>\n<li><strong>Render the \"Where to start\" view only if a purpose was captured.</strong> If Step 1 recorded a purpose, render the\noptional <strong>Where to start</strong> block in Section 1 (after the magnitude table): up to five gaps that most block that\nstated purpose, each as <code>G-NNN — one-line plain-language reason it blocks {purpose}</code>, under the explicit label \"Where\nto start (skill judgment for your stated purpose: ).\" This is the skill's labeled synthesis judgment from\nthe Operating Principles — it adds no new gaps, changes no categories or confidence, and cites only existing <code>G-NNN</code>\nIDs. If no purpose was captured, omit the block entirely; never invent a purpose to justify it.</li>\n<li><strong>Update the optional-section markers in the front matter.</strong> If Section 3 was not rendered, remove\n<code>- technical_details</code> from <code>sections_included</code>. If Section 4 was not rendered (because the user passed <code>no swarm</code>),\nremove <code>- swarm_findings</code>. Update the \"How to Read This Report\" frame so it does not promise sections that are not\npresent — replace each promise with a single line stating the section was not included for this report. The \"Where\nto start\" block and the \"Analysis caveats\" subsection are conditional content inside existing sections, not\ntop-level sections, so they do not get their own <code>sections_included</code> entries.</li>\n</ol>\n<p><strong>Readability.</strong> Invoke <code>han-communication:readability-guidance</code> to surface the shared readability standard into your\ncontext, then draft every prose region to that standard: lead with the main point, give sections descriptive headings\nthat name their content, keep one idea per paragraph with the first sentence carrying it, number sequential steps and\nbullet non-sequential items, and reveal detail in layers (Section 1 before 2, 2 before 3). Do not duplicate the rule's\ntext; apply it. The rule governs prose only — leave code fences, any diagram bodies, and the <code>G-NNN</code> gap IDs untouched,\nsince those IDs are citation identifiers that must survive every rewrite and the self-check unchanged.</p>\n<p>Write the rendered report to the path resolved in Step 1.</p>\n<h2>Step 6.5: Readability Rewrite and Self-Check</h2>\n<p><strong>Readability editor (consolidated reports only).</strong> When the run produced a consolidated report — the medium and large\nsizes where <code>han-core:plan-synthesizer</code> consolidated Section 4 — dispatch the <code>han-communication:readability-editor</code>\nagent in a single Agent call to audit and rewrite the report against the standard. Pass it the report file path and the\ndefault audience frame (a capable reader who did not do this work and lacks the author's context); the editor reads\nhan-communication's own canonical rule, so pass no rule path. Direct it to preserve every fact and to rewrite prose\nregions only — never inside code fences, diagram bodies, or the <code>G-NNN</code> gap-ID citation identifiers. Apply its rewrite\nto the report file. At small size and on the <code>no swarm</code> path this is the lightweight gap-analyzer-only pass, so skip\nthis dispatch; the template above and the self-check below still apply.</p>\n<p><strong>Self-check (all sizes, after any rewrite, before presenting).</strong> Run the standardized readability self-check (the\nshared standard is in your context from <code>han-communication:readability-guidance</code>) over the report's prose regions only —\nnever inside code fences, diagram bodies, or the <code>G-NNN</code> gap-ID citation identifiers. Confirm each criterion and fix any\nfailure before presenting:</p>\n<p>Run the readability rule's standardized self-check, which is already in your context from the <code>readability-guidance</code>\ninvocation above. Correct every failure before presenting. Its fidelity criterion is not optional: the standard governs\nhow the content is said, and drops a required fact only when the reader asked for less and losing it would not change\nwhat they do next.</p>\n<h2>Step 7: Present the Report</h2>\n<p>Tell the user, in a short summary:</p>\n<ul>\n<li>The report path.</li>\n<li>The path to the <code>han-core:gap-analyzer</code>'s underlying source file (so they can verify the technical evidence).</li>\n<li>The size class chosen and the modes used (swarm: yes/no with composition; technical details: yes/no).</li>\n<li>The total gap count and the breakdown by category, exactly as it appears in the report's executive summary.</li>\n<li>If a second round ran in Step 5.5, which trigger fired and what changed (new gaps surfaced, recategorizations,\nwithdrawals).</li>\n<li>If a purpose was captured, a one-line note that the report includes a \"Where to start\" view for that purpose.</li>\n<li>Any open recommendations: a one-line note if the swarm contradicted any gaps (those need adjudication), if any\n<code>proposed_new_gap</code> was surfaced and added, if an artifact-level analysis caveat was raised (e.g., the desired state is\nan uncommitted same-session source), or if the synthesizer flagged anything specific in the Section 4 consolidation.</li>\n</ul>\n<p>Ask whether the user wants to add technical details (if Section 3 was omitted) or refine the scope and re-run.</p>\n","files":[{"path":"references/gap-analysis-report-template.md","sizeBytes":10766,"isText":true},{"path":"SKILL.md","sizeBytes":32654,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-10-15T13:12:06.710817Z","sha256":"8FBD09FE9EAD124C5E9F6C094432B5FBB1F0B5CB756473F676CC9DF0F190BEB2","sizeBytes":15928},"review":null,"source":{"repositoryUrl":"https://github.com/testdouble/han","path":"han-research/skills/gap-analysis","license":"MIT","commit":"abba73a773528905a8f3d15956029394746e5c7f","subtreeSha":"803C439FC87D5C06A7AA0C26F269B30489798A4A34CE7CD973DAE9E6673DB62E","lastSyncedAt":"2026-10-15T13:11:53.672149Z"},"reviewedAt":"2026-10-15T13:12:41.74346Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/testdouble/han/tree/main/han-research/skills/gap-analysis"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install testdouble-han@llmmart"},{"target":"git","command":"git clone https://github.com/testdouble/han.git"}]}