
JavaScript Testing Patterns
Guides an agent to write Jest, Vitest and Testing Library tests for JS/TS projects
- Repository
- wshobson/agents
- Stars
- 42,095
- Licence
- MIT
- Files
- 2 files
What it does
When installed, the agent follows a reference guide for writing tests in JavaScript and TypeScript projects. It knows how to set up Jest or Vitest, structure unit tests for pure functions and classes, and mock network calls such as fetch so tests run without real servers. It can also help with test-driven development and coverage thresholds. The skill is a set of written patterns and example code the agent reads and adapts, not a program that runs by itself.
Great for
- Developers starting a new TypeScript or JavaScript project who need a test setup
- Teams adding unit tests to existing functions, classes or API clients
- Developers who want examples of mocking fetch and async code in Vitest or Jest
Skip it if
- Non-programmers who only want to run an existing test suite, since it teaches how to write tests rather than running them
- Projects using other languages such as Python or Go, where the examples do not apply
- Anyone expecting the skill to verify that generated tests are actually correct or complete
Try asking
- “Set up Vitest with coverage reporting for my TypeScript project”
- “Write unit tests for this calculator module using describe and it blocks”
- “Mock the fetch calls in my API service so the tests don't hit the network”
- “Help me follow a TDD workflow to build a user service”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 2 original files, the MIT licence and an attribution note.
javascript-testing-patterns.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip javascript-testing-patterns.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip javascript-testing-patterns.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Name the framework you use (Jest or Vitest) so the agent follows the matching setup instructions
- Review generated tests yourself, and run them, since the guide's examples are illustrative and not verified against your code
- Note that the example code uses global fetch mocks and placeholder api.example.com URLs; adjust them to your real endpoints
What's inside
- references/advanced-testing-patterns.md
- SKILL.md
Redistributed unmodified from wshobson/agents under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.