跳到正文
Skillpedia
通用编程15k · #11035

trellis-update-spec

它能做什么

该技能把你在工作中学到的内容记录到项目的规格文档中。适合希望未来的会话从这些经验开始的团队。

适用场景

  • ✓当你完成一项任务或修复了一个错误,并学到了值得保留的东西的时候。
  • ✓当你在代码库中发现一种新的模式或惯例的时候。
  • ✓当一项改动涉及命令、API、数据库或集成,其约定需要记录下来的时候。

技能链接

https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/trellis-update-spec/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/mindfold-ai/Trellis/blob/main/.agents/skills/trellis-update-spec/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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:

  1. Scope / Trigger
  2. Signatures (command/API/DB)
  3. Contracts (request/response/env)
  4. Validation & Error Matrix
  5. Good/Base/Bad Cases
  6. Tests Required (with assertion points)
  7. 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:

  1. What did you learn? (Be specific)
  2. Why is it important? (What problem does it prevent?)
  3. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能