AgentSkillsCN

TestArchitect

PAI 项目的测试优先开发策略。当用户需要测试策略、覆盖率分析、ATDD 工作流、基于风险的测试或质量门控时使用。确保测试在代码之前编写,而不是在出现 bug 后才写。

SKILL.md
--- frontmatter
name: TestArchitect
description: Test-first development strategy for PAI projects. USE WHEN user needs test strategy, coverage analysis, ATDD workflows, risk-based testing, or quality gates. Ensures tests are written before code, not after bugs appear.

TestArchitect

Test strategy before code: prevent defects through acceptance test-driven development (ATDD).

Workflow Routing

WorkflowWhen to UseOutput
CreateTestStrategyPlanning new feature or sprintComprehensive test strategy with test types and coverage targets
DefineCoverageAnalyzing existing code or setting quality gatesCoverage analysis report with gaps and improvement plan
AcceptanceTestDrivenDevelopmentStarting development on user storyAcceptance tests in Given-When-Then format, test automation code
RiskBasedTestingPrioritizing test efforts for sprint/releaseRisk matrix with coverage targets by risk level, test effort allocation
CiCdQualityGatesSetting up or improving CI/CD pipelineQuality gate definitions, CI/CD configuration (GitHub Actions/GitLab CI)

Examples

Example 1: Create test strategy for feature

code
User: "Create test strategy for user authentication"
Skill loads: TestArchitect → CreateTestStrategy workflow
Output: Test types (unit/integration/E2E), coverage targets (90% for auth), test scenarios

Example 2: Analyze test coverage gaps

code
User: "Analyze test coverage for the payment module"
Skill loads: TestArchitect → DefineCoverage workflow
Output: Coverage report (65% → 85% target), gap analysis, improvement plan

Example 3: Define tests for user story

code
User: "What tests do we need for password reset feature?"
Skill loads: TestArchitect → CreateTestStrategy workflow (focused on password reset)
Output: Test scenarios (happy path, expired token, invalid email, etc.)

Example 4: Write acceptance tests for user story

code
User: "Write acceptance tests for US-42 (password reset)"
Skill loads: TestArchitect → AcceptanceTestDrivenDevelopment workflow
Output: Given-When-Then scenarios, Playwright/Cypress test automation code, test data fixtures

Example 5: Assess risk and prioritize testing

code
User: "What should we focus testing on this sprint?"
Skill loads: TestArchitect → RiskBasedTesting workflow
Output: Risk matrix (auth=Critical 90%, cart=Medium 70%), test effort allocation (40 hours)

Example 6: Set up CI/CD quality gates

code
User: "Configure quality gates for GitHub Actions"
Skill loads: TestArchitect → CiCdQualityGates workflow
Output: GitHub Actions YAML config, coverage thresholds, security gates, bundle size limits

Integration

  • Works with AgilePm skill (adds test requirements to user stories)
  • Works with Security skill (security test scenarios from threat model)
  • Follows test pyramid (70% unit, 20% integration, 10% E2E)
  • Generates test-strategy.md and coverage reports

Methodology

This skill follows test-first principles:

  • ATDD (Acceptance Test-Driven Development)
  • Test Pyramid (Martin Fowler)
  • Risk-based testing (ISO 29119)
  • Coverage targets by risk (Critical: 90%, High: 80%, Medium: 70%, Low: 50%)

Based on industry standards: ATDD, Test Pyramid, Risk-Based Testing, TDD.