mcpField
U
update-docs

update-docs

github.com/anyproto开发9.0k39 次安装6 天前更新
代码仓库

关于 update-docs

用于根据代码变更维护各文件夹 README 的技能。它指导开发者仅更新受影响部分,并核对文件名、数量和描述。

主要功能

  1. 01识别受影响的文件夹
  2. 02对照 README 与代码变更
  3. 03仅更新相关章节
  4. 04核对文件名和文件数量

适用场景

  1. 01为新增文件补充文档
  2. 02重大组件变更后更新文档
  3. 03删除过时的 README 条目

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/anyproto/anytype-ts --skill update-docs

安装后在 Claude Code 中输入/update-docs确认已加载。

详细介绍

更新文档技能

更新代码发生变更的文件夹中的 README.md 文件。文档应与其描述的代码放在一起——每个组件/抽象文件夹都有自己的 README。

适用场景

在以下情况下启用此技能:

  • 用户明确要求在变更后更新文档
  • 完成的任务新增、删除或大幅修改了组件/抽象文件夹中的文件

原则

  1. 就近放置 — 每个 README 都位于其所描述的文件夹中
  2. 精简 — 只记录有助于开发者理解文件夹用途、结构和模式的内容
  3. 准确 — 文件名、数量、类型数和描述均须准确
  4. 简洁 — 不写冗长的说明。使用表格、项目符号和代码片段
  5. 围绕变更 — 只更新受变更影响的部分,不要重写无关内容

README 结构约定

每个文件夹的 README 都遵循以下骨架(仅在相关时包含相应部分):

# folder-name/ - Short Purpose

One-sentence overview. Contains **N files**.

## Architecture
[Only if the folder has a non-obvious entry point, router, or coordination pattern]

## Components / Modules / Types
[Table or bullet list of files with one-line descriptions]

## Pattern
[Code snippet showing the common pattern, if one exists]

记录内容

变更类型文档操作
新增文件在文件列表中添加条目,并用一句话描述
删除文件从文件列表中移除条目
文件重命名更新对应条目
引入新模式添加/更新 Pattern 部分
架构变更更新 Architecture 部分
文件数量变更更新概览行中的数量
新增 block/menu/popup 类型添加到相关类型列表中

不要记录的内容

  • 阅读代码即可显而易见的实现细节
  • 函数级 API 文档(代码和类型已足够)
  • 变更记录/历史
  • TODO 项或未来计划
  • 每个文件超过一句的描述
  • CLAUDE.md 中已有的重复信息

流程

  1. 确定受影响的文件夹 — 找出新增、删除或发生重大变更的文件所在文件夹
  2. 阅读现有 README — 检查每个受影响的文件夹中是否存在 README.md
  3. 确定差异 — 将变更与 README 当前内容进行对比
  4. 进行最小更新 — 仅编辑受影响的行/部分
  5. 核实准确性 — 确保文件名、数量和描述与实际情况相符

范围规则

  • 只更新代码实际发生变更的文件夹中的 README
  • 如果文件夹尚无 README,且变更较为重大(新建子文件夹、新增抽象层),则按约定创建一个
  • 如果变更很小(修正拼写、微调逻辑),则跳过文档更新
  • 此技能绝不更新 CLAUDE.md——该文件有独立的维护流程

示例

在 block/ 中添加文件
Change: Added `src/ts/component/block/ai.tsx`

Action: Edit `src/ts/component/block/README.md`
- Update file count in overview line
- Add entry under "Other Blocks":
  - `ai.tsx` - AI-generated content block
添加新的 store
Change: Added `src/ts/store/theme.ts`

Action: Edit `src/ts/store/README.md`
- Add row to the Stores table:
  | `theme.ts` | `S.Theme` | Theme management: color schemes, dark mode preferences |
从 menu/ 中删除文件
Change: Removed `src/ts/component/menu/legacySearch.tsx`

Action: Edit `src/ts/component/menu/README.md`
- Remove entry for legacySearch from the menu types list
- Update count if mentioned
创建新的子文件夹
Change: Created `src/ts/component/block/ai/` with index.tsx, toolbar.tsx, preview.tsx

Action: Create `src/ts/component/block/ai/README.md`:
  # ai/ - AI Content Block

  AI-generated content blocks with toolbar controls and preview. Contains **3 files**.

  ## Files
  - `index.tsx` - Main block component, renders AI content with edit/regenerate actions
  - `toolbar.tsx` - Prompt input and model selection toolbar
  - `preview.tsx` - Streaming preview of AI-generated content

Also update parent `src/ts/component/block/README.md` to reference the new subfolder.

评论

支持 Markdown