跳到正文
cccskills
免费在 GitHub 公开中文介绍

documentation-and-adrs

记录软件设计决策的理由及比较过的方案,整理README、API文档和变更日志,帮助后来加入的成员与AI智能体理解实现背景。

原文查看原文说明

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

集成工具PostgreSQL
AI 评分100分/ 100查看安装方法

适用场景

  • 记录设计决策和未采用方案
  • 记录公开API的变更
  • 完善README的启动步骤
  • 记录已发布功能的变更日志
  • 向新成员或智能体交接背景

中文介绍

功能

记录软件设计决策及其理由,在ADR,即重要架构决策记录中,整理背景、约束、采用方案、比较过的选项和结果。还可整理README启动步骤、API参数、返回值与错误、变更日志,以及仅看代码难以理解的注意事项。修改文字时,会检查名称、数值、条件和不确定性是否保留,避免加入缺乏依据的解释。

适用场景

适合记录选择某个库或数据库的理由,或为公开API及面向用户的行为变更编写文档。也可为新成员或AI智能体准备资料,帮助其理解过去的决策和项目约定。

使用示例

  • “请把这个设计的背景和比较过的方案整理成ADR。”
  • “请在README中整理启动步骤和主要命令。”
  • “请编写API参数、返回值、错误和使用示例的文档。”

注意事项

ADR遵循项目现有的保存位置、格式、编号和标题。决策改变后,也不删除旧记录,而是从新的ADR引用旧记录。不用于解释显而易见的代码,也不用于为一次性原型编写文档。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确列出设计决策、公开API变更和成员交接等文档编写场景。
步骤具体性步骤、输入输出和示例是否具体
A良好提供ADR、API文档、README和变更日志的格式及示例。
安全性发送数据、删除文件、执行命令等是否有说明
A良好要求检查现有文档约定,保留旧ADR并从新记录中引用。
安装难易度所需工具和 API 密钥是否少且有说明
A良好内容以文档格式和示例为主,未指定必需的外部工具或API密钥。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月20日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md10.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Documentation and ADRs

Overview

Document decisions, not just code. The most valuable documentation captures the why — the context, constraints, and trade-offs that led to a decision. Code shows what was built; documentation explains why it was built this way and what alternatives were considered. This context is essential for future humans and agents working in the codebase.

When to Use

  • Making a significant architectural decision
  • Choosing between competing approaches
  • Adding or changing a public API
  • Shipping a feature that changes user-facing behavior
  • Onboarding new team members (or agents) to the project
  • When you find yourself explaining the same thing repeatedly

When NOT to use: Don't document obvious code. Don't add comments that restate what the code already says. Don't write docs for throwaway prototypes.

Architecture Decision Records (ADRs)

ADRs capture the reasoning behind significant technical decisions. They're the highest-value documentation you can write.

When to Write an ADR

  • Choosing a framework, library, or major dependency
  • Designing a data model or database schema
  • Selecting an authentication strategy
  • Deciding on an API architecture (REST vs. GraphQL vs. tRPC)
  • Choosing between build tools, hosting platforms, or infrastructure
  • Any decision that would be expensive to reverse

Match the existing convention first

Before creating an ADR, inspect the available repository context for an established convention — existing ADRs, project instructions, and ADR-related configuration or tooling (e.g. an .adr-dir file). An established convention overrides the defaults below. Match:

  • Location and format — e.g. docs/adr/*.md, Documentation/Decisions/*.rst, a MADR layout, or an adr-tools setup. Match the existing directory, file extension, and markup (Markdown vs reStructuredText).
  • Numbering and naming — continue the existing sequence and filename pattern (ADR-004-Title.rst, 0004-title.md, …); don't restart at 001 or introduce a second scheme.
  • Section headings — reuse the project's heading set rather than imposing this template's.

If the available evidence conflicts, surface the conflict rather than silently introducing another scheme. Only when no convention can be established do you apply the default below.

ADR Template

Store ADRs in docs/decisions/ with sequential numbering (unless the project already uses another location — see above):

# 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 Lifecycle

PROPOSED → ACCEPTED → (SUPERSEDED or DEPRECATED)
  • Don't delete old ADRs. They capture historical context.
  • When a decision changes, write a new ADR that references and supersedes the old one.

Inline Documentation

When to Comment

Comment the why, not the what:

// 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;
}

When NOT to Comment

// 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

Document Known Gotchas

/**
 * 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 Documentation

For public APIs (REST, GraphQL, library interfaces):

Inline with Types (Preferred for 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> {
  // ...
}

OpenAPI / Swagger for REST APIs

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 Structure

Every project should have a README that covers:

# 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 Maintenance

For shipped features:

# 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)

Documentation for Agents

Special consideration for AI agent context:

  • CLAUDE.md / rules files — Document project conventions so agents follow them
  • Spec files — Keep specs updated so agents build the right thing
  • ADRs — Help agents understand why past decisions were made (prevents re-deciding)
  • Inline gotchas — Prevent agents from falling into known traps

Prose Review

After checking the technical content, review the prose for the people who will use it. Clearer wording must not change the decision or its limits.

  1. Mark the details that must survive the edit: names, numbers and units, commands, paths, links, conditions, trade-offs, and uncertainty. Check them against the available code and decision context; flag anything you cannot substantiate.
  2. Replace stock introductions, promotional adjectives, and repeated summaries with the concrete information the reader needs. Do not replace an unsupported claim with an invented example or a stronger guarantee. Keep necessary technical repetition and the project's established terminology.
  3. Compare the edited document with the original and its sources. Restore any lost qualifier or caveat, verify command and code examples still work as documented, and explain any unresolved factual question rather than polishing it away.

Common Rationalizations

RationalizationReality
"The code is self-documenting"Code shows what. It doesn't show why, what alternatives were rejected, or what constraints apply.
"We'll write docs when the API stabilizes"APIs stabilize faster when you document them. The doc is the first test of the design.
"Nobody reads docs"Agents do. Future engineers do. Your 3-months-later self does.
"ADRs are overhead"A 10-minute ADR prevents a 2-hour debate about the same decision six months later.
"Comments get outdated"Comments on why are stable. Comments on what get outdated — that's why you only write the former.

Red Flags

  • Architectural decisions with no written rationale
  • Public APIs with no documentation or types
  • README that doesn't explain how to run the project
  • Commented-out code instead of deletion
  • TODO comments that have been there for weeks
  • No ADRs in a project with significant architectural choices
  • Documentation that restates the code instead of explaining intent

Verification

After documenting:

  • ADRs exist for all significant architectural decisions
  • README covers quick start, commands, and architecture overview
  • API functions have parameter and return type documentation
  • Known gotchas are documented inline where they matter
  • No commented-out code remains
  • Rules files (CLAUDE.md etc.) are current and accurate
  • Prose edits preserve source details, decision trade-offs, and qualifiers without adding unsupported guarantees

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

api-and-interface-design

免费有简介AI 评分 100分

在实现前定义 API 和模块之间的输入输出,统一命名、错误格式与输入校验,并考虑现有调用方的兼容性及重试造成的重复处理。

  • 设计新的 REST API
  • 定义界面与服务器的数据规范
  • 在保持兼容的前提下扩展 API
addyosmani/agent-skills10.9万2026年10月14日 更新

browser-testing-with-devtools

免费有简介AI 评分 100分

在真实浏览器中验证页面显示与操作,检查错误、网络通信和加载速度,并比较修复前后的截图、确认无障碍支持。

  • 排查布局与样式问题
  • 检查浏览器错误与API通信
  • 比较修复前后的页面
addyosmani/agent-skills10.9万2026年10月14日 更新

ci-cd-and-automation

免费有简介AI 评分 80分

自动执行代码变更后的测试、类型检查和构建,建立发布前的质量检查流程。涵盖GitHub Actions配置、分阶段发布和回滚步骤,也介绍失败排查与运行提速。

  • 为新项目引入CI
  • 自动执行测试和质量检查
  • 设计分阶段发布与回滚流程
addyosmani/agent-skills10.9万2026年10月14日 更新

code-review-and-quality

免费有简介AI 评分 90分

在合并前从正确性、可读性、架构、安全和性能五个维度审查代码变更,检查测试是否恰当,区分必须修复的问题与可选建议,并提出具体改进方法。

  • 合并前审查拉取请求
  • 检查人工智能编写的代码
  • 评估重构是否带来改善
addyosmani/agent-skills10.9万2026年10月14日 更新

code-simplification

免费有简介AI 评分 100分

在保持行为不变的前提下,整理深层条件分支、长函数、重复逻辑和含糊命名。先检查现有规范与测试,再以可读性为标准逐步修改。

  • 改善已正常运行功能的代码可读性
  • 处理代码审查指出的复杂逻辑
  • 整理深层条件分支和长函数
addyosmani/agent-skills10.9万2026年10月14日 更新

constraint-driven-development

免费有简介AI 评分 80分

将项目质量标准及其数值、理由和检查方法写入文档,并从差异中检查跳过测试、抑制警告或降低门槛的改动,维持智能体开发质量。

  • 制定智能体开发的质量标准
  • 选择覆盖率与性能目标
  • 发现跳过测试或抑制警告
addyosmani/agent-skills10.9万2026年10月14日 更新

查看 addyosmani 的全部技能

报告此技能的问题