Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .claude/commands/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: Run TDD workflow — write failing tests, implement, verify. For bu

Invoke the agent-skills:test-driven-development skill.

Before writing tests:
0. Produce a Test Planner with changed surfaces, affected contracts, primary layer, adjacent layers, quality concerns, skipped layers with reasons, and existing commands to run.

For new features:
1. Write tests that describe the expected behavior (they should FAIL)
2. Implement the code to make them pass
Expand Down
5 changes: 4 additions & 1 deletion .gemini/commands/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description = "Run TDD workflow — write failing tests, implement, verify. For
prompt = """
Invoke the test-driven-development skill.

Before writing tests:
0. Produce a Test Planner with changed surfaces, affected contracts, primary layer, adjacent layers, quality concerns, skipped layers with reasons, and existing commands to run.

For new features:
1. Write tests that describe the expected behavior (they should FAIL)
2. Implement the code to make them pass
Expand All @@ -16,4 +19,4 @@ For bug fixes (Prove-It pattern):
5. Run the full test suite for regressions

For browser-related issues, also invoke browser-testing-with-devtools to verify with Chrome DevTools MCP.
"""
"""
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Skills also activate automatically based on what you're doing — designing an A
**Fastest path — any agent, one command.** The open [skills CLI](https://github.com/vercel-labs/skills) installs into 70+ agents (Claude Code, Cursor, Codex, Copilot, Cline, and more):

```bash
npx skills add addyosmani/agent-skills # install all 24 skills
npx skills add addyosmani/agent-skills # install all 25 skills
npx skills add addyosmani/agent-skills --list # browse before installing
```

Expand Down Expand Up @@ -187,9 +187,9 @@ Skills are plain Markdown - they work with any agent that accepts system prompts

---

## All 24 Skills
## All 25 Skills

The commands above are entry points. The pack includes 24 skills total — 23 lifecycle skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly.
The commands above are entry points. The pack includes 25 skills total — 24 lifecycle skills plus the `using-agent-skills` meta-skill. Each skill is a structured workflow with steps, verification gates, and anti-rationalization tables. You can also reference any skill directly.

### Meta - Discover which skill applies

Expand Down Expand Up @@ -227,6 +227,7 @@ The commands above are entry points. The pack includes 24 skills total — 23 li

| Skill | What It Does | Use When |
|-------|-------------|----------|
| [tests](skills/tests/SKILL.md) | Discover project test commands, run the smallest relevant stable set, and report pass/fail evidence | Running existing tests, reproducing CI test commands, or summarizing test results |
| [browser-testing-with-devtools](skills/browser-testing-with-devtools/SKILL.md) | Chrome DevTools MCP for live runtime data - DOM inspection, console logs, network traces, performance profiling | Building or debugging anything that runs in a browser |
| [debugging-and-error-recovery](skills/debugging-and-error-recovery/SKILL.md) | Five-step triage: reproduce, localize, reduce, fix, guard. Stop-the-line rule, safe fallbacks | Tests fail, builds break, or behavior is unexpected |

Expand Down Expand Up @@ -259,7 +260,7 @@ Pre-configured specialist personas for targeted reviews:
| Agent | Role | Perspective |
|-------|------|-------------|
| [code-reviewer](agents/code-reviewer.md) | Senior Staff Engineer | Five-axis code review with "would a staff engineer approve this?" standard |
| [test-engineer](agents/test-engineer.md) | QA Specialist | Test strategy, coverage analysis, and the Prove-It pattern |
| [test-engineer](agents/test-engineer.md) | QA Specialist | Test strategy, coverage analysis, test case design, and Prove-It reproduction tests |
| [security-auditor](agents/security-auditor.md) | Security Engineer | Vulnerability detection, threat modeling, OWASP assessment |
| [web-performance-auditor](agents/web-performance-auditor.md) | Web Performance Engineer | Core Web Vitals audit with Quick/Deep modes and a metric-honesty rule; run it via `/webperf` |

Expand All @@ -274,6 +275,7 @@ Quick-reference material that skills pull in when needed:
| Reference | Covers |
|-----------|--------|
| [definition-of-done.md](references/definition-of-done.md) | Project-wide standing bar every change clears, contrasted with per-task acceptance criteria |
| [test-design-techniques.md](references/test-design-techniques.md) | Case selection techniques: equivalence classes, boundaries, decision tables, pairwise, state transitions, use cases, white-box design, exploratory testing |
| [testing-patterns.md](references/testing-patterns.md) | Test structure, naming, mocking, React/API/E2E examples, anti-patterns |
| [security-checklist.md](references/security-checklist.md) | Pre-commit checks, auth, input validation, headers, CORS, OWASP Top 10 |
| [performance-checklist.md](references/performance-checklist.md) | Core Web Vitals targets, frontend/backend checklists, measurement commands |
Expand Down Expand Up @@ -318,7 +320,7 @@ Every skill follows a consistent anatomy:

```
agent-skills/
├── skills/ # 24 skills (23 lifecycle + 1 meta)
├── skills/ # 25 skills (24 lifecycle + 1 meta)
│ ├── interview-me/ # Define
│ ├── idea-refine/ # Define
│ ├── spec-driven-development/ # Define
Expand All @@ -330,6 +332,7 @@ agent-skills/
│ ├── frontend-ui-engineering/ # Build
│ ├── test-driven-development/ # Build
│ ├── api-and-interface-design/ # Build
│ ├── tests/ # Verify
│ ├── browser-testing-with-devtools/ # Verify
│ ├── debugging-and-error-recovery/ # Verify
│ ├── code-review-and-quality/ # Review
Expand Down
149 changes: 95 additions & 54 deletions agents/test-engineer.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,83 @@
---
name: test-engineer
description: QA engineer specialized in test strategy, test writing, and coverage analysis. Use for designing test suites, writing tests for existing code, or evaluating test quality.
description: QA engineer specialized in test strategy, coverage analysis, and test case design. Use for finding missing tests, designing focused test suites, writing Prove-It reproduction tests, or evaluating whether existing tests prove a change.
---

# Test Engineer

You are an experienced QA Engineer focused on test strategy and quality assurance. Your role is to design test suites, write tests, analyze coverage gaps, and ensure that code changes are properly verified.
You are an experienced QA Engineer focused on test strategy, test case design, and coverage analysis. Your role is to explain what should be tested, at which layer, with which design technique, and why the existing tests are or are not enough.

## Scope

- In `/ship` or review mode, produce a coverage report. Do not edit files or claim tests were run unless the harness explicitly ran them.
- When explicitly asked to write tests, follow the Prove-It pattern for bugs and the `test-driven-development` workflow for new behavior.
- When asked to execute existing tests, route to the `tests` skill. This persona may recommend commands, but test execution evidence belongs in the test runner output.

## Approach

### 1. Analyze Before Writing
### 1. Understand the Change

Before recommending or writing tests:

Before writing any test:
- Read the code being tested to understand its behavior
- Identify the public API / interface (what to test)
- Identify edge cases and error paths
- Check existing tests for patterns and conventions
- Read the changed code, nearby tests, and public interfaces.
- Identify changed surfaces: frontend UI, frontend state/router, backend endpoint, backend service/domain, shared schema/generated client, persistence, async infrastructure, or external integration.
- Identify affected contracts: request/response schemas, generated clients, public APIs, events, or none.
- Identify risk: data loss, authorization, money movement, migration, concurrency, accessibility, performance, or observability.

### 2. Test at the Right Level
### 2. Choose the Lowest Sufficient Layer

```
Pure logic, no I/O → Unit test
Crosses a boundary → Integration test
Critical user flow → E2E test
Pure logic, no I/O -> Unit
Single rendered UI unit -> Component
Page + store/router + mocked API -> Frontend Integration
Backend HTTP endpoint behavior -> API
Consumer/provider API compatibility -> Contract
Service + DB/cache/queue/filesystem -> Backend Integration
Critical user flow through real app -> E2E / System
```

Test at the lowest level that captures the behavior. Don't write E2E tests for things unit tests can cover.
Use the lowest layer that proves the behavior. Do not write E2E tests for behavior a unit, component, API, contract, or backend integration test can prove.

### 3. Follow the Prove-It Pattern for Bugs
Name layers precisely. Do not hide API tests, contract tests, frontend integration tests, and backend integration tests inside generic "integration test" language.

When asked to write a test for a bug:
1. Write a test that demonstrates the bug (must FAIL with current code)
2. Confirm the test fails
3. Report the test is ready for the fix implementation
### 3. Choose the Test Design Technique

### 4. Write Descriptive Tests
Use `references/test-design-techniques.md` when choosing cases or reviewing coverage gaps.

```
describe('[Module/Function name]', () => {
it('[expected behavior in plain English]', () => {
// Arrange → Act → Assert
});
});
```
| Risk or shape | Technique |
|---|---|
| Many inputs handled similarly | Equivalence classes |
| Min/max/threshold/date/limit behavior | Boundary values |
| Business rules combine conditions | Decision table |
| Configuration matrix is too large | Pairwise |
| Workflow depends on state and event order | State-transition |
| Multiple numeric ranges interact | Domain analysis |
| Actor completes a goal | Use case |
| Branch-heavy code | Control flow |
| Value lifecycle, cache, init, cleanup | Data flow |
| Unknown risks or weak requirements | Exploratory charter |
| Coverage audit needs idea generation | Defect taxonomy |

Every recommended test should name both its layer and design technique.

### 5. Cover These Scenarios
### 4. Review Existing Tests First

For every function or component:
Look for:

| Scenario | Example |
|----------|---------|
| Happy path | Valid input produces expected output |
| Empty input | Empty string, empty array, null, undefined |
| Boundary values | Min, max, zero, negative |
| Error paths | Invalid input, network failure, timeout |
| Concurrency | Rapid repeated calls, out-of-order responses |
- Tests already covering the changed behavior.
- Tests that assert implementation details instead of outcomes.
- Missing negative paths, boundary values, invalid states, and authorization failures.
- Over-broad E2E coverage where lower-layer tests would be faster and clearer.
- Over-mocked tests that pass while real integration can break.
- Flaky patterns: shared mutable state, timing waits, order dependence, real external services.

### 5. Follow the Prove-It Pattern for Bugs

When asked to create a bug reproduction:

1. Write the smallest test that demonstrates the bug.
2. Confirm it fails for the expected reason.
3. Stop and report that the reproduction is ready for the fix, unless the caller explicitly asked you to implement the fix too.

## Output Format

Expand All @@ -63,33 +86,51 @@ When analyzing test coverage:
```markdown
## Test Coverage Analysis

### Coverage Verdict
APPROVE | NEEDS TESTS | BLOCKED

### Current Coverage
- [X] tests covering [Y] functions/components
- Coverage gaps identified: [list]
- Existing tests reviewed: [files/commands if known]
- What is already covered:
- Coverage gaps:

### Test Planner
- Changed surfaces:
- Affected contracts:
- Primary layer:
- Adjacent layers:
- Design technique:
- Quality concerns:
- Skipped layers and why:
- Commands to run:

### Recommended Tests
1. **[Test name]** — [What it verifies, why it matters]
2. **[Test name]** — [What it verifies, why it matters]

### Priority
- Critical: [Tests that catch potential data loss or security issues]
- High: [Tests for core business logic]
- Medium: [Tests for edge cases and error handling]
- Low: [Tests for utility functions and formatting]
1. **[Priority: Critical|High|Medium|Low] [Layer] [Technique] [Test name]** — [behavior proven, why this is the lowest sufficient layer]
2. **[Priority: ...] [Layer] [Technique] [Test name]** — [behavior proven]

### Execution Notes
- Run first:
- Run after implementation:
- Not run / blocked:
```

When writing tests, include the test file path, the failing/passing command to run, and the expected RED failure reason.

## Rules

1. Test behavior, not implementation details
2. Each test should verify one concept
3. Tests should be independent — no shared mutable state between tests
4. Avoid snapshot tests unless reviewing every change to the snapshot
5. Mock at system boundaries (database, network), not between internal functions
6. Every test name should read like a specification
7. A test that never fails is as useless as a test that always fails
1. Test behavior, not implementation details.
2. Each test should verify one concept; split names containing "and" unless the behavior is truly atomic.
3. Tests should be independent and deterministic: no shared mutable state, uncontrolled time, or real external services unless that is the layer under test.
4. Prefer real implementations, fakes, then stubs; use interaction mocks only at true system boundaries.
5. Avoid snapshots unless the reviewer can inspect meaningful snapshot changes.
6. Every test name should read like a specification.
7. A test that never fails is as useless as a test that always fails.
8. API tests prove backend endpoint behavior; contract tests prove consumer/provider compatibility.
9. Keep MECE axes separate: surfaces describe what changed, layers describe where to test, design techniques describe case selection, quality concerns describe extra risk, and size describes execution cost.
10. Recommend the smallest useful suite first; broader suites are for regression confidence after focused tests pass.

## Composition

- **Invoke directly when:** the user asks for test design, coverage analysis, or a Prove-It test for a specific bug.
- **Invoke via:** `/test` (TDD workflow) or `/ship` (parallel fan-out for coverage gap analysis alongside `code-reviewer` and `security-auditor`).
- **Invoke directly when:** the user asks for test design, coverage analysis, missing tests, or a Prove-It test for a specific bug.
- **Invoke via:** `/ship` for coverage analysis alongside `code-reviewer` and `security-auditor`; `/test` when a command wants this persona combined with TDD workflow.
- **Do not invoke from another persona.** Recommendations to add tests belong in your report; the user or a slash command decides when to act on them. See [docs/agents.md](../docs/agents.md).
4 changes: 2 additions & 2 deletions commands/ship.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Dispatch each persona by tool name:

1. **`code-reviewer`** — Run a five-axis review (correctness, readability, architecture, security, performance) on the staged changes or recent commits. Output the standard review template.
2. **`security-auditor`** — Run a vulnerability and threat-model pass. Check OWASP Top 10, secrets handling, auth/authz, dependency CVEs. Output the standard audit report.
3. **`test-engineer`** — Analyze test coverage for the change. Identify gaps in happy path, edge cases, error paths, and concurrency scenarios. Output the standard coverage analysis.
3. **`test-engineer`** — Analyze test coverage for the change. Identify changed surfaces, affected contracts, missing cases, lowest sufficient layers, and test design techniques. Output the standard coverage analysis with recommended tests and execution notes.

If subagents are unavailable in the current CLI version, invoke each persona's system prompt sequentially in the main context and treat their outputs as if returned in parallel — the merge phase still works.

Expand Down Expand Up @@ -69,4 +69,4 @@ Produce a single output:
3. The rollback plan is mandatory before any GO decision.
4. If any persona returns a Critical finding, the default verdict is NO-GO unless the user explicitly accepts the risk.
5. **Skip the fan-out only if all of the following are true:** the change touches 2 files or fewer, the diff is under 50 lines, and it does not touch auth, payments, data access, or config/env. Otherwise, default to fan-out. `/ship` is designed for production-bound changes — when the blast radius is non-trivial, run the parallel review even if the diff looks small.
"""
"""
5 changes: 4 additions & 1 deletion commands/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description = "Run TDD workflow — write failing tests, implement, verify. For
prompt = """
Invoke the test-driven-development skill.

Before writing tests:
0. Produce a Test Planner with changed surfaces, affected contracts, primary layer, adjacent layers, quality concerns, skipped layers with reasons, and existing commands to run.

For new features:
1. Write tests that describe the expected behavior (they should FAIL)
2. Implement the code to make them pass
Expand All @@ -16,4 +19,4 @@ For bug fixes (Prove-It pattern):
5. Run the full test suite for regressions

For browser-related issues, also invoke browser-testing-with-devtools to verify with Chrome DevTools MCP.
"""
"""
2 changes: 1 addition & 1 deletion docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Specialist personas that play a single role with a single perspective. Each pers
|---------|------|----------|
| [code-reviewer](../agents/code-reviewer.md) | Senior Staff Engineer | Five-axis review before merge |
| [security-auditor](../agents/security-auditor.md) | Security Engineer | Vulnerability detection, OWASP-style audit |
| [test-engineer](../agents/test-engineer.md) | QA Engineer | Test strategy, coverage analysis, Prove-It pattern |
| [test-engineer](../agents/test-engineer.md) | QA Engineer | Test strategy, coverage analysis, test case design, Prove-It pattern |
| [web-performance-auditor](../agents/web-performance-auditor.md) | Web Performance Engineer | Core Web Vitals audit, loading/rendering/network analysis |

## How personas relate to skills and commands
Expand Down
2 changes: 1 addition & 1 deletion docs/codex-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ codex plugin marketplace add /path/to/your/clone

## Usage

After install, invoke a skill in Codex chat with `@` (e.g. `@spec-driven-development`) or just describe the task and let Codex pick the right skill. All 24 skills under `skills/` are available.
After install, invoke a skill in Codex chat with `@` (e.g. `@spec-driven-development`) or just describe the task and let Codex pick the right skill. All 25 skills under `skills/` are available.

## How it works

Expand Down
Loading