关于 tabular-review-lawvable
Tabular Review 将多个 PDF 和 Word 文档中的指定字段提取到带引用的 Excel 矩阵中。它适用于需要并行处理并保留可追溯来源的文档审查流程。
主要功能
- 01自定义提取字段
- 02发现 PDF 和 Word 文档
- 03并行处理文档
- 04记录页码和段落引用
- 05生成带来源链接的 Excel 矩阵
适用场景
- 01比较多份合同的关键条款
- 02制作带引用的文档审查表
- 03批量处理 PDF 和 Word 文件
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ lawve-ai/ awesome-legal-skills --skill tabular-review-lawvable安装后在 Claude Code 中输入/tabular-review-lawvable确认已加载。
附带文件LICENSE.txtREADME.md
详细介绍
表格审阅
从多个文档中提取结构化数据,并整理成带引用的 Excel 矩阵。
必需技能
- pdf - 用于读取 PDF 文档
- docx - 用于读取 Word 文档
- xlsx - 用于创建 Excel 输出文件
工作流
步骤 1:收集用户需求
使用 AskUserQuestion 收集:
- 文档文件夹路径 - 文档位于何处?
- 输出文件名 - Excel 文件的名称
- 要提取的列 - 从每份文档中提取哪些信息
列定义示例:
- Parties: Names of all parties to the agreement
- Effective Date: When the agreement becomes effective
- Term: Duration of the agreement
- Governing Law: Jurisdiction for disputes
步骤 2:查找文档
使用 Glob 查找所有文档:
Glob(pattern: "**/*.pdf", path: "<folder>")
Glob(pattern: "**/*.docx", path: "<folder>")
步骤 3:并行处理文档
启动后台 Agent,并行处理文档。每个 Agent:
- 使用 pdf 或 docx 技能读取分配的文档
- 提取每列的值
- 记录页码/段落引用
- 返回结构化 JSON
启动 Agent:
Task(
prompt: "<agent_prompt>",
subagent_type: "general-purpose",
run_in_background: true
)
Agent 提示词模板:
You are processing documents for a tabular review.
DOCUMENTS TO PROCESS:
<list of document paths>
COLUMNS TO EXTRACT:
<column definitions>
For each document:
1. Read the document using the pdf skill (for .pdf) or docx skill (for .docx)
2. Extract the requested information for each column
3. Note the page number (PDF) or section (DOCX) where you found the information
4. Include a brief quote (30-50 chars) showing the source text
Return your results as JSON:
{
"results": [
{
"document": "<filename>",
"path": "<absolute_path>",
"extractions": [
{
"column": "<column_name>",
"value": "<extracted_value>",
"page": <page_number>,
"quote": "<brief_context_quote>"
}
]
}
]
}
If you cannot find information for a column, set value to "Not found" and explain in the quote field.
分配策略:
- 对于 N 份文档和 M 个 Agent,每个 Agent 处理 ceil(N/M) 份文档
- 默认最多使用 10 个 Agent
- 根据文档数量调整
步骤 4:收集结果
等待所有后台 Agent 完成:
TaskOutput(task_id: "<agent_id>", block: true)
将所有结果汇总为一个文档提取结果数组。
步骤 5:生成 Excel 输出文件
调用 xlsx 技能 创建输出文件:
Create an Excel workbook at <output_path>:
SHEET 1: "Document Review"
- Header row: Document | <Column1> | <Column2> | ...
- Data rows: One row per document
For each extraction cell:
- Cell value: The extracted text
- Cell hyperlink: file://<document_path>#page=<N> (for PDFs)
- Cell comment: "Page <N>: '<quote>'"
SHEET 2: "Summary"
- Total documents: <count>
- Documents processed: <count>
- Extraction date: <today>
JSON 架构
提取结果格式:
{
"document": "Contract_ABC.pdf",
"path": "/path/to/Contract_ABC.pdf",
"extractions": [
{
"column": "Parties",
"value": "Acme Corp and Beta Inc",
"page": 1,
"quote": "entered into between Acme Corp and Beta Inc"
},
{
"column": "Effective Date",
"value": "January 15, 2025",
"page": 1,
"quote": "effective as of January 15, 2025"
}
]
}
Excel 输出格式
带引用的单元格:
- 值:"Acme Corp and Beta Inc"
- 超链接:
file:///path/to/Contract_ABC.pdf#page=1 - 批注:
Page 1: "entered into between Acme Corp and Beta Inc"
颜色编码(可选):
- 绿色:已找到值,且置信度高
- 黄色:已找到值,但不确定
- 红色:未找到值
错误处理
| 情况 | 操作 |
|---|---|
| 文档无法读取 | 记录错误,将该行标记为失败,然后继续 |
| 未找到列 | 将值设为 "Not found",并在批注中说明 |
| Agent 超时 | 收集部分结果,并注明未完成 |
| 缺少技能 | 提示用户安装所需技能 |
使用示例
User: I want to do a tabular review of my contracts
Claude: [Uses AskUserQuestion]
- What folder contains your documents?
- What should I name the output Excel file?
- What columns do you want to extract?
User: ~/Contracts, review.xlsx, Parties/Date/Term/Governing Law
Claude: [Discovers 15 documents via Glob]
Claude: [Launches 5 background agents, 3 docs each]
Claude: [Collects results via TaskOutput]
Claude: [Creates review.xlsx via xlsx skill]
Output: review.xlsx with 15 rows, 4 columns, hyperlinks and citations
评论
支持 Markdown