pdf-form-filler
Fill PDF forms programmatically when the user has a fillable PDF and a set of values to populate. Use when the user provides a PDF with form fields and asks to fill them, when the user mentions "AcroForm" or "fillable PDF" workflows, or when batch-filling multiple forms with the same template. Use even if the user does not mention pdfplumber or pikepdf by name.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 15
- Forks
- 13
01 前言 Front Matter
- name
- pdf-form-filler
- model
- opus
- effort
- max
- description
- Fill PDF forms programmatically when the user has a fillable PDF and a set of values to populate. Use when the user provides a PDF with form fields and asks to fill them, when the user mentions "AcroForm" or "fillable PDF" workflows, or when batch-filling multiple forms with the same template. Use even if the user does not mention pdfplumber or pikepdf by name.
- allowed-tools
- Bash, Read, Write
- user-invocable
- true
- disable-model-invocation
- true
02 资源文件 5
- 资产文件assets/report-template.md561 B
- 参考文档references/api-reference.md6.6 KB
- 参考文档references/error-catalog.md3.3 KB
- 脚本scripts/analyze.py3.0 KB
- 脚本scripts/validate.sh3.1 KB
03 SKILL.md 正文
PDF form filler
Fills fillable PDF forms (AcroForm) using a plan-validate-execute pattern. Built around two libraries: pdfplumber for inspection and pikepdf for write-back.
Workflow
Progress checklist:
- [ ] Step 1: Analyze the form (run
scripts/analyze.py) - [ ] Step 2: Create field mapping (write
field_values.json) - [ ] Step 3: Validate mapping (run
scripts/validate.sh) - [ ] Step 4: Fill the form (call pikepdf, see snippet below)
- [ ] Step 5: Verify output (re-analyze the filled PDF)
Step 1: Analyze the form
Run the bundled analyzer to discover form fields:
uv run scripts/analyze.py path/to/input.pdf > form_fields.json
Output is JSON: [{"name": "...", "type": "Tx|Btn|Ch|Sig", "page": 1, "required": false}]. If the PDF is not a fillable form (no AcroForm dictionary), the script exits with code 2 and prints a helpful message to stderr. In that case suggest the user re-export the PDF as a form, or fall back to overlay-text mode (out of scope here).
Step 2: Create field mapping
Write field_values.json mapping every required field name to its value. Use null for fields you intend to leave blank. Example:
{
"customer_name": "Anna Kovalenko",
"order_total": "199.00",
"signature_date": "2026-05-05",
"newsletter_opt_in": false
}
Field names must match the schema produced in step 1 character-for-character. Mismatch is the most common failure mode - the validator in step 3 catches this.
Step 3: Validate mapping
bash scripts/validate.sh form_fields.json field_values.json
The validator returns exit code 0 on success, 2 on validation failure with a structured JSON error report on stdout. Fix issues and re-run until exit 0.
Step 4: Fill the form
import pikepdf, json
values = json.load(open("field_values.json"))
with pikepdf.open("input.pdf", allow_overwriting_input=False) as pdf:
for field in pdf.acroform.fields:
name = str(field.T)
if name in values and values[name] is not None:
field.V = pikepdf.String(str(values[name]))
field.AP = None
pdf.save("output.pdf")
Setting field.AP = None forces the PDF viewer to regenerate appearance streams - without this, fields render blank in some viewers even though the value is set internally.
Step 5: Verify output
Re-run the analyzer on output.pdf. The value key in each entry should match field_values.json. If any field shows null, check the appearance-stream regeneration step.
Gotchas
- AcroForm vs XFA. This skill handles AcroForm only. XFA forms (legacy Adobe LiveCycle) need a different toolchain - if the analyzer reports
"format": "xfa", stop and tell the user. - Checkbox values are case-sensitive. A checkbox field expects
/Yesor/Offexactly. Booleantruein JSON gets translated byanalyze.pyautomatically; never write the string"true"directly. - Signature fields cannot be filled this way. Type
Sigrequires a real cryptographic signature. The validator flags any attempt to set a value on a Sig field. - Read-only fields silently fail. If
field.Ff & 1is set, the field is read-only. The analyzer surfaces this as"read_only": true.
When to read references
- Read
references/api-reference.mdif you need pdfplumber/pikepdf method signatures or the AcroForm field-type table. - Read
references/error-catalog.mdifanalyze.pyorvalidate.shexit non-zero with an error code you do not recognize.
Output format
Write a final report following assets/report-template.md. Keep it short - 4 sections, no prose padding.
04 同仓库更多 Skills
release
Run the whole local release pipeline in order, stopping at each human gate. Triggers on "run the release", "prepare a release", "/release", "зроби реліз", "підготуй реліз". Drives the four stages back to back — bump-version → curate-changelog → release-notes → check-docs-drift — pausing after each so the human reviews the diff before the next stage. Prepares everything in the working tree; never tags, commits, or pushes. The tag push (which fires CI) stays the human's action.
release-notes
Draft partner-facing release notes from the same commits as the changelog. Triggers on "draft release notes", "release notes for the next version", "/release-notes", "нотатки релізу", "release notes партнеру". Same input as curate-changelog, different audience and tone: a short, benefit-first narrative for a user or partner — "what's new for you" — not a categorized engineer's list. Keeps only changes a user actually notices; drops internal refactors and tooling. Prints the notes to the chat to seed a GitHub Release description or a partner announcement. Writes no file.
curate-changelog
Curate the [Unreleased] section of docs/CHANGELOG.md from git history. Triggers on "curate the changelog", "update the changelog", "/curate-changelog", "онови changelog", "курування журналу". Reads git log since the last tag, FILTERS out what a reader never feels (test/ci/chore/merge), GROUPS commits about one feature into one bullet, and REWRITES technical subjects into plain language under the six Keep a Changelog categories (Added/Changed/Deprecated/ Removed/Fixed/Security). The result must have FEWER lines than the raw log — that is the proof of curation, not a dump. Leaves the edit in the working tree; never commits or pushes.
codify-rule
Turn a repeated mistake into a durable, path-scoped rule in .claude/rules/. Triggers on "codify this rule", "make a rule so this doesn't happen again", "/codify-rule", "закодифікуй правило", "петля помилка-правило". Use only when the same mistake showed up TWICE (twice = a pattern, once = noise). Names the wrong shape and the right shape with one short example of each, scopes the rule to the paths that matter, and leaves the edit in the working tree so the next agent on this repo inherits the fix. Edits only .claude/rules/; never commits or pushes.
check-docs-drift
Find and fix where docs/api.md fell behind the code. Triggers on "check for doc drift", "is the API doc up to date", "/check-docs-drift", "перевір дрейф документації", "docs drift". Runs the deterministic scripts/check-docs-drift.py (parses the public NoteBook methods with ast, compares to what docs/api.md documents — NO LLM finds the gap), reports the drift, and PROPOSES the doc edit that closes it. The gap is found by parsing; the agent writes the missing documentation in the doc's existing style. Edits only docs/; never commits or pushes.
bump-version
Decide and apply the next semver for a release. Triggers on "bump the version", "what version is next", "/bump-version", "простав версію", "яка наступна версія". Reads the next number from the deterministic scripts/next-version.sh (NEVER guesses it), explains in plain language WHICH part moved and why (e.g. "MINOR, because a feat landed: filter notes by tag"), edits the version line in pyproject.toml, and proposes the matching `git tag vX.Y.Z`. The number is decided by a rule; the agent explains and applies — the human confirms the tag. Never pushes a tag itself.