/code:test-assertionsfrom code
Enforces strict deep-equality assertions (toStrictEqual) in tests, replacing weak checks like toBeTruthy or toMatchObject. Useful for writing new tests or strengthening existing ones.
Ships in code. 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.
None: SKILL.md is the whole skill.
Capture a value's complete structure in one strict deep-equality check instead of a cluster of narrow checks. When rewriting existing tests, rethink each test as a whole rather than tweaking individual lines, and collapse weak assertions about the same value into one strict check against the complete expected value.
Do not change snapshot assertions (toMatchSnapshot) unless the user explicitly includes them.
Use the strictest deep-equality matcher the framework offers for structured values (in Jest, toStrictEqual). Ranked from worst to best, in Jest and Chai terms; only the last is good enough:
toBeTruthy, toBeDefined, not.toBeNull: barely checks anythingtoHaveProperty('key'): only checks existence, not valuetoContain, toMatch: substring/regex match hides the full valuetoHaveLength(n): only checks count, not contentstoMatchObject, objectContaining, arrayContaining: allows extra properties to sneak intoEqual, to.deep.equal: close, but ignores class mismatches and undefined vs missingtoStrictEqual: the only acceptable assertion for objects and arraysMigrate existing toEqual and to.deep.equal assertions to toStrictEqual too. Use exact equality for primitives (in Jest, toBe is fine for strings, numbers, booleans, null). Tighten calls and exceptions to their exact observable contract: the exact arguments, error type, and message.
toThrow() or toThrow(/partial/) → toThrow(new SpecificError("exact message"))toHaveBeenCalled() → toHaveBeenCalledWith("exact", "args")Do not infer an expected value from implementation code. When writing a new assertion or replacing a weak one, start with a deliberately incomplete strict assertion, run the narrowest relevant test, and use the failure output to capture the actual value. Then review that value as the intended contract and rerun the test to confirm it passes.
// Before: three assertions that barely check anything
const result = await Children.run(['--json', '--projects-dir', '/tmp/fake-projects']);
expect(result).toHaveProperty('projects');
expect(result).toHaveProperty('summary');
expect(result.summary.total).toBe(2);
// First: replace with a placeholder; do NOT guess the expected value
expect(result).toStrictEqual({});
// Then: run the test, read the actual value from the error output, paste it in
expect(result).toStrictEqual({
projects: [
{name: 'project-a', path: '/tmp/fake-projects/project-a'},
{name: 'project-b', path: '/tmp/fake-projects/project-b'},
],
summary: {total: 2, active: 2},
});
If the observed value reveals a bug or an unclear contract, stop and ask the user instead of blessing it as expected behavior.
Even when each assertion is already strict, splitting them across properties loses the structural picture and makes failures harder to diagnose:
// Before: correct but fragmented; each line is fine on its own
const result = processOrder(input);
expect(result.id).toBe('order-42');
expect(result.status).toBe('confirmed');
expect(result.total).toBe(119.99);
expect(result.currency).toBe('USD');
expect(result.items).toStrictEqual([
{sku: 'A1', qty: 2},
{sku: 'B3', qty: 1},
]);
expect(result.shipping.method).toBe('express');
expect(result.shipping.estimatedDays).toBe(3);
expect(result.tags).toStrictEqual([]);
// After: one assertion captures the complete value
expect(result).toStrictEqual({
id: 'order-42',
status: 'confirmed',
total: 119.99,
currency: 'USD',
items: [
{sku: 'A1', qty: 2},
{sku: 'B3', qty: 1},
],
shipping: {method: 'express', estimatedDays: 3},
tags: [],
});
Don't assert length, size, or existence right before asserting the full value; the content assertion already implies it:
// BAD: toHaveLength is redundant
expect(result).toHaveLength(2);
expect(result[0].name).toBe('a');
expect(result[1].name).toBe('b');
// GOOD: one assertion covers length AND contents
expect(result.map((r) => r.name)).toStrictEqual(['a', 'b']);
Same for toBeDefined() / not.toBeNull() before property access: if the value were nullish, the next line would throw anyway.
Assert Sets and Maps directly rather than converting them to arrays:
// BAD: pointless conversion
expect([...result]).toStrictEqual(['a', 'b']);
// GOOD: assert the actual type
expect(result).toStrictEqual(new Set(['a', 'b']));
Prefer deterministic test data for timestamps, temp paths, and UUIDs: freeze time, inject identifiers, use fixed test paths. When a value comes from outside the test's control, don't fall back to weak assertions. Assert the dynamic properties individually, strip them, and assert strict equality on the rest:
const result = await createReport();
// Assert dynamic properties individually
expect(result.createdAt).toBeInstanceOf(Date);
expect(result.tempDir).toMatch(/^\/tmp\//);
// Strip them, then assert everything else strictly
const {createdAt, tempDir, ...rest} = result;
expect(rest).toStrictEqual({
title: 'Q1 Report',
status: 'complete',
items: [{id: 1, name: 'revenue'}],
});
Never put instanceof or type checks inside assertion objects. A failure then shows false !== true instead of the actual value.
// BAD: hides the actual value
expect({createdAt: result.createdAt instanceof Date}).toStrictEqual({
createdAt: true,
});
// GOOD: shows the actual value on failure
expect(result.createdAt).toStrictEqual(new Date(1_704_067_200 * 1000));
When the full expected value would be enormous (more than about 50 lines), extract it into a clearly named const at the top of the test or a fixture file.
Run the narrowest affected tests while discovering values, then run the repository's applicable test and precommit checks. Leave no placeholder assertions behind.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub motlin/claude-code-plugins --plugin code12 skills in this plugin
/build-warningsMake a build quiet by fixing the causes of the warnings it prints, one class at a time, with before and after counts from the same command as evidence. Covers compiler, linter and deprecation warnings, runtime warnings printed during tests, slow-test reports, and stray noise such as debug prints and unsilenced logs. Use when the user asks to clean up build or test warnings, deprecations, or noisy output, or when a caller such as burn runs it unattended./cliCLI guidelines. Use whenever using the Bash tool, which is almost always. Also use when you see "command not found: __zoxide_z" errors./code-generationFormatting rules for Java code generators that build source code via string concatenation. Use when the user asks to "fix formatter-off", "fix code generation formatting", "fix auto-formatted string concatenation", or "add formatter off", and proactively when writing, reviewing, or modifying a code generation method./code-qualityCode quality guidelines. ALWAYS use skill for ANY code changes./dead-codeFind and remove unused code, files, exports and dependencies, with detector output or a zero-reference grep as evidence for every removal, and leave anything uncertain for a human. Use when the user asks to find or delete dead, unused or unreachable code, unused dependencies or exports, for a file, a directory, or the whole repo, or when a caller such as burn runs it unattended./docs-driftFind documentation that disagrees with the code, such as renamed paths, missing recipes, stale versions and outdated behavior claims, apply only mechanical one-to-one fixes, and propose the rest. Use when the user asks to check, audit or fix docs, READMEs, CLAUDE.md, AGENTS.md or SKILL.md files against the code, or to find stale or broken documentation, or when a caller such as burn runs it unattended.Other plugins' skills for the same job