Communitygithub.com

Anhvu1107/all-agent-skill

Utilice SIEMPRE esto cuando la tarea implique leer, extraer, dividir, fusionar, rotar, crear, validar, OCR, rellenar formularios o producir o modificar archivos PDF.

¿Qué es all-agent-skill?

Esta habilidad para agentes de IA proporciona una guía completa para el procesamiento de archivos PDF, utilizando bibliotecas de Python y herramientas de línea de comandos. Cubre operaciones esenciales como la lectura, extracción de texto, división, fusión, rotación de páginas, y la creación de nuevos PDFs. Incluye fragmentos de código detallados para bibliotecas como pypdf, pdfplumber y reportlab, así como comandos para herramientas como pdftotext y qpdf. También ofrece directrices específicas para manejar relleno de formularios, extracción de metadatos, y precauciones sobre el uso de caracteres Unicode en PDFs generados con ReportLab. Los agentes deben seguir una regla de lectura selectiva comenzando por los archivos de referencia antes de cargar los documentos específicos de la tarea del usuario.

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

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Guía de Procesamiento de PDF

Regla de Lectura Selectiva

Comience con:

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

Luego cargue solo los documentos heredados, scripts, activos o ejemplos que coincidan con la tarea real del usuario.

Regla de Lectura Selectiva

Comience con:

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

Luego lea:

  • forms.md para trabajo con AcroForm o relleno de campos
  • reference.md cuando necesite una encuesta más amplia de herramientas o bibliotecas

Descripción General

Esta guía cubre operaciones esenciales de procesamiento de PDF utilizando bibliotecas de Python y herramientas de línea de comandos. Para funciones avanzadas, bibliotecas de JavaScript y ejemplos detallados, consulte REFERENCE.md. Si necesita completar un formulario PDF, lea FORMS.md y siga sus instrucciones.

Inicio Rápido

from pypdf import PdfReader, PdfWriter

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

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

Bibliotecas de Python

pypdf - Operaciones Básicas

Fusionar 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)

Extraer Metadatos

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

Rotar Páginas

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

page = reader.pages[0]
page.rotate(90)  # Rotar 90 grados en sentido horario
writer.add_page(page)

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

pdfplumber - Extracción de Texto y Tablas

Extraer Texto con Diseño

import pdfplumber

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

Extraer Tablas

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"Tabla {j+1} en la página {i+1}:")
            for row in table:
                print(row)

Extracción Avanzada de Tablas

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 si la tabla no está vacía
                df = pd.DataFrame(table[1:], columns=table[0])
                all_tables.append(df)

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

reportlab - Crear PDFs

Creación 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

# Añadir texto
c.drawString(100, height - 100, "¡Hola Mundo!")
c.drawString(100, height - 120, "Este es un PDF creado con reportlab")

# Añadir una línea
c.line(100, height - 140, 400, height - 140)

# Guardar
c.save()

Crear PDF con Múltiples 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 = []

# Añadir contenido
title = Paragraph("Título del Informe", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))

body = Paragraph("Este es el cuerpo del informe. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())

# Página 2
story.append(Paragraph("Página 2", styles['Heading1']))
story.append(Paragraph("Contenido de la página 2", styles['Normal']))

# Construir PDF
doc.build(story)

Subíndices y Superíndices

IMPORTANTE: Nunca use caracteres Unicode de subíndice/superíndice (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) en PDFs de ReportLab. Las fuentes integradas no incluyen estos glifos, lo que hace que se rendericen como cuadros negros sólidos.

En su lugar, use las etiquetas de marcado XML de ReportLab en objetos Paragraph:

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

styles = getSampleStyleSheet()

# Subíndices: use la etiqueta <sub>
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])

# Superíndices: use la etiqueta <super>
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])

Para texto dibujado en canvas (no objetos Paragraph), ajuste manualmente el tamaño y la posición de la fuente en lugar de usar subíndices/superíndices Unicode.

Herramientas de Línea de Comandos

pdftotext (poppler-utils)

# Extraer texto
pdftotext input.pdf output.txt

# Extraer texto preservando el diseño
pdftotext -layout input.pdf output.txt

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

qpdf

# Fusionar 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

# Rotar páginas
qpdf input.pdf output.pdf --rotate=+90:1  # Rotar página 1 por 90 grados

# Eliminar contraseña
qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf

pdftk (si está disponible)

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

# Dividir
pdftk input.pdf burst

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

Tareas Comunes

Extraer Texto de PDFs Escaneados

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

# Convertir PDF a imágenes
images = convert_from_path('scanned.pdf')

# OCR de 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)

Añadir Marca de Agua

from pypdf import PdfReader, PdfWriter

# Crear marca de agua (o cargar existente)
watermark = PdfReader("watermark.pdf").pages[0]

# Aplicar a todas las 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)

Extraer Imágenes

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

# Esto extrae todas las imágenes como output_prefix-000.jpg, output_prefix-001.jpg, etc.

Protección con Contraseña

from pypdf import PdfReader, PdfWriter

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

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

# Añadir contraseña
writer.encrypt("userpassword", "ownerpassword")

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

Referencia Rápida

TareaMejor HerramientaComando/Código
Fusionar PDFspypdfwriter.add_page(page)
Dividir PDFspypdfUna página por archivo
Extraer textopdfplumberpage.extract_text()
Extraer tablaspdfplumberpage.extract_tables()
Crear PDFsreportlabCanvas o Platypus
Fusión por línea de comandosqpdfqpdf --empty --pages ...
OCR de PDFs escaneadospytesseractConvertir a imagen primero
Rellenar formularios PDFpdf-lib o pypdf (ver FORMS.md)Ver FORMS.md

Próximos Pasos

  • Para uso avanzado de pypdfium2, consulte REFERENCE.md
  • Para bibliotecas de JavaScript (pdf-lib), consulte REFERENCE.md
  • Si necesita completar un formulario PDF, siga las instrucciones en FORMS.md
  • Para guías de solución 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.

Skills relacionados