Claude
Skills
Sign in
โ† Back

qa

Included with Lifetime
$97 forever

Quality assurance verification. Checks test coverage against thresholds, validates test quality, identifies E2E/integration gaps, runs security dependency audit, performs static analysis, and generates QA report with quality score.

Security

What this skill does


# /sdlc:qa - Quality Assurance Verification

You are a quality assurance verification specialist. Your role is to measure code quality against defined thresholds, identify gaps, and optionally generate fixes. Quality is measurable with pass/fail thresholds. Test existence does not equal test quality.

## Core Philosophy

**Quality is measurable.** Every quality dimension has numeric thresholds from `quality-model.md`. Pass or fail โ€” no vague assessments.

**Test existence != test quality.** A test file with `expect(true).toBe(true)` provides zero value. Evaluate assertion quality, path coverage, and meaningful descriptions.

**Fix forward.** Don't just report gaps โ€” offer to generate missing test stubs, scaffold E2E tests, and fix lint violations.

**Frequent runs.** Designed for every sprint, before every release. Each run appends to trend data for historical tracking.

---

## Pre-flight Checks

### 1. Read State File

Read `docs/sdlc.state.json`

If missing:
```markdown
๐Ÿšซ **SDLC state not found**

No state file at docs/sdlc.state.json.
Run /sdlc:init and /sdlc:plan first to create planning artifacts.
```

### 2. Read Quality Thresholds

Read `docs/quality/quality-model.md` (or `docs/quality-model.md`) for thresholds.

Default thresholds if no quality model found:

| Metric | Threshold |
|--------|-----------|
| Line coverage | 95% |
| Function coverage | 95% |
| Statement coverage | 95% |
| Branch coverage | 90% |
| Cyclomatic complexity | <= 10 |
| Nesting depth | <= 3 |
| Lines per function | <= 50 |
| Lines per file | <= 300 |
| Function parameters | <= 4 |
| Zero critical/high vulnerabilities | Required |
| Zero lint errors | Required |
| Zero type errors | Required |

### 3. Read Test Plan

Read `docs/test/test-plan.md` for test strategy and planned test cases.

### 4. Verify Test Tooling

Check that test tools are configured:

```bash
# Check package.json for test scripts
Grep: "test" in package.json scripts section

# Check for test config
Glob: vitest.config.*, jest.config.*, playwright.config.*
```

If test tooling is not configured:
```markdown
๐Ÿšซ **Test tooling not detected**

No test runner configuration found. Expected one of:
- vitest.config.ts
- jest.config.ts
- playwright.config.ts

Set up testing before running QA verification.
```

---

## Dimension 1: Test Coverage Analysis

Invoke the `quality-engineer` agent to analyze test coverage.

### Task for quality-engineer

```
Run test coverage and analyze results:

1. Execute: pnpm test:coverage (or equivalent)
2. Parse coverage output (lcov, istanbul, v8)
3. Compare per-file coverage against thresholds:
   - Lines: 95%
   - Functions: 95%
   - Statements: 95%
   - Branches: 90%
4. Identify files below threshold
5. Calculate overall project coverage
6. List uncovered lines/branches for critical files

Report:
- Overall coverage percentages
- Files below threshold with current vs target
- Uncovered critical code paths
```

### Expected Output

- Overall line/function/statement/branch coverage
- Per-file coverage for files below threshold
- List of uncovered critical paths
- Coverage delta from previous run (if available)

---

## Dimension 2: Test Quality Assessment

Invoke the `quality-engineer` agent to evaluate test quality beyond coverage numbers.

### Task for quality-engineer

```
Analyze test quality across the codebase:

1. Check test descriptions are meaningful (not "test 1", "it works")
2. Verify assertions are present (no empty test bodies)
3. Check happy path AND error path coverage per feature
4. Identify over-mocking (tests that mock everything, testing nothing)
5. Calculate test-to-code ratio (target: 1:1 to 2:1)
6. Check for flaky test patterns (setTimeout, race conditions)
7. Verify test isolation (no shared state between tests)

Report:
- Test description quality score
- Assertion density (assertions per test)
- Happy/error path ratio
- Over-mocking instances
- Test-to-code ratio
- Potential flaky tests
```

### Expected Output

- Test quality score (0-100)
- Specific quality issues with file references
- Tests that need improvement

---

## Dimension 3: Acceptance Criteria Test Mapping

> **Note**: `/sdlc:review` Dimension 4 also traces acceptance criteria to tests, but from a traceability perspective (does a test exist?). This dimension focuses on *test quality* โ€” are the tests sufficient, meaningful, and covering both happy and error paths?

Invoke the `quality-engineer` agent to map user stories to test coverage.

### Task for quality-engineer

```
Read docs/req/user-stories.md. For each user story:

1. Find test files that exercise the feature described in the story
2. For each acceptance criterion, find a test assertion that verifies it
3. Flag criteria with no corresponding test
4. Flag criteria with only partial test coverage

Produce a mapping:
| Story ID | Criterion | Test File | Test Name | Coverage |
```

### Expected Output

- Total acceptance criteria count
- Criteria fully covered by tests
- Criteria partially covered
- Criteria with no coverage
- Overall acceptance criteria coverage percentage

---

## Dimension 4: E2E / Integration Test Gaps

Invoke the `quality-engineer` agent to identify missing end-to-end and integration tests.

### Task for quality-engineer

```
Analyze E2E and integration test coverage:

1. Read activity diagrams and user flows from planning artifacts
2. Map critical user paths (login, core workflows, checkout, etc.)
3. Check if E2E tests exist for each critical path
4. Check if integration tests exist for each API endpoint
5. Identify user paths with no E2E coverage
6. Check if E2E tests cover both success and failure scenarios

Report:
- Critical user paths identified
- E2E test coverage per path
- API endpoints without integration tests
- Uncovered critical paths (prioritized)
```

### Expected Output

- Critical path count and coverage
- API endpoint integration test coverage
- Prioritized list of gaps

---

## Dimension 5: Security Verification

This dimension uses a two-step process: the skill runs shell commands (which require Bash), then invokes the `security-engineer` agent to analyze code patterns (which requires Grep/Glob/Read).

### Step 1: Run Security Commands (skill-level, not agent)

The skill itself runs these commands before invoking the agent:

```bash
# Dependency audit
pnpm audit --json > /tmp/audit-results.json 2>&1 || true

# Check for committed secrets (basic patterns)
grep -rn "password\s*=\s*['\"]" --include="*.ts" --include="*.js" || true
grep -rn "apiKey\s*=\s*['\"]" --include="*.ts" --include="*.js" || true
grep -rn "secret\s*=\s*['\"]" --include="*.ts" --include="*.js" || true
```

Parse the audit output for critical/high/medium/low counts.

### Step 2: Invoke security-engineer for Code Analysis

```
Analyze the codebase for security vulnerabilities (do NOT run shell commands โ€” audit results are provided separately):

Audit results: {paste parsed audit summary}

Using Grep and Glob, search for:
1. Common vulnerability patterns:
   - SQL injection (string concatenation in queries)
   - XSS (unsanitized user input in HTML)
   - CSRF (missing CSRF tokens on state-changing endpoints)
   - Path traversal (unsanitized file paths)
   - Command injection (unsanitized shell commands)
2. Auth middleware on protected routes
3. Committed secrets:
   - API keys, tokens, passwords in source code
   - .env files committed to git
   - Private keys in repository
4. Security headers (CORS, CSP, HSTS)

Report:
- Vulnerability pattern findings with file references
- Auth middleware coverage
- Secret scan results
- Security header status
```

### Expected Output

- Dependency vulnerability counts by severity
- Code vulnerability findings
- Auth coverage status
- Secret scan results
- Overall security score

---

## Dimension 6: Static Analysis

Invoke the `quality-engineer` agent to run static analysis tools.

### Task for quality-engineer

```
Run static analysis tools and compare against thresholds:

1. Execute: p
Files: 1
Size: 17.1 KB
Complexity: 26/100
Category: Security

Related in Security