12312

Fills placeholders in Word DOCX templates written as double-brace variables with values taken from task_context JSON, docxReview annotations/mappings, and ontologyInstance properties; supports users supplying a template and ontology field bindings or a query containing task_context/docxReview/mapping/ontologyInstance, and uploading the generated DOCX via TUSD in the word-actions block.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "12312" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-6a41cff27e5e98363a986e0ca114d33c8bad455224a705f65140f0ce1fc322d8. Verify the upstream source and version against https://skillhub.cn/skills/user_078cba33/ad before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Fills placeholders in Word DOCX templates written as double-brace variables with values taken from task_context JSON, docxReview annotations/mappings, and ontologyInstance properties; supports users supplying a template and ontology field bindings or a query containing task_context/docxReview/mapping/ontologyInstance, and uploading the generated DOCX via TUSD in the word-actions block.

0 Downloads

Introduction source: third_party · user_078cba33 · 1.0.0 Reference

SkillPi interpretation

Tasks
Use this skill to fill an existing Word template from ontology-bound field values. The required input is a user query containing `task_context`, whose value is the download URL for the full task JSON.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: docx-template-binding-fill
description: "Fill Word DOCX templates whose placeholders are written as double-brace variables from task_context JSON, docxReview annotations/mapping, and ontologyInstance property values. Use when a user provides a Word template plus ontology field bindings, asks to replace double-brace variables in a DOCX, or supplies a query containing task_context/docxReview/mapping/ontologyInstance and expects a generated DOCX uploaded through TUSD inside a word-actions block."

DOCX Template Binding Fill

Use this skill to fill an existing Word template from ontology-bound field values. The required input is a user query containing task_context, whose value is the download URL for the full task JSON.

Mandatory Workflow

Run the workflow without asking the user to confirm JSON contents.

  1. Parse task_context from the user query and download it:
python scripts/download_url.py --query-text "<raw user query>" --output-dir .tmp --output-name source_context.json
  1. Split the downloaded context into the four required fragments:
python scripts/split_context.py .tmp/source_context.json --output-dir .tmp

The script writes .tmp/currentDocx.json, .tmp/annotations.json, .tmp/mapping.json, and .tmp/ontologyInstance.json.

  1. Download the source Word template from currentDocx.sourceFetchUrl:
python scripts/download_docx.py .tmp/currentDocx.json --output-dir .tmp
  1. Build placeholder bindings from annotations, mapping, and ontologyInstance:
python scripts/build_bindings.py --annotations .tmp/annotations.json --mapping .tmp/mapping.json --ontology-instance .tmp/ontologyInstance.json --output .tmp/binding-values.json

Each annotation id maps to mapping[id]; the first binding property id is read from mapping[id]["bindings"][0]["propertyId"]. All ontology values matching that propertyId are collected in the exact order and count they appear in ontologyInstance.json, including duplicate values. Do not deduplicate repeated values, because repeated values can represent distinct table rows. If the same placeholder is referenced by multiple annotations for the same property, collect that property's value sequence only once for that placeholder. If the same placeholder text is bound to different property ids in different document locations, keep separate value variants and fill each template-row occurrence in document order.

  1. Fill the DOCX with OOXML editing:
python scripts/fill_docx_template.py .tmp/source.docx --bindings .tmp/binding-values.json --output outputs/filled.docx

The filler replaces placeholders across Word runs. If placeholders are inside a table row and any bound value has multiple values, it duplicates that template row and fills each row by index. If a value is missing, leave the original placeholder unchanged.

Strict replacement guard: only replace exact placeholders that match the double-brace text extracted from annotations.json and appear in binding-values.json. Never edit, polish, normalize, rewrite, merge, or otherwise change nearby text that is not inside the matched double-brace placeholder. In OOXML, perform replacement only at paragraph scope, not document/body/table/cell/root scope, so non-placeholder content keeps its original location and structure.

  1. Upload the generated DOCX to TUSD and return exactly one block:
python scripts/upload_docx_to_tusd.py outputs/filled.docx
<word-actions>https://...uploaded.docx</word-actions>

Do not return local file paths, raw JSON, or intermediate artifacts in the final answer when upload succeeds.

End-To-End Command

Prefer the orchestrator for normal use:

python scripts/run_workflow.py --query-text "<raw user query>" --work-dir .tmp --output-dir outputs

It performs every mandatory step, prints progress JSON to stderr, and prints the final <word-actions>...</word-actions> block to stdout.

Script Notes

  • download_url.py is generic and always writes the exact output filename requested; for task context use source_context.json.
  • split_context.py accepts either a root JSON object or a { "context": ... } wrapper.
  • download_docx.py always prefers sourceFetchUrl and falls back only to common URL fields.
  • build_bindings.py handles ontologyInstance.properties as either an object or list and recursively searches nested child values. It preserves the source order and repeated occurrence count for matching property values.
  • fill_docx_template.py edits OOXML directly and preserves unrelated DOCX parts, styles, relationships, headers, footers, images, and metadata.
  • upload_docx_to_tusd.py defaults to the built-in TUSD base URL http://192.168.0.192:1080/plm/files/; TUSD_BASE_URL or --base-url can override it. It reads optional TUSD_AUTHORIZATION or --authorization.

Failure Handling

  • If task_context is missing or invalid, ask for the raw query containing task_context: "https://...".
  • If currentDocx.sourceFetchUrl cannot be downloaded, report the URL and error.
  • If no binding value exists for a placeholder, leave that placeholder unchanged and include the unresolved placeholder in the script report.
  • If TUSD upload fails, report the upload error and do not emit a fake word-actions URL.

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决企业文档自动化生成中的高频刚需场景
  • 功能闭环完整,支持 ontology 绑定、模板填充、TUSD 上传全流程
Trigger Precision95/100

Highlights

  • 触发条件描述清晰,覆盖多种用户输入变体
  • 关键词边界明确,不易与其他 Skill 混淆
Structure and Standards94/100

Areas to improve

  • description 重复 Reported severity: Minor

    顶层 frontmatter 和 skill_body 内部均包含 description,内容重复

    Recommendation: 建议移除 skill_body 内部的 description 重复内容,保持单一来源

  • 缺少显式 When to Use 章节 Reported severity: Minor

    文档未使用 "When to Use" 作为独立章节标题

    Recommendation: 建议在文档开头添加 "When to Use" 章节以增强可读性

Highlights

  • 工作流程步骤清晰,共 6 个明确阶段
  • 包含端到-end 命令和详细的失败处理机制
Execution Reliability93/100

Highlights

  • 所有脚本来源明确,参数使用规范
  • 覆盖主要异常场景并提供明确处理建议
  • DOCX 编辑有严格替换保护机制,防止误修改
Evidence Verifiability (mean of the first four)94/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • ...
  • ...uploaded.docx
  • 192.168.0.192

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.