Generates unit tests, integration tests, and E2E tests for React/Next.js applications. Scans components to create Jest + React Testing Library test stubs, an...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install senior-qa或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install senior-qa⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/senior-qa/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: "senior-qa" description: Generates unit tests, integration tests, and E2E tests for React/Next.js applications. Scans components to create Jest + React Testing Library test stubs, analyzes Istanbul/LCOV coverage reports to surface gaps, scaffolds Playwright test files from Next.js routes, mocks API calls with MSW, creates test fixtures, and configures test runners. Use when the user asks to "generate tests", "write unit tests", "analyze test coverage", "scaffold E2E tests", "set up Playwright", "configure Jest", "implement testing patterns", or "improve test quality". ---
Test automation, coverage analysis, and quality assurance patterns for React and Next.js applications.
---
# Generate Jest test stubs for React components
python scripts/test_suite_generator.py src/components/ --output __tests__/
# Analyze test coverage from Jest/Istanbul reports
python scripts/coverage_analyzer.py coverage/coverage-final.json --threshold 80
# Scaffold Playwright E2E tests for Next.js routes
python scripts/e2e_test_scaffolder.py src/app/ --output e2e/
---
Scans React/TypeScript components and generates Jest + React Testing Library test stubs with proper structure.
Input: Source directory containing React components Output: Test files with describe blocks, render tests, interaction tests
Usage:
# Basic usage - scan components and generate tests
python scripts/test_suite_generator.py src/components/ --output __tests__/
# Include accessibility tests
python scripts/test_suite_generator.py src/ --output __tests__/ --include-a11y
# Generate with custom template
python scripts/test_suite_generator.py src/ --template custom-template.tsx
Supported Patterns:
---
Parses Jest/Istanbul coverage reports and identifies gaps, uncovered branches, and provides actionable recommendations.
Input: Coverage report (JSON or LCOV format) Output: Coverage analysis with recommendations
Usage:
# Analyze coverage report
python scripts/coverage_analyzer.py coverage/coverage-final.json
# Enforce threshold (exit 1 if below)
python scripts/coverage_analyzer.py coverage/ --threshold 80 --strict
# Generate HTML report
python scripts/coverage_analyzer.py coverage/ --format html --output report.html
---
Scans Next.js pages/app directory and generates Playwright test files with common interactions.
Input: Next.js pages or app directory Output: Playwright test files organized by route
Usage:
# Scaffold E2E tests for Next.js App Router
python scripts/e2e_test_scaffolder.py src/app/ --output e2e/
# Include Page Object Model classes
python scripts/e2e_test_scaffolder.py src/app/ --output e2e/ --include-pom
# Generate for specific routes
python scripts/e2e_test_scaffolder.py src/app/ --routes "/login,/dashboard,/checkout"
---
Use when setting up tests for new or existing React components.
Step 1: Scan project for untested components
python scripts/test_suite_generator.py src/components/ --scan-only
Step 2: Generate test stubs
python scripts/test_suite_generator.py src/components/ --output __tests__/
Step 3: Review and customize generated tests
// __tests__/Button.test.tsx (generated)
import { render, screen, fireEvent } from '@testing-library/react';
import { Button } from '../src/components/Button';
describe('Button', () => {
it('renders with label', () => {
render(<Button>Click me</Button>);
expect(screen.getByRole('button', { name: "click-mei-tobeinthedocument"
});
it('calls onClick when clicked', () => {
const handleClick = jest.fn();
render(<Button onClick={handleClick}>Click</Button>);
fireEvent.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalledTimes(1);
});
// TODO: Add your specific test cases
});
Step 4: Run tests and check coverage
npm test -- --coverage
python scripts/coverage_analyzer.py coverage/coverage-final.json
---
Use when improving test coverage or preparing for release.
Step 1: Generate coverage report
npm test -- --coverage --coverageReporters=json
Step 2: Analyze coverage gaps
python scripts/coverage_analyzer.py coverage/coverage-final.json --threshold 80
Step 3: Identify critical paths
python scripts/coverage_analyzer.py coverage/ --critical-paths
Step 4: Generate missing test stubs
python scripts/test_suite_generator.py src/ --uncovered-only --output __tests__/
Step 5: Verify improvement
npm test -- --coverage
python scripts/coverage_analyzer.py coverage/ --compare previous-coverage.json
---
Use when setting up Playwright for a Next.js project.
Step 1: Initialize Playwright (if not installed)
npm init playwright@latest
Step 2: Scaffold E2E tests from routes
python scripts/e2e_test_scaffolder.py src/app/ --output e2e/
Step 3: Configure authentication fixtures
// e2e/fixtures/auth.ts (generated)
import { test as base } from '@playwright/test';
export const test = base.extend({
authenticatedPage: async ({ page }, use) => {
await page.goto('/login');
await page.fill('[name="email"]', '[email protected]');
await page.fill('[name="password"]', 'password');
await page.click('button[type="submit"]');
await page.waitForURL('/dashboard');
await use(page);
},
});
Step 4: Run E2E tests
npx playwright test
npx playwright show-report
Step 5: Add to CI pipeline
# .github/workflows/e2e.yml
- name: "run-e2e-tests"
run: npx playwright test
- name: "upload-report"
uses: actions/upload-artifact@v3
with:
name: "playwright-report"
path: playwright-report/
---
| File | Contains | Use When | |------|----------|----------| | references/testing_strategies.md | Test pyramid, testing types, coverage targets, CI/CD integration | Designing test strategy | | references/test_automation_patterns.md | Page Object Model, mocking (MSW), fixtures, async patterns | Writing test code | | references/qa_best_practices.md | Testable code, flaky tests, debugging, quality metrics | Improving test quality |
---
// Preferred (accessible)
screen.getByRole('button', { name: "submiti"
screen.getByLabelText(/email/i)
screen.getByPlaceholderText(/search/i)
// Fallback
screen.getByTestId('custom-element')
// Wait for element
await screen.findByText(/loaded/i);
// Wait for removal
await waitForElementToBeRemoved(() => screen.queryByText(/loading/i));
// Wait for condition
await waitFor(() => {
expect(mockFn).toHaveBeenCalled();
});
import { rest } from 'msw';
import { setupServer } from 'msw/node';
const server = setupServer(
rest.get('/api/users', (req, res, ctx) => {
return res(ctx.json([{ id: 1, name: "john" }]));
})
);
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
// Preferred
page.getByRole('button', { name: "submit" })
page.getByLabel('Email')
page.getByText('Welcome')
// Chaining
page.getByRole('listitem').filter({ hasText: 'Product' })
module.exports = {
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80,
},
},
};
---
...
安装 Senior Qa 后,可以对 AI 说这些话来触发它
Help me get started with Senior Qa
Explains what Senior Qa does, walks through the setup, and runs a quick demo based on your current project
Use Senior Qa to generates unit tests, integration tests, and E2E tests for React/Next
Invokes Senior Qa with the right parameters and returns the result directly in the conversation
What can I do with Senior Qa in my developer & devops workflow?
Lists the top use cases for Senior Qa, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/senior-qa/ 目录(个人级,所有项目可用),或 .claude/skills/senior-qa/(项目级)。重启 AI 客户端后,用 /senior-qa 主动调用,或让 AI 根据上下文自动发现并使用。
Senior Qa 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Senior Qa 可免费安装使用。请查阅仓库了解许可证信息。
Generates unit tests, integration tests, and E2E tests for React/Next.js applications. Scans components to create Jest + React Testing Library test stubs, an...
Senior Qa 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Senior Qa
Identifies repetitive steps in your workflow and sets up Senior Qa to handle them automatically