Communitygithub.com

Anhvu1107/all-agent-skill

Sempre use esta skill quando a tarefa envolver ler, extrair, dividir, mesclar, girar, criar, validar, fazer OCR, preencher formulários ou produzir/modificar arquivos PDF.

O que é all-agent-skill?

Esta skill é um guia abrangente para manipulação de arquivos PDF, projetado para ser usado como recurso principal em tarefas que envolvam criação, leitura, extração, divisão, mesclagem, rotação, validação, OCR ou preenchimento de formulários em PDF. Ela suporta as principais plataformas de agentes de IA, como Claude Code e Cursor, e fornece instruções detalhadas com exemplos de código em Python e comandos de linha de comando. A skill organiza o conhecimento em seções práticas, começando com uma regra de leitura seletiva que direciona para arquivos de referência específicos (como `references/usage-routing.md` e `references/quality-checklist.md`) antes de apresentar bibliotecas como pypdf, pdfplumber e reportlab, além de ferramentas CLI como qpdf e pdftotext. Ela também inclui soluções para problemas comuns, como extração de texto de PDFs digitalizados, adição de marcas d'água, proteção por senha e extração de imagens, garantindo que o agente possa lidar com qualquer demanda relacionada a PDF de forma eficiente e precisa.

Funciona com~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/pdf

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Guia de Processamento de PDF

Regra de Leitura Seletiva

Comece com:

  • references/usage-routing.md
  • references/quality-checklist.md

Em seguida, carregue apenas os documentos, scripts, ativos ou exemplos herdados que correspondam à tarefa real do usuário.

Regra de Leitura Seletiva

Comece com:

  • references/senior-master-standard.md
  • references/task-routing.md
  • references/quality-checklist.md

Depois leia:

  • forms.md para trabalhos com AcroForm ou preenchimento de campos
  • reference.md quando precisar de uma pesquisa mais ampla de ferramentas ou bibliotecas

Visão Geral

Este guia cobre operações essenciais de processamento de PDF usando bibliotecas Python e ferramentas de linha de comando. Para funcionalidades avançadas, bibliotecas JavaScript e exemplos detalhados, consulte REFERENCE.md. Se você precisar preencher um formulário PDF, leia FORMS.md e siga suas instruções.

Início Rápido

from pypdf import PdfReader, PdfWriter

# Ler um PDF
reader = PdfReader("document.pdf")
print(f"Páginas: {len(reader.pages)}")

# Extrair texto
text = ""
for page in reader.pages:
    text += page.extract_text()

Bibliotecas Python

pypdf - Operações Básicas

Mesclar PDFs

from pypdf import PdfWriter, PdfReader

writer = PdfWriter()
for pdf_file in ["doc1.pdf", "doc2.pdf", "doc3.pdf"]:
    reader = PdfReader(pdf_file)
    for page in reader.pages:
        writer.add_page(page)

with open("merged.pdf", "wb") as output:
    writer.write(output)

Dividir PDF

reader = PdfReader("input.pdf")
for i, page in enumerate(reader.pages):
    writer = PdfWriter()
    writer.add_page(page)
    with open(f"page_{i+1}.pdf", "wb") as output:
        writer.write(output)

Extrair Metadados

reader = PdfReader("document.pdf")
meta = reader.metadata
print(f"Título: {meta.title}")
print(f"Autor: {meta.author}")
print(f"Assunto: {meta.subject}")
print(f"Criador: {meta.creator}")

Girar Páginas

reader = PdfReader("input.pdf")
writer = PdfWriter()

page = reader.pages[0]
page.rotate(90)  # Girar 90 graus no sentido horário
writer.add_page(page)

with open("rotated.pdf", "wb") as output:
    writer.write(output)

pdfplumber - Extração de Texto e Tabelas

Extrair Texto com Layout

import pdfplumber

with pdfplumber.open("document.pdf") as pdf:
    for page in pdf.pages:
        text = page.extract_text()
        print(text)

Extrair Tabelas

with pdfplumber.open("document.pdf") as pdf:
    for i, page in enumerate(pdf.pages):
        tables = page.extract_tables()
        for j, table in enumerate(tables):
            print(f"Tabela {j+1} na página {i+1}:")
            for row in table:
                print(row)

Extração Avançada de Tabelas

import pandas as pd

with pdfplumber.open("document.pdf") as pdf:
    all_tables = []
    for page in pdf.pages:
        tables = page.extract_tables()
        for table in tables:
            if table:  # Verificar se a tabela não está vazia
                df = pd.DataFrame(table[1:], columns=table[0])
                all_tables.append(df)

# Combinar todas as tabelas
if all_tables:
    combined_df = pd.concat(all_tables, ignore_index=True)
    combined_df.to_excel("extracted_tables.xlsx", index=False)

reportlab - Criar PDFs

Criação Básica de PDF

from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

c = canvas.Canvas("hello.pdf", pagesize=letter)
width, height = letter

# Adicionar texto
c.drawString(100, height - 100, "Olá Mundo!")
c.drawString(100, height - 120, "Este é um PDF criado com reportlab")

# Adicionar uma linha
c.line(100, height - 140, 400, height - 140)

# Salvar
c.save()

Criar PDF com Múltiplas Páginas

from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet

doc = SimpleDocTemplate("report.pdf", pagesize=letter)
styles = getSampleStyleSheet()
story = []

# Adicionar conteúdo
title = Paragraph("Título do Relatório", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))

body = Paragraph("Este é o corpo do relatório. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())

# Página 2
story.append(Paragraph("Página 2", styles['Heading1']))
story.append(Paragraph("Conteúdo da página 2", styles['Normal']))

# Construir PDF
doc.build(story)

Subscritos e Sobrescritos

IMPORTANTE: Nunca use caracteres Unicode de subscrito/sobrescrito (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) em PDFs do ReportLab. As fontes incorporadas não incluem esses glifos, fazendo com que sejam renderizados como caixas pretas sólidas.

Em vez disso, use as tags de marcação XML do ReportLab em objetos Paragraph:

from reportlab.platypus import Paragraph
from reportlab.lib.styles import getSampleStyleSheet

styles = getSampleStyleSheet()

# Subscritos: use a tag <sub>
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])

# Sobrescritos: use a tag <super>
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])

Para texto desenhado em canvas (não objetos Paragraph), ajuste manualmente o tamanho da fonte e a posição, em vez de usar caracteres Unicode de subscrito/sobrescrito.

Ferramentas de Linha de Comando

pdftotext (poppler-utils)

# Extrair texto
pdftotext input.pdf output.txt

# Extrair texto preservando layout
pdftotext -layout input.pdf output.txt

# Extrair páginas específicas
pdftotext -f 1 -l 5 input.pdf output.txt  # Páginas 1-5

qpdf

# Mesclar PDFs
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf

# Dividir páginas
qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
qpdf input.pdf --pages . 6-10 -- pages6-10.pdf

# Girar páginas
qpdf input.pdf output.pdf --rotate=+90:1  # Girar página 1 em 90 graus

# Remover senha
qpdf --password=minhasenha --decrypt encrypted.pdf decrypted.pdf

pdftk (se disponível)

# Mesclar
pdftk file1.pdf file2.pdf cat output merged.pdf

# Dividir
pdftk input.pdf burst

# Girar
pdftk input.pdf rotate 1east output rotated.pdf

Tarefas Comuns

Extrair Texto de PDFs Digitalizados

# Requer: pip install pytesseract pdf2image
import pytesseract
from pdf2image import convert_from_path

# Converter PDF para imagens
images = convert_from_path('scanned.pdf')

# OCR em cada página
text = ""
for i, image in enumerate(images):
    text += f"Página {i+1}:\n"
    text += pytesseract.image_to_string(image)
    text += "\n\n"

print(text)

Adicionar Marca d'Água

from pypdf import PdfReader, PdfWriter

# Criar marca d'água (ou carregar existente)
watermark = PdfReader("watermark.pdf").pages[0]

# Aplicar a todas as páginas
reader = PdfReader("document.pdf")
writer = PdfWriter()

for page in reader.pages:
    page.merge_page(watermark)
    writer.add_page(page)

with open("watermarked.pdf", "wb") as output:
    writer.write(output)

Extrair Imagens

# Usando pdfimages (poppler-utils)
pdfimages -j input.pdf output_prefix

# Isso extrai todas as imagens como output_prefix-000.jpg, output_prefix-001.jpg, etc.

Proteção por Senha

from pypdf import PdfReader, PdfWriter

reader = PdfReader("input.pdf")
writer = PdfWriter()

for page in reader.pages:
    writer.add_page(page)

# Adicionar senha
writer.encrypt("senha_usuario", "senha_proprietario")

with open("encrypted.pdf", "wb") as output:
    writer.write(output)

Referência Rápida

TarefaMelhor FerramentaComando/Código
Mesclar PDFspypdfwriter.add_page(page)
Dividir PDFspypdfUma página por arquivo
Extrair textopdfplumberpage.extract_text()
Extrair tabelaspdfplumberpage.extract_tables()
Criar PDFsreportlabCanvas ou Platypus
Mesclar via linha de comandoqpdfqpdf --empty --pages ...
OCR em PDFs digitalizadospytesseractConverter para imagem primeiro
Preencher formulários PDFpdf-lib ou pypdf (veja FORMS.md)Veja FORMS.md

Próximos Passos

  • Para uso avançado do pypdfium2, consulte REFERENCE.md
  • Para bibliotecas JavaScript (pdf-lib), consulte REFERENCE.md
  • Se você precisar preencher um formulário PDF, siga as instruções em FORMS.md
  • Para guias de solução de problemas, consulte REFERENCE.md

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

Habilidades Relacionadas