AGENT SKILL

input-contract-tests

Use when adding or changing a public API, CLI command, or module export — cover applicable input classes (empty, invalid/negative, overflow, concurrent, exception). Triggers on "入参契约", "input contract", "public API tests". Not for hook/detector trigger-semantics (use boundary-testing). Not a default landing gate.

License 许可
MIT
最近更新
2026-10-28
Stars
★ 2
Forks
0

01 前言 Front Matter

name
input-contract-tests
type
technique
bucket
engineering
description
Use when adding or changing a public API, CLI command, or module export — cover applicable input classes (empty, invalid/negative, overflow, concurrent, exception). Triggers on "入参契约", "input contract", "public API tests". Not for hook/detector trigger-semantics (use boundary-testing). Not a default landing gate.

02 资源文件 2

03 SKILL.md 正文

Input Contract Tests

Write-time checklist for public entries: callers outside the module can send dirty input. Nail the promise (reject / tolerate / typed error) with tests. This is not a default review slot and does not dispatch an auditor agent.

When to use

  • New or changed public API / CLI / RPC / exported function that accepts external input
  • A PR clearly missing an input class on a public entry
  • Operator asks for 入参契约 / input-contract coverage

Skip: internal helpers with no external callers; prototypes; generated code; formatting. Hook/detector trigger drift → boundary-testing (sequential axis1 → axis2).

The five input classes

Apply only classes that fit the entry:

Class Meaning
empty missing / null / blank where a value is required
invalid / negative wrong type, illegal enum, negative where forbidden
overflow too long / too large / out of range
concurrent two callers mutate shared state at once (if relevant)
exception dependency failure surfaces as a typed error, not a swallow

Procedure

  1. Name the public entry. Completion: function/command path stated.
  2. List applicable classes. Drop classes that cannot apply; note why. Completion: list written.
  3. For each listed class — RED then GREEN under test-driven-development. Completion: each class has a test that failed before the handling code (or already existed and still passes).
  4. Stop. Do not open a separate audit agent. Optional human re-check: invoke this skill by name on the diff.

Acceptance Criteria

  • [ ] Public entry named
  • [ ] Applicable input classes listed (inapplicable marked N/A)
  • [ ] Each applicable class has a focused test
  • [ ] No default dispatch of a contract-validator agent

Verification

Skill type: technique
Bar level:  minimum

See Also

  • test-driven-development — RED/GREEN discipline for every test you add
  • boundary-testing — detector/hook trigger-semantics smoke (not input classes)

04 同仓库更多 Skills

winter6205
winter6205/arthurpower

writing-plans

Use when turning a buildable spec into ordered tracer bullets after architecture-change-reviewer. Covers vertical slicing, dependency order, and headroom for the implementer. Triggers on 写计划, 拆任务, 任务分解, 制定方案, 跨文件改动, 计划.

★ 2
winter6205
winter6205/arthurpower

wayfinder

Use when a chunk of work is more than one agent session can hold — plan it as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.

★ 2
winter6205
winter6205/arthurpower

verification-before-completion

This skill should be used when claiming "完成" / "done" / "fixed" / "passing" / "ready to ship", before trusting a subagent success report, or when checking "对照计划" / "对照 spec" — whether this run's delivery matches its basis.

★ 2
winter6205
winter6205/arthurpower

using-agent-skills

Use when starting a new session, switching tasks, or unsure which arthurpower skill applies. Routes incoming work to the matching skill via flowchart before invoking. Activates on phrases like "which skill should I use", "skill check", "pre-task skill check", "how to start", "router", "skill routing", or when multiple competing skills could apply. Does not auto-invoke user-invoked authoring skills (skill-authoring, self-evolving-rules).

★ 2
winter6205
winter6205/arthurpower

test-driven-development

Use when implementing logic, fixing a bug, or changing behavior — write the failing test first (RED), then minimal code (GREEN), then refactor. Triggers on "write the failing test first", "Prove-It", or a bug that needs a reproduction test before the fix.

★ 2
winter6205
winter6205/arthurpower

systematic-debugging

Use when debugging a test failure, build break, unexpected runtime error, flaky test, or hanging process. Triggers on phrases like "fix this bug", "getting an error", "failing test", "flaky", "hanging", "halfway through debugging", "this used to work", "intermittent failure", "stack trace shows X", or any case where behavior does not match expectations. Prevents shotgun debugging.

★ 2