toc-section-parsing

用于长文档章节树的目录与章节结构解析原子 skill,适用于通用行业文档解析场景。

105 stars

Best use case

toc-section-parsing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

用于长文档章节树的目录与章节结构解析原子 skill,适用于通用行业文档解析场景。

Teams using toc-section-parsing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/toc-section-parsing/SKILL.md --create-dirs "https://raw.githubusercontent.com/aifinlab/FinClaw/main/skills/archive/toc-section-parsing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/toc-section-parsing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How toc-section-parsing Compares

Feature / Agenttoc-section-parsingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

用于长文档章节树的目录与章节结构解析原子 skill,适用于通用行业文档解析场景。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 目录与章节结构解析 Skill

## 数据来源

本 Skill 支持多种长文档输入格式,核心数据来源包括:

### 1. 文档类型
- **报告文档**:年度报告、研究报告、分析报告
- **书籍文档**:书籍、手册、指南
- **法律文档**:法律条文、法规文件、合同文档
- **技术文档**:技术规范、技术文档、用户手册

### 2. 文档格式
- **PDF格式**:PDF格式的长文档
- **Word格式**:Word格式的长文档
- **HTML格式**:网页格式的长文档
- **Markdown格式**:Markdown格式的长文档

### 3. 文档特征
- **文档长度**:长文档(>50页)、超长文档(>200页)
- **章节结构**:多级章节、复杂层级结构
- **目录格式**:标准目录、自定义目录格式
- **文档语言**:中文、英文、多语言混合

### 4. 数据格式要求
- **文件路径**:本地文件路径或网络文件URL
- **文件编码**:UTF-8、GBK、GB2312等
- **文件权限**:需要读取权限

> 说明:本 Skill 不包含文档采集功能,需要用户提供长文档文件。建议文档格式规范,以便进行准确的目录和章节结构解析。

---

## 功能

本 Skill 提供全面的目录与章节结构解析能力,涵盖多种解析功能:

### 1. 目录识别
- **目录定位**:定位文档中的目录位置
- **目录结构识别**:识别目录的层级结构
- **目录项提取**:提取目录项和页码信息
- **目录格式识别**:识别目录的格式和样式

### 2. 章节识别
- **章节标题识别**:识别文档中的章节标题
- **章节层级识别**:识别章节的层级结构
- **章节编号识别**:识别章节的编号规则
- **章节位置定位**:定位章节在文档中的位置

### 3. 章节树构建
- **章节树生成**:生成完整的章节树结构
- **章节关系识别**:识别章节之间的父子关系
- **章节层级标注**:标注章节的层级级别
- **章节路径生成**:生成章节的完整路径

### 4. 章节内容提取
- **章节内容提取**:提取章节的具体内容
- **章节边界识别**:识别章节的起始和结束位置
- **章节摘要生成**:生成章节的摘要
- **章节关键词提取**:提取章节的关键词

### 5. 章节导航
- **章节导航生成**:生成章节导航结构
- **章节跳转链接**:生成章节跳转链接
- **章节索引构建**:构建章节索引
- **章节搜索支持**:支持章节搜索功能

### 6. 高级处理功能
- **目录验证**:验证目录的准确性
- **章节完整性检查**:检查章节的完整性
- **章节结构标准化**:标准化章节结构
- **章节报告生成**:生成章节结构报告

---

## 使用示例

### 输出示例
```json
{
  "source_info": {
    "document_id": "DOC001",
    "document_type": "annual_report",
    "source_file": "annual_report.pdf",
    "page_count": 200
  },
  "table_of_contents": {
    "toc_location": {
      "start_page": 3,
      "end_page": 10
    },
    "toc_items": [
      {
        "level": 1,
        "title": "第一章 公司概况",
        "page": 15,
        "section_id": "SEC001"
      },
      {
        "level": 2,
        "title": "1.1 公司基本信息",
        "page": 15,
        "section_id": "SEC002"
      },
      {
        "level": 1,
        "title": "第二章 财务数据",
        "page": 50,
        "section_id": "SEC003"
      }
    ]
  },
  "section_tree": {
    "root": {
      "section_id": "ROOT",
      "title": "文档根节点",
      "level": 0,
      "children": [
        {
          "section_id": "SEC001",
          "title": "第一章 公司概况",
          "level": 1,
          "page": 15,
          "path": ["第一章 公司概况"],
          "children": [
            {
              "section_id": "SEC002",
              "title": "1.1 公司基本信息",
              "level": 2,
              "page": 15,
              "path": ["第一章 公司概况", "1.1 公司基本信息"],
              "children": []
            }
          ]
        },
        {
          "section_id": "SEC003",
          "title": "第二章 财务数据",
          "level": 1,
          "page": 50,
          "path": ["第二章 财务数据"],
          "children": []
        }
      ]
    }
  },
  "sections": [
    {
      "section_id": "SEC001",
      "title": "第一章 公司概况",
      "level": 1,
      "start_page": 15,
      "end_page": 49,
      "content_preview": "公司概况内容...",
      "keywords": ["公司", "概况", "基本信息"]
    }
  ],
  "statistics": {
    "total_sections": 20,
    "max_level": 3,
    "average_section_length": 10,
    "parsing_confidence": 0.94
  }
}
```

---

## 注意事项与限制

### 1. 文档格式要求
- 标准格式文档解析准确率较高
- 非标准格式可能影响解析
- 扫描版文档需要OCR支持

### 2. 目录识别准确性
- 标准目录格式识别准确率较高
- 非标准目录可能需要人工处理
- 复杂目录可能需要人工分析

### 3. 章节识别准确性
- 标准章节格式识别准确率较高
- 非标准章节可能需要人工处理
- 复杂章节结构可能需要人工分析

### 4. 章节层级
- 标准层级结构识别准确率较高
- 非标准层级可能需要人工处理
- 深层嵌套可能需要特殊处理

### 5. 使用限制
- 本 Skill 不包含文档编辑功能
- 解析结果需要人工复核
- 复杂文档可能需要人工处理

---

## 参考资料
- 见 references/ 目录中的相关文档,包括:
  - 目录与章节结构解析方法手册
  - 章节识别算法说明
  - 章节树构建指南
  - 性能优化指南