plugins/typescript-dev/skills/testing-typescript/SKILL.md
Writes tests following TDD (using vitest and @testing-library/react) best practices. Use when writing unit tests, integration tests, or component tests in TypeScript.
npx skillsauth add qte77/claude-code-utils-plugin testing-typescriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Target: $ARGUMENTS
Writes focused, behavior-driven tests following project testing strategy.
TDD methodology (language-agnostic): See tdd-core plugin (testing-tdd skill)
TypeScript-specific documentation: references/
references/testing-strategy-ts.md — TypeScript tools (vitest, @testing-library/react, MSW)references/tdd-best-practices-ts.md — TypeScript TDD examples (extends tdd-core)vitest (default): Use it/test for known cases, vi.mock for module mocking. Works at unit/integration levels.
@testing-library/react (components): Use for React component behavior testing with render, screen, userEvent.
See references/testing-strategy-ts.md for full methodology comparison.
Cycle: RED (failing test / type error) -> GREEN (minimal pass) -> REFACTOR (clean up)
Structure: Arrange-Act-Assert (AAA)
it('calculates order total from item prices', () => {
// ARRANGE
const items = [{ price: 10, qty: 2 }, { price: 5, qty: 1 }];
const calculator = new OrderCalculator();
// ACT
const total = calculator.total(items);
// ASSERT
expect(total).toBe(25);
});
| Priority | Area | Example | | -------- | ---- | ------- | | CRITICAL | User interactions | Button click triggers handler | | CRITICAL | Conditional rendering | Error state shows message | | HIGH | Form validation | Invalid input shows error | | HIGH | Async data loading | Loading -> success/error states |
High-Value: Business logic, error paths, component behavior, async flows, custom hooks
Avoid: Type system behavior, library internals, CSS styling, implementation details
See references/testing-strategy-ts.md -> "Patterns to Remove" for full list.
Format: {module} > {component} > {behavior}
describe('UserService', () => {
it('creates a new user with valid data', () => { ... });
it('rejects duplicate email addresses', () => { ... });
});
npx vitest # Watch mode (default)
npx vitest run # Single run
npx vitest run src/utils # Filter by path
npx vitest run --reporter=verbose # Verbose output
npx vitest --ui # Browser UI
npx vitest run)vi.mock() with proper restore (vi.restoreAllMocks())development
Verify an external or AI-generated security report against the actual codebase before acting on it. Use when handed a scanner PDF, automated teardown, audit report, or bug-bounty submission — classifies every finding CONFIRMED / OVERSTATED / FALSE-POSITIVE / FABRICATED and salvages the real work items.
development
Audits a site's SEO and AI-search (GEO) readiness — meta tags, Open Graph/Twitter, JSON-LD, robots/llms conventions — and generates fixes. Use when reviewing search visibility, social previews, structured data, or LLM/AI-crawler discoverability.
development
Analyzes industry websites for design patterns, layout, typography, and content strategies using first-principles thinking. Use when researching website design, UI patterns, or competitive design analysis.
development
Audits website usability for UX optimization, covering forms, navigation, validation, and microcopy. Use when reviewing user experience, task completion flows, or interface friction points.