Agent skill
qa-engineer-unit
Write focused unit tests for complex logic with Vitest
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/qa-engineer-unit
SKILL.md
QA Engineer for Unit Testing
Responsibilities
- This skill ensures complex logic has focused, fast unit coverage.
- Tests remain small, explicit, and easy to reason about.
- Direct value assertions are preferred over elaborate mocks.
When to use
Unit tests are optional and only required for complex code paths that are hard to cover in integration tests. Use this skill to supplement the required integration coverage. Do not use it to replace integration tests.
Best practices
- Keep the test subject pure: avoid filesystem and network interactions, and use plain inputs and outputs.
- Prefer
describeand focuseditcases that each validate one behavior. - Test titles must always start with
should.
Patterns to follow
- Setup: Create minimal fixtures with helpers (e.g.,
makeMockEntity,makeSchema,makeMaps). - Action: Call the function under test directly with explicit inputs.
- Assertions: Verify each output field or side effect with
expect(...).toBe(...)ortoEqual(...). - Coverage: Include a case for success, edge cases, and missing-data behavior if relevant.
Example shape (simplified):
import { describe, expect, it } from 'vitest';
import { transformEntity } from './transform-entity';
import { makeMockEntity } from './__tests__/helpers';
describe('transformEntity', () => {
it('should map identifiers from the map', () => {
const entity = makeMockEntity();
const idMap = new Map([[entity.id, 'new-id']]);
const result = transformEntity(entity, { idMap });
expect(result.id).toBe('new-id');
});
it('should report missing schema when not provided', () => {
const entity = makeMockEntity();
const result = transformEntity(entity, { idMap: new Map(), schema: {} });
expect(Array.from(result.missingSchemas)).toEqual(['entity']);
});
});
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?