본문으로 건너뛰기
cccskills
무료GitHub에 공개

pdf-to-markdown

Split a PDF into chunks and convert it to readable markdown text. Use when the user wants to read, extract, or convert a PDF document.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback스타 507(GitHub 507 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md7.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

PDF Split & Convert

Convert a PDF file to readable markdown text. Handles large PDFs efficiently.

Input

  • $ARGUMENTS[0] — Path to the PDF file (required)

Choose the method first

Before reading anything, check whether pdftotext (part of poppler) is available:

which pdftotext
  • If available → use the pdftotext path below. It is 10–100× faster than the Read tool, uses no model context for the text content, and doesn't suffer from stream idle timeouts. Always prefer this for PDFs longer than ~30 pages.
  • If not available → fall back to the Read-tool path. Warn the user that large PDFs (>40 pages) may hit stream idle timeouts when run in subagents (~12 min cap). Prefer running in the main conversation for large files.

Resolve the path and get page count

  1. If the path is relative, resolve it relative to the current working directory.
  2. Run mdls -name kMDItemNumberOfPages "<pdf_path>" to get the total page count. If mdls is unavailable or returns (null), use pdftotext or Read to probe.

Method A — pdftotext (preferred)

Extract the full PDF to text in one shot, then trim at references/appendix and add page markers. pdftotext emits a form-feed character (\f) at every page break — use that for pagination.

Reference implementation (bash + awk):

PDF="$1"
OUT="${PDF%.pdf}.md"
TITLE=$(basename "${PDF%.pdf}")
TMPTXT=$(mktemp)

pdftotext -layout "$PDF" "$TMPTXT"

awk -v title="$TITLE" '
BEGIN {
    print "# " title
    print ""
    page = 1
    printf "---\n## Pages %d-%d\n---\n", page, page+19
    next_marker = page + 20
}
{
    # Convert form-feed page breaks to newlines and count pages
    n = gsub(/\f/, "\n")
    if (n > 0) {
        page += n
        if (page >= next_marker) {
            printf "\n---\n## Pages %d-%d\n---\n", next_marker, next_marker+19
            next_marker += 20
        }
    }

    # Build a stripped copy for heading detection.
    # CRITICAL: strip both form feeds AND embedded newlines — gsub above inserts
    # newlines into $0, which will defeat regex anchors like ^ and $ if you skip this.
    stripped = $0
    gsub(/[\f\n]/, "", stripped)
    sub(/^[ \t]+/, "", stripped)
    sub(/[ \t]+$/, "", stripped)

    if (length(stripped) > 0) {
        # References / Bibliography — standalone word, optionally numbered, short, no prose punctuation
        if (length(stripped) < 50 && stripped !~ /[(),;]/) {
            if (stripped ~ /^([0-9]+\.?[ \t]+)?(References|REFERENCES|Bibliography|BIBLIOGRAPHY)$/) exit
            if (stripped == "Works Cited") exit
        }

        # Appendix — length up to ~120 chars (some titles are long), no prose punctuation
        if (length(stripped) < 120 && stripped !~ /[(),;]/) {
            # "Appendix A" alone (bare letter, no title)
            if (stripped ~ /^Appendix[ \t]+[A-Z][0-9]*$/) exit
            # "Appendix A. Title" or "Appendix A: Title" — punctuation REQUIRED to avoid
            # matching body-text references like "Appendix H examines the effect..."
            if (stripped ~ /^Appendix[ \t]+[A-Z][0-9]*[.:][ \t]+[A-Z].*$/) exit
            # "APPENDIX A" variants
            if (stripped ~ /^APPENDIX[ \t]+[A-Z][0-9]*([ \t]+.*)?$/) exit
            # "Online Appendix [A]"
            if (stripped ~ /^Online[ \t]+Appendix([ \t]+[A-Z].*)?$/) exit
            # "Supplemental/Supplementary/Internet Appendix"
            if (stripped ~ /^(Supplement(al|ary)|Internet)[ \t]+Appendix([ \t]+.*)?$/) exit
        }
    }

    print
}
' "$TMPTXT" > "$OUT"

rm -f "$TMPTXT"
echo "Wrote $OUT ($(wc -l < "$OUT") lines)"

After running, sanity-check the output:

# Should print nothing if trimming worked
grep -cE "^[[:space:]]*(References|Bibliography|REFERENCES|BIBLIOGRAPHY)[[:space:]]*$" "$OUT"

# Eyeball last few lines — should be prose/conclusion, not body-of-table or mid-paragraph
tail -5 "$OUT"

If the tail looks truncated mid-paragraph, the heading detection likely fired on a false positive. If the tail shows references or appendix content, the detection missed the heading — inspect the PDF text around that area and extend the regex.

Method B — Read tool (fallback when pdftotext unavailable)

  1. Read the PDF in chunks of up to 20 pages at a time using the Read tool's pages parameter: 1-20, 21-40, 41-60, etc.
  2. Focus on the MAIN TEXT ONLY. Stop including content once you hit "References", "Bibliography", "Works Cited", or an appendix section. If references appear mid-chunk, keep everything before them and drop the rest.
  3. Compile output:
    • Save alongside the PDF with a .md extension.
    • Header: # [Original Filename]
    • Page markers between chunks: ---\n## Pages X-Y\n---
    • Preserve extracted text as-is.

Warning: The Read tool is slow for large PDFs (roughly 30–60 seconds per 20-page chunk). A 60-page paper can take 3–4 minutes, and sub-agents have a ~13-minute stream idle timeout that this can hit. When running a batch of conversions, run them sequentially in the main conversation or use Method A.

Heading-detection pitfalls (hard-won lessons)

These false positives broke earlier attempts — keep them in mind whether you use Method A or B:

  • Parenthetical references in body text like (see Appendix B.5) — exclude lines containing (, ), ,, or ;.
  • Body text starting with "Appendix X ..." like Appendix H examines the differential effect... — require punctuation (. or :) immediately after the appendix letter when a title follows. Bare "Appendix A" alone on a line is still valid.
  • Line-wrapped headings — pdftotext can wrap Online Appendix across two lines if the PDF's layout is unusual. You'll see Online on one line and Appendix on the next. The regex above matches the joined form; if you see false trims at a lone Appendix line, inspect and tighten.
  • Form-feed at start of page — pdftotext emits \f as the first character on every new page. After gsub(/\f/, "\n") on $0, the line has an embedded \n that defeats ^ / $ anchors unless you also gsub(/[\f\n]/, "", stripped) on your detection copy.
  • Length thresholds — simple "< 50 chars" is too tight for appendix titles. "Appendix A. Merging Mortgages with the Real Estate Database" is 59 chars. Use ~120 for appendix patterns, ~50 for bare References.
  • Numbered section headings — some papers format as 7 References or 7. References. Allow an optional leading number.

Report results

Tell the user:

  • Method used (pdftotext vs Read tool)
  • Total pages processed
  • Output file path and final line count
  • Where trimming occurred (last section / page number included)
  • Any pages that were unreadable or empty

For batch conversions, print a summary table and note any files whose trim point looks suspicious (very short output, or output ending mid-sentence).

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Adversarially audit changed analysis code against a base ref, hunting for correctness errors in sample construction, merges, variable construction, silent failures, and clustering or fixed effects. Runs in an isolated subagent. Use before circulating results or submitting. This is not a reproducibility or paper-to-code review — use review-paper-code for that.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

Explain a code change as a standalone offline HTML page with a five-question quiz. Reads the diff and the surrounding code from scratch, states the consequences for the empirical results, and saves the page outside the repository under a dated filename.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

Build a LaTeX beamer slide deck in the explorable-explanation style (Nicky Case) — one idea per frame, assertion titles, a concrete running example, TikZ/pgfplots stages the presenter steps through, the source's own figures recoloured into the deck palette, an appendix of side rooms, and a screenshot-and-log check of every page. Use for any request for a Beamer, LaTeX or TeX presentation, talk, slides, seminar, conference, lecture, keynote or job-market deck, "turn this paper into beamer slides", a deck that must be a PDF, or for revising or reviewing a deck built this way. The sibling skill explorable-deck builds the same deck in Quarto reveal.js; use this one when the user names Beamer, LaTeX, TeX or PDF, or works in a LaTeX project. Not for a website explorable (that is explorable-explanations) or a poster.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

Build a Quarto reveal.js slide deck in the explorable-explanation style (Nicky Case) — one idea per slide, assertion titles, a concrete running example, run-time SVG stages the presenter drives live, the source's own figures recoloured into the deck palette, and an appendix of side rooms. Use for any request for a presentation, talk, slides, a seminar, conference, lecture, keynote or job-market deck, a Quarto or reveal.js deck, "turn this paper into slides", "a deck like the explorable", or for revising or reviewing a deck built this way. Prefer it over .pptx skills unless the user names PowerPoint, Beamer, LaTeX or Google Slides. Not for a website explorable (that is explorable-explanations) or a poster.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

Convert a LaTeX research paper into a policy brief, 1-page summary, or 5-page summary for a general audience, with factual review and a standalone HTML page for GitHub Pages.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

Run a 6-agent pre-submission panel review for a grant proposal targeting a specified funder or program

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

claesbackman/AI-research-feedback5072026년 10월 24일 업데이트

claesbackman의 스킬 모두 보기

이 스킬의 문제 신고