Github Repo Guide Pdf
Turn a GitHub repository into a usage-first Chinese guide and PDF.
Inputs
- - Accept a GitHub repo URL or
OWNER/REPO. - Default audience: user/operator, not maintainer or contributor.
- If the repo is a monorepo, has several products, or mixes SDK plus server plus docs, ask one scoping question before continuing.
Workflow
- 1. Normalize the repo identifier.
- Use
gh first for repo metadata. Fall back to browser only if gh is blocked or missing needed details. - Clone the repo into a temporary directory with shallow depth when possible.
- Inspect user-facing docs and entry points.
- Write a Chinese Markdown guide that teaches usage, not internals.
- Build a PDF with
scripts/build_pdf.py. - Reply with one short status line plus
MEDIA: lines for the generated files.
Collection Rules
Prefer these sources, in this order:
- 1.
README* and localized README files - INLINECODE7 and obvious user-guide files
- command reference and configuration docs
- INLINECODE8 ,
pyproject.toml, Cargo.toml, go.mod, or equivalent manifest files for install/runtime hints - examples, templates, or sample config files
- GitHub repo metadata from INLINECODE12
Use rg --files to find files quickly. Favor user-facing docs over architecture or internal implementation notes.
Analysis Rules
Focus on what a real user needs to learn:
- - what the project is
- who it is for
- prerequisites and install
- quick start
- main commands or workflows
- important config options
- when to use which mode or command
- troubleshooting and common pitfalls
- minimal cheat sheet
Avoid deep implementation detail unless it is required to explain usage.
If docs are weak, infer carefully from manifests, command docs, examples, and CLI entry points. State uncertainty briefly instead of pretending.
Preferred GitHub Retrieval
Use gh first.
Examples:
CODEBLOCK0
CODEBLOCK1
If gh is insufficient, use browser to inspect the GitHub page or linked docs site.
Recommended File Discovery
CODEBLOCK2
Read only the files needed to build the guide. Do not dump the whole repo into context.
Output Structure
Use this structure unless the repo clearly needs a different shape:
- 1. What it is
- Who it is for
- Installation and prerequisites
- Quick start
- Core workflows or commands
- Configuration and modes
- Recommended usage paths by scenario
- Troubleshooting and common mistakes
- One-page cheat sheet
- Sources used
Output Paths
Write outputs under the workspace media directory so they can be sent directly:
- - Markdown: INLINECODE17
- PDF: INLINECODE18
Use a short slug derived from the repo name.
PDF Build
After the Markdown guide is ready, run:
CODEBLOCK3
If font selection fails, rerun with:
CODEBLOCK4
Final Reply
After success, reply with:
- 1. one short sentence saying the guide is ready
- one
MEDIA: line for the Markdown file - one
MEDIA: line for the PDF file
Example:
CODEBLOCK5
Validation Checklist
Before replying, verify all of the following:
- - the repo URL or
OWNER/REPO was normalized correctly - the guide is usage-first, not implementation-first
- the Markdown file exists and is non-empty
- the PDF exists and is non-empty
- both files live under the workspace media directory
- the
MEDIA: paths match the actual files
Github Repo 指南 PDF
将 GitHub 仓库转化为以使用为导向的中文指南和 PDF。
输入
- - 接受 GitHub 仓库 URL 或 OWNER/REPO 格式。
- 默认受众:用户/操作者,而非维护者或贡献者。
- 如果仓库是单体仓库、包含多个产品、或混合了 SDK 加服务器加文档,请在继续前先提出一个范围界定问题。
工作流程
- 1. 规范化仓库标识符。
- 优先使用 gh 获取仓库元数据。仅在 gh 被屏蔽或缺少所需细节时回退到 browser。
- 尽可能以浅层克隆方式将仓库克隆到临时目录。
- 检查面向用户的文档和入口点。
- 编写中文 Markdown 指南,教授使用方法而非内部原理。
- 使用 scripts/build_pdf.py 构建 PDF。
- 回复一行简短状态信息,加上生成文件的 MEDIA: 行。
收集规则
按此顺序优先选择以下来源:
- 1. README* 和本地化 README 文件
- docs/ 和明显的用户指南文件
- 命令参考和配置文档
- package.json、pyproject.toml、Cargo.toml、go.mod 或等效清单文件(用于安装/运行时提示)
- 示例、模板或示例配置文件
- 来自 gh repo view 的 GitHub 仓库元数据
使用 rg --files 快速查找文件。优先选择面向用户的文档,而非架构或内部实现说明。
分析规则
关注真实用户需要学习的内容:
- - 项目是什么
- 面向谁
- 前提条件和安装
- 快速开始
- 主要命令或工作流程
- 重要配置选项
- 何时使用哪种模式或命令
- 故障排除和常见陷阱
- 精简速查表
除非需要解释用法,否则避免深入实现细节。
如果文档薄弱,请从清单文件、命令文档、示例和 CLI 入口点谨慎推断。简要说明不确定性,而非假装确定。
首选 GitHub 检索
优先使用 gh。
示例:
bash
gh repo view OWNER/REPO --json name,description,url,defaultBranchRef,licenseInfo,stargazerCount,forkCount,updatedAt
bash
gh repo clone OWNER/REPO /tmp/repo -- --depth=1
如果 gh 不足,使用 browser 检查 GitHub 页面或关联的文档站点。
推荐的文件发现
bash
rg --files . | rg (^README|^readme|^docs/|guide|manual|command|config|example|package\.json$|pyproject\.toml$|Cargo\.toml$|go\.mod$)
仅读取构建指南所需的文件。不要将整个仓库内容放入上下文。
输出结构
除非仓库明显需要不同结构,否则使用此结构:
- 1. 它是什么
- 面向谁
- 安装和前提条件
- 快速开始
- 核心工作流程或命令
- 配置和模式
- 按场景推荐的使用路径
- 故障排除和常见错误
- 一页速查表
- 使用的来源
输出路径
将输出写入工作区媒体目录,以便直接发送:
- - Markdown:media/-user-guide-zh-YYYYMMDD-HHMMSS.md
- PDF:media/-user-guide-zh-YYYYMMDD-HHMMSS.pdf
使用从仓库名称派生的简短 slug。
PDF 构建
Markdown 指南准备就绪后,运行:
bash
python3 skills/github-repo-guide-pdf/scripts/build_pdf.py \
--markdown /absolute/path/to/guide.md \
--output /absolute/path/to/guide.pdf \
--title
\
--source-url https://github.com/OWNER/REPO
如果字体选择失败,重新运行并添加:
bash
--mainfont Hiragino Sans GB
最终回复
成功后,回复:
- 1. 一句简短说明指南已准备就绪
- Markdown 文件的一行 MEDIA:
- PDF 文件的一行 MEDIA:
示例:
text
完成。我已将仓库转化为中文使用指南和 PDF。
MEDIA:media/example-user-guide-zh-20260328-150500.md
MEDIA:media/example-user-guide-zh-20260328-150500.pdf
验证清单
回复前,请确认以下所有内容:
- - 仓库 URL 或 OWNER/REPO 已正确规范化
- 指南以使用为导向,而非以实现为导向
- Markdown 文件存在且非空
- PDF 文件存在且非空
- 两个文件均位于工作区媒体目录下
- MEDIA: 路径与实际文件匹配