test-patterns

test-patterns is a skill for Claude Code, Codex from atuljha23/holocron. It costs 41 tokens per session (680 once invoked), scanned A, original, MIT.

A guide to writing tests that catch behavior changes, rather than merely checking how the code is implemented. It covers clear test structure, repeated test cases, and clean test data.

In plain words
What is it for?
Use it when writing, reviewing, or reorganizing automated tests.
Why use it?
It helps prevent tests that pass even when user-visible behavior is broken or that become fragile after refactoring.

Skill for Claude CodeCodex

Part of the holocron plugin — 11 skills, 24 commands, 14 agents, 6 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/atuljha23/holocron/test-patterns
Any agent
npx skills add atuljha23/holocron --skill test-patterns
Clone the repo
git clone --depth 1 https://github.com/atuljha23/holocron

Made for: Claude Code, Codex.

Or install holocron, the plugin that ships this one along with the rest of its 11 skills, 24 commands, 14 agents, 6 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/atuljha23/holocron/test-patterns.svg)](https://agentmods.dev/skills/atuljha23/holocron/test-patterns)
Your own site
<a href="https://agentmods.dev/skills/atuljha23/holocron/test-patterns"><img src="https://agentmods.dev/badge/skills/atuljha23/holocron/test-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 680 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.00680
Opus 5 $0.00020 $0.00340
Sonnet 5 $0.00008 $0.00136
Haiku 4.5 $0.00004 $0.00068

Measured 3d ago against content hash b05573f6d092, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/test-patterns/SKILL.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test patterns

A test's job is to fail when the behavior is wrong. Most mediocre tests pass whether the code is right or not.

Rules of thumb

Assert behavior, not implementation

Bad:

expect(spy).toHaveBeenCalled()

Good:

expect(response.body.status).toBe('completed')
expect(db.getUser(id).lastSeenAt).toBe(mockNow)

Spy-assertions fail on refactor and protect nothing. Behavior-assertions fail when the user-visible contract breaks.

One logical check per test

Many expect lines can add up to one assertion of one outcome — that's fine. What's not fine: one test that covers three unrelated behaviors so nobody can tell what broke when it fails.

Arrange-Act-Assert

it('rejects stale tokens', () => {
  // Arrange
  const token = signToken({ exp: yesterday() })
  // Act
  const result = verify(token)
  // Assert
  expect(result.ok).toBe(false)
  expect(result.reason).toBe('expired')
})

Table-driven when the shape repeats

test.each([
  ['empty',       '',         'required'],
  ['too short',   'ab',       'min_length'],
  ['has space',   'a b',      'invalid_char'],
  ['ok',          'alice',    null],
])('validateUsername(%s=%j)', (_, input, expected) => {
  expect(validateUsername(input).error).toBe(expected)
})

Fixtures > inline setup

If three tests set up the same validUser, extract it. If the setup is 20 lines, it's probably doing too much — mock less, use a real test DB.

Name tests as specs

The test name is a sentence the reader can understand without opening the code. it('rejects stale tokens') > it('test2').

Integration > unit for risk hotspots

Unit tests are great for pure logic. For "this endpoint returns the right data for this user" you want an integration test that hits a real database, a real router, and a real serializer. Mocks hide the bugs you actually ship.

Framework-specific pointers

Testing Library (React/Vue/Svelte)

  • Query by role/label first, getByTestId last.
  • userEvent over fireEvent.
  • Avoid testing props/state; test what the user sees.

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 88 lines · 41 tokens per session scan A b05573f6d092

Subscribe to this mod's changes

test-patterns is a skill published in the GitHub repository atuljha23/holocron (2 stars, last pushed 4mo ago), licensed MIT. It adds 41 tokens to every session and 680 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

batch-orchestration

Decompose large-scale changes into independent units and spawn parallel agents in isolated worktrees. Use for migrations, refactors, codemods, and any change touching 10+ files with the same pattern.

rohitg00/pro-workflow · 46 tokens

design-engineering

Apply interface craft when building or reviewing UI - motion, easing, timing, springs, component feel, and visual foundations. Use when building a component, animation, transition, hover or press state, modal, drawer, toast, or when polishing an interface so it feels right. Says "make this feel better", "add an…

rohitg00/pro-workflow · 82 tokens

context-optimizer

Optimize token usage and context management. Use when sessions feel slow, context is degraded, or you're running out of budget.

rohitg00/pro-workflow · 28 tokens

deslop

Remove AI-generated code slop, unnecessary comments, and over-engineering from the current branch diff. Cleans up boilerplate, simplifies abstractions, strips defensive code, and in skill-file mode lints SKILL.md files for quality. Use when cleaning up code, simplifying, removing boilerplate, before committing, or…

rohitg00/pro-workflow · 75 tokens

bug-capture

Capture a user-reported defect as a durable GitHub issue written in the project's own domain language. Explores the codebase in parallel for context but never leaks file paths or line numbers into the issue. Use when the user reports a bug conversationally, runs a QA pass, or says "file an issue", "log this as a bug"…

rohitg00/pro-workflow · 78 tokens

compact-guard

Smart context compaction with state preservation. Saves critical files, task progress, and working state before compaction, restores after. Use before manual compact or when auto-compact triggers.

rohitg00/pro-workflow · 40 tokens