skills.guanliai
How-tosAll SkillsCombos
中EN
How-tosAll SkillsCombos

skills.guanliai.com

An AI how-to library organised by scene: which skills to use, how to install, how to prompt, and what traps to avoid.

How-tosAll SkillsCombos

Supported clients

  • Claude Code
  • Cline / Roo Code
  • CodeBuddy
  • CodeGeeX (Zhipu)
  • Comate (Baidu)
  • Cursor
  • Fitten Code
  • Gemini CLI
  • GitHub Copilot
  • Kiro
  • Lingma (Alibaba)
  • MarsCode
  • OpenAI Codex
  • OpenClaw
  • OpenCode
  • Qoder
  • Tencent CloudBase AI
  • Trae
  • VS Code
  • Windsurf
skills.guanliai.com · Agent Skill DirectoryData from GitHub · Next.js + MySQL
HomeGuidesTesting & QualityWrite test cases and automation scripts with AI

Write test cases and automation scripts with AI

Updated 2026-10-12 20 分钟(含跑通) Difficulty ★★☆☆☆Author Skills 编辑部

Skills used in this guide (3)

  • tdd-workflowtdd-workflowPrimary

    写新功能、修 bug 或重构时使用:强制测试驱动开发,单元、集成与端到端测试合计覆盖率 80% 以上。

    npx skills add affaan-m/ECC -g
  • e2e-testinge2e-testingSupporting

    Playwright 端到端测试模式:Page Object Model、配置、CI/CD 接入、产物管理与 flaky 测试治理。

    npx skills add affaan-m/ECC -g
  • tddtddSupporting

    测试驱动开发。当用户想测试优先地构建功能或修 bug、提到红-绿-重构,或想要集成测试时使用。

    npx skills add mattpocock/skills -g

The biggest value of testing isn't "high coverage" — it's "catching the paths that actually break". The point of AI-generated tests: give it the implemented code or a clear behavior contract, then have it add edge cases. Don't let it invent the thing under test; a test that passes on a fake object proves nothing.

Who this is for / not for

For:

  • Need unit tests / edge cases for existing functions / interfaces
  • Want TDD but don't know which test to write first
  • Want end-to-end (E2E) tests for key user paths

Not for:

  • Code whose logic isn't decided yet (define behavior first)
  • Asking AI to decide "what's correct" (you define correctness)
  • Treating coverage as a KPI (green ≠ correct)

Before you start

  1. Code under test: the function / module / interface definition.
  2. Behavior contract: input/output boundaries, error branches, expectations.
  3. Framework: unit (Vitest/Jest/pytest), E2E (Playwright).

Steps

1. Install the skill

tdd-workflow is a test-driven workflow skill. Copy its folder into your client's skills directory (same as any Agent Skill):

ClientDirectory
Claude Code~/.claude/skills/
Codex~/.codex/skills/
Cursor~/.cursor/skills/
Trae~/.trae/skills/
CodeBuddy~/.codebuddy/skills/
Tongyi Lingma~/.lingma/skills/

2. Give behavior, then let AI write tests

text
From this function, write Vitest tests:
- cover: normal input, empty, out-of-range, wrong type (one each)
- one assertion per test, name states the expectation
- don't change the implementation, only add the test file
List the 3 riskiest edges first, then write.

3. TDD: red before green

text
Using tdd-workflow: first write a failing test (red) for "cart checkout",
describing the expected behavior; after I implement, make it pass (green),
then propose one safe refactor.

4. Add E2E for key paths

Use e2e-testing for Playwright on the 2-3 highest-cost paths, not clicking everything:

text
Write one Playwright E2E: login through successful checkout.
Assert only key states (success toast, order id generated), not every element.

Pitfalls

PitSymptomFix
Fake objectAI invents nonexistent fnGive real code, don't let it invent
Only happy pathEdges missedForce empty/range/error coverage
Too many assertsDon't know what failedOne behavior per test
Green = correctAsserted wrong wayYou define "correct"
E2E too wideBrittle, slowOnly key paths

FAQ

No framework yet?

Yes — have AI use your project's; if none, pick one first.

Trust AI tests as-is?

Run once to confirm they actually failed (red), then go green; avoid "fake green".

Must test first in TDD?

Recommended. Red-green lets behavior be defined before implementation.

How much E2E?

Only the highest-cost paths; clicking all is brittle and slow.

Low coverage?

Add edges and error branches first; more useful than normal-path padding.

Related guides

Continue across these scenes:

  • Write, review and refactor code with AI
  • Get an AI code review worth reading

相关源码

  • affaan-m/ECC · tdd-workflow source
  • affaan-m/ECC · e2e-testing source
  • mattpocock/skills · tdd source
  • Agent Skill open format spec

一句话结论

结论:测试的价值在"抓住真会出事的路径"——给 AI 真实代码或行为约定,让它补边界用例,别让它凭空造被测对象。

References

  • affaan-m/ECC · tdd-workflow 源码
  • affaan-m/ECC · e2e-testing 源码
  • mattpocock/skills · tdd 源码
  • Agent Skill 开放格式规范

Related Scenes

Testing & Quality

Guard code quality with AI (translated)

AI writes fast, but the quality gate matters more. Community consensus in three: reverse TDD (AI writes tests, then minimal impl), zero-warning gate (`--max-warnings=0`, warnings silently become the new baseline), review as a gate (every change through the same gate). Make AI output verifiable and g

★★★☆☆ 25 分钟(含落地)3 skills
Testing & Quality

Get an AI code review worth reading

The classic failure mode is twenty "suggestions" where eighteen are style preferences. A useful review contains only two kinds of information: what will break, and what will confuse the next reader. So the job is not to make AI say more. It is to forbid everything else.

★★★☆☆ 一次 PR 约 15 分钟3 skills

Contents

  • Who this is for / not for
  • Before you start
  • Steps
  • 1. Install the skill
  • 2. Give behavior, then let AI write tests
  • 3. TDD: red before green
  • 4. Add E2E for key paths
  • Pitfalls
  • FAQ
  • No framework yet?
  • Trust AI tests as-is?
  • Must test first in TDD?
  • How much E2E?
  • Low coverage?
  • Related guides
  • 相关源码
  • 一句话结论