agentleFS
gigio1023gigio1023/agent-skills/skills/additional/pdf-page-count/SKILL.md

pdf-page-count

Skill2 starsChanged 10 days agoMITView on GitHub

Use when the user asks for the page count of an existing PDF, whether a PDF meets an exact/minimum/maximum page limit, or the numeric page-count result for another workflow. Triggers on "PDF pages", "page count", "몇 페이지", and "분량 제한 확인". NOT for creating, editing, rendering, or visually reviewing a PDF; use a PDF skill, when installed, for those tasks.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the bundled counter from this skill directory:

    line 18
  2. Very specific:

    Treat exit code 0 plus a single integer on stdout as success.

    line 26
  3. Distinctive:

    If another task changed the source document, count the rebuilt output PDF, not the stale pre-edit artifact.

    line 38
  4. Distinctive:

    Do not infer pages from filename, file size, source-document pagination, or a viewer thumbnail count.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PDF Page Count

Return the PDF's numeric page count and, when a limit was supplied, an explicit pass/fail comparison. Do not edit or rebuild the document unless the user also requested that separate work.

Quick Start

  1. Resolve the exact PDF path and confirm the file exists.
  2. Run the bundled counter from this skill directory:

    python3 scripts/count_pdf_pages.py <path-to-pdf>

    The script needs Python 3.7 or newer (the macOS system python3 works) and one of the counting backends listed under Gotchas.

  3. Treat exit code 0 plus a single integer on stdout as success. Exit code 2 means none of the available backends could determine the count; report the dependency/error message instead of guessing.
  4. Compare the integer to the user's rule:
    • maximum N: pass when count <= N;
    • minimum N: pass when count >= N;
    • exact N: pass when count == N.

One successful counter result for the exact output file completes counting. Do not render pages or run additional backends unless the file changed or a concrete discrepancy calls that result into question.

Output Contract

Report the file, page count, limit if any, and result. When over or under the limit, include the exact difference. Example: 27 pages; maximum 25; fail by 2 pages. Keep any requested caveat or next action, but omit backend narration on success.

If another task changed the source document, count the rebuilt output PDF, not the stale pre-edit artifact. If no rebuilt PDF exists, state that the count is for the currently supplied file.

Gotchas

  • Do not infer pages from filename, file size, source-document pagination, or a viewer thumbnail count.
  • Encrypted or malformed PDFs may fail every backend. Surface the failure; do not report zero pages.
  • The script tries pypdf, pdfinfo, then macOS mdls. If no backend works, report that; installing pypdf or pdfinfo needs the user's go-ahead. Do not rewrite the script during the counting task.
  • A request to check a limit does not authorize layout compression or content cuts. Offer or perform PDF editing only when asked.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.