agentsclimarketplace

Pdf form filling

Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-opus-4-6/court-form-filling/pdf-form-filling

[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.

Install
npx -y skills add cxcscmu/SkillLearnBench --skill pdf-form-filling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Fill PDF form fields using pypdf library in Python, including text fields and checkboxes.

SKILL.md

1.7 KB, as published. Nobody here has run it

PDF Form Filling with pypdf

When to Use

When you need to programmatically fill in PDF forms (AcroForms) with text values and checkbox selections.

Setup

pip install pypdf

Key Concepts

Reading Form Fields

import pypdf
reader = pypdf.PdfReader('form.pdf')
fields = reader.get_fields()
for name, field in fields.items():
    print(f"{name} | type={field.get('/FT')} | states={field.get('/_States_', [])}")
  • /FT = /Tx → text field
  • /FT = /Btn → checkbox/button
  • /_States_ shows valid values for checkboxes (e.g., ['/1', '/Off'])

Filling the Form

reader = pypdf.PdfReader('blank.pdf')
writer = pypdf.PdfWriter()
writer.append(reader)

# Build field data dict - keys are FULL field paths
field_data = {
    "Form[0].Page1[0].TextField[0]": "value",
}

# For checkboxes, use the "on" state value from _States_ (e.g., '/1', '/2')
field_data["Form[0].Checkbox[0]"] = "/1"  # checked
# Use '/Off' for unchecked (usually default)

# Update fields on specific pages
writer.update_page_form_field_values(writer.pages[page_idx], field_data)

with open('filled.pdf', 'wb') as f:
    writer.write(f)

Important Notes

  • Field names are hierarchical paths like SC-100[0].Page2[0].List1[0].Item1[0].PlaintiffName1[0]
  • update_page_form_field_values only updates fields present on the specified page
  • For radio-button-style checkboxes (Yes/No pairs), each option has its own field with different "on" states (/1 for first, /2 for second)
  • Always use the full field path as the key
  • Auto-formatting may not work; set /NeedAppearances if text doesn't display

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.