test-patterns

test-patterns is a skill for Claude Code 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 Code

Written for Claude Code: shipped in a Claude Code plugin.

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

Good fit Use it when writing, reviewing, or reorganizing automated tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/atuljha23/holocron/test-patterns
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.

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.

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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/atuljha23/holocron/test-patterns"><img src="https://agentmods.dev/badge/skills/atuljha23/holocron/test-patterns.svg" alt="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00041 $0.00680
Opus 5.5 $0.00016 $0.00272
Sonnet 5.5 $0.00008 $0.00136
Haiku 4.5 $0.00004 $0.00068

Measured 1mo ago against content hash b05573f6d092, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 6mo ago), licensed MIT. It adds 41 tokens to every session and 680 once invoked, about $0.0002 per session on Opus 5.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