Community编程与开发github.com

代码文档生成

根据用户请求生成、创建或改进代码、API、库、仓库或软件项目的文档。支持README生成、API参考文档、内联代码注释、架构文档、变更日志生成和开发者指南。

代码文档生成 是什么?

该技能用于为软件项目、代码库、库和API生成专业、全面的文档。它遵循React、Django、Stripe和Kubernetes等行业最佳实践,生成准确、结构良好且对新贡献者和经验丰富的开发者都有用的文档。输出范围从单个文件的README到多文档的开发者指南,始终与项目的复杂性和用户的需求匹配。核心能力包括生成带有徽章、安装、使用和API参考的README.md文件,通过源代码分析创建API参考文档,生成带有图表的架构和设计文档,编写开发人员入职和贡献指南,从提交历史或发布说明生成变更日志,以及创建遵循语言特定约定的内联代码文档。该技能支持工作流程的三个阶段:代码库分析(项目发现、代码结构分析和文档范围界定)、文档生成(README、API参考、架构文档和内联注释)和质量保证(完整性检查、质量标准和交叉引用验证)。它适用于Claude Code、Coder、Cursor和Codex等平台,并可与deep-research技能结合用于记录第三方集成或依赖项。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bytedance/deer-flow/tree/main/skills/public/code-documentation

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

预览

来自技能 README

徽章

文档

代码文档技能

概述

此技能为软件项目、代码库、库和API生成专业、全面的文档。它遵循React、Django、Stripe和Kubernetes等行业最佳实践,生成准确、结构良好且对新贡献者和经验丰富的开发者都有用的文档。

输出范围从单个文件的README到多文档的开发者指南,始终与项目的复杂性和用户的需求匹配。

核心能力

  • 生成带有徽章、安装、使用和API参考的全面README.md文件
  • 通过源代码分析创建API参考文档
  • 生成带有图表的架构和设计文档
  • 编写开发人员入职和贡献指南
  • 从提交历史或发布说明生成变更日志
  • 创建遵循语言特定约定的内联代码文档
  • 支持JSDoc、docstrings、GoDoc、Javadoc和Rustdoc格式
  • 根据项目的语言和生态系统调整文档风格

何时使用此技能

在以下情况始终加载此技能:

  • 用户要求为任何代码“记录”、“创建文档”或“编写文档”
  • 用户请求README、API参考或开发者指南
  • 用户分享代码库或仓库并希望生成文档
  • 用户要求改进或更新现有文档
  • 用户需要架构文档,包括图表
  • 用户请求变更日志或迁移指南

文档工作流程

阶段1:代码库分析

在撰写文档之前,全面了解代码库。

步骤1.1:项目发现

识别项目基础:

字段如何确定
语言检查文件扩展名、package.json、pyproject.toml、go.mod、Cargo.toml等
框架查看已知框架的依赖项(React、Django、Express、Spring等)
构建系统检查Makefile、CMakeLists.txt、webpack.config.js、build.gradle等
包管理器npm/yarn/pnpm、pip/uv/poetry、cargo、go modules等
项目结构映射目录树以理解架构
入口点查找主文件、CLI入口点、导出的模块
现有文档检查现有的README、docs/、wiki或内联文档

步骤1.2:代码结构分析

使用沙箱工具探索代码库:

# 获取目录结构
ls /mnt/user-data/uploads/project-dir/

# 读取关键文件
read_file /mnt/user-data/uploads/project-dir/package.json
read_file /mnt/user-data/uploads/project-dir/pyproject.toml

# 搜索公共API表面
grep -r "export " /mnt/user-data/uploads/project-dir/src/
grep -r "def " /mnt/user-data/uploads/project-dir/src/ --include="*.py"
grep -r "func " /mnt/user-data/uploads/project-dir/ --include="*.go"

步骤1.3:确定文档范围

基于分析,确定要生成的文档:

项目规模推荐文档
单个文件/脚本内联注释 + 使用说明头部
小型库带有API参考的README
中型项目README + API文档 + 示例
大型项目README + 架构 + API + 贡献指南 + 变更日志

阶段2:文档生成

步骤2.1:README生成

每个项目都需要一个README。遵循此结构:

# 项目名称

[一行项目描述 — 它的作用及其重要性]

[![徽章](https://raw.githubusercontent.com/bytedance/deer-flow/main/link)](#) [![徽章](https://raw.githubusercontent.com/bytedance/deer-flow/main/link)](#)

## 特性

- [关键特性1 — 简要描述]
- [关键特性2 — 简要描述]
- [关键特性3 — 简要描述]

## 快速开始

### 前提条件

- [前提条件1及版本要求]
- [前提条件2及版本要求]

### 安装

[带有可复制粘贴代码块的安装命令]

### 基本用法

[展示核心功能的最小工作示例]

## 文档

- [如有单独API参考的链接]
- [如有单独架构文档的链接]
- [如有示例目录的链接]

## API参考

[对于较小项目内联API参考,或链接到生成的文档]

## 配置

[环境变量、配置文件或运行时选项]

## 示例

[2-3个涵盖常见用例的实际示例]

## 开发

### 设置

[如何设置开发环境]

### 测试

[如何运行测试]

### 构建

[如何构建项目]

## 贡献

[贡献指南或链接到CONTRIBUTING.md]

## 许可证

[许可证信息]

步骤2.2:API参考生成

对于每个公共API表面,记录:

函数/方法文档:

### `functionName(param1, param2, options?)`

对此函数功能的简要描述。

**参数:**

| 参数 | 类型 | 必需 | 默认值 | 描述 |
|-----------|------|----------|---------|-------------|
| `param1` | `string` | 是 | — | param1的描述 |
| `param2` | `number` | 是 | — | param2的描述 |
| `options` | `Object` | 否 | `{}` | 配置选项 |
| `options.timeout` | `number` | 否 | `5000` | 超时时间(毫秒) |

**返回值:** `Promise<Result>` — 返回值的描述

**抛出异常:**
- `ValidationError` — 当param1为空时
- `TimeoutError` — 当操作超过超时时间时

**示例:**

javascript
const result = await functionName("hello", 42, { timeout: 10000 });
console.log(result.data);


类文档:

### `ClassName`

简要描述类及其用途。

**构造函数:**

javascript
new ClassName(config)


| 参数 | 类型 | 描述 |
|-----------|------|-------------|
| `config.option1` | `string` | 描述 |
| `config.option2` | `boolean` | 描述 |

**方法:**

- [`method1()`](#method1) — 简要描述
- [`method2(param)`](#method2) — 简要描述

**属性:**

| 属性 | 类型 | 描述 |
|----------|------|-------------|
| `property1` | `string` | 描述 |
| `property2` | `number` | 只读。描述 |

步骤2.3:架构文档

对于中型到大型项目,包括架构文档:

# 架构概述

## 系统图

[包含显示高层架构的Mermaid图]

 mermaid
graph TD
    A[客户端] --> B[API网关]
    B --> C[服务A]
    B --> D[服务B]
    C --> E[(数据库)]
    D --> E


## 组件概述

### 组件名称
- **用途**:此组件的作用
- **位置**:`src/components/name/`
- **依赖项**:它依赖的内容
- **公共API**:关键导出或接口

## 数据流

[描述关键操作的数据如何在系统中流动]

## 设计决策

### 决策标题
- **背景**:导致此决策的情况
- **决策**:决定的内容
- **理由**:选择此方法的原因
- **权衡**:牺牲了什么

步骤2.4:内联代码文档

生成语言合适的内联文档:

Python(Docstrings — Google风格):

def process_data(input_path: str, options: dict | None = None) -> ProcessResult:
    """处理来自给定文件路径的数据。

    读取输入文件,根据提供的选项应用转换,
    并返回结构化结果对象。

    参数:
        input_path: 输入数据文件的绝对路径。
            支持CSV、JSON和Parquet格式。
        options: 可选配置字典。
            - "validate" (bool): 启用输入验证。默认为True。
            - "format" (str): 输出格式("json"或"csv")。默认为"json"。

    返回值:
        包含转换后数据和元数据的ProcessResult。

    引发异常:
        FileNotFoundError: 如果input_path不存在。
        ValidationError: 如果启用验证且数据格式错误。

    示例:
        >>> result = process_data("/data/input.csv", {"validate": True})
        >>> print(result.row_count)
        1500
    """

TypeScript(JSDoc / TSDoc):

/**
 * 从API获取用户数据并进行转换以供显示。
 *
 * @param userId - 用户的唯一标识符
 * @param options - 获取操作的配置选项
 * @param options.includeProfile - 是否包含完整个人资料。默认为`false`。
 * @param options.cache - 缓存持续时间(秒)。设置为`0`以禁用。
 * @returns 转换后的用户数据,可用于渲染
 * @throws {NotFoundError} 当用户ID不存在时
 * @throws {NetworkError} 当API不可达时
 *
 * @example
 * ```ts
 * const user = await fetchUser("usr_123", { includeProfile: true });
 * console.log(user.displayName);
 * ```
 */

Go(GoDoc):

// ProcessData读取给定路径的输入文件,应用指定的
// 转换,并返回处理后的结果。
//
// 输入路径必须是CSV或JSON文件的绝对路径。
// 如果options为nil,则使用默认选项。
//
// 如果文件不存在或无法解析,ProcessData返回错误。
func ProcessData(inputPath string, options *ProcessOptions) (*Result, error) {

阶段3:质量保证

步骤3.1:文档完整性检查

验证文档覆盖:

  • 它是什么 — 新手能理解的清晰项目描述
  • 它为什么存在 — 它解决的问题和价值主张
  • 如何安装 — 可复制粘贴的安装命令
  • 如何使用 — 至少一个最小工作示例
  • API表面 — 所有公共函数、类和类型都已文档化
  • 配置 — 所有环境变量、配置文件和选项
  • 错误处理 — 常见错误及其解决方法
  • 贡献 — 如何设置开发环境并提交更改

步骤3.2:质量标准

标准检查项
准确性每个代码示例必须与描述的API一致
完整性没有公共API表面未文档化
一致性整个文档格式和结构一致
时效性文档与当前代码匹配,而非旧版本
可访问性没有无解释的行话,首提时定义缩写
示例每个复杂概念至少有一个实际示例

步骤3.3:交叉引用验证

确保:

  • 所有提及的文件路径在项目中存在
  • 所有引用的函数和类在代码中存在
  • 所有代码示例使用正确的函数签名
  • 版本号与项目的实际版本匹配
  • 所有链接(内部和外部)有效

文档风格指南

写作原则

  1. 先说明“为什么” — 在解释工作原理之前,先说明其存在的原因
  2. 渐进式披露 — 从简单开始,逐步增加复杂性
  3. 展示而非讲述 — 优先使用代码示例而非冗长解释
  4. 主动语态 — “函数返回X”而非“X由函数返回”
  5. 现在时态 — “服务器在端口8080上启动”而非“服务器将在端口8080上启动”
  6. 第二人称 — “您可以配置...”而非“用户可以配置...”

格式规则

  • 使用ATX样式标题(#, ##, ###)
  • 使用带语言标识的围栏代码块(```python, ```bash)
  • 使用表格呈现结构化信息(参数、选项、配置)
  • 使用提醒框标记重要说明、警告和提示
  • 保持行长度可读(源文件中散文部分约80-100字符换行)
  • 对函数名、文件路径、变量名和CLI命令使用代码格式化

语言特定约定

语言文档格式风格指南
PythonGoogle风格的docstringsPEP 257
TypeScript/JavaScriptTSDoc / JSDocTypeDoc约定
GoGoDoc注释Effective Go
RustRustdoc(///)Rust API指南
JavaJavadocOracle Javadoc指南
C/C++DoxygenDoxygen手册

输出处理

生成后:

  • 将文档文件保存到/mnt/user-data/outputs/
  • 对于多文件文档,保持项目目录结构
  • 使用present_files工具将生成的文件呈现给用户
  • 主动提出迭代特定部分或调整详细程度
  • 建议可能有价值的其他文档

说明

  • 始终在编写文档前分析实际代码 — 永远不要猜测API签名或行为
  • 当存在现有文档时,除非用户明确要求重写,否则保留其结构
  • 对于大型代码库,优先记录公共API表面和关键抽象
  • 文档应与项目现有文档使用相同语言;如果没有现有文档,默认使用英语
  • 生成变更日志时,使用Keep a Changelog格式
  • 此技能可与deep-research技能结合使用,用于记录第三方集成或依赖项

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

academic-paper-review

Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints, or scientific publications. Supports comprehensive structured reviews covering methodology assessment, contribution evaluation, literature positioning, and constructive feedback generation. Trigger on queries involving paper URLs, uploaded PDFs, arXiv links, or requests like "review this paper", "analyze this research", "summarize this study", or "write a peer review".

bootstrap

Generate a personalized SOUL.md through a warm, adaptive onboarding conversation. Trigger when the user wants to create, set up, or initialize their AI partner's identity — e.g., "create my SOUL.md", "bootstrap my agent", "set up my AI partner", "define who you are", "let's do onboarding", "personalize this AI", "make you mine", or when a SOUL.md is missing. Also trigger for updates: "update my SOUL.md", "change my AI's personality", "tweak the soul".

bytedance/academic-paper-review

Use this skill when the user requests to review, analyze, critique, or summarize academic papers, research articles, preprints, or scientific publications. Supports comprehensive structured reviews covering methodology assessment, contribution evaluation, literature positioning, and constructive feedback generation. Trigger on queries involving paper URLs, uploaded PDFs, arXiv links, or requests like "review this paper", "analyze this research", "summarize this study", or "write a peer review".

bytedance/chart-visualization

This skill should be used when the user wants to visualize data. It intelligently selects the most suitable chart type from 26 available options, extracts parameters based on detailed specifications, and generates a chart image using a JavaScript script.

bytedance/claude-to-deerflow

Interact with DeerFlow AI agent platform via its HTTP API. Use this skill when the user wants to send messages or questions to DeerFlow for research/analysis, start a DeerFlow conversation thread, check DeerFlow status or health, list available models/skills/agents in DeerFlow, manage DeerFlow memory, upload files to DeerFlow threads, or delegate complex research tasks to DeerFlow. Also use when the user mentions deerflow, deer flow, or wants to run a deep research task that DeerFlow can handle.

bytedance/consulting-analysis

Use this skill when the user requests to generate, create, or write professional research reports including but not limited to market analysis, consumer insights, brand analysis, financial analysis, industry research, competitive intelligence, investment due diligence, or any consulting-grade analytical report. This skill operates in two phases — (1) generating a structured analysis framework with chapter skeleton, data query requirements, and analysis logic, and (2) after data collection by other skills, producing the final consulting-grade report with structured narratives, embedded charts, and strategic insights.

bytedance/data-analysis

Use this skill when the user uploads Excel (.xlsx/.xls) or CSV files and wants to perform data analysis, generate statistics, create summaries, pivot tables, SQL queries, or any form of structured data exploration. Supports multi-sheet Excel workbooks, aggregation, filtering, joins, and exporting results to CSV/JSON/Markdown.

bytedance/deep-research

Use this skill instead of WebSearch for ANY question requiring web research. Trigger on queries like "what is X", "explain X", "compare X and Y", "research X", or before content generation tasks. Provides systematic multi-angle research methodology instead of single superficial searches. Use this proactively when the user's question needs online information.

bytedance/find-skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

bytedance/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

bytedance/github-deep-research

Conduct multi-round deep research on any GitHub Repo. Use when users request comprehensive analysis, timeline reconstruction, competitive analysis, or in-depth investigation of GitHub. Produces structured markdown reports with executive summaries, chronological timelines, metrics analysis, and Mermaid diagrams. Triggers on Github repository URL or open source projects.

bytedance/image-generation

Use this skill when the user requests to generate, create, imagine, or visualize images including characters, scenes, products, or any visual content. Supports structured prompts and reference images for guided generation.

bytedance/podcast-generation

Use this skill when the user requests to generate, create, or produce podcasts from text content. Converts written content into a two-host conversational podcast audio format with natural dialogue.

bytedance/ppt-generation

Use this skill when the user requests to generate, create, or make presentations (PPT/PPTX). Creates visually rich slides by generating images for each slide and composing them into a PowerPoint file.

bytedance/skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

bytedance/surprise-me

Create a delightful, unexpected "wow" experience for the user by dynamically discovering and creatively combining other enabled skills. Triggers when the user says "surprise me" or any request expressing a desire for an unexpected creative showcase. Also triggers when the user is bored, wants inspiration, or asks for "something interesting".

bytedance/vercel-deploy

Deploy applications and websites to Vercel. Use this skill when the user requests deployment actions such as "Deploy my app", "Deploy this to production", "Create a preview deployment", "Deploy and give me the link", or "Push this live". No authentication required - returns preview URL and claimable deployment link.

bytedance/video-generation

Use this skill when the user requests to generate, create, or imagine videos. Supports structured prompts and reference image for guided generation.

bytedance/web-design-guidelines

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

chart-visualization

This skill should be used when the user wants to visualize data. It intelligently selects the most suitable chart type from 26 available options, extracts parameters based on detailed specifications, and generates a chart image using a JavaScript script.

相关技能