workflow-test-generation

A workflow for creating unit, integration, and performance tests from a specification or existing code. TDD, or test-driven development, is a style of working where tests help define the expected behavior before implementation.

In plain words
What is it for?
Use it to generate tests for a new feature, add tests to existing functions or classes, or design a testing strategy without writing code yet.
Why use it?
It turns unclear testing needs into a concrete plan covering normal cases, boundaries, errors, and external dependencies.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/davidyichengwei/agentic-engineering-framework/workflow-test-generation
Any agent
npx skills add davidYichengWei/agentic-engineering-framework --skill workflow-test-generation
Clone the repo
git clone --depth 1 https://github.com/davidYichengWei/agentic-engineering-framework

Made for: Claude Code, Codex.

Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,232 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00048 $0.01232
Opus 5 $0.00024 $0.00616
Sonnet 5 $0.00010 $0.00246
Haiku 4.5 $0.00005 $0.00123

Measured 3d ago against content hash 8e824a6e2a1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

workflow-test-generation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/workflow-test-generation/SKILL.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

测试生成

Step 0: 意图识别与路径路由

根据调用上下文判断走哪条路径:

信号 路径 执行步骤
workflow-code-generation 完成后衔接进入,或用户明确提到需求管理链接 完整流程 Step 1 → 2 → 3 → 4 → 5
用户直接说"给 X 写个测试"/"补个单测",指定了具体代码 快速补测试 Step 2 → 3 → 4
workflow-system-design 讨论测试计划章节时加载 测试策略设计 Step 1 → 2 → 3,只输出计划,不生成代码

如果无法判断,默认走完整流程


Step 1: 收集测试上下文

完整流程测试策略设计执行本步骤。快速补测试跳过(用户已指定了被测代码)。

尝试读取 docs/design-docs/<module>/<feature>/spec.md

有 spec.md

  1. 读取 "7. 测试计划"
  2. 测试计划明确 → 进入 Step 2
  3. 测试计划不完整 → 补充读取 "2. 目标"、"3. 需求"、"4. 设计方案",自行判断

无 spec.md(为已有代码补测试):

  • 询问用户要测哪些函数/类,基于代码生成

Step 2: 确定测试类型

根据代码特征自动判断需要哪些测试类型(可组合,非互斥),无法判断时才询问:

特征 测试类型
纯函数、无外部依赖 单元测试
端到端流程、多组件交互 集成测试
spec.md 有性能指标要求 性能测试

一个 feature 通常需要多种测试类型组合,例如:核心逻辑用单元测试 + 端到端用集成测试。

Step 3: 制定测试计划

分析被测代码,制定测试计划(不生成代码):

  1. 读取被测代码,识别公共接口、输入/输出、副作用、需要 mock 的依赖
  2. 读取 reference/boundary-checklist.md,选择适用的边界条件
  3. 根据项目需要,读取对应模块的测试参考文档(如有)
  4. 为每个测试目标列出:正常路径、边界条件、异常场景的具体测试点

创建测试任务清单,与用户确认后再继续:

示例:
1. [pending] UnitTest - FooClass::Bar() 正常路径 + 边界条件
2. [pending] UnitTest - FooClass::Bar() 异常处理
3. [pending] IntegrationTest - 端到端流程

测试策略设计路径到此结束。将测试计划输出为 spec.md 测试计划章节的内容,不进入 Step 4。

Step 4: 逐个生成测试

完整流程快速补测试执行本步骤。

4.1 加载编码规范(🚨 强制前置)

规范 何时加载
bp-coding-best-practices 始终
std-cpp .cc/.cpp/.h 文件
std-go .go 文件

根据项目需要,额外加载其他编码规范 skill。

4.2 逐个生成

对每个测试任务生成测试代码。每个测试必须覆盖三类场景:

  1. 正常路径 — happy path
  2. 边界条件 — 基于 Step 3 选出的 boundary-checklist 条目
  3. 异常场景 — 错误输入、异常处理

生成后更新构建配置,复用项目现有的测试基类和断言工具(不要自己造)。

每完成一个任务,标记 [completed],继续下一个。

Step 5: 收尾流程

完整流程执行本步骤。

前置条件:所有测试用例已通过。

提示用户进入 workflow-code-review 进行 AI 代码评审(同时评审功能代码和测试代码):

自测已全部通过。

推荐下一步:
- 说"CR"或"代码评审"进入 AI 代码评审阶段

强制规则

  1. 测试计划必须经用户确认后才能生成代码
  2. 必须覆盖三类场景:正常路径 + 边界条件 + 异常场景
  3. 必须应用 boundary-checklist:Step 3 中读取并选择适用条目
  4. 必须可编译运行:包含所有必要头文件/导入,更新构建配置
  5. 复用现有基础设施:使用项目的测试基类和断言工具,不要自己造
  6. 测试全部通过才能推进:编译失败或用例未通过时,先修复,确认全部 PASS 后才可进入 CR

Read the full file on GitHub · 117 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 117 lines · 48 tokens per session scan A 8e824a6e2a1e

Subscribe to this mod's changes

workflow-test-generation is a skill published in the GitHub repository davidYichengWei/agentic-engineering-framework (159 stars, last pushed 5mo ago), licensed MIT. It adds 48 tokens to every session and 1,232 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pest-testing

Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to…

coollabsio/coolify · 171 tokens

write-vibe-tests

Write or refactor Mistral Vibe tests with proper decoupling. Use when adding behavior coverage, testing ports/adapters, replacing brittle mocks, creating fakes, adding characterization tests before refactors, or changing tests under tests/ for vibe/core, vibe/cli, vibe/acp, tools, config, sessions, skills, hooks, MCP…

mistralai/mistral-vibe · 80 tokens

composing-matchers

Build compound Gomega assertions by combining matchers — And/SatisfyAll (all pass), Or/SatisfyAny (any pass), Not (negate), WithTransform to map the actual before matching, Satisfy for an ad-hoc predicate, HaveValue to dereference pointers/interfaces, HaveField for struct fields and method results, HaveEach for every…

onsi/gomega · 136 tokens

adding-dbt-unit-test

Creates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-driven development (TDD) in dbt.

dbt-labs/dbt-agent-skills · 44 tokens

testing-guide

Design, write, run, and diagnose Synergy tests with Bun, temporary Scope isolation, deterministic fixtures, and behavior-first assertions. Use for TDD, bug regressions, feature tests, migration tests, flaky tests, coverage, package tests, frontend tests, and selecting verification gates.

SII-Holos/synergy · 60 tokens

test

Generate tests and coverage plans. Triggers: "test", "generate tests and coverage plans.", "test skill".

boshu2/agentops · 25 tokens