.claude/skills/test-local/SKILL.md
Local dev testing workflow — verify test environment, provision infrastructure (Docker, Testcontainers), run multi-level test suite (unit → integration → E2E), coverage analysis, quality gate. Applies QA Engineer role. Use for full local QA cycle before commit or PR.
npx skillsauth add avav25/ai-assets test-localInstall 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.
Full QA cycle for local development environments. Verifies test infrastructure, provisions dependencies, runs tests at all levels (unit → integration → E2E), analyzes coverage, and applies quality gates. Orchestrated by Agent(qa-engineer).
Key difference from /run-tests: This workflow manages the full local test environment lifecycle (setup → test → report → cleanup). /run-tests is a lightweight sub-workflow that only executes and analyzes tests.
Read TESTING.md at the project root (and per-service TESTING.md in monorepos) for test infrastructure, commands, credentials, and organization. This is the authoritative source for how to test the project.
Ask the user (or extract from context):
If invoked by another workflow — extract scope from parent context.
Primary: Agent(qa-engineer) — owns test strategy, quality gates, and test infrastructure decisions.
Secondary (applied as needed during test execution):
| Need | Role |
|---|---|
| Fix failing unit/integration tests | Stack-specific: Agent(java-engineer) / Agent(python-engineer) / Agent(frontend-engineer) |
| Docker/compose/infra issues | Agent(devops-engineer) |
| Test data / database schema | Agent(db-engineer) |
| General debugging | Agent(software-engineer) |
Read CLAUDE.md and scan project files to determine:
| Signal | Stack | Test Runner | Container Tool |
|---|---|---|---|
| package.json + vitest/jest | TypeScript/JS | npx vitest / npx jest | Testcontainers-node |
| package.json + playwright | TypeScript/JS (E2E) | npx playwright test | Playwright containers |
| pom.xml / build.gradle | Java | mvn test / gradle test | Testcontainers-java |
| pyproject.toml / pytest.ini | Python | pytest | Testcontainers-python |
| go.mod | Go | go test ./... | Testcontainers-go |
| *.csproj | .NET | dotnet test | Testcontainers-dotnet |
Also detect:
docker-compose.yml, docker-compose.test.yml, compose.yaml.env.test, jest.config.*, vitest.config.*, playwright.config.*, pytest.ini, conftest.py.github/workflows/, Jenkinsfile, .gitlab-ci.yml — extract test commands used in CI for parityBefore running tests, verify the local environment is ready.
// turbo
docker version --format "Client: {{.Client.Version}} | Server: {{.Server.Version}}"
If Docker is not running — notify user and stop. Tests requiring containers will fail.
Check that ports needed by test services are available:
// turbo
netstat -ano | findstr ":<port>"
Common test ports: 5432 (PostgreSQL), 6379 (Redis), 27017 (MongoDB), 9092 (Kafka), 3306 (MySQL).
If conflicts found — report which process holds the port. Suggest resolution.
Check for test-specific environment configuration:
.env — verify it exists and contains test_ prefixed variables (e.g., test_user, test_db_host).env.example — flag missing test variables.env.example for reference — never log or output actual .env valuesVerify project dependencies are installed:
| Stack | Check Command |
|---|---|
| Node.js | node_modules/ exists, package-lock.json up to date |
| Java | mvn dependency:resolve -q |
| Python | Virtual env active, pip check |
| Go | go mod verify |
If dependencies are stale — suggest npm install / pip install -r requirements.txt / etc.
Based on project config, set up test dependencies.
If the project uses Testcontainers — no manual setup needed. Testcontainers starts/stops containers automatically per test suite. Verify:
.testcontainers.properties if needed)If the project uses docker-compose.test.yml or similar:
docker compose -f docker-compose.test.yml up -d
Wait for services to be healthy:
docker compose -f docker-compose.test.yml ps
Check health status. If any service is unhealthy — collect logs and diagnose using Agent(devops-engineer).
If the project has seed scripts for test data:
CLAUDE.md, package.json scripts, Makefile, scripts/ directory)If the project uses only mocks/stubs for unit tests — skip to Step 6.
Execute tests in pyramid order: unit → integration → E2E. Stop at first failing level unless user requested full suite.
// turbo
<unit-test-command>
Expected: Fast (< 2 min), high pass rate. If unit tests fail — fix before proceeding.
For failures — delegate to /run-tests for analysis and auto-fix (Step 3-4 of that workflow).
Run only if unit tests pass (or user explicitly requested):
<integration-test-command>
Expected: Moderate speed (< 10 min). Tests interact with real dependencies (DB, APIs via containers).
Common integration test patterns by stack:
| Stack | Command | Notes |
|---|---|---|
| Vitest/Jest | npx vitest run --project integration | If workspace configured |
| pytest | pytest tests/integration/ -v | Or pytest -m integration |
| Maven | mvn verify -pl <module> | Failsafe plugin for ITs |
| Go | go test -tags=integration ./... | Build tag separation |
Run only if integration tests pass (or user explicitly requested):
<e2e-test-command>
Prerequisites:
npx playwright install)Common E2E commands:
| Stack | Command |
|---|---|
| Playwright | npx playwright test |
| Cypress | npx cypress run |
| pytest + Selenium | pytest tests/e2e/ -v |
If user requested or project has them:
| Type | When | Command Pattern |
|---|---|---|
| Performance | Pre-release, after optimization | k6 run tests/load/script.js |
| Security | Pre-release, after auth changes | npm audit / OWASP ZAP scan |
| Accessibility | UI changes | npx playwright test --grep @a11y or axe-core |
After all tests pass, run coverage analysis:
| Stack | Command |
|---|---|
| Vitest | npx vitest run --coverage |
| Jest | npx jest --coverage |
| pytest | pytest --cov=<package> --cov-report=term-missing |
| Go | go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out |
| Maven | mvn jacoco:report |
Compare against test-strategy skill targets:
| Metric | Target | Hard Minimum | Status | |---|---|---|---| | Line coverage | ≥ 80% | ≥ 60% | [pass/fail] | | Branch coverage | ≥ 75% | ≥ 50% | [pass/fail] | | New code coverage | ≥ 90% | ≥ 80% | [pass/fail] |
Flag modules with coverage below hard minimum.
Evaluate overall test quality:
| Gate | Criteria | Result | |---|---|---| | Unit tests | All pass | ✅ / ❌ | | Integration tests | All pass (if run) | ✅ / ❌ / ⏭️ skipped | | E2E tests | All pass (if run) | ✅ / ❌ / ⏭️ skipped | | Coverage | Meets targets | ✅ / ⚠️ below target / ❌ below minimum | | No flaky tests | Zero retried tests | ✅ / ⚠️ | | No new warnings | Lint + type checks clean | ✅ / ❌ |
Decision:
| Result | Action | |---|---| | All gates pass | ✅ PASS — safe to commit/PR | | Coverage warning only | ⚠️ PASS with notes — consider adding tests | | Any test failure | ❌ FAIL — fix before commit | | Flaky tests detected | ⚠️ PASS with action — file flaky test issue |
After testing completes:
docker compose -f docker-compose.test.yml down -v
Testcontainers handles its own cleanup automatically — verify no orphaned containers remain.
## Local Test Summary
### Environment
- **Stack**: [detected stack]
- **Docker**: [version] | Test infra: [Testcontainers / Docker Compose / none]
- **Env issues**: [none / list]
### Test Results
| Level | Total | Passed | Failed | Skipped | Duration |
|-------|-------|--------|--------|---------|----------|
| Unit | X | X | X | X | Xs |
| Integration | X | X | X | X | Xs |
| E2E | X | X | X | X | Xs |
### Coverage
| Metric | Value | Target | Status |
|--------|-------|--------|--------|
| Line | X% | 80% | ✅/❌ |
| Branch | X% | 75% | ✅/❌ |
| New code | X% | 90% | ✅/❌ |
### Coverage Gaps
- [file/module] — [current%] — [uncovered areas]
### Quality Gate: ✅ PASS / ❌ FAIL
- [gate details]
### Failures Fixed (if any)
- [test] — [issue] — [fix]
### Remaining Issues
- [issue] — [action needed]
### Follow-up
- [recommendations]
Agent(qa-engineer) (primary), stack-specific roles (test fixes), Agent(devops-engineer) (infra issues)test-strategy skill (test patterns, coverage targets)/run-tests (test execution and auto-fix for failures)/feature-dev (pre-commit testing), /bugfix (verify fix)/pre-commit (quality gate), /create-pr (submit changes)development
Use this skill when running the recurring (daily) knowledge-base rescan for a repo that already has knowledge/.knowledge-sync.yml — the main-thread dispatcher that reads the config, computes the git delta since last_scanned_sha, maps changed paths to affected doc areas, early-exits cheaply when nothing changed, then fans out one Agent(content-writer) per affected area, applies the propose/direct update policy, advances the baseline only on success, and writes an L4 run log — all with the G1 untrusted-content choke-point, secret-scan, deny-list, and budget controls woven in. For first-time setup use /knowledge-sync-init.
development
Use this skill when bootstrapping scheduled knowledge-base sync for a repo that has no knowledge/.knowledge-sync.yml yet — to run one-time setup that detects the knowledge_root from CLAUDE.md/AGENTS.md, maps doc areas to source globs, records opt-in external sources (Linear/Notion/WebFetch, all disabled by default), captures a baseline last_scanned_sha, sets the per-area update policy, generates or seeds knowledge/CONVENTIONS.md, provisions the L4 memory dir, and offers to register the daily routine. Routes ongoing recurring sync operations to /knowledge-sync.
tools
Use this skill when bootstrapping a target repository to be ai-skills-aware — on the first run of any ai-skills workflow in a fresh repo, when adopting the ai-skills plugin in an existing repo, or after upgrading to a plugin version that adds new memory paths or templates, including when the user does not say "init" but asks to "set up" or "onboard" the repo — to detect codebase type, create CLAUDE.md + AGENTS.md scaffolding, initialize the .ai-skills-memory/ directory tree from L1 templates, and configure .gitignore. Idempotent — safe to re-run. Accepts `--codebase-type <type>` and `--overwrite`. Not for re-initializing only memory — use `/memory-init` instead.
tools
Use this skill when extending, repairing, or improving plugin assets, when ingesting a `/feedback` report as a fix-cycle backlog, or when you do not remember which lower-level command is right for the job — the umbrella workflow for ai-skills plugin-asset authoring and maintenance: creating, auditing, fixing, improving, refactoring, and migrating skills, agents, rules, hooks, prompts, schemas, and rubrics inside the plugin. Auto-classifies the request, loads the right knowledge skills (`@prompt-engineering`, `@context-engineering`, `@team-protocols`), and spawns the right subagents (`prompt-engineer`, `system-architect`, `python-engineer`, `software-engineer`, `qa-engineer`, `eval-judge`) via the `Agent` tool.