/nacl:tl-verify-codefrom nacl
Static code analysis that verifies implementation correctness by tracing data flow from DB to UI. Returns PASS/FAIL statuses and a detailed report. Invoke via /nacl:tl-verify-code.
Ships in nacl. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Inputs this skill consumes:
package.json scripts.test (read to discover the test runner)Outputs this skill produces:
kind
(code-defect | spec-drift | coverage-gap | suggestion | info),
routedTo (downstream skill route, e.g. /nacl:tl-reconcile), and
note (pre-flag suppression breadcrumb such as
pre-flagged in review-be.md:84). Absence of these fields is
equivalent to kind: code-defect for ISSUE status and
kind: suggestion for SUGGESTION status.Downstream consumers of this output:
Contract change discipline: If this skill's output contract changes — status vocabulary, headline format, exit codes, or report-field names — every downstream consumer in the list above must be audited and updated in the same release. The 0.10.0→0.10.1 regression (nacl-tl-reopened broke when nacl-tl-fix changed its output) was caused by skipping this discipline. Do not ship contract changes without auditing consumers.
You are a code verification specialist. You verify that a change is CORRECTLY implemented by tracing the full data flow, not just checking code style.
/nacl:tl-review: checks code QUALITY (style, patterns, security, TDD compliance)/nacl:tl-verify-code: checks code CORRECTNESS (does the data flow work end-to-end?)/nacl:tl-verify-code UC028 # verify specific UC implementation
/nacl:tl-verify-code --task ELE-644 # verify by task code (if YouGile)
/nacl:tl-verify-code --files src/routes/analytics.ts # verify specific files
| Result | Meaning |
|---|---|
PASS | Static checks pass AND test suite ran AND at least one test covers the changed file(s) AND suite is clean |
PASS_NEEDS_E2E | All checks pass, changes affect UI — need browser verification; tests ran and passed |
UNVERIFIED | One of: (a) static checks pass but no test file imports the changed module(s) — coverage gap; (b) no baseline ref could be resolved (no --base flag, no saved baseline artifact, no merge-base HEAD main) — set arithmetic is undefined |
NO_INFRA | scripts.test is missing from the workspace's package.json — cannot run tests |
RUNNER_BROKEN | scripts.test exists but runner crashed (non-zero exit before any test ran, or zero tests collected and sanity check failed) |
BLOCKED | Suite ran; test(s) pass for the verified change, but unrelated pre-existing failures remain |
REGRESSION | Test suite reveals failures introduced by the change |
FAIL | Static analysis found issues that would cause runtime errors or incorrect behavior |
Static analysis alone never produces PASS. At best, static analysis without a passing test suite produces UNVERIFIED.
.tl/tasks/ or YouGile)git diff or explicit --files)Before tracing data flow, read every .tl/tasks/<UC>/review-*.md file for
the UC under verification (review.md, review-be.md, review-fe.md,
review-tech.md — whichever exist). These reviews may have already
catalogued issues as non-blocking and routed them downstream; Step 2.5
must not re-flag those same issues as fresh defects.
Parse the "issues" sections under both conventions:
${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/templates/review-template.md
§"Issues Found"): headings ### 🔴 Blockers (Must Fix),
### 🟠 Critical Issues (Should Fix),
### 🟡 Major Issues (Should Fix),
### 🟢 Minor Issues (Nice to Have), with sub-issue IDs
B01 / C01 / M01 / N01.## Critical Issues /
## Minor Issues (carried forward, non-blocking), with lowercase
IDs m-1 / m-2. The fixture
tests/fixtures/verify-code-enum-drift-snapshot/.tl/tasks/UC-EXP-001/review-be.md
demonstrates this layout.Build prior_flagged as a list of { tokens, kind, severity, source }:
tokens: a set of fingerprints extracted from the issue body —
every CAPS sequence matching [A-Z][A-Z0-9_]{2,} plus every
code span (back-tick-wrapped identifier). One real-world issue
often catalogues a multi-token rename (e.g. QUEUED/IN_PROGRESS/ COMPLETED/FAILED renamed to PENDING/PROCESSING/DONE/ERROR); the
set captures all of them so a later Step 2.5.5 suppression match
works on any one of the drifted tokens. Filter out the same common
acronyms enumerated in Step 2.5.2 to avoid spurious matches on
HTTP, JSON, etc.kind: heuristic from the issue text — spec-drift if the body
mentions "spec ... drift", "vocabulary drift", "spec lags",
"task-be.md uses ... vs actual", or "route to /nacl:tl-reconcile";
code-defect otherwise.severity: blocker / critical / major / minor from the
section heading or the symbol prefix.source: review-<phase>.md:<line of issue heading>.This step is read-only. Do not write or modify any review file. If no
review-*.md files exist for the UC, prior_flagged is empty and Step 2.5
proceeds without suppression.
Read .tl/tasks/<UC>/acceptance.md and build acceptance: [{ id, text }] —
one entry per acceptance criterion / REQ, not the category groups. This is
the requirements checklist Step 5.4 traces against: verification keyed on
code-presence alone passes a change that touches clean-tracing code while an
acceptance criterion is entirely unimplemented (the "missing-requirement"
defect class — e.g. an audit-log row the spec demands but no code writes).
For each acceptance[i], during the Step 2 trace, mark whether it is
implemented (a changed-code path actually produces the required behaviour —
confirmed via the Step 2.6 cross-file trace, not a plausibly-named function)
and whether it is covered (a collected test exercises it). A criterion that
is neither implemented in the change nor covered by a test is a coverage gap,
handled in Step 5.4. If the UC has no acceptance.md, acceptance is empty
and this traceability check is skipped (record it, do not fail).
For each changed area, trace the FULL flow:
Backend flow:
DB schema/migration → Repository/query → Service → Route handler → Response DTO → API contract
Frontend flow:
API client → Hook/Store → Component props → Render → UI output
Full-stack flow (for UC changes):
DB → Repository → Service → Route → API → Client → Hook → Component → UI
Check at each step:
The flows above are the canonical chain — but a defect often lives one hop off it, in a caller or a runtime the chain does not name. Do NOT stop at the template; trace the actual code graph:
src/, api/, web/, worker/, packages/, apps/, plus workspace-declared roots; exclude .tl/, docs/, prisma/, node_modules/, build folders) for import/require of the module and for call-sites of the symbol, then re-apply the per-step checks (types, field names, null handling, error propagation) at each consumer found.Emit any cross-file mismatch as a normal finding (status: ISSUE, kind: code-defect) — it contributes to FAIL like any other static defect. Do not introduce a new status.
Goal: distinguish three vocabulary-drift situations that look similar in casual inspection but require very different routing:
| Class | Code | Spec | Action |
|---|---|---|---|
SPEC_DRIFT | consistent canonical values | uses a stale value | non-blocking SUGGESTION routed to /nacl:tl-reconcile |
CODE_DRIFT | inconsistent (some files stale) | (either way) | blocking ISSUE → FAIL |
UNUSED_ENUM_VALUE | declares a value never used | n/a | informational SUGGESTION |
The verifier MUST run this structured check before classifying any enum-named token as a defect. Reading a stale spec and reporting "spec says X but code uses Y" without this procedure is the recurring false positive this step is designed to prevent.
code_enums (canonical set)Read enum declarations from:
**/prisma/schema.prisma — DB-level enums.
Pattern: enum <Name> {\n VALUE\n ...\n}.**/shared/**/enums.{ts,js,mjs,cjs} — runtime-level enums exported
from a shared package. Patterns:
export enum <Name> { VALUE = "...", ... }export const <Name> = { VALUE: "..." } as constconfig.yaml → verify_code.runtime_enum_globs
when the workspace declares additional canonical sources.Build code_enums: [{ name, values, source }] where source is
<file>:<line of declaration>.
spec_termsGrep .tl/tasks/<UC>/task-*.md for ALL-CAPS tokens matching
[A-Z][A-Z0-9_]{2,}. Strip common acronyms that never participate in
runtime enums: HTTP, HTTPS, SQL, JSON, API, URL, UC, RQ,
BRQ, NFR, ADR, TDD, CRUD, JWT, CORS, DTO, MVP, SLA,
MIME, UUID, ASR, NULL, TRUE, FALSE. Build spec_terms as a
set with { token, occurrences: [<file>:<line>, ...] }.
code_usageFor each value in every code_enums[*].values, grep all source roots
(src/, api/, web/, worker/, packages/, apps/, plus any
workspace-declared root) — but exclude .tl/, docs/, prisma/,
node_modules/, build/dist folders. Record where each canonical value
is used: code_usage: Map<value, [<file>:<line>, ...]>.
Also grep the same roots for spec_terms tokens that are NOT in any
code_enums[*].values — these are "alien tokens": present in spec, not
canonical. Record where each alien token appears in code:
alien_code_usage: Map<token, [<file>:<line>, ...]>.
For every code_enum (call it E) and every alien token T whose name
is enum-shaped and plausibly belongs to E's domain (heuristic: T
appears in task-*.md paragraphs that also mention E.name or any of
E.values), classify:
| Condition | Class | finding.status | finding.kind | finding.routedTo |
|---|---|---|---|---|
alien_code_usage[T] is empty and code_usage for E.values is non-empty everywhere | SPEC_DRIFT | SUGGESTION | spec-drift | /nacl:tl-reconcile |
alien_code_usage[T] is non-empty (T is used in code AND a canonical E.values member is also used elsewhere) | CODE_DRIFT | ISSUE | code-defect | (none) |
code_usage[v] is empty for some v ∈ E.values (declared but unused) | UNUSED_ENUM_VALUE | SUGGESTION | suggestion | (none) |
SPEC_DRIFT and UNUSED_ENUM_VALUE are never by themselves grounds
for a FAIL result. They contribute findings only. CODE_DRIFT is.
For each classified finding F, search prior_flagged (from Step 1.4)
for a matching entry P. A match exists when any of the following
holds (case-sensitive throughout):
F.token ∈ P.tokens — the exact alien/stale token the verifier
re-flagged was already named in the prior issue.F.enum_name ∈ P.tokens — the enum-name itself appears in the
prior issue (less common, but handles bare-name flags).(F.enum_canonical_values ∩ P.tokens) ≠ ∅ —
at least one canonical value of the disputed enum is mentioned in
the prior issue. This is the case when the catalogued review entry
reads "spec uses A vs actual B" and B is a current canonical value
of the same enum. The prior issue covers the entire rename family,
not only the specific stale pair.Severity ordering: blocker > critical > major > minor. Kind ordering:
code-defect > spec-drift > suggestion > info.
F.severity ≤ P.severity AND F.kind ≤ P.kind → suppress:
set F.status = INFO, add F.note = "pre-flagged in <P.source>".F.kind > P.kind (e.g. current finding is CODE_DRIFT but prior
flag was SPEC_DRIFT) → escalate, do not suppress: keep
F.status = ISSUE, add
F.note = "escalated from prior <P.source> SPEC_DRIFT classification".This guarantees that a drift previously reviewed as non-blocking spec drift but newly leaking into code (becoming code drift) still surfaces as a real defect.
Skip Step 2.5 silently and emit no enum findings when any of:
.tl/tasks/<UC>/ directory does not exist (TECH task with no UC
context).code_enums is empty (no Prisma schema, no shared enums file).task-*.md exists for the UC.A skipped Step 2.5 is not an error and does not affect the top-level result.
SPEC_DRIFT (see Step 2.5), not a code defect — finding goes out as
SUGGESTION routed to /nacl:tl-reconcile, NOT FAIL. Docs remain
canonical for new-requirement meaning (the semantic intent of a new
field or new entity), but never for the wire-level name of a token
already present in compiled code.CODE_DRIFT per Step 2.5 → ISSUE → contributes to FAIL)SPEC_DRIFT per Step 2.5 →
SUGGESTION + routedTo: /nacl:tl-reconcile, never FAIL)This step is mandatory. Static analysis alone cannot produce PASS.
Locate the workspace owning the changed files (the nearest package.json walking up from a changed file). Read its scripts.test.
scripts.test is missing → record NO_INFRA; skip 5.2–5.4.scripts.test exists → proceed to 5.2.Do NOT invent a runner. Do NOT substitute npx vitest, npx jest, or any other command. The runner is exactly what the workspace declares.
Baseline ref discovery (mandatory). This skill is invoked AFTER a change has landed; the working tree is already post-change. Running the suite once on the working tree is therefore not a baseline — it's a postfix-only measurement, and any "pre-existing" / "regression" claim from a single run is unprovable. Resolve a baseline ref in this priority order:
--base <ref> flag supplied by the caller (e.g. a tag, a commit SHA, or the name of an unmerged branch)..tl/tasks/{taskCode}/baseline-failures.json (written by an upstream nacl-tl-fix / nacl-tl-dev invocation at its CAPTURE BASELINE step). If present, use the failure set verbatim and skip the baseline-suite run.git merge-base HEAD main (or the configured git.main_branch).If none of the three resolves to a usable ref (e.g. shallow clone, no main, no saved artifact, no flag) → record the suite result as UNVERIFIED with reason no baseline ref resolvable. Do NOT classify as BLOCKED or REGRESSION — both require a baseline.
Baseline run (unchanged code) via worktree. Create a temporary worktree at the resolved baseline ref:
git worktree add <tempdir> <baseline_ref>
cd <tempdir> && <scripts.test>
git worktree remove -f <tempdir>
Capture:
tests_collected (number of tests discovered by the runner)baseline_failuresThe worktree is removed on every exit path (success, halt, error). Do NOT use git stash on the active branch — verifier callers may have uncommitted work the operator does not want disturbed.
Postfix run (current working tree, change already applied): run the same command on the working tree. Capture:
tests_collectedpostfix_failuresIf either run exits non-zero before any test runs, or if stderr is non-empty and stdout is empty → record RUNNER_BROKEN.
If tests_collected == 0 on either run:
git log).RUNNER_BROKEN.Derived sets (computed after both runs):
new_failures = postfix_failures − baseline_failures (failures introduced by the change)transitioned = baseline_failures − postfix_failures (failures that went away after the change)First, locate all test files (*.test.{ts,tsx,js,jsx}, *.spec.{ts,tsx,js,jsx}) in the workspace.
Empty-file guard: count the total number of it( / test( / it.each( / test.each( call sites across all test files.
it() count is zero, the files are hollow stubs.
Record NO_INFRA with reason empty test files — N test files found, 0 it() calls.
Do NOT proceed to 5.4 with this workspace; treat it the same as a missing scripts.test.
(Exception: if a test file contains only import * from './someFile.tests' proxy-imports, note
import-proxy pattern as INFO and count the imported file's it() calls instead.)Then grep test files for any import or require of the module name(s) being verified.
coverage_gap = true.coverage_gap = false.Cross the acceptance checklist from Step 1.5 against the trace results: for every criterion that is neither implemented in the change (Step 2.6) nor covered by a collected test, emit a finding kind: coverage-gap naming the criterion id, and set coverage_gap = true. This routes an unmet acceptance criterion through the existing coverage-gap → UNVERIFIED mapping below — a change cannot reach PASS while a required behaviour is unverified. (A criterion implemented but contradicted by the code is a code-defect/ISSUE → FAIL, not a coverage gap.)
Precondition checked FIRST, before any exit-code logic: tests_collected > 0 must hold for the postfix run.
tests_collected == 0 after the known-good-file re-run fallback → RUNNER_BROKEN. Do not proceed further.| Condition | Suite result |
|---|---|
NO_INFRA flag set (5.1 or 5.3 empty-file guard) | NO_INFRA |
RUNNER_BROKEN flag set (5.2 or 5.4 precondition) | RUNNER_BROKEN |
Baseline ref unresolvable (5.2 baseline-ref discovery) AND postfix_failures.size > 0 | UNVERIFIED (no baseline) — list postfix_failures but do NOT classify them as pre-existing or new |
new_failures.size > 0 (baseline available) | REGRESSION — list the failing test names from new_failures |
new_failures.size == 0 AND postfix_failures.size > 0 (baseline available) | BLOCKED — list the pre-existing failures from postfix_failures |
postfix_failures.size == 0 AND coverage_gap = true | UNVERIFIED |
postfix_failures.size == 0 AND coverage_gap = false AND no UI changes | PASS |
postfix_failures.size == 0 AND coverage_gap = false AND UI changes present | PASS_NEEDS_E2E |
Note: BLOCKED supersedes UNVERIFIED (coverage-gap variant) when pre-existing failures are present AND a baseline is available. Without a baseline, the result is UNVERIFIED, not BLOCKED — set arithmetic is undefined when one operand is missing (Cross-cutting principle P3).
Authoritative classifier (determinism). Do not re-derive the precedence by hand. Once the inputs are computed (Steps 2.5/5.1–5.3a), run the decision-table script and emit its token verbatim into VERIFY_CODE_RESULT.result:
node nacl-tl-verify-code/scripts/classify-status.mjs \
'{"staticFail":<bool>,"scriptsTestMissing":<bool>,"emptyTestStubs":<bool>,"runnerCouldNotExecute":<bool>,"testsCollected":<int>,"baselineResolved":<bool>,"newFailures":<int>,"postfixFailures":<int>,"coverageGap":<bool>,"uiChanges":<bool>}'
coverageGap is true if no test imports the changed module or Step 5.3a found an unmet acceptance criterion. The script encodes the full precedence in one place (including the FAIL overlay, which the prose left without a defined order — a confirmed static defect blocks regardless of tests, so FAIL is highest). The table above documents the logic the script implements; the script is the tie-break authority. Equivalence and precedence are pinned by scripts/classify-status.test.mjs (node --test nacl-tl-verify-code/scripts/classify-status.test.mjs) — every row maps to the exact same one of the 8 canonical tokens, so this is a derivation change, not a contract change.
Result format (structured):
VERIFY_CODE_RESULT:
result: PASS | PASS_NEEDS_E2E | UNVERIFIED | NO_INFRA | RUNNER_BROKEN | BLOCKED | REGRESSION | FAIL
taskCode: UC028
module: backend + frontend
summary: "one-line summary"
testRunner:
command: "npm test" # exact scripts.test command, or "none — NO_INFRA"
collected: N # tests collected in postfix run
passed: N
failed: N
coverageGap: true | false # whether changed files have test coverage
runnerOutput: "..." # first 20 lines of stdout/stderr snippet
baseline_failures: # set of test names that failed BEFORE the change
- "describe > test name"
postfix_failures: # set of test names that failed AFTER the change
- "describe > test name"
new_failures: # postfix_failures − baseline_failures (change introduced these)
- "describe > test name"
transitioned: # baseline_failures − postfix_failures (change fixed these)
- "describe > test name"
findings:
- file: src/routes/analytics.ts
line: 42
status: OK | ISSUE | SUGGESTION | INFO
kind: code-defect | spec-drift | coverage-gap | suggestion | info # optional; default code-defect for ISSUE, suggestion for SUGGESTION
detail: "description"
suggestedFix: "what to change" (only for ISSUE)
routedTo: "/nacl:tl-reconcile" # optional; non-empty implies a downstream skill should pick this up
note: "pre-flagged in review-be.md:84" # optional; pre-flag suppression breadcrumb
dbChecks:
- query: "SELECT ..."
expected: "column exists, type is varchar"
actual: "confirmed"
status: OK | FAIL
recommendation: "PASS_NEEDS_E2E because new data reaches UI components"
Decision logic summary:
tests_collected > 0 AND new_failures is empty AND postfix_failures is empty AND coverage_gap = false AND no UI changestests_collected > 0, postfix_failures is empty, but coverage_gap = truescripts.test missing OR test files exist with zero it() calls (empty stubs) — new_failures and postfix_failures are meaninglessscripts.test exists but runner could not execute, or tests_collected == 0 even after known-good-file re-run — environment issuenew_failures is empty but postfix_failures is non-empty — pre-existing failures not introduced by this change; surfaces postfix_failures listnew_failures is non-empty — change introduced test failures; surfaces new_failures listFAIL / CODE_DRIFT finding, re-read the cited code path once more and try to refute your own claim (a guard, a consumer that never hits it, a type that makes it safe); keep the finding unless that second read gives positive evidence it is a non-issue — never drop on uncertainty.kind: spec-drift and routedTo: /nacl:tl-reconcile. The top-level result (PASS / PASS_NEEDS_E2E / UNVERIFIED / NO_INFRA / RUNNER_BROKEN / BLOCKED / REGRESSION / FAIL) is determined solely by the test suite, the integrity gate, and CODE_DRIFT-class findings — never by spec drift./nacl:tl-verify orchestrator)${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/references/review-checklist.md — for additional quality checks${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/references/sa-doc-update-matrix.md — for understanding doc impactWhat SKILL.md sets; muted values are Claude Code's defaults
sonnetmediumnpx claudepluginhub itsalt/nacl --plugin nacl53 skills in this plugin
/ba-analyzeАнализ Excalidraw-доски бизнес-процесса: полнота, diff со snapshot, сравнение с Neo4j-графом.
Используй когда пользователь просит: проанализировать доску, проверить доску,
найти проблемы на доске, board analysis, nacl-ba-analyze.
/ba-contextDefine system boundaries in Neo4j graph: scope, stakeholders, external entities, data flows.— all data stored as graph nodes and edges.
Use when: define system scope with graph, system context diagram, or the user says "/nacl:ba-context".
/ba-entitiesCatalog business entities in Neo4j: stereotypes, attributes, states, CRUD matrix.Use when: model entities with graph, create entity catalog, or the user says "/nacl:ba-entities".
/ba-from-boardOrchestrator skill: unified BA-board workflow combining import_doc + analyze + sync.
Creates boards, imports client documents, analyzes completeness, syncs to Neo4j graph.
Invocation: /nacl:ba-from-board <command> [arguments]
/ba-fullFull BA model creation in Neo4j via 10-phase orchestration.
Chains all nacl-ba-* skills sequentially with user confirmation gates.Use when: create complete BA model with graph, full business analysis, or the user says "/nacl:ba-full".
/ba-glossaryBuild ubiquitous language glossary in Neo4j: terms, definitions, synonyms, links.Use when: create glossary with graph, define terms, or the user says "/nacl:ba-glossary".
Other plugins' skills for the same job