技能文件类型
- 作者仓库星标 435
- 作者仓库 nvim
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @benbrastmckie · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Filetypes Skill
Thin wrapper that routes file format operations to the `filetypes-router-agent`, which then delegates to specialized sub-agents based on file type.
## Context Pointers
Reference (do not load eagerly):
- Path: `.opencode/context/core/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 agents, not this skill.
## Trigger Conditions
This skill activates when:
### Direct Invocation
- User explicitly runs `/convert` command
- User requests file format conversion in conversation
### Implicit Invocation (during task implementation)
When an implementing agent encounters any of these patterns:
**Plan step language patterns**:
- "Extract text from [file].pdf"
- "Extract content from [file]"
- "Convert [file] to markdown"
- "Convert [file] to PDF"
- "Generate PDF from [documentation/file]"
- "Read content from [file].docx"
- "Create PDF version of [file]"
- "Parse [file].pdf for content"
- "Import [file] content"
**File extension detection**:
- Source file has extension: `.pdf`, `.docx`, `.xlsx`, `.pptx`, `.html`
- Target mentions: "markdown", ".md", "PDF", ".pdf"
**Task description keywords**:
- "document conversion"
- "format transformation"
- "extract from PDF"
- "generate PDF"
### When NOT to trigger
Do not invoke for:
- Reading source code files (.py, .js, .lean, etc.)
- Viewing images without extraction
- Operations that don't involve format conversion
- Files already in the target format
- Spreadsheet-specific operations (use skill-spreadsheet)
- Presentation-specific operations (use skill-presentation)
---
## Execution
### 1. Input Validation
Validate required inputs:
- `source_path` - Must be provided and file must exist
- `output_path` - Optional, defaults to source dir with appropriate extension
```bash
# Validate source exists
if [ ! -f "$source_path" ]; then
return error "Source file not found: $source_path"
fi
# Determine output path if not provided
if [ -z "$output_path" ]; then
source_dir=$(dirname "$source_path")
source_base=$(basename "$source_path" | sed 's/\.[^.]*$//')
source_ext="${source_path##*.}"
# Infer target extension
case "$source_ext" in
pdf|docx|xlsx|pptx|html) output_path="${source_dir}/${source_base}.md" ;;
md) output_path="${source_dir}/${source_base}.pdf" ;;
*) return error "Cannot infer output format for .$source_ext" ;;
esac
fi
```
### 2. Context Preparation
Prepare delegation context:
```json
{
"source_path": "/absolute/path/to/source.pdf",
"output_path": "/absolute/path/to/output.md",
"metadata": {
"session_id": "sess_{timestamp}_{random}",
"delegation_depth": 1,
"delegation_path": ["orchestrator", "convert", "skill-filetypes"]
}
}
```
### 3. Invoke Router Agent
**CRITICAL**: You MUST use the **Task** tool to spawn the router agent.
**Required Tool Invocation**:
```
Tool: Task (NOT Skill)
Parameters:
- subagent_type: "filetypes-router-agent"
- prompt: [Include source_path, output_path, metadata]
- description: "Convert {source_path} to {output_path}"
```
**DO NOT** use `Skill(filetypes-router-agent)` - this will FAIL.
Agents live in `.opencode/agents/` or extension agent directories, not `.opencode/skills/`.
The Skill tool can only invoke skills from `.opencode/skills/`.
The router will:
- Detect source and target formats
- Select appropriate sub-agent (document, spreadsheet, presentation)
- Delegate to sub-agent for actual conversion
- Return standardized JSON result
### 4. Return Validation
Validate return matches `subagent-return.md` schema:
- Status is one of: converted, extracted, 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 `.opencode/context/core/formats/subagent-return.md` for full specification.
Expected successful return:
```json
{
"status": "converted",
"summary": "Successfully converted document.pdf to document.md using markitdown",
"artifacts": [
{
"type": "implementation",
"path": "/absolute/path/to/document.md",
"summary": "Converted markdown document"
}
],
"metadata": {
"session_id": "sess_...",
"agent_type": "document-agent",
"delegation_depth": 2,
"delegation_path": ["orchestrator", "convert", "skill-filetypes", "filetypes-router-agent", "document-agent"],
"tool_used": "markitdown"
},
"next_steps": "Review converted document"
}
```
---
## Error Handling
### Input Validation Errors
Return immediately with failed status if source file not found.
### Unsupported Format
Return failed status with clear message about supported formats.
### Router/Subagent Errors
Pass through the router/subagent's error return verbatim.
### Tool Not Available
Return failed status with installation instructions.
章节与文件索引
按说明文件中的顺序排列。
上下文指针
直接调用
隐式调用(任务执行期间)
何时不触发
1. 输入验证
文件/命令 -> filetypes-router-agent · .opencode/context/core/formats/subagent-return.md · /convert · .pdf · .docx · .xlsx · .pptx · .html
内容校验值 -> 71f26fa3eb6b
当前原文的自动摘译,尚未人工审校。
上下文指针
参考(不要急于加载): 路径:
.opencode/context/core/formats/subagent-return.md目的:返回验证 加载于:仅子代理执行 注意:此技能是一个薄包装。上下文由委托代理加载,而不是由该技能加载。直接调用
用户显式运行
/convert命令用户在对话中请求文件格式转换隐式调用(任务执行期间)
当实施代理遇到以下任何模式时: 规划步骤语言模式:“从 [文件].pdf 中提取文本”“从 [文件] 中提取内容”“将 [文件] 转换为 markdown”
何时不触发
请勿调用: 读取源代码文件(.py、.js、.lean 等) 查看图像而不提取 不涉及格式转换的操作 已采用目标格式的文件
1. 输入验证
验证所需的输入:
source_path- 必须提供且文件必须存在output_path- 可选,默认为具有适当扩展名的源目录