write-unit-tests

Generate focused unit tests for changed functions or modules.

37|20|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/fieldsphere/cursor-team-marketplace-template --skill write-unit-tests-fieldsphere
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: write-unit-tests
Source: https://github.com/fieldsphere/cursor-team-marketplace-template/tree/main/plugins/testing/skills/write-unit-tests
Command: npx skills add https://github.com/fieldsphere/cursor-team-marketplace-template --skill write-unit-tests-fieldsphere

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps teams write concise, reliable unit tests that validate new or changed logic, improving confidence and maintainability.

Core Features & Use Cases

  • Discover the repository's unit-test framework and layout, and identify changed functions or modules.
  • Create or update focused unit tests that cover critical paths, edge cases, and failure modes.
  • Apply mocking and boundary I/O practices aligned with the repo's conventions to keep tests fast and deterministic.
  • Provide guidance on test output, organization, and consistency with existing tests.

Quick Start

Invoke the write-unit-tests skill after a code change to generate focused unit tests for the modified logic.

Frequently Asked Questions about write-unit-tests

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

FAQPage Schema
How do I write focused unit tests for changed functions in my repository?

Write focused unit tests by identifying modified functions or modules and generating isolated tests that cover critical paths and edge cases. The skill discovers your repo's testing framework and layout to conform tests to existing conventions.

What is the best way to generate unit tests for a code refactor?

Generating unit tests for a code refactor involves targeting the modified logic, applying boundary mocking, and prioritizing fast, isolated tests over end-to-end coverage to validate critical paths and failure modes.

How do you mock boundary I/O to keep unit tests fast and deterministic?

Mock boundary I/O by applying practices aligned with your repository's conventions, isolating changed functions from external dependencies to ensure unit tests remain fast and deterministic.

Does this approach work with my existing testing framework and layout?

Yes, it discovers your repository's unit-test framework and layout conventions automatically, ensuring newly created or updated tests match the organization and style of your existing test suite.

When should I use isolated unit tests instead of end-to-end coverage?

Use isolated unit tests for typical code changes, refactors, or bug fixes where validating specific changed logic quickly is prioritized over slower, broader end-to-end coverage.

How do I ensure new unit tests cover edge cases and failure modes?

Ensure edge case and failure mode coverage by generating focused unit tests that explicitly exercise critical paths within the changed functions, guided by the repo's testing conventions.