Skip to content
Development
Skill

/code-verification

Use after every code change, after writing tests, or before marking a task complete, and when the user says verify, quality gate, or audit code. Runs a 7-category mechanical check for TDZ, import, dead code, and mock leakage bugs.

From plugin
coco
631200 skills53 agents42 commands3 hooks

Claude Code

$ npx -y skills add coco-research/coco --skill code-verification --agent claude-code

SKILL.md

code-verification.SKILL.md
name: code-verification
description: "Use after every code change, after writing tests, or before marking a task complete, and when the user says verify, quality gate, or audit code. Runs a 7-category mechanical check for TDZ, import, dead code, and mock leakage bugs."
domain: engineering

Code Verification Skill

A systematic post-implementation verification workflow that catches the bugs AI coding assistants most commonly introduce. This is NOT a code review for style or architecture — it is a mechanical correctness checklist that catches structural errors (TDZ, imports, dead code, mock leakage, CSS orphans, React anti-patterns) that humans and AI both miss during implementation.

When to Use

  • **After every code change** (1-2 files changed -> run immediately)
  • **After a multi-file feature** (run on all changed files in one pass)
  • **After writing/modifying tests** (switch to Test Verification mode)
  • **Before marking any task complete** (final gate)
  • **When a subagent completes work** (verify their output)
  • **When user says**: "verify", "check quality", "audit code", "run verification", "quality gate", "pre-commit check"

Quick Start

1. Identify changed files (git diff --name-only or manual list)
2. Run the 7-category checklist below on each file
3. Run automated checks (build, lint, tests)
4. Report findings as PASS / FAIL / WARNING
5. Fix all FAIL items before proceeding

---

The 7-Category Verification Checklist

Category 1: Variable Declaration Order (TDZ Prevention)

**What to check:** Variables, constants, and hooks used BEFORE their declaration in the same scope.

**How it breaks:** JavaScript `const` and `let` have a "temporal dead zone" — referencing them before their declaration line throws `ReferenceError` at runtime, but no build error.

**React-specific**: `useMemo`, `useCallback`, `useEffect` that reference state or derived values declared later in the component. This is the #1 AI-introduced bug.

**Scan pattern:**

  • For every `useMemo`, `useCallback`, `useEffect`: check that ALL variables in the dependency array AND the callback body are declared ABOVE that hook.
  • For every function that references a `const`/`let`: check the declaration is above the function definition.
  • For every destructured import used in a module-level `const`: check for circular dependencies.

**Real examples caught:**

  • `activeQuestions` useMemo referenced 150 lines before its declaration
  • `baseDeps` used in JSX but handler functions declared 100 lines later
  • `DR_FIELDS` referenced in `NFR_CATALOG` before `export const DR_FIELDS` line

**Fix:** Move the declaration above all usages. If it's a React hook, reorder hooks so dependencies come first.

---

Category 2: Import/Export Integrity

**What to check:** Every import resolves to a real export. Named vs default matches.

**How it breaks:** Build may succeed (tree-shaking ignores dead imports in dev mode) but runtime throws `undefined is not a function`.

**Scan pattern:**

  • For each `import { X } from './file'`: open `./file` and confirm `export { X }` or `export const X` or `export function X` exists.
  • For each `import X from './file'`: confirm `export default X` exists.
  • Flag: `import { X } from './file'` when file only has `export default X` (or vice versa).

**Real examples caught:**

  • `useResizeHandle` imported as default when it's a named export
  • `ConfluencePagePicker` imported as default when it's a named export
  • Removed component still imported in 3 files

**Automated check:**

npx eslint --rule '{"import/named": "error", "import/default": "error"}' src/

---

Category 3: Reference Integrity

**What to check:** After any rename/remove/move, ALL usages of the old name are updated.

**Scan pattern:**

  • Search for ALL usages of the old name across the project
  • Verify zero references remain to removed identifiers
  • Check that moved code doesn't reference variables from its old scope

**Real examples caught:**

  • `setPrdDocViewMode` was removed but `Cmd+E` handler still called it
  • Removed component still imported in 3 files
// BUG: setPrdDocViewMode was removed but Cmd+E handler still calls it
useEffect(() => {
  const handler = (e) => {
    if (e.metaKey && e.key === 'e') setPrdDocViewMode(prev => ...);  // ReferenceError
  };
}, []);

---

Category 4: Dead Code Detection

**What to check:** Unused imports, unreachable code, orphaned handlers.

**Scan pattern:**

  • Unused imports: variable imported but never referenced in file body.
  • Orphaned event handlers: `onClick={handleFoo}` removed from JSX but `const handleFoo = ...` still declared.
  • Unreachable code: `return` before a code block, `if (false)` guard, feature-flagged code where flag is always false.
  • State setters never called: `const [x, setX] = useState()` where `setX` appears nowhere.
  • Functions defined but never called.

**Automated check:**

npx eslint --rule '{"no-unused-vars": "error", "no-unreachable": "error"}' src/file.jsx

---

Category 5: React State & Effects

**What to check:** State variables are used, effects clean up, no updates after unmount, correct dependencies.

5.1 Component Reuse Bugs

When the same component renders for multiple routes (e.g., `OperationalDocEditor` for DR/IRP/Recovery):

  • Does it have a `key={uniqueId}` to force remount on route change?
  • Does it reset internal state when props change?

5.2 Effect Dependencies

For every `useEffect`:

  • Are all referenced variables in the dependency array?
  • Are object/array deps stable (memoized) or will they trigger infinite re-renders?
  • Does the cleanup function undo what the effect created?

5.3 Ref Safety

  • Is `ref.current` used in the render return? (Should be state instead — ref changes don't trigger re-render)
  • Are refs initialized before first access? (Common with resize handles)
  • Does `useRef` get set in an effect that runs after the component mounts?

5.4 Async State Updates

  • D
Read more
@coco-research
Ships withcoco

495 personas across 13 departments, 229 skills[^installed] and 388 commands in the full catalog (coco 1.9.0, 2026-10-21). Agent skills, slash commands and subagents for Claude Code, Cursor, Codex and other AI coding agents.

631200 skills53 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
631
Star history of coco-research/coco on GitHub, a chart by star-history.com

Other skills on coco.

create-rule

create-rule

Create Cursor rules for persistent AI guidance. Use when the user wants to create a rule, add coding standards, set up project…

@coco-research@coco-researchInstall Skill
create-skill

create-skill

Guides users through creating effective Agent Skills for Cursor. Use when the user wants to create, write, or author a new skill,…

@coco-research@coco-researchInstall Skill
create-subagent

create-subagent

Create custom subagents for specialized AI tasks. Use when the user wants to create a new type of subagent, set up task-specific…

@coco-research@coco-researchInstall Skill
migrate-to-skills

migrate-to-skills

Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills…

@coco-research@coco-researchInstall Skill
agent-lightning

agent-lightning

Train and optimize AI agents using Microsoft's Agent Lightning framework with reinforcement learning. Use when setting up agent…

@coco-research@coco-researchInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about code-verification.

Which coding agents can use code-verification?
code-verification installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.