技能刮

数据 社区

技能解读

当前原文的自动摘译,尚未人工审校。

上下文指针

参考(不要急于加载): 路径:.claude/context/formats/subagent-return.md 目的:返回验证 加载于:仅子代理执行 注意:此技能是一个薄包装。上下文由委托代理加载,而不是由该技能加载。

直接调用

用户显式运行/scrape命令用户请求在对话中提取注释

隐式调用(任务执行期间)

当实施代理遇到以下任何模式时: 规划步骤语言模式:“从 [文件].pdf 中提取注释” “从 [文件].pdf 中提取突出显示” “从 [文件] 中提取注释”

何时不触发

请勿调用: 非 PDF 文件(.docx、.html、.txt 等) 一般文档转换(使用技能文件类型) 阅读没有注释上下文的 PDF 文本内容(使用技能文件类型) 对电子表格或演示文稿的操作(使用技能电子表格、技能演示文稿)

1. 输入验证

验证所需的输入: pdf_path - 必须提供,必须存在,必须是 .pdf 文件 output_path - 可选,默认为同一目录中的 {basename}_annotations.md annotation_types - 可选数组,默认为所有类型 output_format - 可选,默认为“markdown”

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
数据
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@benbrastmckie · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
需简单配置
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
  • 命令执行
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# Scrape Skill

Thin wrapper that routes PDF annotation extraction to the `scrape-agent`, which extracts highlights, comments, notes, and other annotations from PDF files.

## Context Pointers

Reference (do not load eagerly):
- Path: `.claude/context/formats/subagent-return.md`
- Purpose: Return validation
- Load at: Subagent execution only

Note: This skill is a thin wrapper. Context is loaded by the delegated agent, not this skill.

## Trigger Conditions

This skill activates when:

### Direct Invocation
- User explicitly runs `/scrape` command
- User requests annotation extraction in conversation

### Implicit Invocation (during task implementation)

When an implementing agent encounters any of these patterns:

**Plan step language patterns**:
- "Extract annotations from [file].pdf"
- "Extract highlights from [file].pdf"
- "Extract comments from [file]"
- "Scrape notes from [file].pdf"
- "Collect annotations in [file]"
- "Export PDF comments to markdown"
- "Gather highlights and notes from [file]"

**File extension detection**:
- Source file has extension: `.pdf`
- Target mentions: "annotations", "highlights", "comments", "notes"

**Task description keywords**:
- "annotation extraction"
- "PDF scraping"
- "extract highlights"
- "collect comments"
- "gather notes from PDF"

### When NOT to Trigger

Do not invoke for:
- Non-PDF files (.docx, .html, .txt, etc.)
- General document conversion (use skill-filetypes)
- Reading PDF text content without annotation context (use skill-filetypes)
- Operations on spreadsheets or presentations (use skill-spreadsheet, skill-presentation)

---

## Execution

### 1. Input Validation

Validate required inputs:
- `pdf_path` - Must be provided, must exist, must be a .pdf file
- `output_path` - Optional, defaults to `{basename}_annotations.md` in same directory
- `annotation_types` - Optional array, defaults to all types
- `output_format` - Optional, defaults to "markdown"

```bash
# Validate source exists
if [ ! -f "$pdf_path" ]; then
  return error "PDF file not found: $pdf_path"
fi

# Validate source is a PDF
if [[ "${pdf_path##*.}" != "pdf" ]]; then
  return error "Source must be a .pdf file: $pdf_path"
fi

# Determine output path if not provided
if [ -z "$output_path" ]; then
  source_dir=$(dirname "$pdf_path")
  source_base=$(basename "$pdf_path" .pdf)
  output_path="${source_dir}/${source_base}_annotations.md"
fi
```

### 2. Context Preparation

Prepare delegation context:

```json
{
  "pdf_path": "/absolute/path/to/document.pdf",
  "output_path": "/absolute/path/to/document_annotations.md",
  "annotation_types": ["highlights", "comments", "notes", "bookmarks"],
  "output_format": "markdown",
  "metadata": {
    "session_id": "sess_{timestamp}_{random}",
    "delegation_depth": 1,
    "delegation_path": ["orchestrator", "scrape", "skill-scrape"]
  }
}
```

### 3. Invoke Agent

**CRITICAL**: You MUST use the **Agent** tool to spawn the scrape agent.

**Required Tool Invocation**:
```
Tool: Agent (NOT Skill, NOT Plan)
Parameters:
  - subagent_type: "scrape-agent"
  - prompt: [Include pdf_path, output_path, annotation_types, output_format, metadata]
  - description: "Extract annotations from {pdf_path} to {output_path}"
```

**DO NOT** use `Skill(scrape-agent)` - this will FAIL.
Agents live in `.claude/agents/` or extension agent directories, not `.claude/skills/`.
The Skill tool can only invoke skills from `.claude/skills/`.

The agent will:
- Open the PDF and enumerate all annotation objects
- Filter by requested annotation types
- Format annotations according to output_format
- Write structured output to output_path
- Return standardized JSON result

### 4. Return Validation

Validate return matches `subagent-return.md` schema:
- Status is one of: scraped, partial, failed
- Summary is non-empty and <100 tokens
- Artifacts array present with output file path
- Metadata contains session_id, agent_type, delegation info

### 5. Return Propagation

Return validated result to caller without modification.

---

## Return Format

See `.claude/context/formats/subagent-return.md` for full specification.

Expected successful return:
```json
{
  "status": "scraped",
  "summary": "Extracted 42 annotations from document.pdf: 28 highlights, 10 comments, 4 notes",
  "artifacts": [
    {
      "type": "implementation",
      "path": "/absolute/path/to/document_annotations.md",
      "summary": "Extracted annotations in markdown format"
    }
  ],
  "metadata": {
    "session_id": "sess_...",
    "agent_type": "scrape-agent",
    "delegation_depth": 2,
    "delegation_path": ["orchestrator", "scrape", "skill-scrape", "scrape-agent"],
    "annotation_count": 42,
    "annotation_breakdown": {
      "highlights": 28,
      "comments": 10,
      "notes": 4
    }
  },
  "next_steps": "Review extracted annotations"
}
```

---

## Error Handling

### Input Validation Errors
Return immediately with failed status if PDF not found or not a .pdf file.

### Unsupported Format
Return failed status with clear message about supported annotation types.

### Agent Errors
Pass through the agent's error return verbatim.

### Tool Not Available
Return failed status with installation instructions for PDF annotation tools (e.g., pdfannots, PyMuPDF).

---

## MUST NOT

- Run the postflight step (git commit, status update) — that is the command's responsibility
- Modify the return from scrape-agent before propagating
- Load context files eagerly — only reference them when needed
- Use the Skill tool to invoke scrape-agent (use Agent tool instead)

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。