用测试驱动方式编写流程文档,先验证再成稿,提升技能说明的可靠性。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "Creating Skills" 技能: 1. 下载 https://raw.githubusercontent.com/obra/clank/main/skills/meta/creating-skills/SKILL.md 2. 保存为 ~/.claude/skills/creating-skills/SKILL.md 3. 装好后重载技能,告诉我可以用了
请用测试驱动的方法帮我写一份新员工入职流程文档:先列出关键步骤与可能失败点,再设计由子代理执行的检查用例,迭代修正文档直到步骤清晰、无歧义、可执行。
一份经过测试用例验证并多轮修订的入职流程文档,包含步骤、风险点和改进说明。
我有一份技能说明草稿,请先模拟不同子代理按文档执行任务,找出理解偏差、遗漏条件和失败场景,再重写成更严谨的最终版本。
一份基于执行测试结果优化后的技能说明,结构更清晰、边界条件更完整。
请把这份团队SOP当作待测试文档处理:先生成验收标准,再用多个角色视角逐步执行并记录卡点,最后输出修订后的标准操作流程。
一份附带验收标准、测试发现和修订结果的可执行SOP。
Creating skills IS Test-Driven Development applied to process documentation.
You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes).
Core principle: If you didn't watch an agent fail without the skill, you don't know if the skill teaches the right thing.
See skills/testing/test-driven-development for the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.
A skill is a reference guide for proven techniques, patterns, or tools. Skills help future Claude instances find and apply effective approaches.
Skills are: Reusable techniques, patterns, tools, reference guides
Skills are NOT: Narratives about how you solved a problem once
| TDD Concept | Skill Creation |
|---|---|
| Test case | Pressure scenario with subagent |
| Production code | Skill document (SKILL.md) |
| Test fails (RED) | Agent violates rule without skill (baseline) |
| Test passes (GREEN) | Agent complies with skill present |
| Refactor | Close loopholes while maintaining compliance |
| Write test first | Run baseline scenario BEFORE writing skill |
| Watch it fail | Document exact rationalizations agent uses |
| Minimal code | Write skill addressing those specific violations |
| Watch it pass | Verify agent now complies |
| Refactor cycle | Find new rationalizations → plug → re-verify |
The entire skill creation process follows RED-GREEN-REFACTOR.
Create when:
Don't create for:
Concrete method with steps to follow (condition-based-waiting, root-cause-tracing)
Way of thinking about problems (flatten-with-flags, test-invariants)
API docs, syntax guides, tool documentation (office docs)
skills/
skill-name/
SKILL.md # Main reference (required)
supporting-file.* # Only if needed
Flat namespace - all skills in one searchable location
Separate files for:
Keep inline:
---
name: Human-Readable Name
description: One-line summary of what this does
when_to_use: Symptoms and situations when you need this (CSO-critical)
version: 1.0.0
languages: all | [typescript, python] | etc
dependencies: (optional) Required tools/libraries
---
# Skill Name
## Overview
What is this? Core principle in 1-2 sentences.
## When to Use
[Small inline flowchart IF decision non-obvious]
Bullet list with SYMPTOMS and use cases
When NOT to use
## Core Pattern (for techniques/patterns)
Before/after code comparison
## Quick Reference
Table or bullets for scanning common operations
## Implementation
Inline code for simple patterns
@link to file for heavy reference or reusable tools
## Common Mistakes
What goes wrong + fixes
## Real-World Impact (optional)
Concrete results
Critical for discovery: Future Claude needs to FIND your skill
Include SYMPTOMS not just abstract use cases:
# ❌ BAD: Too abstract
when_to_use: For async testing
# ✅ GOOD: Symptoms and context
when_to_use: When tests use setTimeout/sleep and are flaky, timing-dependent,
pass locally but fail in CI, or timeout when run in parallel
…
先用伪代码梳理方案与迭代思路,再高效转成可执行代码。
帮助开发者用早返回或表驱动方式简化嵌套条件分支,提升代码可读性。
帮助你为变量选择清晰准确、易维护的命名,提升代码可读性。
帮助开发者保持类接口抽象一致,避免混杂序列化、持久化等无关职责。
帮助你撰写不过时的代码注释,聚焦做什么与为什么而非时序背景。
帮助用户检索过往 Claude Code 对话,快速找回事实、决策与上下文线索。
用红绿重构式迭代测试流程文档,发现漏洞并持续完善说明。
用测试驱动开发流程编写新功能、修复缺陷并安全重构代码。
在开发新功能、修复缺陷或重构时,按测试驱动流程生成高覆盖测试与代码。
通过测试驱动开发流程,先写测试再实现功能或修复缺陷。
通过测试驱动开发流程编写新功能、修复缺陷并安全重构代码。
通过测试驱动开发流程,为新功能、修复和重构生成高覆盖测试与实现方案。