Agent Skills › instructa/agent-skills › lean-testing

lean-testing

GitHub

指导智能体在编码时选择最小充分测试,避免不必要的测试生成。强调基于风险、复用现有覆盖、证明持久测试价值,反对盲目增加测试文件。

skills/engineering/lean-testing/SKILL.md instructa/agent-skills

Trigger Scenarios

实现新功能 修复 Bug 决定是否需要添加测试

Install

npx skills add instructa/agent-skills --skill lean-testing -g -y
More Options

Non-standard path

npx skills add https://github.com/instructa/agent-skills/tree/main/skills/engineering/lean-testing -g -y

Use without installing

npx skills use instructa/agent-skills@lean-testing

指定 Agent (Claude Code)

npx skills add instructa/agent-skills --skill lean-testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add instructa/agent-skills --all -g -y

预览 repo 内 skill

npx skills add instructa/agent-skills --list

SKILL.md

Frontmatter
{
    "name": "lean-testing",
    "description": "Prevent unnecessary test generation in agentic coding. Use when implementing features, fixing bugs or deciding whether to add tests; select the smallest sufficient check and justify lasting test code."
}

Lean Testing

Choose the smallest sufficient check for the concrete risk. Zero new tests is valid, often preferable. Cheap generation does not remove execution, diagnosis, review or maintenance costs. Test production is not proof of progress.

Own test selection and permanent-test admission; leave roles, delegation, review timing, reruns and acceptance to the existing workflow. Works with single agents or orchestrators. Preserve explicit user requirements and required project checks. Add no reviewer, approval stage or runner.

Select evidence before generating tests

Identify changed behavior and a meaningful failure. Reuse existing coverage unchanged when sufficient; new assertions or files are not mandatory deliverables.

For behavioral uncertainty, prefer checking the runnable product's real entry point and relevant backend. Inspect outcomes, including relevant persistence. Use authorized environments and data; live means running, not necessarily production. Commands, browser interactions and diagnostic probes may remain temporary. Keep useful observations in the existing task record.

Assess protected behavior, not filenames or a fixed unit/integration/E2E pyramid. node:test driving real CLI processes can be a system check; browser tests mocking meaningful boundaries may offer little integration evidence. Focused unit tests may check rounding or controlled faults most cheaply; real journeys may expose wiring failures mocks miss. Neither live success nor stronger models guarantee untested behavior. Missing live access remains an evidence gap; do not manufacture a large replacement mock suite.

Justify permanent tests

Before adding one, identify a meaningful failure existing checks inadequately expose and why repeated automated detection warrants execution and maintenance costs. One sentence in the existing brief or change description suffices. No admission form, score or extra review.

Recurring regressions, important invariants and hard-to-reach faults can justify small durable tests. Preserve targeted money, authorization, concurrency and protocol protection; one live pass does not replace it. Critical faults need not have occurred to warrant protection. Reproduced bugs warrant useful future detection, not automatic files per bug. Promote temporary probes only for clear unique recurring value.

Derive expectations from requirements or contracts. Do not mirror implementation, copy its expected-value tables or expand small fixes into speculative test families. Prefer existing cases and fixtures. When mocks, helpers and helper tests grow around a small change, first reconsider whether an existing command or direct check answers the question.

Assert externally required properties. Private call order, incidental wording, broad snapshots and fixed catalog counts can reject legitimate changes while missing defects. Preserve exact contract values, including serialization, security allowlists and financial outputs.

Situation Decision
One-time save/reload uncertainty Exercise real save/reload; inspect stored outcomes; retain observation, not automatically probe
Rare race, retry or partial-write fault impractical live Controlled focused invariant test
Product contract intentionally changed Update affected expectation from contract; preserve unrelated assertions

For failed checks, establish whether expectations match the agreed contract and whether the fault belongs to product, test or environment. Unexplained reds remain unresolved. Never alter correct product behavior for invented expectations or weaken safeguards or contract values merely to pass.

Small changes may need only existing checks and a temporary live probe; small high-risk changes may need several focused cases. Size alone decides neither. No mandatory mutation campaign. Coverage, test counts and test-to-product line ratios are signals, never generation targets or deletion quotas. Reassess machinery as tools and models change using observed task results, not assumed model accuracy. Useful existing tests need no ceremonial re-proving. Broad suite deletion or consolidation requires separate authorization.

Version History

  • 624519d Current 2026-10-19 21:50

Same Skill Collection

skills/3d-gaming/unity-docs/SKILL.md
skills/claude/codex-reviewer/SKILL.md
skills/codex/claude-designer/SKILL.md
skills/delegation/delegate-fable/SKILL.md
skills/delegation/delegate-grok/SKILL.md
skills/delegation/delegate-sol/SKILL.md
skills/design/redesign-my-landingpage/SKILL.md
skills/electron/electron-live-test/SKILL.md
skills/engineering/architecture-ownership/SKILL.md
skills/engineering/clarify/SKILL.md
skills/engineering/code-quality/SKILL.md
skills/engineering/consolidate-test-suites/SKILL.md
skills/engineering/find-duplicate-ownership/SKILL.md
skills/engineering/hard-cut/SKILL.md
skills/engineering/lean-ci/SKILL.md
skills/engineering/root-cause-finder/SKILL.md
skills/engineering/search-context/SKILL.md
skills/git/gitwhat/SKILL.md
skills/go/go-local-health/SKILL.md
skills/herdr/delegate-fable/SKILL.md
skills/herdr/delegate-grok/SKILL.md
skills/herdr/delegate-sol/SKILL.md
skills/orchestration/sitrep/SKILL.md
skills/release/homebrew-publish/SKILL.md
skills/security/package-security-check/SKILL.md
skills/security/secleak-check/SKILL.md
skills/shell/shellck/SKILL.md
skills/specs/app-spec-packager/SKILL.md

Metadata

Files
0
Version
624519d
Hash
2264d90a
Indexed
2026-10-19 21:50

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-27 12:32
浙ICP备14020137号-1