backup/framework/.amazonq/skills/testing-qa/SKILL.md
Automate the generation and maintenance of unit, integration, and end-to-end tests, as well as test data generation and debugging. Use when writing tests for new features, maintaining existing tests after API/UI changes, generating synthetic test data, or debugging test failures. Essential for ensuring code quality and preventing regressions.
npx skillsauth add b4san/ac-framework testing-qaInstall 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.
Automated test generation, maintenance, and quality assurance for comprehensive code validation.
Use this skill when:
For each component, generate tests covering:
Unit Tests:
Integration Tests:
E2E Tests:
Follow project conventions:
test-file-naming:
unit: "*.test.js" or "*.spec.js"
integration: "*.integration.test.js"
e2e: "*.e2e.test.js" or in "e2e/" folder
test-structure:
describe: "Component/Feature name"
it: "should [expected behavior] when [condition]"
Create realistic test data:
Static Data:
const mockUsers = [
{ id: 1, name: "John Doe", email: "[email protected]" },
{ id: 2, name: "Jane Smith", email: "[email protected]" }
];
Dynamic Data (using factories):
const generateUser = (overrides = {}) => ({
id: faker.datatype.uuid(),
name: faker.name.fullName(),
email: faker.internet.email(),
...overrides
});
Synthetic Data for Load Testing:
Write tests following best practices:
Arrange-Act-Assert Pattern:
test('should calculate total price with tax', () => {
// Arrange
const cart = { items: [{ price: 100, quantity: 2 }] };
const taxRate = 0.08;
// Act
const total = calculateTotal(cart, taxRate);
// Assert
expect(total).toBe(216); // 200 + 16 tax
});
Mock External Dependencies:
jest.mock('../api/client', () => ({
fetchUser: jest.fn()
}));
beforeEach(() => {
fetchUser.mockResolvedValue({ id: 1, name: 'Test User' });
});
Execute test suite:
npm test
# or
npm run test:unit
npm run test:integration
npm run test:e2e
Analyze failures:
Debug failing tests:
When APIs or UI changes:
Run coverage report:
npm run test:coverage
Identify gaps:
Add tests to cover gaps
openspec-verify-change to validate tests passTesting Async Code:
test('should fetch user data', async () => {
const user = await fetchUser(1);
expect(user).toEqual({ id: 1, name: 'John' });
});
Testing React Components:
import { render, screen, fireEvent } from '@testing-library/react';
test('should toggle visibility on click', () => {
render(<ToggleButton />);
const button = screen.getByRole('button');
fireEvent.click(button);
expect(screen.getByText('Visible')).toBeInTheDocument();
fireEvent.click(button);
expect(screen.queryByText('Visible')).not.toBeInTheDocument();
});
Testing API Endpoints:
import request from 'supertest';
import app from '../app';
test('POST /api/users should create user', async () => {
const response = await request(app)
.post('/api/users')
.send({ name: 'John', email: '[email protected]' });
expect(response.status).toBe(201);
expect(response.body).toHaveProperty('id');
});
test-generator - Generate initial test suiteopenspec-verify-change - Validate implementation with testssystematic-debugging - Debug failing testssecure-coding-cybersecurity - Security-focused testingdevelopment
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
development
Automate the generation and maintenance of unit, integration, and end-to-end tests, as well as test data generation and debugging. Use when writing tests for new features, maintaining existing tests after API/UI changes, generating synthetic test data, or debugging test failures. Essential for ensuring code quality and preventing regressions.
testing
Generate comprehensive test suites ensuring requirements are met. Strategies for Unit, Integration, and E2E testing.
development
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes