unit-test-generator_skill

This skill generates unit tests for changed files and identifies coverage gaps to improve reliability and maintainability.

2

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill wesleysmits/agent-skills --skill unit-test-generator

  • SKILL.md5.7 KB

Overview

This skill generates unit and end-to-end tests for changed or specified files and identifies coverage gaps. It detects the project's test framework (Jest, Vitest, Playwright, Mocha), creates well-structured test files with edge cases and mocks, and can run tests and report coverage recommendations.

How this skill works

It inspects changed or target source files, extracts exported functions, classes, and component behavior, and infers inputs, outputs, and failure modes. It chooses the correct test template for the detected framework, inserts boundary and error-case tests, adds necessary mocks, and optionally runs the test runner to validate results and produce coverage reports.

When to use it

  • You want tests for a changed file or a specific function.
  • You need to increase or verify test coverage metrics.
  • The project uses Jest, Vitest, Playwright, or Mocha.
  • You want automated edge-case, error-path, and async behavior tests.
  • You need a baseline test suite to catch regressions quickly.

Best practices

  • Target only changed files or clear units to avoid noisy diffs.
  • Detect and respect the project's test framework and naming conventions.
  • Include boundary values, null/undefined, type-coercion, and async error cases.
  • Mock external modules, timers, and environment variables, and reset mocks between tests.
  • Run the test runner with --coverage and aim for recommended thresholds before merging.

Example use cases

  • Generate Jest unit tests for a modified utility function and add boundary/value checks.
  • Create Vitest tests for a React component with interaction tests using testing-library.
  • Produce Playwright E2E tests for a newly added user flow and validate visibility and navigation.
  • Identify coverage gaps after a feature change and generate additional tests to meet thresholds.
  • Add mocks for external API calls in a Node handler and test success and failure responses.

FAQ

Jest, Vitest, Playwright, and Mocha are detected and supported with appropriate templates.

How are target files identified?

Changed files are discovered via git diff patterns or you can provide a specific path; test paths are derived using common project conventions.

Will the skill run tests and produce coverage?

Yes—if permitted, it will run the configured test runner and generate coverage reports using the framework's CLI flags.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational