create-unit-test

Create Vitest unit tests co-located with source files using project templates.

4|Updated Oct 24, 2025
One-click install
npx skills add https://github.com/tech-with-seth/iridium --skill create-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-unit-test
Source: https://github.com/tech-with-seth/iridium/tree/main/.github/skills/create-unit-test
Command: npx skills add https://github.com/tech-with-seth/iridium --skill create-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill creates Vitest unit tests following project patterns for functions, components, models, or route loaders/actions.

Core Features & Use Cases

  • Co-located testing: Place test files next to source files (e.g., Button.tsx and Button.test.tsx).
  • Template-driven: Uses standard Vitest templates for component, model, and route tests to ensure consistency.
  • Mocking patterns: Demonstrates mocking and isolation strategies for dependencies.
  • Use Case: When you implement a new function, component, or route, generate the corresponding tests with ready-to-run patterns.

Quick Start

Use this skill to create and organize Vitest unit tests alongside your source files. For example, to test a Button component, add app/components/Button.tsx and create app/components/Button.test.tsx with a basic describe/it/test structure. Then run npm test to execute the tests.

Frequently Asked Questions about create-unit-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Vitest unit tests that match my existing project patterns?

To create Vitest unit tests matching project patterns, use a template-driven approach that co-locates test files next to source files. This ensures consistency by applying standard structures for components, models, and route loaders using built-in mocking strategies.

How do I co-locate test files next to my TypeScript components?

Co-locating test files involves placing the test file directly next to its source file, such as creating Button.test.tsx alongside Button.tsx. This pattern keeps tests organized and easily discoverable within your project structure.

What is the best way to mock dependencies in Vitest for route loaders and actions?

The best way to mock dependencies in Vitest for route loaders and actions is to apply standard mocking patterns that isolate your modules. This ensures tests run reliably by replacing external dependencies with controlled mock implementations.

Do I need Vitest already set up to generate co-located tests for my project?

Yes, you need Vitest already set up in your project along with TypeScript support. This setup is required to generate and run the standard test templates for your functions, components, models, and route loaders.

What standard Vitest templates are available for testing functions and models?

Standard Vitest templates are available for testing functions, components, models, and route loaders. These templates provide a ready-to-run describe/it/test structure, ensuring consistent testing patterns across your entire codebase.

Why should I use co-located tests instead of a separate test directory?

Co-located tests place files like Button.test.tsx next to Button.tsx to improve maintainability. This pattern ensures tests are immediately accessible during development, reducing context switching compared to using a separate test directory.