AgentSkillsCN

test-cartographer

通过调研当前代码库与现有测试,识别测试空白,并提出优先级更高的测试补充方案,从而构建全面的测试计划(包括单元测试、集成测试、回归测试以及其他已发现的测试类型)。当用户要求添加/编写/改进测试、寻找缺失的测试覆盖率、创建回归测试计划,或为某个仓库或特定领域验证测试策略时触发此功能。可选配范围参数(路径/模块/服务);若未指定范围,则默认为全仓库范围。

SKILL.md
--- frontmatter
name: test-cartographer
description: Build a comprehensive test plan (unit, integration, regression, and other discovered test types) by surveying the current codebase and existing tests, identifying gaps, and proposing prioritized test additions. Trigger when users ask to add/write/improve tests, find missing test coverage, create regression plans, or validate test strategy for a repo or specific area. Use optional scope parameter (path/module/service); default to full-repo when no scope is provided.

Test Cartographer

Create a test strategy grounded in the current repository state.

Inputs

  • Optional scope: path/module/service to analyze.
  • Optional mode: quick or deep.

Defaults:

  • If scope is not provided, analyze the entire repository.
  • If mode is not provided, use deep.

Workflow

1) Resolve scope and repository context

  • Detect repository root, branch, HEAD, and git status --short.
  • If scope is provided, validate that it exists; if not, ask for correction.
  • If no scope is provided, set scope to full repository.

2) Discover current test ecosystem

Survey code, docs, and CI to detect:

  • languages/frameworks and manifests
  • current test frameworks and test commands
  • existing test directories, naming conventions, and fixtures
  • CI test jobs and gating behavior

Use only discovered tools/commands unless assumptions are explicitly marked.

3) Inventory existing tests by type

Categorize existing coverage into:

  • unit
  • integration
  • regression
  • contract (if present)
  • end-to-end (if present)
  • performance/security/smoke (if present)

Map tests to target modules/paths and note strong vs weak coverage.

4) Gap analysis

For in-scope code, identify missing coverage across:

  • happy path
  • edge cases
  • failure and error handling paths
  • boundary and data validation cases
  • regression protections for historically fragile paths

Flag test quality concerns:

  • flaky patterns
  • skipped/disabled tests
  • low-assertion tests
  • unclear fixtures/mocks

5) Prioritize plan

Prioritize proposed tests using risk and impact:

  • business/user impact
  • change likelihood
  • defect detectability

Label each proposal High, Medium, or Low priority.

6) Produce plan artifact

Select artifact base directory in this order:

  • .codex/
  • .claude/
  • .agent-cache/

Write:

  • <base>/test-plan.md
  • <base>/test-plan.json

Required markdown output sections (test-plan.md)

Use this order:

  1. Scope and Context
  2. Existing Test Inventory
  3. Coverage and Gap Analysis
  4. Prioritized Test Plan
  5. Regression Pack
  6. Execution Commands
  7. Risks, Assumptions, Unknowns

Output contract (chat)

Return:

  • Action: generated or updated plan
  • Scope: full-repo or requested area
  • Result: key gaps and highest-priority tests
  • Confidence: High/Medium/Low
  • Next step: recommended immediate implementation sequence

Guardrails

  • Do not propose frameworks not present in repository unless clearly marked as optional recommendations.
  • Do not mutate source code while planning.
  • If scope is narrow, still include cross-module dependencies that materially affect test strategy.
  • Mark unknowns explicitly instead of guessing.