/qa-testing:unit-test-generationfrom qa-testing
Generates high-signal unit tests for existing code using behavior-first case selection, boundary/error paths, mocking discipline, and mutation-tested quality. Outputs framework-idiomatic tests for Vitest, Jest, and pytest.
Ships in qa-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert software engineer generating unit tests for existing code. Your tests must catch real future bugs, not inflate coverage numbers. Follow these instructions whenever asked to "write tests for" a function, module, or class.
refuses expired coupons beats test_coupon_2.For each public function, enumerate in this order:
Skip: private helpers (test through the public surface), trivial getters, framework glue.
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { calculateDiscount } from './discount';
import * as rates from './rates';
describe('calculateDiscount', () => {
it('applies percentage discount to eligible subtotal', () => {
expect(calculateDiscount({ subtotal: 200, code: 'SAVE10' })).toEqual({ total: 180, applied: true });
});
it.each([
[0, 0], // zero subtotal
[0.01, 0.01], // minimum
[49.99, 49.99], // just under threshold: no discount
[50, 45], // threshold boundary: discount applies
])('boundary: subtotal %f -> total %f', (subtotal, total) => {
expect(calculateDiscount({ subtotal, code: 'SAVE10' }).total).toBeCloseTo(total, 2);
});
it('throws CodeExpiredError with the expiry date for expired codes', () => {
expect(() => calculateDiscount({ subtotal: 100, code: 'XMAS2024' }))
.toThrowError(expect.objectContaining({ name: 'CodeExpiredError' }));
});
it('does not mutate the input order object', () => {
const input = Object.freeze({ subtotal: 100, code: 'SAVE10' });
expect(() => calculateDiscount(input)).not.toThrow();
});
it('fetches live rates only for FX orders (mock at the boundary)', async () => {
const spy = vi.spyOn(rates, 'fetchRate').mockResolvedValue(1.1);
await calculateDiscount({ subtotal: 100, code: 'SAVE10', currency: 'EUR' });
expect(spy).toHaveBeenCalledWith('EUR'); // interaction that IS the contract
});
});
import pytest
from discount import calculate_discount, CodeExpiredError
class TestCalculateDiscount:
def test_applies_percentage_to_eligible_subtotal(self):
assert calculate_discount(subtotal=200, code="SAVE10").total == 180
@pytest.mark.parametrize("subtotal,total", [
(0, 0), (0.01, 0.01), (49.99, 49.99), (50, 45),
])
def test_threshold_boundaries(self, subtotal, total):
assert calculate_discount(subtotal=subtotal, code="SAVE10").total == pytest.approx(total)
def test_expired_code_raises_with_expiry(self):
with pytest.raises(CodeExpiredError, match=r"expired on \d{4}-\d{2}-\d{2}"):
calculate_discount(subtotal=100, code="XMAS2024")
def test_unknown_code_is_no_op_not_error(self):
result = calculate_discount(subtotal=100, code="NOPE")
assert result.total == 100 and result.applied is False
Mock ONLY at architectural boundaries: network, filesystem, clock, randomness, databases, third-party SDKs. Never mock the module under test's own collaborators just to isolate lines.
vi.useFakeTimers() / freezegun; no test should depend on real now()vitest run --coverage or pytest --cov; inspect UNCOVERED branches and either add a behavior case or document why it is unreachable. Do not chase 100%.toHaveBeenCalledTimes on internals so refactors fail without behavior changesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub hackernoon/cuttlefish-agent-skills --plugin qa-testing422 skills in this plugin
/a-b-test-validationA/B Test ValidationValidating A/B test implementations including traffic splitting accuracy, statistical significance calculation, metric tracking, and experiment cleanup./accessibility-a11y-enhancedAccessibility A11y EnhancedComprehensive WCAG compliance and accessibility testing covering ARIA, keyboard navigation, screen readers, color contrast, and automated a11y validation./add-seed-skillsUse when adding or editing QA skills in seed-skills/ or getting them onto the live qaskills.sh catalog, e.g. "add N new skills", "create a seed skill for X", "seed the database", "the skill page is empty", "skill 404s on the site".