editing-documents
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEditing Documents with the FPR Editorial Agent
借助FPR编辑Agent处理文档
You are the FPR Editorial Agent. You apply Foundation for Puerto Rico's style guides to Word documents, producing track changes that authors can accept or reject in Word.
你是FPR编辑Agent。你需要将波多黎各基金会(FPR)的风格指南应用到Word文档中,生成作者可在Word中接受或拒绝的修订标记。
Auto-Setup (runs once)
自动设置(仅运行一次)
Before running the CLI for the first time, ensure the Python environment is ready. The plugin is self-contained — all source code and knowledge base files are included.
Find the plugin root (the directory containing ). It is the base directory of this skill, two levels up from this SKILL.md file.
src/fpr_edit.pybash
PLUGIN_ROOT="<plugin-root>"首次运行CLI前,请确保Python环境已准备就绪。该插件为独立封装,包含所有源代码和知识库文件。
找到插件根目录(包含的目录)。它是本技能的基础目录,位于当前SKILL.md文件的上两级目录。
src/fpr_edit.pybash
PLUGIN_ROOT="<plugin-root>"Check if venv exists; if not, create it and install dependencies
Check if venv exists; if not, create it and install dependencies
if [ ! -d "$PLUGIN_ROOT/.venv" ]; then
python3 -m venv "$PLUGIN_ROOT/.venv"
"$PLUGIN_ROOT/.venv/bin/pip" install -r "$PLUGIN_ROOT/requirements.txt"
fi
All subsequent commands use the plugin's own Python:
```bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" ...If the venv already exists, skip setup and go straight to running the CLI.
if [ ! -d "$PLUGIN_ROOT/.venv" ]; then
python3 -m venv "$PLUGIN_ROOT/.venv"
"$PLUGIN_ROOT/.venv/bin/pip" install -r "$PLUGIN_ROOT/requirements.txt"
fi
后续所有命令均使用插件自带的Python环境:
```bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" ...若venv已存在,可跳过设置步骤直接运行CLI。
Quick Start
快速开始
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" <file.docx> --project <ERSV|WCRP> --mode <light|deep|audit>bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" <file.docx> --project <ERSV|WCRP> --mode <light|deep|audit>Step-by-Step Workflow
分步工作流
1. Determine the project
1. 确定项目类型
If the user did not specify a project, infer it:
- Filename contains "ERSV", "microsite", "visitor", "economy", "tourism" →
ERSV - Filename contains "WCRP", "resilience", "resiliencia", "comunitario", "community" →
WCRP - Otherwise: ask the user which project to use.
若用户未指定项目类型,按以下规则推断:
- 文件名包含"ERSV"、"microsite"、"visitor"、"economy"、"tourism" → 采用项目规则
ERSV - 文件名包含"WCRP"、"resilience"、"resiliencia"、"comunitario"、"community" → 采用项目规则
WCRP - 否则:询问用户应使用哪种项目规则。
2. Determine the mode
2. 确定处理模式
| Mode | When to use |
|---|---|
| Quick pass. Only applies deterministic term bank substitutions. Default. |
| Full edit. Deterministic + Claude evaluates every prose paragraph against FPR style rules. |
| Diagnostic only. Same analysis as deep, but does not modify the document. |
If the user says "just the basics" or "quick edit" → .
If the user says "full edit", "thorough", or "deep review" → .
If the user says "just check it" or "audit" → .
lightdeepaudit| 模式 | 使用场景 |
|---|---|
| 快速处理。仅应用确定性术语库替换。为默认模式。 |
| 完整编辑。确定性处理 + Claude根据FPR风格规则评估每个散文段落。 |
| 仅诊断。执行与deep模式相同的分析,但不修改文档。 |
若用户提及“仅基础处理”或“快速编辑” → 采用模式。
若用户提及“完整编辑”、“全面处理”或“深度审阅” → 采用模式。
若用户提及“仅检查”或“审计” → 采用模式。
lightdeepaudit3. Resolve the file path
3. 确认文件路径
Verify the file exists. If the user provides a relative path, resolve it against the current working directory. If the file is not found, check common locations: Desktop, Downloads, Documents.
验证文件是否存在。若用户提供相对路径,基于当前工作目录解析。若未找到文件,检查常见位置:桌面(Desktop)、下载(Downloads)、文档(Documents)。
4. Run the CLI
4. 运行CLI
For light mode:
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode lightReport the results to the user: number of track changes applied, output file path.
For deep mode — Step A (deterministic + export heuristic tasks):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deepThis produces:
- The edited document (with deterministic changes)
- A file with paragraphs to evaluate
_heuristic_tasks.json
For deep mode — Step B (evaluate heuristic tasks):
After Step A completes, invoke the skill to process the heuristic tasks JSON. That skill will:
evaluating-heuristics- Read each paragraph and its prompt
- Evaluate against FPR style rules
- Produce a
_heuristic_results.json
For deep mode — Step C (apply heuristic results):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep --apply-heuristic "<results.json>"Report the final results to the user.
轻量模式运行命令:
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode light向用户报告结果:已应用的修订标记数量、输出文件路径。
深度模式 — 步骤A(确定性处理 + 导出启发式任务):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep此步骤将生成:
- 已编辑文档(包含确定性修改)
- 包含待评估段落的文件
_heuristic_tasks.json
深度模式 — 步骤B(评估启发式任务):
步骤A完成后,调用技能处理启发式任务JSON文件。该技能将:
evaluating-heuristics- 读取每个段落及其提示语
- 根据FPR风格规则进行评估
- 生成文件
_heuristic_results.json
深度模式 — 步骤C(应用启发式评估结果):
bash
"$PLUGIN_ROOT/.venv/bin/python" "$PLUGIN_ROOT/src/fpr_edit.py" "<file.docx>" --project <PROJECT> --mode deep --apply-heuristic "<results.json>"向用户报告最终结果。
5. Report results
5. 报告结果
After completion, tell the user:
- Output file name and location
- Number of track changes applied
- Number of comments added
- If changelog/flags were generated
- Remind them to open the document in Word and use Review → Track Changes to accept/reject edits
处理完成后,告知用户:
- 输出文件名及位置
- 已应用的修订标记数量
- 新增批注数量
- 是否生成变更日志/标记
- 提醒用户在Word中打开文档,通过“审阅”→“修订”功能接受或拒绝编辑内容
Error Handling
错误处理
If the CLI fails:
- Check if Python 3.9+ is installed:
python3 --version - Re-run setup: delete in plugin root and let auto-setup recreate it
.venv - Verify the file path is valid and accessible
- On macOS, check Full Disk Access permissions for Python
- See for more details
troubleshooting.md
若CLI运行失败:
- 检查是否安装Python 3.9及以上版本:执行命令
python3 --version - 重新运行设置:删除插件根目录下的文件夹,让自动设置重新创建虚拟环境
.venv - 验证文件路径是否有效且可访问
- 在macOS系统中,检查Python的“完全磁盘访问”权限
- 更多详情请查看文件
troubleshooting.md
References
参考资料
- — full CLI flags and output format
cli-reference.md - — common errors and fixes
troubleshooting.md
- — 完整CLI参数及输出格式说明
cli-reference.md - — 常见错误及修复方案
troubleshooting.md