jest-generator

jest-generator is a skill for Claude Code from secondsky/claude-skills. It costs 43 tokens per session (1,094 once invoked), scanned A, original, MIT.

A skill for generating Jest unit tests for JavaScript and TypeScript code. Unit tests check small parts of a program in isolation, while Jest is a tool for writing and running those tests.

In plain words
What is it for?
Use it to create tests for modules, classes, utility functions, and React components, including mocked dependencies and coverage runs.
Why use it?
It helps fill missing test coverage and avoids common problems with test structure, mocks, spies, and setup or cleanup code.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the jest-generator plugin — 1 skill shipped together

Good fit Use it to create tests for modules, classes, utility functions, and React components, including mocked dependencies and coverage runs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/secondsky/claude-skills/jest-generator
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 secondsky/claude-skills --skill jest-generator
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install jest-generator, the plugin that ships this one along with the rest of its 1 skill.

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 jest-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/secondsky/claude-skills/jest-generator/github.svg)](https://agentmods.dev/skills/secondsky/claude-skills/jest-generator)
Your own site
<a href="https://agentmods.dev/skills/secondsky/claude-skills/jest-generator"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/jest-generator/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 jest-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/secondsky/claude-skills/jest-generator"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/jest-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,094 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.00043 $0.01094
Opus 5.5 $0.00017 $0.00438
Sonnet 5.5 $0.00009 $0.00219
Haiku 4.5 $0.00004 $0.00109

Measured 2d ago against content hash 92d105d0b14e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

jest-generator 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 2d 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.

plugins/jest-generator/skills/jest-generator/SKILL.md · 199 lines

How it starts

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

Jest Generator Skill

Purpose

Generate Jest-based unit tests for JavaScript and TypeScript code, following Jest conventions and best practices with proper mocking, describe blocks, and code organization.

When to Use

  • Generate Jest tests for JavaScript/TypeScript modules
  • Create test files for React components
  • Add missing test coverage to existing code
  • Need Jest-specific patterns (mocks, spies, snapshots)

Test File Naming

Source to Test Mapping:

  • src/components/Feature.tsx → src/components/Feature.test.tsx
  • src/utils/validator.ts → src/utils/validator.test.ts
  • src/models/User.ts → src/models/User.test.ts

Running Tests

# Preferred: Using bun (faster)
bun test

# Run specific file
bun test src/utils/validator.test.ts

# Run with coverage
bun test --coverage

# Watch mode
bun test --watch

# Alternative: Using npm
npm test
npm test -- --coverage

Jest Test Structure

import { functionToTest, ClassToTest } from './Feature'

jest.mock('./dependency')

describe('ModuleName', () => {
  beforeEach(() => {
    jest.clearAllMocks()
  })

  afterEach(() => {
    jest.restoreAllMocks()
  })

  describe('ClassName', () => {
    let instance: ClassToTest

    beforeEach(() => {
      instance = new ClassToTest()
    })

    it('should return expected result with valid input', () => {
      // Arrange
      const input = { key: 'value' }
      const expected = { processed: true }

      // Act
      const result = instance.method(input)

      // Assert
      expect(result).toEqual(expected)
    })

    it('should throw error with invalid input', () => {
      expect(() => instance.method(null)).toThrow('Invalid input')
    })
  })
})

Jest-Specific Patterns

Mocking

// Mock entire module
jest.mock('./api', () => ({
  fetchData: jest.fn(),
}))

// Mock with implementation
const mockFn = jest.fn((x: number) => x * 2)

// Spy on method
const spy = jest.spyOn(obj, 'method').mockReturnValue('mocked')
spy.mockRestore()

Read the full file on GitHub · 199 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. 2d ago First seen · 199 lines · 43 tokens per session scan A 92d105d0b14e

Subscribe to this mod's changes

jest-generator is a skill published in the GitHub repository secondsky/claude-skills (251 stars, last pushed 2d ago), licensed MIT. It adds 43 tokens to every session and 1,094 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-11-22.

Related

jest-generator compared with skills from other repositories

jest-generator next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
jest-generatorsecondsky/claude-skillsSkill2512d agoMITA43Claude Code
imagegenopenai/codexSkill136ktodayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill101ktodayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill395ktodayMITA36Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill81k7d agoMITA200Claude Code, Codex
free-llm-apismnfst/awesome-free-llm-apisSkill14ktodayCC0-1.0A113Claude Code, Codex
next-cache-components-adoptionvercel/next.jsSkill144ktodayMITA95Claude Code