kramme-cc-workflow/skills/kramme:siw:implementation-audit/SKILL.md
Exhaustively audit codebase implementation against specification. Detects spec divergences, undocumented implementation extensions, contract violations, and spec drift. Supports inline report output and an optional team mode for multi-agent cross-validation.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:siw:implementation-auditInstall 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.
Exhaustively compare the codebase implementation against specification documents.
/kramme:siw:spec-audit to audit the spec itself for ambiguity, gaps, or contradictions before comparing against code./kramme:siw:product-audit to evaluate whether the spec describes the right product./kramme:pr:code-review for code quality on a specific diff; this skill compares the full implementation against the full spec.Standard mode assumes a host harness with a research sub-agent primitive (Claude Code: Task tool with subagent_type=Explore; Codex: equivalent task sub-agent). Interactive YAML prompt blocks shown in later steps map to the host's interactive question mechanism. Team mode (--team) additionally requires multi-agent support and is gated explicitly in references/team-mode.md.
Every audit must detect and report both:
A report is not complete unless it includes:
IMPORTANT: This workflow is adversarial and exhaustive. Do not return early. Do not conclude anything is implemented without reading code. Grep hits are not implementation evidence.
If $ARGUMENTS contains --team, remove that flag, read references/team-mode.md, and follow that workflow instead of the standard workflow below. Pass the remaining arguments through as the team-mode arguments.
$ARGUMENTS contains the spec file path(s), keyword, and optional flags.
Extract control flags first:
$ARGUMENTS contains --auto, set AUTO_MODE=true and remove the flag before processing remaining arguments.$ARGUMENTS contains --inline, set INLINE_MODE=true and remove the flag before processing remaining arguments.--team was already handled by the Team Mode section above and never reaches this step.Extract --model flag next (Claude Code only — ignored on other platforms):
$ARGUMENTS contains --model opus, --model sonnet, or --model haiku, extract it and store as agent_model.opus$ARGUMENTS before processing remaining arguments.--auto means:
Detection rules for remaining arguments:
/ or ends in .md, .txtsiw: Explicitly requests auto-detectionRead references/spec-resolution.md, then resolve spec_files using the explicit-path flow or the SIW auto-detection flow that matches the remaining arguments.
Required behavior from the reference:
LOG.md, OPEN_ISSUES_OVERVIEW.md, DISCOVERY_BRIEF.md, SPEC_STRENGTHENING_PLAN.md, AUDIT_*.md, PRODUCT_AUDIT.md, SIW_*.md.Read every file in spec_files fully and extract a requirements checklist.
Read each spec file completely. Do not skim. Understand the full picture before extracting requirements.
Everything in the spec is a requirement — names, structures, behaviors, contracts, constraints. If the spec describes it, the code must match it. Extract checkable items across all of these areas:
For each item, capture:
REQ-001)MUST, ONLY, NEVER (or synonyms)For each requirement, detect strict operators:
MUST/REQUIRED/SHALL -> MUSTONLY/EXCLUSIVELY -> ONLYNEVER/MUST NOT/FORBIDDEN -> NEVERAny requirement with at least one strict marker requires explicit negative/permissiveness testing in Pass A.
When parsing specs:
siw/OPEN_ISSUES_OVERVIEW.md for phase status if available).Spec Analysis Complete
Sources:
- {spec_file_1}
- {spec_file_2}
Requirements Extracted: {total}
Spec Sections: {section_count}
Strict requirements (MUST/ONLY/NEVER): {strict_total}
Key search terms identified: {count} unique names/identifiers
If no extractable requirements found:
Warning: Could not extract structured requirements from {file}.
The file may need clearer acceptance criteria, named entities, or explicit contracts.
If AUTO_MODE=true, choose Attempt best-effort scan automatically.
Otherwise use AskUserQuestion:
header: "No Requirements Found"
question: "Could not extract structured requirements. How should I proceed?"
options:
- label: "Attempt best-effort scan"
description: "Search for any named terms found in the spec, even without clear requirement structure"
- label: "Abort"
description: "Cancel the audit"
Group requirements by spec file or major spec section (not by abstract domain). Each group will be assigned to an Explore agent that receives the full context of that spec section.
For each group of requirements, identify:
**/*controller*, **/*model*)This information will be passed to Explore agents to direct their search.
Create a section-level matrix row for every spec section that contributed requirements:
| Section ID | Source | Req Count | Strict (M/O/N) | Pass A Checked | Pass B Checked | Divergences | Extensions | Alignments | Evidence Refs | Status | | --- | --- | --: | --: | --: | --: | --: | --: | --: | --- | --- |
Initialize Status = PENDING.
Coverage is complete only when each row has:
CRITICAL: A grep hit is not evidence. Read and reason about actual behavior.
For each group from Step 3, launch an Explore agent using the Task tool (subagent_type=Explore, model={agent_model}).
Default model: opus. Override with --model sonnet or --model haiku for faster/cheaper runs.
All agents run in parallel — launch them in a single message with multiple Task tool calls.
Read the Pass A agent prompt template from references/pass-a-conformance.md. Each agent receives that prompt structure, populated with its assigned spec section and requirements checklist.
Agents must return:
MISSING requirementPass B is mandatory even if Pass A appears mostly compliant.
Launch Explore agents in parallel to hunt for undocumented implementation behavior beyond spec boundaries.
Read the Pass B agent prompt template from references/pass-b-extension.md. Each agent receives that prompt structure, populated with its assigned spec context.
Treat low-findings outcomes on large specs as suspicious:
requirements >= 30 or sections >= 6.divergences + extensions < max(3, ceil(requirements * 0.05)).If suspiciously clean, auto-run Pass B2 before finalizing:
MUST/ONLY/NEVER), role checks, config flags, and data-access boundaries.If Pass B2 cannot run, mark the audit BLOCKED and do not produce a final report.
Aggregate Pass A and Pass B/B2 findings by requirement and section.
A conflict exists when:
For each conflict:
If any conflict remains unresolved, audit is BLOCKED and no final report may be produced.
Every Divergence, Extension, and Verified Alignment must include:
Findings missing any of the above are invalid until evidence is completed.
After findings are stable (post tie-break, evidence verified), join them against existing SIW issues:
siw/issues/ does not exist, populate the report's Existing-Issue Cross-Reference section with None and skip the rest of this step.siw/issues/*.md and read each issue's title and Related / Spec requirement / Finding lines.REQ-{id} or finding ID (DIV-{n} / EXT-{n}), orHygiene constraints (Hard):
Complete the section matrix for every audited section with:
If the matrix is incomplete, audit is BLOCKED and no final report may be produced.
If a previous report exists (siw/AUDIT_IMPLEMENTATION_REPORT.md, or AUDIT_IMPLEMENTATION_REPORT.md in the project root), read it and parse the previously reported finding IDs (DIV-NNN / EXT-NNN), recording the highest of each as previous_max_id:
DIV-NNN / EXT-NNN IDs.previous_max_id + 1 within their prefix.If no previous report exists, number findings DIV-001, EXT-001, etc. from scratch.
This keeps IDs stable across re-runs so commits, SIW issues (e.g. /kramme:siw:resolve-audit filenames ISSUE-G-XXX-{finding-id}-*.md), and external references stay valid.
Generate the report using the schema from assets/report-schema.md. All sections in the schema are mandatory. If a section has zero entries, include the section with None.
Read the report output procedure from references/report-and-issue-output.md.
Read the SIW issue creation procedure from references/report-and-issue-output.md.
Use the summary template from assets/audit-complete-summary.md.
STOP HERE. Wait for the user's next instruction.
For spec file errors, no-requirements cases, Explore agent failures, unresolved conflicts, incomplete coverage, and inactive SIW workflow handling, read references/error-handling.md and apply the matching branch.
tools
Requires Linear MCP. Implements one Linear issue end to end, selects applicable code-review, convention, and PR-refactor gates, runs them to bounded convergence, verifies, and optionally opens the PR and iterates on CI and review feedback until green. Use when the user wants a single Linear issue taken from implementation through a clean Pull Request. Not for implementation-only work, SIW-tracked issues, stacked PRs, existing PR updates, or post-merge rollout.
development
Reviews PR and local changes for convention drift and overcaution against documented rules and mined peer-file practice. Use for new patterns, dependencies, abstractions, or defensive complexity that departs from established practice; every finding cites evidence. Supports --inline. Not for general code quality (use kramme:pr:code-review) or spec review (use kramme:siw:spec-audit --team).
testing
Charts huge or foggy initiatives into a local `.context` decision map and resolves one typed frontier ticket per session until the work is ready for SIW or another execution workflow. Use when the route to a destination cannot fit in one agent session or parallel workspaces need coordinated planning state. Not for clear specs, ordinary issue decomposition, implementation, or Linear-native tracking.
development
Investigates a question against primary sources and saves one cited Markdown artifact. Use for reading legwork: official docs/API facts, source-code or spec checks, standards, and first-party service behavior before planning or implementation. Not for making product or architecture decisions, implementing code, broad web search, secondary blog summaries, or uncited answers.