Logo von Code Verification

Code Verification

Community
coco-research
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.

Add to TypingMind

Übersicht

Herausgebercoco-research
Repositorycoco
Skill-Namecode-verification
Sterne
550
Forks
12
Mitgelieferte Dateien
Nur Anweisungen
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • In sich abgeschlossen

    Alles, was das Modell braucht, steht in den Anweisungen — keine zusätzlichen Dateien zum Synchronisieren.

  • Open Source

    Von coco-research auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Code Verification in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/coco-research/coco/tree/main/skills/code-verification
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/coco-research/coco.git /tmp/coco
mkdir -p .claude/skills
cp -r /tmp/coco/skills/code-verification .claude/skills/code-verification
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Code Verification in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Code Verification automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Code Verification nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

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:

bash
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
javascript
// 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:

bash
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
  • Does any async callback (fetch, setTimeout) update state after potential unmount?
  • Is there a cleanup function that cancels pending operations?
  • Every useEffect that calls an async function should have an abort/cancel mechanism.

Real examples caught:

  • initialLoadRef set to true before async data arrived, blocking subsequent updates
  • useResizeHandle ref null on mount because empty state rendered first (MutationObserver fix needed)
  • DR/IRP/Recovery shared OperationalDocEditor reused state across route changes (fixed with key={docType})
  • prdDocViewMode state removed but Cmd+E handler still called setPrdDocViewMode
Common React Anti-Patterns
Anti-PatternWhy It BreaksFix
Mutating state directly (state.push(x))React won't re-rendersetState([...state, x])
Object/array in useEffect depsNew reference every render -> infinite loopuseMemo the dep, or use primitive
ref.current in render returnRef changes don't trigger re-renderUse state instead
history.pushState with #fragment in hash routerDouble-hash URL breaks navigationUse state-based tracking
Inline object as prop (style={{ color: 'red' }})New reference every render, breaks memoExtract to useMemo or module-level const
useEffect missing cleanup for asyncState update on unmounted componentAbortController or mounted flag

Category 6: Mock Isolation (Test Files Only)

What to check: Mocks don't leak between tests. Fake timers are restored. Tests are meaningful.

6.1 Mock Leakage
  • vi.mock() / jest.mock() at module level: OK
  • mockImplementation() inside a describe without afterEach(() => mock.mockReset()): LEAK RISK
  • vi.useFakeTimers() without corresponding vi.useRealTimers() in afterEach: LEAK
  • mockResolvedValueOnce chains: fragile if test execution order changes. Prefer mockImplementation that inspects the call.
  • Multiple describe blocks sharing the same fetch.mock without isolation: INTERFERENCE
6.2 Tautological Tests

Tests that can never fail:

  • Asserting a mock's return value equals itself
  • expect(x).toBeDefined() where x is hardcoded in setup
  • expect(fn).toHaveBeenCalled() immediately after calling fn yourself
  • expect(array.length).toBeGreaterThanOrEqual(0) (always true)
6.3 Query Specificity
  • getByText / getByRole that matches multiple elements -> use getAllBy* or scope with within()
  • Tests that pass because they find the wrong element (e.g., finding a button label that also appears in a tooltip)
6.4 Meaningful Assertions
  • Every test should have at least one assertion
  • Tests should assert behavior, not just "it renders"
  • Snapshot tests should be small enough to review

Real examples caught:

  • Jira test: mockResolvedValueOnce chain broke when test order changed; fixed with request-inspecting mockImplementation
  • ConfluencePagePicker: fake timers from one test leaked into search filter test
  • NFRTracker: missing SettingsContext mock caused cascading failures

Category 7: CSS Class Integrity

What to check: Every className in JSX has a corresponding CSS rule. No orphaned selectors.

7.1 Class Name Integrity
  • Extract all className="..." and className={...} values from the JSX file.
  • For each class, search the associated CSS file(s) for .classname.
  • Flag: class used in JSX but not defined in CSS (will silently fail — no visual, no error).
  • Flag: class defined in CSS but not used in any JSX (dead CSS — bloat).

Note: Dynamic classes like className={isActive ? 'active' : ''} need both branches checked.

7.2 CSS Variable Integrity

For every var(--token) in CSS:

  • Is the variable defined in :root or a parent selector?
  • Is it defined for both light and dark themes?

Automated Verification Script

Run these commands after any code change:

bash
# 1. Build check
npm run build

# 2. Lint check (catches unused vars, unreachable code)
npx eslint src/path/to/changed/file.jsx

# 3. Test check (run tests for changed file)
npx vitest run src/path/to/changed/file.test.jsx

# 4. Full suite (after a feature is complete)
npx vitest run

# 5. Circular dependency check (if available)
npx madge --circular src/

Report Template

Use this format when reporting verification results:

markdown
## Verification Report — [Project Name]
**Date:** [YYYY-MM-DD]
**Files checked:** [list]
**Tool:** code-verification skill

### PASS
- `path/to/file.jsx` — All 7 categories checked, no issues

### FAIL (must fix before proceeding)
- `path/to/file.jsx:142` — [CAT 1: TDZ] `activeQuestions` referenced before declaration
  **Fix:** Move `const activeQuestions = useMemo(...)` to line 95 (before `showClarifyingQuestions`)

### WARNING (review, may be intentional)
- `path/to/file.jsx:88` — [CAT 4: DEAD CODE] `const [oldState, setOldState]` — setOldState never called
  **Likely:** Leftover from removed feature. Remove if confirmed unused.

### Summary
| Category | Pass | Fail | Warn |
|----------|------|------|------|
| 1. TDZ | 4 | 1 | 0 |
| 2. Imports | 5 | 0 | 0 |
| 3. References | 5 | 0 | 0 |
| 4. Dead Code | 4 | 0 | 1 |
| 5. React State | 3 | 0 | 2 |
| 6. Mocks | 3 | 0 | 1 |
| 7. CSS | 5 | 0 | 0 |

Integration with Agents

This skill is the workflow. The agents are the executors:

AgentRoleWhen
Inline (main agent)Runs Categories 1-5, 7 on product codeAfter implementation
test-guardianRuns Category 6 on test codeAfter writing tests
code-reviewerBroader quality review (SOLID, perf, security)Before merge/deploy

Integration with Rules

RuleRoleWhen
verification-workflow.mdcMerged quality gate + pre-implementation checklist, enforced after every changeAlways (auto-applied)
code-quality.mdcDocumentation, error handling, and logging standardsWhen editing JS/TS/JSX/PY

Quick Commands

bash
# Run all tests for a specific file
npx vitest run path/to/file.test.jsx

# Run full test suite
npx vitest run

# Build check
npm run build

# Lint check
npx eslint src/path/to/changed/file.jsx

When to Skip Verification

  • Editing only markdown, docs, or comments (no executable code)
  • Adding a TODO comment
  • Changing only CSS values (not selectors or class names)
  • Reverting a commit (restoring known-good state)

When Verification is MANDATORY (No Exceptions)

  • Any .jsx, .js, .ts, .tsx file edit
  • Any file rename or move
  • Any import/export change
  • Any React hook addition, removal, or reordering
  • Any state variable addition or removal
  • Any test file modification
  • After running npm install or changing package.json
  • After merging branches or resolving conflicts
  • After a subagent completes work in another window

Häufig gestellte Fragen

Was macht der KI-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.

Warum Code Verification in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Code Verification besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Code Verification in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/coco-research/coco/tree/main/skills/code-verification ein. TypingMind liest die Datei SKILL.md und installiert den Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Code Verification nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Code Verification verwenden?

So viele Sie möchten. In TypingMind können Sie Code Verification mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Code Verification kostenlos?

Der Skill wird von coco-research auf GitHub veröffentlicht. Prüfen Sie im Repository, ob dort Lizenzbedingungen angegeben sind. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇