test-case-writer

test-case-writer is a skill for Claude Code, Codex from flasherses/claude-code-dotfiles. It costs 187 tokens per session (8,092 once invoked), scanned A, original, MIT.

A guide for designing software test cases from requirements or code. It can produce structured testing documentation, a developer self-check list, and executable test scripts.

In plain words
What is it for?
Use it before building a new feature to plan tests, or after implementation to add missing coverage. TDD means writing these checks first and then coding until they pass.
Why use it?
It turns expected behavior into specific checks, including normal use, edge cases, errors, unit tests, and integration tests.

Skill for Claude CodeCodex

Part of the claude-code-dotfiles plugin — 3 skills, 4 commands, 5 agents, 1 plugin shipped together

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/flasherses/claude-code-dotfiles/test-case-writer
Any agent
npx skills add flasherses/claude-code-dotfiles --skill test-case-writer
Clone the repo
git clone --depth 1 https://github.com/flasherses/claude-code-dotfiles

Made for: Claude Code, Codex.

Or install claude-code-dotfiles, the plugin that ships this one along with the rest of its 3 skills, 4 commands, 5 agents, 1 plugin.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-case-writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/flasherses/claude-code-dotfiles/test-case-writer.svg)](https://agentmods.dev/skills/flasherses/claude-code-dotfiles/test-case-writer)
Your own site
<a href="https://agentmods.dev/skills/flasherses/claude-code-dotfiles/test-case-writer"><img src="https://agentmods.dev/badge/skills/flasherses/claude-code-dotfiles/test-case-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 187 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 8,092 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.00187 $0.08092
Opus 5 $0.00093 $0.04046
Sonnet 5 $0.00037 $0.01618
Haiku 4.5 $0.00019 $0.00809

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

Security

Grade A, and why

test-case-writer 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/test-case-writer/SKILL.md · 514 lines

How it starts

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

Test Case Writer

做什么:从需求文档或代码出发,产出结构化的测试用例文档、自测清单和可执行测试脚本,覆盖研发自测的 6 个维度(黑盒功能/边界/异常 + 白盒单元/覆盖率/集成)。

本 Skill 聚焦研发侧 R 的六类测试。 不设计兼容性、探索性、性能、安全、回归测试用例——这些由测试角色负责。

为什么:DORA 2025 数据显示 AI 生成代码的 Bug 率是人工的 1.7 倍——跳过测试不是"少几个用例",而是把质量风险直接推到生产环境。TDD 先行是唯一对冲策略:编码前出用例,以"让测试变绿"驱动编码。

要不要做:先判断。纯写代码不涉及测试设计(如"写个 utils 函数")、只需要跑已有测试或审查→不需要本 skill。代码已写好才来补用例→走反哺模式,不要假装是正常模式。

模式选择

场景 模式 触发词
新需求,还没写代码 正常模式 Step 0→1→1.5→2→3→4 "写测试用例"、"出用例"
已有功能,反向补充 反哺模式 Step A→B→C "补测"、"反哺"、"补充用例"
已有完整用例文档+脚本 不触发,直接补充 1-2 个用例

适用判断

执行前检查

用户要的是"测试用例文档"还是"测试用例文档 + 可执行测试脚本"?
    ├─ 测试用例文档 only → Step 0-3(跳过脚本生成)
    ├─ 测试用例文档 + 脚本 → Step 0-4(完整流程)
    └─ 只需要跑已有测试/审查已有测试 → 不需要本 skill

跳过本 skill 的情况

  • 已有完整测试用例文档和脚本,只需补充 1-2 个用例 → 直接补充
  • 纯写代码不涉及测试设计(如"写个 utils 函数")
  • 用户只需要跑测试或审查测试,不需要设计新用例

前置条件

本 skill 假设:被测功能已有明确的需求描述或设计文档。如果还没有,先和用户口头确认功能的输入/输出/行为边界,替代设计文档作为用例设计的输入。不要在没有需求输入的情况下凭空设计用例。

执行前确认:被测代码存在 + 构建文件含测试依赖 + 了解已有测试风格(如存在)。Step 0 已自动化此过程。

快速决策:用哪种测试

用户要测什么?
    ├─ "这个功能对不对?" / "does this work?"
    │       → 黑盒:功能测试 → references/blackbox-functional.md
    ├─ "边界在哪里?" / "where are the boundaries?" / "edge cases"
    │       → 黑盒:边界值测试 → references/blackbox-boundary.md
    │         (含空值/null/空串/0值——这些都是边界,不是功能变体)
    ├─ "异常怎么处理?" / "how are errors handled?" / "failure modes"
    │       → 黑盒:异常流程测试 → references/blackbox-exception.md
    ├─ "这个函数对吗?" / "is this function correct?" / "unit test"
    │       → 白盒:单元测试 → references/whitebox-unit.md
    ├─ "测够了没有?" / "is coverage enough?" / "what's uncovered?"
    │       → 白盒:代码覆盖率 → references/whitebox-coverage.md
    └─ "接口通不通?" / "does the API work?" / "integration test"
            → 白盒:接口集成测试 → references/whitebox-integration.md

空值 = 边界,不是功能uniqueNumber: "" / age: null / name: "" 是边界值测试,不要归入功能测试。功能测试关注的是有效输入的不同组合和场景变体。

测试类型 关注点 设计方法 适用阶段 为什么需要
黑盒-功能 输入→输出是否正确 等价类划分 + 场景枚举 需求确认后 验证需求实现——用户不会按你的代码路径操作
黑盒-边界 边界值处理是否正确 边界值分析(±0, ±1) 功能测试后 bug 集中在边界——max/max+1 之间差的是 crash
黑盒-异常 错误输入/异常路径 错误推测 + 异常路径遍历 功能测试后 用户给的输入永远是脏的——不测异常等于赌用户不乱点
白盒-单元 函数/方法逻辑正确性 语句/分支/路径覆盖 编码时 (TDD) 最快的反馈循环——秒级知道改坏了什么
白盒-覆盖率 测试充分性度量 行/分支/方法覆盖率 单元测试后 80% 行覆盖 != 测够了——可能全是没 assert 的执行
白盒-集成 接口契约+数据流正确性 接口规格 × 数据组合 模块完成后 单元测试全过接口照样炸——序列化、中间件、拦截器单元测不到

Read the full file on GitHub · 514 lines

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 · 514 lines · 187 tokens per session scan A 37ac7c2bdaa0

Subscribe to this mod's changes

test-case-writer is a skill published in the GitHub repository flasherses/claude-code-dotfiles (5 stars, last pushed 24d ago), licensed MIT. It adds 187 tokens to every session and 8,092 once invoked, about $0.0009 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-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens