
Fill PDF forms reliably by detecting fillable AcroForm fields versus flat PDFs and running the bundled Python helpers in the right order.
Overview
pdf is an agent skill most often used in Build (also Validate scope, Operate iterate) that fills PDF forms by first detecting fillable AcroForm fields and following scripted extract-and-fill steps.
Install
npx skills add https://github.com/k-dense-ai/scientific-agent-skills --skill pdfWhat is this skill?
- Mandatory ordered workflow: detect fillable fields before any fill code
- check_fillable_fields script gates fillable versus non-fillable paths
- extract_form_field_info.py outputs JSON with field_id, page, rect, and types text/checkbox/radio_group/choice
- Checkbox and radio_group semantics include checked_value, unchecked_value, and radio_options
- Python scripts run from the skill directory against local PDF files
- Ordered mandatory steps before writing fill code
- Field JSON includes types text, checkbox, radio_group, and choice
Adoption & trust: 623 installs on skills.sh; 27.6k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need an agent to complete a PDF form but you cannot tell whether fields are fillable widgets or a flat scan, so ad-hoc filling wastes time and breaks submissions.
Who is it for?
Solo builders automating repeatable government, vendor, or scientific PDF forms with local Python scripts and structured field metadata.
Skip if: Teams that only need one-off manual edits in Preview, or workflows that require cloud e-sign platforms with no local PDF file.
When should I use this skill?
You must fill out a PDF form and need to know fillable versus non-fillable handling first.
What do I get? / Deliverables
After the ordered checks and field JSON export, the agent follows the correct fillable or non-fillable playbook and produces a completed PDF with consistent field values.
- field_info.json field manifest
- Completed filled PDF per skill branch
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Document automation and form completion live in Build under docs because agents run local scripts to inspect and write PDFs before shipping paperwork or compliance packets. Docs subphase fits procedural knowledge for producing and completing document artifacts, not frontend UI or API code.
Where it fits
Complete a grant or vendor application PDF after scope is fixed but before full product build.
Automate batch filling of standard contract PDFs from repo-stored templates and JSON field maps.
Re-run annual compliance PDF updates when field layouts change slightly.
How it compares
Use this procedural pdf skill instead of asking the model to guess coordinates on unknown PDF types.
Common Questions / FAQ
Who is pdf for?
Indie builders and small teams who ship agent workflows that must complete real-world PDF forms using the skill’s Python utilities and strict step order.
When should I use pdf?
Use it during Build when generating document automation, during Validate when finishing application PDFs, and during Operate when updating compliance forms—always after check_fillable_fields.
Is pdf safe to install?
Review the Security Audits panel on this Prism page for install risk and file integrity; the skill runs local Python on paths you supply, so treat PDF paths and scripts like any filesystem automation.
SKILL.md
READMESKILL.md - Pdf
**CRITICAL: You MUST complete these steps in order. Do not skip ahead to writing code.** If you need to fill out a PDF form, first check to see if the PDF has fillable form fields. Run this script from this file's directory: `python scripts/check_fillable_fields <file.pdf>`, and depending on the result go to either the "Fillable fields" or "Non-fillable fields" and follow those instructions. # Fillable fields If the PDF has fillable form fields: - Run this script from this file's directory: `python scripts/extract_form_field_info.py <input.pdf> <field_info.json>`. It will create a JSON file with a list of fields in this format: ``` [ { "field_id": (unique ID for the field), "page": (page number, 1-based), "rect": ([left, bottom, right, top] bounding box in PDF coordinates, y=0 is the bottom of the page), "type": ("text", "checkbox", "radio_group", or "choice"), }, // Checkboxes have "checked_value" and "unchecked_value" properties: { "field_id": (unique ID for the field), "page": (page number, 1-based), "type": "checkbox", "checked_value": (Set the field to this value to check the checkbox), "unchecked_value": (Set the field to this value to uncheck the checkbox), }, // Radio groups have a "radio_options" list with the possible choices. { "field_id": (unique ID for the field), "page": (page number, 1-based), "type": "radio_group", "radio_options": [ { "value": (set the field to this value to select this radio option), "rect": (bounding box for the radio button for this option) }, // Other radio options ] }, // Multiple choice fields have a "choice_options" list with the possible choices: { "field_id": (unique ID for the field), "page": (page number, 1-based), "type": "choice", "choice_options": [ { "value": (set the field to this value to select this option), "text": (display text of the option) }, // Other choice options ], } ] ``` - Convert the PDF to PNGs (one image for each page) with this script (run from this file's directory): `python scripts/convert_pdf_to_images.py <file.pdf> <output_directory>` Then analyze the images to determine the purpose of each form field (make sure to convert the bounding box PDF coordinates to image coordinates). - Create a `field_values.json` file in this format with the values to be entered for each field: ``` [ { "field_id": "last_name", // Must match the field_id from `extract_form_field_info.py` "description": "The user's last name", "page": 1, // Must match the "page" value in field_info.json "value": "Simpson" }, { "field_id": "Checkbox12", "description": "Checkbox to be checked if the user is 18 or over", "page": 1, "value": "/On" // If this is a checkbox, use its "checked_value" value to check it. If it's a radio button group, use one of the "value" values in "radio_options". }, // more fields ] ``` - Run the `fill_fillable_fields.py` script from this file's directory to create a filled-in PDF: `python scripts/fill_fillable_fields.py <input pdf> <field_values.json> <output pdf>` This script will verify that the field IDs and values you provide are valid; if it prints error messages, correct the appropriate fields and try again. # Non-fillable fields If the PDF doesn't have fillable form fields, you'll add text annotations. First try to extract coordinates from the PDF structure (more accurate), then fall back to visual estimation if needed. ## Step 1: Try Structure Extraction First Run this script to extract text labels, lines, and checkboxes with their exact PDF coordinates: `python scripts/extract_form_structure.py <input.pdf> form_structure.json` This creates a JSON file containing: - **labels**: Every text element with exact coordinates (x0, top, x1, bottom in PDF points) - **lines**: Horizontal lines that define row boundaries - **checkboxes**: Small square rectangles