feishu-doc-to-dev-spec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese飞书云文档转研发需求文档
Convert Feishu Cloud Docs to Development Requirement Documents
任务目标
Task Objectives
本 Skill 用于:
- 读取飞书云文档内容(支持多个文档链接)
- 完整解析文档中的所有内容:文本、表格、图片、代码块等
- 根据用户选择的开发语言和存储结构
- 将产品需求文档(PRD)转换为结构化的研发开发需求文档
This Skill is used to:
- Read Feishu Cloud Doc content (supports multiple document links)
- Fully parse all content in the documents: text, tables, images, code blocks, etc.
- Based on the development language and storage structure selected by users
- Convert Product Requirement Documents (PRD) into structured development requirement documents
前置准备
Preparations
飞书应用配置
Feishu Application Configuration
使用前需要创建飞书应用并获取凭证:
- 访问 飞书开放平台
- 创建企业自建应用
- 获取 App ID 和 App Secret
- 配置应用权限:
- - 读取文档内容
docx:document:readonly - - 读取云空间文件
drive:drive:readonly - - 读取知识库(如需要)
wiki:wiki:readonly
You need to create a Feishu application and obtain credentials before use:
- Visit Feishu Open Platform
- Create an enterprise self-built application
- Get App ID and App Secret
- Configure application permissions:
- - Read document content
docx:document:readonly - - Read cloud space files
drive:drive:readonly - - Read knowledge base (if needed)
wiki:wiki:readonly
环境变量
Environment Variables
bash
export FEISHU_APP_ID=your-app-id
export FEISHU_APP_SECRET=your-app-secretbash
export FEISHU_APP_ID=your-app-id
export FEISHU_APP_SECRET=your-app-secret操作步骤
Operation Steps
标准流程
Standard Process
-
收集文档链接
- 用户提供一个或多个飞书文档链接
- 支持的链接格式:
- - 新版文档
https://xxx.feishu.cn/docx/xxxxx - - 旧版文档
https://xxx.feishu.cn/docs/xxxxx - - 知识库文档
https://xxx.feishu.cn/wiki/xxxxx
-
确认技术选型
- 询问用户选择的开发语言(如:Python、Java、Go、Node.js、Rust 等)
- 询问存储结构(如:PostgreSQL、MySQL、MongoDB、Redis 等)
- 询问其他技术栈偏好(框架、部署方式等)
-
读取文档内容
- 调用 脚本
[INVOKE:fetch_feishu_doc] - 传入文档链接列表
- 脚本会返回完整的文档内容,包括:
- 文本段落
- 表格数据(转换为 Markdown 表格)
- 图片(下载到本地并返回路径)
- 代码块
- 有序/无序列表
- 调用
-
分析需求内容
- 识别功能需求、非功能需求
- 提取业务规则和约束
- 整理用户故事和验收标准
-
生成研发需求文档
- 根据用户选择的技术栈
- 生成包含以下内容的研发文档:
- 技术架构设计
- 数据模型设计(表结构)
- API 接口设计
- 核心功能实现方案
- 技术风险评估
-
输出结果
- 生成 Markdown 格式的研发需求文档
- 保存到 目录
./output/
-
Collect Document Links
- Users provide one or more Feishu document links
- Supported link formats:
- - New version documents
https://xxx.feishu.cn/docx/xxxxx - - Old version documents
https://xxx.feishu.cn/docs/xxxxx - - Knowledge base documents
https://xxx.feishu.cn/wiki/xxxxx
-
Confirm Technical Selection
- Ask users to select a development language (e.g., Python, Java, Go, Node.js, Rust, etc.)
- Ask users to select a storage structure (e.g., PostgreSQL, MySQL, MongoDB, Redis, etc.)
- Ask about other tech stack preferences (frameworks, deployment methods, etc.)
-
Read Document Content
- Call the script
[INVOKE:fetch_feishu_doc] - Pass in the list of document links
- The script will return the complete document content, including:
- Text paragraphs
- Table data (converted to Markdown tables)
- Images (downloaded to local and return paths)
- Code blocks
- Ordered/unordered lists
- Call the
-
Analyze Requirement Content
- Identify functional requirements and non-functional requirements
- Extract business rules and constraints
- Organize user stories and acceptance criteria
-
Generate Development Requirement Documents
- Based on the tech stack selected by users
- Generate development documents containing the following content:
- Technical architecture design
- Data model design (table structure)
- API interface design
- Core function implementation scheme
- Technical risk assessment
-
Output Results
- Generate development requirement documents in Markdown format
- Save to the directory
./output/
资源索引
Resource Index
脚本
Scripts
- 飞书文档读取:
scripts/fetch_feishu_doc.py- 用途:读取飞书云文档的完整内容
- 输入参数(JSON 格式):
json
{ "doc_urls": ["https://xxx.feishu.cn/docx/xxxxx"], "app_id": "飞书应用ID(可选,默认从环境变量读取)", "app_secret": "飞书应用密钥(可选,默认从环境变量读取)" } - 输出:文档内容的 JSON 结构
- Feishu Doc Reading:
scripts/fetch_feishu_doc.py- Purpose: Read complete content of Feishu Cloud Docs
- Input parameters (JSON format):
json
{ "doc_urls": ["https://xxx.feishu.cn/docx/xxxxx"], "app_id": "Feishu App ID (optional, read from environment variables by default)", "app_secret": "Feishu App Secret (optional, read from environment variables by default)" } - Output: JSON structure of document content
参考文档
Reference Documents
-
研发文档模板:
references/dev-spec-template.md- 何时读取:生成研发需求文档时
- 包含标准的研发文档结构和示例
-
技术选型指南:
references/tech-stack-guide.md- 何时读取:帮助用户选择技术栈时
- 包含常见技术栈的特点和适用场景
-
Development Document Template:
references/dev-spec-template.md- When to read: When generating development requirement documents
- Contains standard development document structure and examples
-
Tech Stack Guide:
references/tech-stack-guide.md- When to read: When helping users select tech stacks
- Contains characteristics and applicable scenarios of common tech stacks
注意事项
Notes
文档权限
Document Permissions
- 确保飞书应用有权限访问目标文档
- 如果文档是私有的,需要将应用添加为文档协作者
- Ensure the Feishu application has permission to access the target documents
- If the document is private, add the application as a document collaborator
图片处理
Image Processing
- 文档中的图片会被下载到 目录
./output/images/ - 图片链接会被替换为本地相对路径
- Images in documents will be downloaded to the directory
./output/images/ - Image links will be replaced with local relative paths
多文档合并
Multi-Document Merging
- 当用户提供多个文档链接时,会按顺序读取并合并内容
- 每个文档的内容会用分隔线区分
- When users provide multiple document links, the content will be read and merged in order
- Content of each document will be separated by a divider
输出格式
Output Format
- 研发需求文档采用 Markdown 格式
- 表格使用 Markdown 表格语法
- 代码块使用对应语言的语法高亮标记
- Development requirement documents use Markdown format
- Tables use Markdown table syntax
- Code blocks use syntax highlighting tags corresponding to the language
使用示例
Usage Examples
示例 1:单个文档转换
Example 1: Single Document Conversion
用户输入:
请帮我把这个产品需求文档转换为研发需求文档:
https://example.feishu.cn/docx/abc123
技术栈:
- 语言:Python
- 框架:FastAPI
- 数据库:PostgreSQL
- 缓存:Redis执行流程:
- 调用 读取文档
[INVOKE:fetch_feishu_doc] - 分析需求内容
- 根据 Python + FastAPI + PostgreSQL 技术栈生成研发文档
- 输出到
./output/dev-spec.md
User Input:
Please help me convert this product requirement document into a development requirement document:
https://example.feishu.cn/docx/abc123
Tech stack:
- Language: Python
- Framework: FastAPI
- Database: PostgreSQL
- Cache: RedisExecution Process:
- Call to read the document
[INVOKE:fetch_feishu_doc] - Analyze requirement content
- Generate development documents based on Python + FastAPI + PostgreSQL tech stack
- Output to
./output/dev-spec.md
示例 2:多个文档合并
Example 2: Multi-Document Merging
用户输入:
这是我们的产品需求文档,包含多个部分:
1. 总体需求:https://example.feishu.cn/docx/main
2. 用户模块:https://example.feishu.cn/docx/user
3. 订单模块:https://example.feishu.cn/docx/order
请使用 Java + Spring Boot + MySQL 生成研发文档执行流程:
- 依次读取三个文档
- 合并并分析需求
- 生成 Java 技术栈的研发文档
User Input:
These are our product requirement documents, including multiple parts:
1. Overall Requirements: https://example.feishu.cn/docx/main
2. User Module: https://example.feishu.cn/docx/user
3. Order Module: https://example.feishu.cn/docx/order
Please generate development documents using Java + Spring Boot + MySQLExecution Process:
- Read the three documents in sequence
- Merge and analyze requirements
- Generate development documents for Java tech stack
研发文档输出结构
Development Document Output Structure
生成的研发需求文档包含以下章节:
markdown
undefinedThe generated development requirement documents include the following sections:
markdown
undefined研发需求文档
Development Requirement Document
1. 项目概述
1. Project Overview
- 项目背景
- 项目目标
- 技术栈选型
- Project Background
- Project Objectives
- Tech Stack Selection
2. 系统架构
2. System Architecture
- 整体架构图
- 模块划分
- 技术组件
- Overall Architecture Diagram
- Module Division
- Technical Components
3. 数据模型设计
3. Data Model Design
- ER 图
- 表结构定义
- 索引设计
- ER Diagram
- Table Structure Definition
- Index Design
4. API 接口设计
4. API Interface Design
- 接口列表
- 请求/响应格式
- 错误码定义
- Interface List
- Request/Response Format
- Error Code Definition
5. 功能模块详设
5. Detailed Design of Functional Modules
- 模块 A
- 功能描述
- 实现方案
- 关键代码示例
- 模块 B
- ...
- Module A
- Function Description
- Implementation Scheme
- Key Code Examples
- Module B
- ...
6. 非功能需求
6. Non-Functional Requirements
- 性能要求
- 安全要求
- 可用性要求
- Performance Requirements
- Security Requirements
- Availability Requirements
7. 开发计划
7. Development Plan
- 里程碑
- 任务分解
- 风险评估
undefined- Milestones
- Task Decomposition
- Risk Assessment
undefined