Agent skill · Testing & QA

caliber-testing

Writes Vitest tests following project patterns: __tests__/ directories, vi.mock() for module mocking with vi.hoisted() for test-time factories, global LLM mock from src/test/setup.ts, environment variable save/restore in beforeEach/afterEach, vi.clearAllMocks() lifecycle, and test file organization. Use when user says 'write tests', 'add test coverage', 'test this', creates *.test.ts files, or when test failures appear in CI. Do NOT use for non-test code or for debugging without writing tests.

caliber-ai-orggithub.com/caliber-ai-orgGitHub ↗
claude-codecodexcursorMIT
Install
npx skills add caliber-ai-org/ai-setup --skill caliber-testing --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 13 KB
Bundled scripts: none
Path: skills/caliber-testing/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 1,235
Language: TypeScript

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Caliber Testing ## Critical - All test files MUST be placed in `__tests__/` directories parallel to source files: `src/[module]/__tests__/[module].test.ts` - Register any new `__tests__/` directories in `vitest.config.ts`'s `include` glob (already configured: `src/**/*.test.ts`) - NEVER mock `src/test/setup.ts` — it is the global LLM provider mock already applied to all tests - Environment variable tests MUST save `process.env` in `beforeEach`, restore in `afterEach`, and explicitly delete env vars to test absence - Temporary file/directory cleanup MUST happen in `afterEach`, not in individual test cleanup. Use `fs.rmSync(dir, { recursive: true, force: true })` - When a test requires unmocking modules mocked in global setup, call `vi.unmock('../module.js')` BEFORE the import statement - Run `pnpm test` locally and `pnpm test:coverage` before committing to verify coverage thresholds (lines: 50, functions: 50, branches: 50, statements: 50) ## Instructions ### Step 1: Create the test file in the correct directory Create `src/[module]/__tests__/[module].test.ts`. The parent source file is `src/[module]/[module].ts`. **Verify**: The `__tests__` directory exists at the same level as th

What's inside
Steps it walks through
  1. Critical
  2. Instructions
  3. Step 1: Create the test file in the correct directory
  4. Step 2: Import test framework
  5. Step 3: Set up module mocking (if needed)
  6. Step 4: Organize tests in describe blocks
  7. Step 5: Manage environment and process state
  8. Step 6: Manage temporary files and directories
  9. Step 7: Handle mock state cleanup
  10. Step 8: Test assertions
  11. Step 9: Run tests
  12. Examples
  13. Example 1: Testing a module with environment variables (config.test.ts pattern)
  14. Common Issues
Commands it runs
pnpm test                # Run all tests in watch mode
pnpm test:coverage       # Check coverage thresholds
pnpm test -- src/my/path/__tests__/my.test.ts  # Run single test file
More from ai-setup
All skills →
About this skill
What does the caliber-testing skill do?

Writes Vitest tests following project patterns: __tests__/ directories, vi.mock() for module mocking with vi.hoisted() for test-time factories, global LLM mock from src/test/setup.ts, environment variable save/restore in beforeEach/afterEach, vi.clearAllMocks() lifecycle, and test file organization. Use when user says 'write tests', 'add test coverage', 'test this', creates *.test.ts files, or when test failures appear in CI. Do NOT use for non-test code or for debugging without writing tests.

How do I install it?

Run `npx skills add caliber-ai-org/ai-setup --skill caliber-testing --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From caliber-ai-org/ai-setup, a repository with 1,235 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going