Fill Protocol logo

Fill Protocol

Organization
Aperivue
fill-protocol

Use when an institutional Word form (.doc/.docx IRB protocol, ethics application, grant template) must be filled without breaking its styles, tables, fonts or page layout. Renders content drafted by /write-protocol into the template; CJK-aware.

Overview

PublisherAperivue
Repositorymedsci-skills
Skill namefill-protocol
Stars
349
Forks
82
Bundled files
10
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Aperivue on GitHub. Read the source before you install it.

Installation

Install the Fill Protocol AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Aperivue/medsci-skills/tree/main/skills/fill-protocol
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Aperivue/medsci-skills.git /tmp/medsci-skills
mkdir -p .claude/skills
cp -r /tmp/medsci-skills/skills/fill-protocol .claude/skills/fill-protocol
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Fill Protocol in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Fill Protocol on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Fill Protocol is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Fill-Protocol Skill

Core Principles (Do Not Violate)

  1. Open the existing template — never create from scratch. Use Document(template_path), not Document(): rebuilding loses the header logo, custom margins, footer placeholders and page numbering. Replace cell/paragraph text in place; never a single cell.text = "value" assignment, which erases run-level styles (bold, color, eastAsia font).
  2. Convert .doc → .docx via LibreOffice headless before any editing. pandoc -f doc is not supported; textutil corrupts table structure (merged cells dropped).
  3. Match cells by left-label text, not row/column coordinates such as table.cell(2, 1). Templates evolve and coordinate matching breaks silently.
  4. Apply cantSplit to every filled row so a row never breaks across pages.
  5. For CJK languages, set the eastAsia font attribute, not just run.font.name, or Hangul/Kanji/Hanzi render in fallback fonts.
  6. Validate every fill operation: resolve every [MISS] line and every WARN: line ([TABLE-MISS], [SECTION-MISS], [RAW-NEWLINE]) before the filled form is submitted.

Dependencies

Python packages docxtpl python-docx pyyaml are always required. LibreOffice is needed only for a legacy .doc template (~700 MB on macOS). The bundled setup.sh detects what is missing:

bash
bash ${CLAUDE_SKILL_DIR}/setup.sh check     # report what's installed (read-only)
bash ${CLAUDE_SKILL_DIR}/setup.sh install   # install missing pieces (asks before each)

When invoking this skill on behalf of a user:

  1. Skip LibreOffice entirely if the template is already .docx.
  2. Before calling doc_to_docx.py, run setup.sh check. If LibreOffice is missing, ask the user before installing, because the cask is ~700 MB.
  3. Never pass --yes to setup.sh install unless the user has explicitly authorized unattended installation in this session, because it installs without prompting.
  4. If the user declines, ask them to convert the .doc manually (Word/LibreOffice/Pages → Save As → .docx) and re-run with the converted file.

Workflow

Step 1 — Convert legacy .doc to .docx (if needed)

bash
python3 ${CLAUDE_SKILL_DIR}/scripts/doc_to_docx.py path/to/template.doc path/to/template.docx

Step 2 — Inspect the template structure

bash
python3 ${CLAUDE_SKILL_DIR}/scripts/inspect_template.py path/to/template.docx

It lists every table, every cell (coordinates and content preview) and every top-level paragraph. Take the exact labels for the YAML from this output.

Step 3 — Author a content YAML

Start from ${CLAUDE_SKILL_DIR}/examples/example_irb_template.yaml. Three fill modes; all keys are optional.

yaml
protections:
  korean_font: "맑은 고딕"   # CJK font (set to "Noto Sans CJK KR", "SimSun",
                              # "MS Mincho", etc. for other locales)
  cant_split: true            # Apply <w:cantSplit/> to every filled row

  # Readability options (defaults shown)
  blank_between_paragraphs: true            # Enter between \n\n chunks
  blank_around_section_header: true         # Enter above/below filled sections
  blank_around_all_section_headers: false   # opt-in; also touches untouched sections
  normalize_page_breaks: true               # empty page-break paragraphs -> pageBreakBefore

# Mode 1 — table key/value (left-label cell → right value cell)
table_kv:
  "Study Title": "Multi-center prospective validation of ..."
  "Principal Investigator": "Last, First (Department)"
  "연구 목적": "본 연구는 ..."

# Mode 2 — section replacement (find numbered header, replace until next header)
section_replace:
  "1. Background":
    "Hepatocellular carcinoma is the third leading cause of ..."
  "4. 연구 배경 및 이론적 근거":
    "..."

# Mode 3 — single paragraph in-place text replacement
paragraph_replace:
  "Title:":
    "Title: Multi-center prospective validation of ..."

Read ${CLAUDE_SKILL_DIR}/references/best_practices.md (Readability knobs) before changing any readability option from its default.

Content rules: put a reference in only with a /search-lit-confirmed DOI or PMID, otherwise mark it [UNVERIFIED - NEEDS MANUAL CHECK]; mark any unconfirmed clinical definition, diagnostic criterion or guideline claim [VERIFY] and ask the user.

Step 4 — Run the fill

bash
python3 ${CLAUDE_SKILL_DIR}/scripts/fill_form.py \
  --template path/to/template.docx \
  --content  content.yaml \
  --output   path/to/filled.docx

The CLI prints [OK] / [MISS] for every fill operation, a summary, then any WARN: lines. Investigate every [MISS] and WARN: before submitting (Principle 6).

Every value under table_kv, section_replace and paragraph_replace is written exactly as typed (012345, 12:30, 1.10, No stay text). An empty value or a list/mapping value stops the run with exit 2 and names the label; write '' to blank a field on purpose. A section_replace on a header with no later numbered header replaces everything to the end of the document, and its [OK] line says so with the number of paragraphs replaced. If a signature/date block or anything else follows the last section, bound it with section_end (header -> regex matched against the paragraph that starts the kept block):

yaml
section_end:
  "18. References": "^Investigator signature"

Step 5 — Visual verification

bash
soffice --headless --convert-to pdf path/to/filled.docx

Without LibreOffice (a .docx template skips it), export the PDF from Word instead. Open the PDF and confirm: page count is sensible, no table row was split across pages, no font fell back to Times New Roman, all required fields are populated.

Read ${CLAUDE_SKILL_DIR}/references/best_practices.md when a label or section header does not match, the template has no numbered section headers (section_end), a cell needs multi-line content, or cells are merged.

Known Limitations

  • HWP / HWPX input is not handled directly — convert it to .docx first.
  • Merged cells: filling a label cell that participates in a vertical merge may overwrite the merged region's content. Test on a copy first.
  • Embedded form fields (Word content controls): not supported; plain paragraph and table cell content only.
  • Right-to-left scripts (Arabic, Hebrew): untested.
  • Last section with no later header: replaced through the end of the document unless a section_end pattern is given; the filler cannot tell the section body from a trailing block.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Fill Protocol AI skill do?

Use when an institutional Word form (.doc/.docx IRB protocol, ethics application, grant template) must be filled without breaking its styles, tables, fonts or page layout. Renders content drafted by /write-protocol into the template; CJK-aware.

Why use Fill Protocol on TypingMind?

Because you install it once and use it with any model. Fill Protocol is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Fill Protocol in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Aperivue/medsci-skills/tree/main/skills/fill-protocol. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Fill Protocol?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Fill Protocol?

As many as you like. As long as a model supports skills, you can use Fill Protocol with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Fill Protocol AI skill free?

Yes. It is published on GitHub by Aperivue under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇