test-automator
This skill guides agents in creating and maintaining automated tests across the testing pyramid, from unit tests to integration and end-to-end tests.
Community author
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
- License
- MIT (permissive)
- Pin
- be7a9d7pinned Oct 9, 2026
- Context cost
- about 1,100 tokenswhen the skill loads
- GitHub stars
- 82on zhaono1/agent-playbook
- Scripts
- 2 scripts
What it does
“Test automation framework expert for creating and maintaining automated tests. Use when user asks to write tests, automate testing, or improve test coverage.”
Generated summary from the skill's own text
This skill guides agents in creating and maintaining automated tests across the testing pyramid, from unit tests to integration and end-to-end tests. It provides framework-specific examples for Jest, Supertest, and Playwright, along with best practices for test naming, coverage goals, and test data management. The skill includes Python scripts to generate test boilerplate and coverage reports.
When to use it
- Writing unit, integration, or end-to-end tests for code
- Setting up testing frameworks and test coverage measurement
- Improving test coverage metrics above baseline targets
- Fixing bugs by creating tests that reproduce the issue
When not to
- Testing third-party libraries or external services directly
- Creating tests for implementation details rather than behavior
- Situations requiring manual testing only without automation
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add zhaono1/agent-playbook --skill test-automatorInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install zhaono1/agent-playbook test-automator@be7a9d7d17593abd8cf029d51c87dbd5b445351eInstalls the commit we checked (be7a9d7).
Copy by hand
Download the folder at be7a9d7 and put it in .claude/skills/test-automator for Claude Code and in .agents/skills/test-automator for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "test-automator" by zhaono1. Source, pinned to commit be7a9d7d17593abd8cf029d51c87dbd5b445351e: https://github.com/zhaono1/agent-playbook/tree/be7a9d7d17593abd8cf029d51c87dbd5b445351e/skills/test-automator 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/test-automator/ for Claude Code and .agents/skills/test-automator/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/zhaono1/test-automator
SKILL.md at the pin
---
name: test-automator
description: Test automation framework expert for creating and maintaining automated tests. Use when user asks to write tests, automate testing, or improve test coverage.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
metadata:
hooks:
after_complete:
- trigger: session-logger
mode: auto
reason: "Log test creation"
---
# Test Automator
Expert in creating and maintaining automated tests for various frameworks and languages.
## When This Skill Activates
Activates when you:
- Ask to write tests
- Mention test automation
- Request test coverage improvement
- Need to set up testing framework
## Testing Pyramid
```
/\
/E2E\ - Few, expensive, slow
/------\
/ Integration \ - Moderate number
/--------------\
/ Unit Tests \ - Many, cheap, fast
/------------------\
```
## Unit Testing
### Principles
1. **Test behavior, not implementation**
2. **One assertion per test** (generally)
3. **Arrange-Act-Assert** pattern
4. **Descriptive test names**
### Example (Jest)
```typescript
describe('UserService', () => {
describe('createUser', () => {
it('should create a user with valid data', async () => {
// Arrange
const userData = {
name: 'John Doe',
email: 'john@example.com'
};
// Act
const user = await userService.create(userData);
// Assert
expect(user.id).toBeDefined();
expect(user.email).toBe(userData.email);
});
it('should throw error for invalid email', async () => {
// Arrange
const userData = { email: 'invalid' };
// Act & Assert
await expect(userService.create(userData))
.rejects.toThrow('Invalid email');
});
});
});
```
## Integration Testing
### Principles
1. **Test component interactions**
2. **Use test doubles for external services**
3. **Clean up test data**
4. **Run in isolation**
### Example (Supertest)
```typescript
describe('POST /api/users', () => {
it('should create a user', async () => {
const response = await request(app)
.post('/api/users')
.send({
name: 'John Doe',
email: 'john@example.com'
})
.expect(201)
.expect((res) => {
expect(res.body.id).toBeDefined();
expect(res.body.email).toBe('john@example.com');
});
});
});
```
## E2E Testing
### Principles
1. **Test critical user flows**
2. **Use realistic test data**
3. **Handle async operations properly**
4. **Clean up after tests**
### Example (Playwright)
```typescript
test('user can login', async ({ page }) => {
await page.goto('/login');
await page.fill('[name="email"]', 'user@example.com');
await page.fill('[name="password"]', 'password123');
await page.click('button[type="submit"]');
await expect(page).toHaveURL('/dashboard');
await expect(page.locator('h1')).toContainText('Welcome');
});
```
## Test Coverage
### Coverage Goals
| Type | Target |
|------|--------|
| Lines | > 80% |
| Branches | > 75% |
| Functions | > 80% |
| Statements | > 80% |
### Coverage Reports
```bash
# Jest
npm test -- --coverage
# Python (pytest-cov)
pytest --cov=src --cov-report=html
# Go
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
```
## Testing Best Practices
### DO's
- Write tests before fixing bugs (TDD)
- Test edge cases
- Keep tests independent
- Use descriptive test names
- Mock external dependencies
- Clean up test data
### DON'Ts
- Don't test implementation details
- Don't write brittle tests
- Don't skip tests without a reason
- Don't commit commented-out tests
- Don't test third-party libraries
## Test Naming Conventions
```typescript
// Good: Describes what is being tested
it('should reject invalid email addresses')
// Good: Describes the scenario and outcome
it('returns 401 when user provides invalid credentials')
// Bad: Vague
it('works correctly')
```
## Common Testing Frameworks
| Language | Framework | Command |
|----------|-----------|---------|
| TypeScript/JS | Jest, Vitest | `npm test` |
| Python | pytest | `pytest` |
| Go | testing | `go test` |
| Java | JUnit | `mvn test` |
| Rust | built-in | `cargo test` |
## Scripts
Generate test boilerplate:
```bash
python3 scripts/generate_test.py --name <feature> --output tests/test-plan.md
```
Check test coverage:
```bash
python3 scripts/coverage_report.py --name <service-name> --output coverage-report.md
```
## References
- `references/best-practices.md` - Testing best practices
- `references/examples/` - Framework-specific examples
- `references/mocking.md` - Mocking guidelines
From zhaono1/agent-playbook at be7a9d7, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at be7a9d7Files
- SKILL.md4.6 KB · ab306b62a1be
- README.md928 B · 8cf57c1ba891
- references/
- best-practices.md154 B · 575c8797d4b2
- examples/
- README.md77 B · bee16e5c7843
- unit-test-example.md104 B · 8c2076b1f06a
- mocking.md101 B · 26995a82dbe0
- scripts/
- coverage_report.py1.5 KB · 57effc286024
- generate_test.py1.6 KB · c1e3d21686d9
8 files, 9.2 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at be7a9d7Related in Testing and QA
triaging-visual-review-runs
Inspects PostHog Visual Review screenshot regression runs that gate pull requests, helping engineers triage diff results, identify flaky stories, and decide…
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 8.9K tokens · pinned 6 days ago
webapp-testing
This skill enables agents to test local web applications using Playwright by writing Python automation scripts.
by SnykOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 890 tokens · pinned 6 days ago
emulate
This skill runs local emulated APIs for 14+ third-party services including Vercel, GitHub, Google, Slack, AWS, Stripe, and others.
by VercelOfficial publisher
Claude Code, Codex, Cursor +4 · about 4.7K tokens · pinned 6 days ago
browser-probe
This skill probes a URL with escalating headless browser configurations to detect CDN bot protection systems like Akamai and Cloudflare, then generates a…
by Adobe, Inc.Official publisher
Contains scripts
Claude Code · about 1K tokens · pinned 6 days ago
browser-navigation
This skill enables agents to automate browser interactions including navigation, form filling, element clicking, screenshots, and data extraction from web…
by FactoryOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.5K tokens · pinned 6 days ago
triaging-visual-review-runs
Inspects PostHog Visual Review runs that gate PR merges with screenshot regression checks.
by PostHogOfficial publisher
Claude Code, Codex, Cursor +4 · about 8.9K tokens · pinned 6 days ago