/loom-engineering:loom-test-after-implementation <behavior or test seam>from loom-engineering
Implements features first, then writes behavior-verification tests against the real public API. Enforces a code-first/test-after cycle with mandatory refactoring before testing.
Ships in loom-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
独立失败信号与实现顺序
默认实现 → 重构 → 持久化 public boundary 行为测试 → 验证。bug 和关键不变量还须有独立于待改实现的预期:来自已批准意图、原始复现或既有不变量;保留真实 baseline 观察、修复后同口径观察和回归证据。缺依赖、导入错误、超时与行为失败分开记录。失败信号可以是 CLI、HTTP、轨迹重放或 probe,不以测试代码的写作先后证明质量;本段是执行指导,不是假装已有受保护的机器门禁。
实现(Implement)→ 重构(Refactor)→ 测试(Test)→ 验证(Verify)
本 skill 采用“实现 → 重构 → 行为测试 → 验证”流程,不要求测试代码先于生产代码。
先根据真实业务需求完成最小实现,并在测试前整理设计。随后针对稳定的 public API 编写行为级测试,验证用户可观察的结果、边界、异常和副作用。
测试不得成为引入生产抽象的理由。除外部网络或计费 API、不可回滚副作用、不可控非确定性外,优先使用真实依赖,不为测试增加构造参数、接口或测试专用方法。
默认用于新功能、bug 修复、重构和行为变更。一次性原型、生成代码或纯配置变更可以先询问用户是否例外。
当前 task 的需求产物必须从 specs/<date+feature>/ 读取;不要在项目根目录读取或生成 spec.md、plan.md、tasks/ 等 loom 阶段产物。
读取 specs/<date+feature>/spec.md、specs/<date+feature>/plan.md 和当前 specs/<date+feature>/tasks/TN.md,明确当前 task 的实现范围和测试范围。
从已批准的 spec、plan 和 task 中确认实现范围、用户可观察行为以及适用的异常和边界条件。
此步骤只确认业务边界,不设计测试隔离点、不预设依赖替换方式,也不要求先写测试。public boundary 只作为业务入口记录,具体测试 seam 在实现和重构完成后确认。
behavior_ids,不超出 spec 范围。在写测试前重构。这是强制步骤。
在实现和重构完成后,列出候选 seam,并说明每个 seam 对应的 public boundary,例如 CLI 命令、HTTP API、组件交互、公开函数、持久化副作用或事件输出。
必须向用户或当前已批准 spec/plan 对齐以下内容:
未确认 seam 时,不得写测试。若用户不在场且 spec/plan 已明确 public boundary,可基于已批准产物确认 seam,并在输出中记录依据。
mkdtempSync 真实临时目录 + afterEach 清理,单元测试仅作为行为级触达不到的纯逻辑分支的补充。按实际能力核验失败、恢复与资源证据
从本次需求和交付声明选择适用场景,不要求所有任务模拟所有故障。在既有测试/验证报告中记录适用能力、触发方式、预期、实测结果和证据路径:
dispose/close/finally 判定;有限次数观察不等于长期无泄漏。区分原生失败、测试包装触发的真实失败和模拟,不混称真实故障;未诱发目标失败属于准备不足,不算该失败路径通过。证据缺失或场景不适用须说明依据,不用正常流程通过、覆盖率或体验确认替代失败/恢复证据。本规则是执行指导,不新增机器门禁,也不证明模型稳定性。
specs/<date+feature>/traceability.json:每个 behavior_ids 至少对应一个持久化行为验证测试,写入 behavior 级 tests 与 evidence 引用。对下一个行为点重复实现→重构→测试→验证。
示例、理由和反模式见:
references/examples-and-rationale.mdreferences/testing-anti-patterns.mdreferences/common-pitfalls.md出现红旗时,先补齐重构或测试,再继续。
traceability.json 的 behavior 级 tests 与 evidence 已更新。实现先行 -> 重构 -> 测试验证真实 public API
否则 -> 没有验证的实现
What SKILL.md sets; muted values are Claude Code's defaults
Implement behavior through a code-first/test-after loop with mandatory refactor before testing.
Three short reads, in order
Other plugins' skills for the same job
Claude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest/PreSkillShellCommand at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.json declares PreToolUse/PermissionRequest/PreSkillShellCommand at its top level, outside the "hooks" object — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
22 skills in this plugin
/loom-analyze-artifactsRead-only cross-artifact consistency analysis after planning and before approval. Verifies that spec.md, requirements.json, plan.md, tasks/Tn.md, traceability.json are mutually consistent: no duplicate/ambiguous requirements, every behavior mapped to a task, no orphan tasks, no coverage gaps, no contradictions. Outputs artifact-analysis.json with coverage% and severity. CRITICAL/HIGH findings block the approval gate. Use when: planning produced plan.md + tasks + traceability.json, before the user approves the plan.
/loom-brainstormingExplore 2-3 implementation options with trade-offs when the user describes a new feature or requirement. Use when: the user asks for a new feature design, implementation options, or technical trade-off analysis.
/loom-convergeCheck local behavior references, then independently review code and test semantics against approved requirements. Use when: executing produced test-report.md and implementation drift must be checked before final verification.
/loom-detail-expansionExpand each requirement into verifiable Behavior Obligations across 15 fixed dimensions (happy-path, boundary, invalid-input, authorization, state-transition, idempotency, concurrency, atomicity, external-failure, compatibility, security, performance, observability, recovery, forbidden-behavior) before planning. Use when: brainstorming produced requirements.json and spec is approved, but behaviors are still placeholders or only happy-path; before loom-writing-plans.
/loom-dispatching-parallel-agentsDispatch multiple independent tasks to parallel subagents when no shared file conflicts exist. Use when: a confirmed plan has independent tasks that can run concurrently without touching shared files.
/loom-finishing-a-development-branchClean up a feature branch after verification: merge, create PR, keep, or discard. Follows conventional commits. Use when: a development branch has passed verification and needs merge, PR, keep, or discard handling.