/harness-claude:test-snapshot-patternsfrom harness-claude
Guides selective use of snapshot testing for stable outputs like serialized data, error messages, and config generation, while avoiding it for UI or non-deterministic values.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:test-snapshot-patterns still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Use snapshot testing selectively for stable outputs, knowing when to avoid it
it('serializes user data correctly', () => {
const user = formatUser({ id: '1', name: 'Alice', email: '[email protected]' });
expect(user).toMatchSnapshot();
});
First run creates the snapshot file. Subsequent runs compare against it.
it('formats the error message', () => {
const error = formatError({ code: 404, resource: 'User' });
expect(error).toMatchInlineSnapshot(`"User not found (404)"`);
});
Vitest/Jest auto-fills the inline snapshot on first run.
it('creates a user with generated fields', () => {
const user = createUser({ name: 'Alice' });
expect(user).toMatchSnapshot({
id: expect.any(String),
createdAt: expect.any(Date),
});
});
This snapshots the structure but uses matchers for non-deterministic fields.
vitest --update # or vitest -u
Review the diff before committing updated snapshots.
it('generates correct SQL', () => {
const query = buildQuery({ table: 'users', where: { role: 'admin' } });
expect(query).toMatchInlineSnapshot(`
"SELECT * FROM users WHERE role = 'admin'"
`);
});
it('generates correct API response', () => {
const response = buildResponse(testData);
expect(response).toMatchSnapshot(); // Stored in __snapshots__/
});
Avoid snapshots for:
Good snapshot candidates:
Snapshot testing captures the serialized output of a value and compares it against a stored reference. It is a regression detection tool — it tells you when output changes, but not whether the change is correct.
Snapshot workflow:
__snapshots__/ or inline)--update flag and review the diffSnapshot hygiene:
toMatchInlineSnapshot for values under 5 lines — inline snapshots are easier to reviewtoMatchSnapshot vs toMatchInlineSnapshot:
Trade-offs:
https://vitest.dev/guide/snapshot.html
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job