add-test

Generate Vitest test files mirroring source layout and run validation.

148|28|Updated Mar 20, 2025
One-click install
npx skills add https://github.com/cyanheads/mcp-ts-core --skill add-test-cyanheads
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-test
Source: https://github.com/cyanheads/mcp-ts-core/tree/main/skills/add-test
Command: npx skills add https://github.com/cyanheads/mcp-ts-core --skill add-test-cyanheads

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating and organizing tests for existing tools, resources, or services, ensuring test coverage is added when users request tests or when definitions exist without tests.

Core Features & Use Cases

  • Scaffolds Vitest-based test files that mirror the project's source structure.
  • Supports happy path, error path, and edge-case coverage for existing handlers and resources.
  • Integrates with the repo's test layout, creating a root tests/ directory if none exists.

Quick Start

Instruct the AI to generate Vitest-based tests for the specified tool and place them in the project's test layout.

Frequently Asked Questions about add-test

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

FAQPage Schema
How do I scaffold Vitest tests for existing tools?

You can scaffold Vitest tests by instructing the AI to generate test files mirroring the source structure. It places tests in the repo's test layout, creating a root tests directory if none exists, and covers happy-path, error-path, and edge-case scenarios.

What is the best way to generate test files that mirror my source layout?

The best way to generate test files mirroring your source layout is using a scaffolding process that reads existing tool definitions and creates matching Vitest tests. This ensures structural alignment and validates handlers across happy-path, error-path, and edge-case scenarios.

Does this test scaffolding approach support happy path, error path, and edge-case scenarios?

Yes, this test scaffolding approach explicitly supports happy path, error path, and edge-case scenarios. It generates Vitest-based tests for existing handlers and resources to ensure comprehensive coverage when definitions exist without tests.

How do I validate scaffolded Vitest tests after generation?

You validate scaffolded Vitest tests by running bun run test and bun run devcheck. This verifies the newly created test files function correctly within the project's test layout and properly validate the targeted existing tools.

Can I add test coverage for existing resources without a tests directory?

Yes, you can add test coverage for existing resources without a tests directory. The scaffolding process integrates with the repo's test layout and automatically creates a root tests directory if none exists before generating the Vitest files.