trellis-update-spec
它能做什么
该技能把你在工作中学到的内容记录到项目的规格文档中。适合希望未来的会话从这些经验开始的团队。
适用场景
- ✓当你完成一项任务或修复了一个错误,并学到了值得保留的东西的时候。
- ✓当你在代码库中发现一种新的模式或惯例的时候。
- ✓当一项改动涉及命令、API、数据库或集成,其约定需要记录下来的时候。
技能链接
https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/trellis-update-spec/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们刚修改了上传 API。请更新规格,让未来的工作遵循新的约定。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会找到与该经验相匹配的规格文件,并写入一条具体的条目,包括签名、约定、错误情况、示例和需要检查的测试。它会让规格保持具体,而不是只停留在一般原则上。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Update Code-Spec - Capture Executable Contracts
When you learn something valuable (from debugging, implementing, or discussion), use this to update the relevant code-spec documents.
Timing: After completing a task, fixing a bug, or discovering a new pattern
Code-Spec First Rule (CRITICAL)
In this project, "spec" for implementation work means code-spec:
- Executable contracts (not principle-only text)
- Concrete signatures, payload fields, env keys, and boundary behavior
- Testable validation/error behavior
If the change touches infra or cross-layer contracts, code-spec depth is mandatory.
Mandatory Triggers
Apply code-spec depth when the change includes any of:
- New/changed command or API signature
- Cross-layer request/response contract change
- Database schema/migration change
- Infra integration (storage, queue, cache, secrets, env wiring)
Mandatory Output (7 Sections)
For triggered tasks, include all sections below:
- Scope / Trigger
- Signatures (command/API/DB)
- Contracts (request/response/env)
- Validation & Error Matrix
- Good/Base/Bad Cases
- Tests Required (with assertion points)
- Wrong vs Correct (at least one pair)
When to Update Code-Specs
| Trigger | Example | Target Spec |
|---|---|---|
| Implemented a feature | Added a new integration or module | Relevant spec file |
| Made a design decision | Chose extensibility pattern over simplicity | Relevant spec + "Design Decisions" section |
| Fixed a bug | Found a subtle issue with error handling | Relevant spec (e.g., error-handling docs) |
| Discovered a pattern | Found a better way to structure code | Relevant spec file |
| Hit a gotcha | Learned that X must be done before Y | Relevant spec + "Common Mistakes" section |
| Established a convention | Team agreed on naming pattern | Quality guidelines |
| New thinking trigger | "Don't forget to check X before doing Y" | guides/*.md (as a checklist item) |
Key Insight: Code-spec updates are NOT just for problems. Every feature implementation contains design decisions and contracts that future AI/developers need to execute safely.
Spec Structure Overview
.trellis/spec/
├── <layer>/ # Per-layer coding standards (e.g., backend/, frontend/, api/)
│ ├── index.md # Overview and links
│ └── *.md # Topic-specific guidelines
└── guides/ # Thinking checklists (NOT coding specs!)
├── index.md # Guide index
└── *.md # Topic-specific guides
CRITICAL: Code-Spec vs Guide - Know the Difference
| Type | Location | Purpose | Content Style |
|---|---|---|---|
| Code-Spec | <layer>/*.md |
Tell AI "how to implement safely" | Signatures, contracts, matrices, cases, test points |
| Guide | guides/*.md |
Help AI "what to think about" | Checklists, questions, pointers to specs |
Decision Rule: Ask yourself:
- "This is how to write the code" → Put in a spec layer directory
- "This is what to consider before writing" → Put in
guides/
Example:
| Learning | Wrong Location | Correct Location |
|---|---|---|
| "Use API X not API Y for this task" | ❌ guides/ (too specific for a thinking guide) |
✅ Relevant spec file (concrete convention) |
| "Remember to check X when doing Y" | ❌ Spec file (too abstract for a spec) | ✅ guides/ (thinking checklist) |
Guides should be short checklists that point to specs, not duplicate the detailed rules.
Update Process
Step 1: Identify What You Learned
Answer these questions:
- What did you learn? (Be specific)
- Why is it important? (What problem does it prevent?)
- Where does it belong? (Which spec file?)
Step 2: Classify the Update Type
| Type | Description | Action |
|---|---|---|
| Design Decision | Why we chose approach X over Y | Add to "Design Decisions" section |
| Project Convention | How we do X in this project | Add to relevant section with examples |
| New Pattern | A reusable approach discovered | Add to "Patterns" section |
| Forbidden Pattern | Something that causes problems | Add to "Anti-patterns" or "Don't" section |
| Common Mistake | Easy-to-make error | Add to "Common Mistakes" section |
| Convention | Agreed-upon standard | Add to relevant section |
| Gotcha | Non-obvious behavior | Add warning callout |
常见问题
什么是代码规格?
一种规格,包含具体的签名、数据字段和错误行为,并且这些内容可以被测试,而不仅仅是一般性原则。
什么时候需要更深入的格式?
该技能要求在改动命令、API 约定、数据库模式或基础设施集成时使用它。
它包含哪些部分?
范围、签名、约定、验证和错误表、正确与错误的情况、必需的测试,以及一个错误与正确的对比示例。
详情
作者的原始描述
Captures executable contracts and coding conventions into .trellis/spec/ documents. Use when learning something valuable from debugging, implementing, or discussion that should be preserved for future sessions.
repo: mindfold-ai/Trellis
热度
- GitHub 星标
- 15k
- 排名
- #11035
- 许可证
- AGPL-3.0
- 更新时间
- 2026/9/29
评论
- …
同一仓库的更多技能
first-principles-thinking
15k帮你的智能体把计划或设计拆解为基本事实,再由此向上推理来检验它,而不是依赖习惯或惯例。
python-design
15k帮你的智能体编写和审阅 Python 命令行脚本,使其模块清晰、接口简单,并减少隐藏的复杂性。
trellis-before-dev
15k帮你的智能体在开始编写代码之前,阅读项目的编码指南和任务说明,使其遵循团队的惯例。
trellis-brainstorm
15k帮你的智能体每次提出一个有价值的问题、检查代码并就狭窄的范围达成一致,从而厘清新功能或不明确的任务。