Agent安装
- 作者仓库星标 21,713
- 叉子 2,492
- 作者更新于 2026年6月13日 05:00
- 作者仓库 baoyu-skills
- 领域
- 文档
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 92 / 100 · 已通过审计
- 作者 / 版本 / 许可
- @JimLiu · v1.61.0 · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 底层运行要求
- Bun
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: baoyu-url-to-markdown
description: Fetch any URL and convert to markdown using baoyu-fetch CLI (Chrome CDP with site-specific adapt…
category: 文档
runtime: Bun
---
# baoyu-url-to-markdown 输出预览
## PART A: 任务判断
- 适用问题:PRD、RFC、README、项目说明或知识库整理。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“User Input Tools / CLI Setup / Preferences (EXTEND.md)”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于PRD、RFC、README、项目说明或知识库整理,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“User Input Tools / CLI Setup / Preferences (EXTEND.md)”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文没有稳定的斜杠命令要求。安装验证后通常全局生效,直接在对话里点名这个 Skill 并描述任务即可。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“User Input Tools / CLI Setup / Preferences (EXTEND.md)”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: baoyu-url-to-markdown
description: Fetch any URL and convert to markdown using baoyu-fetch CLI (Chrome CDP with site-specific adapt…
category: 文档
source: JimLiu/baoyu-skills
---
# baoyu-url-to-markdown
## 什么时候使用
- 给一个网页地址就把正文抓回来转成干净 Markdown——图片、代码块、引用结构都保留 适合处理README、PRD、RFC、教程和知识库文档,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆…
- 面向PRD、RFC、README、项目说明或知识库整理,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「User Input Tools / CLI Setup / Preferences (EXTEND.md)」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "baoyu-url-to-markdown" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> User Input Tools / CLI Setup / Preferences (EXTEND.md)
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Bun | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} URL 转 Markdown
通过 baoyu-fetch CLI(Chrome CDP + 站点特定适配器)抓取任何 URL 并将其转换为干净的 Markdown。
用户输入工具
当此技能提示用户时,请遵循以下工具选择规则(优先级顺序):
- 优先使用当前 Agent 运行时公开的内置用户输入工具——例如
AskUserQuestion、request_user_input、clarify、ask_user或任何等效工具。 - 回退方案:如果不存在此类工具,则发出带编号的纯文本消息,并要求用户回复所选的编号/答案以回答每个问题。
- 批处理:如果工具支持每次调用多个问题,则将所有适用问题合并到一次调用中;如果只支持单个问题,则按优先级顺序逐一提问。
下面具体的 AskUserQuestion 引用是示例——在其他运行时中请替换为本地等效项。
CLI 设置
重要提示:CLI 源代码位于 {baseDir}/scripts/lib 中。scripts/package.json 仅安装第三方运行时依赖项。
Agent 执行说明:
- 确定此 SKILL.md 文件的目录路径为
{baseDir} - 解析
${BUN}运行时:如果bun已安装 →bun;否则建议安装 Bun - 如果
{baseDir}/scripts/node_modules不存在,运行${BUN} install --cwd {baseDir}/scripts ${READER}={baseDir}/scripts/baoyu-fetch- 将此文档中所有
${READER}替换为解析后的值
首选项 (EXTEND.md)
按优先级顺序检查 EXTEND.md——找到的第一个生效:
| 优先级 | 路径 | 范围 |
|---|---|---|
| 1 | .baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
项目 |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
用户主目录 |
| 结果 | 操作 |
|---|---|
| 找到 | 读取、解析、应用设置 |
| 未找到 | 必须运行首次设置(见下文)——不要静默创建默认值 |
EXTEND.md 支持:默认下载媒体、默认输出目录。
首次设置 ⛔ 阻塞
当未找到 EXTEND.md 时,您必须使用 AskUserQuestion 收集首选项,然后才能创建 EXTEND.md。切勿使用静默默认值创建 EXTEND.md。在设置完成之前,生成操作将被阻塞。将所有三个问题合并到一次调用中:
- 问题 1 — 媒体(标题“媒体”): “如何处理页面中的图片和视频?”
- “每次询问(推荐)”——每次保存后提示
- “始终下载”——下载到本地
imgs/和videos/ - “从不下载”——保留远程 URL
- 问题 2 — 输出(标题“输出”): “默认输出目录?”
- “url-to-markdown(推荐)”——保存到
./url-to-markdown/{domain}/{slug}.md - 用户可以选择“其他”并输入自定义路径
- “url-to-markdown(推荐)”——保存到
- 问题 3 — 保存(标题“保存”): “将首选项保存到何处?”
- “用户(推荐)”——
~/.baoyu-skills/(所有项目) - “项目”——
.baoyu-skills/(仅此项目)
- “用户(推荐)”——
回答后,写入 EXTEND.md,确认“首选项已保存到 [路径]”,然后继续。
完整模板:references/config/first-time-setup.md。
支持的键
| 键 | 默认值 | 值 | 描述 |
|---|---|---|---|
download_media |
ask |
ask / 1 / 0 |
ask = 每次提示,1 = 始终,0 = 从不 |
default_output_dir |
空 | 路径或空 | 默认输出目录(空 = ./url-to-markdown/) |
EXTEND.md → CLI 映射:
| EXTEND.md 键 | CLI 参数 | 备注 |
|---|---|---|
download_media: 1 |
--download-media |
需要设置 --output |
default_output_dir: ./posts/ |
Agent 构建 --output ./posts/{domain}/{slug}.md |
Agent 生成路径,而非直接的标志 |
值优先级:CLI 参数 → EXTEND.md → 技能默认值。
用法
# 默认:无头捕获,markdown 输出到 stdout
${READER} <url>
# 保存到文件
${READER} <url> --output article.md
# 保存并下载媒体
${READER} <url> --output article.md --download-media
# 等待交互(登录/验证码)——自动检测并继续
${READER} <url> --wait-for interaction --output article.md
# 等待交互——手动控制(按 Enter 键继续)
${READER} <url> --wait-for force --output article.md
# JSON 输出
${READER} <url> --format json --output article.json
# 强制使用特定适配器
${READER} <url> --adapter youtube --output transcript.md
选项
| 选项 | 描述 |
|---|---|
<url> |
要抓取的 URL |
--output <path> |
输出文件路径(默认:stdout) |
--format <type> |
输出格式:markdown(默认)或 json |
--json |
--format json 的简写 |
--adapter <name> |
强制适配器:x、youtube、hn 或 generic(默认:自动检测) |
--headless |
强制无头 Chrome(无可见窗口) |
--wait-for <mode> |
交互等待模式:none(默认)、interaction 或 force |
--wait-for-interaction |
--wait-for interaction 的别名 |
--wait-for-login |
--wait-for interaction 的别名 |
--timeout <ms> |
页面加载超时(默认:30000) |
--interaction-timeout <ms> |
登录/验证码等待超时(默认:600000 = 10 分钟) |
--interaction-poll-interval <ms> |
交互检查的轮询间隔(默认:1500) |
--download-media |
将图片/视频下载到本地 imgs/ 和 videos/,重写 markdown 链接。需要 --output |
--media-dir <dir> |
下载媒体的基础目录(默认:与 --output 目录相同) |
--cdp-url <url> |
重用现有 Chrome DevTools Protocol 端点 |
--browser-path <path> |
自定义 Chrome/Chromium 二进制文件路径 |
--chrome-profile-dir <path> |
Chrome 用户数据目录(默认:BAOYU_CHROME_PROFILE_DIR 环境变量或 ./baoyu-skills/chrome-profile) |
--debug-dir <dir> |
写入调试工件(document.json、markdown.md、page.html、network.json) |
Agent 质量门
关键:将默认的无头捕获视为临时方案。某些站点在无头模式下渲染不同,可能会在不使 CLI 失败的情况下静默返回低质量内容。
每次无头运行后,检查保存的 markdown。有关完整的检查清单、恢复工作流程和捕获模式表,请参阅 references/quality-gate.md。当运行结果可疑或用户询问登录/验证码处理时,请阅读此文件。
输出路径生成
Agent 必须构建输出文件路径——baoyu-fetch 不会自动生成路径。
算法:
- 从 EXTEND.md
default_output_dir或默认的./url-to-markdown/确定基础目录 - 从 URL 中提取域名(例如
example.com) - 从 URL 路径或页面标题生成 slug(kebab-case,2-6 个单词)
- 构建:
{base_dir}/{domain}/{slug}/{slug}.md——每个 URL 都有自己的目录,以便媒体文件保持隔离 - 冲突解决:追加时间戳
{slug}-YYYYMMDD-HHMMSS/{slug}-YYYYMMDD-HHMMSS.md
将构建的路径传递给 --output。媒体文件(--download-media)保存到 markdown 文件旁边的子目录中,使每个 URL 的资产自包含。
适配器和媒体
有关适配器目录(X、YouTube、Hacker News、通用)、每个适配器的说明、媒体下载流程(ask / 始终 / 从不)以及 JSON 输出模式,请参阅 references/adapters.md。在回答特定于适配器的问题或处理媒体提示之前,请阅读此文件。
环境变量
| 变量 | 描述 |
|---|---|
BAOYU_CHROME_PROFILE_DIR |
Chrome 用户数据目录(也可以使用 --chrome-profile-dir) |
故障排除:未找到 Chrome → 使用 --browser-path。超时 → 增加 --timeout。登录/验证码 → --wait-for interaction。调试 → --debug-dir 以检查捕获的 HTML 和网络日志。
扩展支持
通过 EXTEND.md 进行自定义配置。有关路径和支持的键,请参阅上面的首选项部分。
URL to Markdown
Fetches any URL via baoyu-fetch CLI (Chrome CDP + site-specific adapters) and converts it to clean markdown.
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
- Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.
CLI Setup
Important: The CLI source is vendored in {baseDir}/scripts/lib. scripts/package.json installs only third-party runtime dependencies.
Agent Execution Instructions:
- Determine this SKILL.md file's directory path as
{baseDir} - Resolve
${BUN}runtime: ifbuninstalled →bun; else suggest installing Bun - If
{baseDir}/scripts/node_modulesdoes not exist, run${BUN} install --cwd {baseDir}/scripts ${READER}={baseDir}/scripts/baoyu-fetch- Replace all
${READER}in this document with the resolved value
Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-url-to-markdown/EXTEND.md |
User home |
| Result | Action |
|---|---|
| Found | Read, parse, apply settings |
| Not found | MUST run first-time setup (see below) — do NOT silently create defaults |
EXTEND.md supports: download media by default, default output directory.
First-Time Setup ⛔ BLOCKING
When EXTEND.md is not found, you MUST use AskUserQuestion to gather preferences before creating EXTEND.md. NEVER create EXTEND.md with silent defaults. Generation is BLOCKED until setup completes. Batch all three questions into a single call:
- Q1 — Media (header "Media"): "How to handle images and videos in pages?"
- "Ask each time (Recommended)" — Prompt after each save
- "Always download" — Download to local
imgs/andvideos/ - "Never download" — Keep remote URLs
- Q2 — Output (header "Output"): "Default output directory?"
- "url-to-markdown (Recommended)" — Save to
./url-to-markdown/{domain}/{slug}.md - User may pick "Other" and type a custom path
- "url-to-markdown (Recommended)" — Save to
- Q3 — Save (header "Save"): "Where to save preferences?"
- "User (Recommended)" —
~/.baoyu-skills/(all projects) - "Project" —
.baoyu-skills/(this project only)
- "User (Recommended)" —
After answers, write EXTEND.md, confirm "Preferences saved to [path]", then continue.
Full template: references/config/first-time-setup.md.
Supported Keys
| Key | Default | Values | Description |
|---|---|---|---|
download_media |
ask |
ask / 1 / 0 |
ask = prompt each time, 1 = always, 0 = never |
default_output_dir |
empty | path or empty | Default output directory (empty = ./url-to-markdown/) |
EXTEND.md → CLI mapping:
| EXTEND.md key | CLI argument | Notes |
|---|---|---|
download_media: 1 |
--download-media |
Requires --output to be set |
default_output_dir: ./posts/ |
Agent constructs --output ./posts/{domain}/{slug}.md |
Agent generates path, not a direct flag |
Value priority: CLI arguments → EXTEND.md → skill defaults.
Usage
# Default: headless capture, markdown to stdout
${READER} <url>
# Save to file
${READER} <url> --output article.md
# Save with media download
${READER} <url> --output article.md --download-media
# Wait for interaction (login/CAPTCHA) — auto-detect and continue
${READER} <url> --wait-for interaction --output article.md
# Wait for interaction — manual control (Enter to continue)
${READER} <url> --wait-for force --output article.md
# JSON output
${READER} <url> --format json --output article.json
# Force specific adapter
${READER} <url> --adapter youtube --output transcript.md
Options
| Option | Description |
|---|---|
<url> |
URL to fetch |
--output <path> |
Output file path (default: stdout) |
--format <type> |
Output format: markdown (default) or json |
--json |
Shorthand for --format json |
--adapter <name> |
Force adapter: x, youtube, hn, or generic (default: auto-detect) |
--headless |
Force headless Chrome (no visible window) |
--wait-for <mode> |
Interaction wait mode: none (default), interaction, or force |
--wait-for-interaction |
Alias for --wait-for interaction |
--wait-for-login |
Alias for --wait-for interaction |
--timeout <ms> |
Page load timeout (default: 30000) |
--interaction-timeout <ms> |
Login/CAPTCHA wait timeout (default: 600000 = 10 min) |
--interaction-poll-interval <ms> |
Poll interval for interaction checks (default: 1500) |
--download-media |
Download images/videos to local imgs/ and videos/, rewrite markdown links. Requires --output |
--media-dir <dir> |
Base directory for downloaded media (default: same as --output directory) |
--cdp-url <url> |
Reuse existing Chrome DevTools Protocol endpoint |
--browser-path <path> |
Custom Chrome/Chromium binary path |
--chrome-profile-dir <path> |
Chrome user data directory (default: BAOYU_CHROME_PROFILE_DIR env or ./baoyu-skills/chrome-profile) |
--debug-dir <dir> |
Write debug artifacts (document.json, markdown.md, page.html, network.json) |
Agent Quality Gate
CRITICAL: treat default headless capture as provisional. Some sites render differently in headless mode and can silently return low-quality content without failing the CLI.
After every headless run, inspect the saved markdown. See references/quality-gate.md for the full checklist, recovery workflow, and capture-mode table. Read it whenever a run looks suspicious or the user asks about login/CAPTCHA handling.
Output Path Generation
The agent must construct the output file path — baoyu-fetch does not auto-generate paths.
Algorithm:
- Determine base directory from EXTEND.md
default_output_diror default./url-to-markdown/ - Extract domain from URL (e.g.,
example.com) - Generate slug from URL path or page title (kebab-case, 2-6 words)
- Construct:
{base_dir}/{domain}/{slug}/{slug}.md— each URL gets its own directory so media files stay isolated - Conflict resolution: append timestamp
{slug}-YYYYMMDD-HHMMSS/{slug}-YYYYMMDD-HHMMSS.md
Pass the constructed path to --output. Media files (--download-media) are saved into subdirectories next to the markdown file, keeping each URL's assets self-contained.
Adapters & Media
See references/adapters.md for the adapter catalog (X, YouTube, Hacker News, generic), per-adapter notes, the media download flow (ask / always / never), and the JSON output schema. Read it before answering adapter-specific questions or handling media prompts.
Environment Variables
| Variable | Description |
|---|---|
BAOYU_CHROME_PROFILE_DIR |
Chrome user data directory (can also use --chrome-profile-dir) |
Troubleshooting: Chrome not found → use --browser-path. Timeout → increase --timeout. Login/CAPTCHA → --wait-for interaction. Debug → --debug-dir to inspect captured HTML and network logs.
Extension Support
Custom configurations via EXTEND.md. See Preferences section above for paths and supported keys.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核