Documentation And Adrs logo

Documentation And Adrs

Community
vinvcn
documentation-and-adrs

记录决策和文档。用于需要记录架构决策(ADR)或某个设计选择背后的理由时;用于变更公开 API、发布功能,或需要记录未来工程师和 agent 理解代码库所需的上下文时。

Overview

Publishervinvcn
Repositoryaddyosmani-agent-skills-zh
Skill namedocumentation-and-adrs
Stars
48
Forks
10
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by vinvcn on GitHub. Read the source before you install it.

Installation

Install the Documentation And Adrs AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/vinvcn/addyosmani-agent-skills-zh/tree/main/skills/documentation-and-adrs
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vinvcn/addyosmani-agent-skills-zh.git /tmp/addyosmani-agent-skills-zh
mkdir -p .claude/skills
cp -r /tmp/addyosmani-agent-skills-zh/skills/documentation-and-adrs .claude/skills/documentation-and-adrs
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Documentation And Adrs in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Documentation And Adrs on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Documentation And Adrs is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

文档和 ADR

概览

记录决策,而不只是记录代码。最有价值的文档会捕捉 why:促成某个决策的上下文、约束和权衡。代码展示构建了 what;文档解释 why it was built this way,以及 what alternatives were considered。这些上下文对未来在代码库中工作的工程师和 agent 都很重要。

何时使用

  • 做出重要架构决策
  • 在多个竞争方案之间做选择
  • 添加或变更公开 API
  • 发布会改变用户可见行为的功能
  • 让新的团队成员(或 agent)熟悉项目
  • 当你发现自己反复解释同一件事时

不应使用的情况: 不要记录显而易见的代码。不要添加只是复述代码本身的注释。不要为一次性原型编写文档。

Architecture Decision Records (ADRs,架构决策记录)

ADR 捕捉重大技术决策背后的推理。它们是你能写出的最高价值文档。

何时编写 ADR

  • 选择框架、库或主要依赖
  • 设计数据模型或数据库 schema
  • 选择认证策略
  • 决定 API 架构(REST vs. GraphQL vs. tRPC)
  • 在构建工具、托管平台或基础设施之间做选择
  • 任何逆转成本高的决策

优先匹配现有约定

在创建 ADR 之前,先检查可用的仓库上下文中是否已有既定约定——现有 ADR、项目指令,以及与 ADR 相关的配置或工具(例如 .adr-dir 文件)。既定约定优先于下面的默认设置。需要匹配:

  • 位置和格式 — 例如 docs/adr/*.md、Documentation/Decisions/*.rst、MADR 布局,或 adr-tools 配置。匹配现有目录、文件扩展名和标记语言(Markdown vs reStructuredText)。
  • 编号和命名 — 延续现有序列号和文件名模式(ADR-004-Title.rst、0004-title.md 等);不要从 001 重新开始,也不要引入第二套方案。
  • 章节标题 — 复用项目的标题集合,而不是强加本模板的标题。

如果现有证据彼此冲突,把冲突暴露出来,而不是悄悄再引入一套新方案。只有在完全无法确立约定时,才使用下面的默认模板。

ADR 模板

将 ADR 存放在 docs/decisions/,并使用连续编号(除非项目已使用其他位置——见上文):

markdown
# ADR-001: Use PostgreSQL for primary database

## Status
Proposed | Accepted | Superseded by ADR-XXX | Deprecated

## Date
2025-01-15

## Context
We need a primary database for the task management application. Key requirements:
- Relational data model (users, tasks, teams with relationships)
- ACID transactions for task state changes
- Support for full-text search on task content
- Managed hosting available (for small team, limited ops capacity)

## Decision
Use PostgreSQL with Prisma ORM.

## Alternatives Considered

### MongoDB
- Pros: Flexible schema, easy to start with
- Cons: Our data is inherently relational; would need to manage relationships manually
- Rejected: Relational data in a document store leads to complex joins or data duplication

### SQLite
- Pros: Zero configuration, embedded, fast for reads
- Cons: Limited concurrent write support, no managed hosting for production
- Rejected: Not suitable for multi-user web application in production

### MySQL
- Pros: Mature, widely supported
- Cons: PostgreSQL has better JSON support, full-text search, and ecosystem tooling
- Rejected: PostgreSQL is the better fit for our feature requirements

## Consequences
- Prisma provides type-safe database access and migration management
- We can use PostgreSQL's full-text search instead of adding Elasticsearch
- Team needs PostgreSQL knowledge (standard skill, low risk)
- Hosting on managed service (Supabase, Neon, or RDS)

ADR 生命周期

PROPOSED → ACCEPTED → (SUPERSEDED or DEPRECATED)
  • 不要删除旧 ADR。 它们捕捉历史上下文。
  • 当决策发生变化时,写一个新的 ADR,引用并取代旧 ADR。

行内文档

何时写注释

注释解释 why,而不是 what:

typescript
// BAD: Restates the code
// Increment counter by 1
counter += 1;

// GOOD: Explains non-obvious intent
// Rate limit uses a sliding window — reset counter at window boundary,
// not on a fixed schedule, to prevent burst attacks at window edges
if (now - windowStart > WINDOW_SIZE_MS) {
  counter = 0;
  windowStart = now;
}

何时不要写注释

typescript
// Don't comment self-explanatory code
function calculateTotal(items: CartItem[]): number {
  return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
}

// Don't leave TODO comments for things you should just do now
// TODO: add error handling  ← Just add it

// Don't leave commented-out code
// const oldImplementation = () => { ... }  ← Delete it, git has history

记录已知陷阱

typescript
/**
 * IMPORTANT: This function must be called before the first render.
 * If called after hydration, it causes a flash of unstyled content
 * because the theme context isn't available during SSR.
 *
 * See ADR-003 for the full design rationale.
 */
export function initializeTheme(theme: Theme): void {
  // ...
}

API 文档

对于公开 API(REST、GraphQL、库接口):

与类型一起内联记录(TypeScript 首选)

typescript
/**
 * Creates a new task.
 *
 * @param input - Task creation data (title required, description optional)
 * @returns The created task with server-generated ID and timestamps
 * @throws {ValidationError} If title is empty or exceeds 200 characters
 * @throws {AuthenticationError} If the user is not authenticated
 *
 * @example
 * const task = await createTask({ title: 'Buy groceries' });
 * console.log(task.id); // "task_abc123"
 */
export async function createTask(input: CreateTaskInput): Promise<Task> {
  // ...
}

REST API 使用 OpenAPI / Swagger

yaml
paths:
  /api/tasks:
    post:
      summary: Create a task
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTaskInput'
      responses:
        '201':
          description: Task created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '422':
          description: Validation error

README 结构

每个项目都应该有一份 README,覆盖:

markdown
# Project Name

One-paragraph description of what this project does.

## Quick Start
1. Clone the repo
2. Install dependencies: `npm install`
3. Set up environment: `cp .env.example .env`
4. Run the dev server: `npm run dev`

## Commands
| Command | Description |
|---------|-------------|
| `npm run dev` | Start development server |
| `npm test` | Run tests |
| `npm run build` | Production build |
| `npm run lint` | Run linter |

## Architecture
Brief overview of the project structure and key design decisions.
Link to ADRs for details.

## Contributing
How to contribute, coding standards, PR process.

Changelog 维护

对于已发布功能:

markdown
# Changelog

## [1.2.0] - 2025-01-20
### Added
- Task sharing: users can share tasks with team members (#123)
- Email notifications for task assignments (#124)

### Fixed
- Duplicate tasks appearing when rapidly clicking create button (#125)

### Changed
- Task list now loads 50 items per page (was 20) for better UX (#126)

面向 Agent 的文档

需要特别考虑 AI agent 的上下文:

  • CLAUDE.md / rules files — 记录项目约定,让 agent 遵循它们
  • Spec files — 保持 spec 更新,让 agent 构建正确的东西
  • ADRs — 帮助 agent 理解过去决策的原因(避免重复决策)
  • Inline gotchas — 防止 agent 掉入已知陷阱

文字审阅

技术内容检查完之后,再为将来使用这份文档的人审阅文字。更清晰的措辞绝不能改变决策本身或其限制。

  1. 标出那些改动后必须存活下来的细节:名称、数字和单位、命令、路径、链接、条件、取舍,以及不确定之处。拿它们和可用的代码及决策上下文核对;凡是你无法证实的,都标记出来。
  2. 用读者真正需要的具体信息,替换掉套话式开头、宣传式形容词和重复的总结。不要用一个编造的示例或更强的保证,去替换一个没有支撑的说法。保留必要的技术性重复,以及项目既有的术语。
  3. 把改后的文档和原文及其来源做对比。恢复任何丢失的限定语或注意事项,验证命令和代码示例仍能按文档所述工作,并解释任何未解决的事实问题,而不是把它打磨掉。

常见合理化借口

合理化借口现实
“代码是自解释的”代码展示 what。它不展示 why、不展示哪些替代方案被拒绝,也不展示适用哪些约束。
“等 API 稳定后再写文档”当你记录 API 时,API 会更快稳定下来。文档是设计的第一道测试。
“没人读文档”Agent 会读。未来工程师会读。三个月后的你也会读。
“ADR 是额外负担”一份 10 分钟写完的 ADR,可以避免六个月后围绕同一决策进行 2 小时争论。
“注释会过时”关于 why 的注释是稳定的。关于 what 的注释会过时,所以只写前者。

危险信号

  • 架构决策没有书面理由
  • 公开 API 没有文档或类型
  • README 没有说明如何运行项目
  • 用注释掉的代码代替删除
  • TODO 注释已经存在数周
  • 有重大架构选择的项目中没有 ADR
  • 文档只是复述代码,而不是解释意图

验证

完成文档后:

  • 所有重大架构决策都有 ADR
  • README 覆盖 quick start、commands 和 architecture overview
  • API 函数有参数和返回类型文档
  • 已知陷阱在重要位置以内联方式记录
  • 没有保留注释掉的代码
  • Rules files(CLAUDE.md 等)是最新且准确的
  • 文字改动保留了来源细节、决策取舍和限定语,且没有添加无支撑的保证

Frequently asked questions

What does the Documentation And Adrs AI skill do?

记录决策和文档。用于需要记录架构决策(ADR)或某个设计选择背后的理由时;用于变更公开 API、发布功能,或需要记录未来工程师和 agent 理解代码库所需的上下文时。

Why use Documentation And Adrs on TypingMind?

Because you install it once and use it with any model. Documentation And Adrs is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Documentation And Adrs in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vinvcn/addyosmani-agent-skills-zh/tree/main/skills/documentation-and-adrs. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Documentation And Adrs?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Documentation And Adrs?

As many as you like. As long as a model supports skills, you can use Documentation And Adrs with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Documentation And Adrs AI skill free?

Yes. It is published on GitHub by vinvcn under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇