Fractionnement de scans par lot Zotero

VérifiéSûr

Sépare un PDF de dossier d'archives numérisé en plusieurs éléments de document dans Zotero, avec identification visuelle et copie des métadonnées.

Spar Skills Guide Bot
ProductiviteIntermédiaire
23/07/2026
Claude Code
#zotero#pdf-splitting#archival-scans#metadata#ocr

Recommandé pour

Synthèse automatique

Découpe un PDF d'archives issu d'un scan de lot (un dossier physique par PDF, style vFlat) en plusieurs notices Zotero au niveau du document, avec métadonnées et rangement dans la collection la plus profonde.

Points forts

  • Identification des documents par lecture visuelle des pages extraites, plus fiable que l'OCR seul (lettres, coupures de presse, manuscrits)
  • Extraction des photos JPEG d'origine intégrées à chaque page, avec rastérisation seulement en secours
  • Séparation nette entre l'inspection (locate + lecture des images) et l'écriture, via un manifest.json éditable avant exécution
  • Respecte les règles de sécurité Zotero : aucune écriture sous ~/Zotero, tout passe par l'API web, la notice de lot n'est jamais supprimée

Limites

  • Suppose des PDF vFlat avec exactement une photo intégrée par page ; les autres modes de scan nécessitent des ajustements
  • La lecture visuelle de chaque page est manuelle et devient longue sur de gros lots
  • Les conventions (tag `for review`, préfixe `DONE `, mapping des types de notices) sont des valeurs par défaut à modifier dans le script pour un autre flux
Quand l'utiliser

À utiliser quand un lot numérisé d'archives a été importé dans Zotero sous forme d'une seule notice PDF et qu'il faut le scinder en notices par document avec métadonnées.

Quand l'éviter

À éviter pour des PDF déjà découpés en documents, des scans sans couche photo par page, ou si vous ne pouvez pas passer par l'API web Zotero.

Analyse de sécurité

Sûr
Score qualité90/100

The skill's actions—reading a local PDF, splitting it with pypdf, creating Zotero items, uploading attachments, and tagging a title—are all core intended functionality. It explicitly forbids writing under ~/Zotero and forbids deleting the batch item, uses no curl|sh, base64 payloads, or secret-exfiltration, and the only credential use is for the stated Zotero API. Network access and API-key handling are inherent to the task and non-destructive, so overall risk is low.

Points d'attention
  • •Reads Zotero API credentials (ZOTERO_API_KEY etc.) from plaintext ~/.zotero_env; used only for the legitimate Zotero web API, no evidence of external exfiltration
  • •Broad Bash(python3:*) permission with network access via pyzotero creates items, uploads PDFs, and mutates remote library metadata (prepends 'DONE ' to a title)
  • •Writes intermediate files to /tmp/zotero-split/<batchKey>/ (standard, non-destructive)
Comment cette analyse est faite

Exemples

Split a folder batch item
Split the Zotero item "[Folder 42, Box 1]" into per-document items, using the deepest collection and tagging everything for review.
Locate then inspect
Run zsplit.py locate on "Folder 17, Box 3" and show me the page images so we can decide the document boundaries.
Handwritten page transcription
Split the batch scan item "[Folder 8, Box 2]" and produce a transcription for any handwritten pages you find.

name: zotero-split-scans description: Split a batch-scanned archival PDF in your Zotero library into document-level items. Use whenever you ask to "split" a Zotero folder/batch scan item (e.g. an item titled "[Folder N, Box X]"), break a multi-document archive scan into separate items, or process a new batch scan from the archive. The batch PDFs are assumed to come from the vFlat iPhone app — one OCR'ed PDF per physical archive folder, with multiple documents inside. allowed-tools: Bash(python3:*) Read

Zotero Split Scans

Splits one "whole folder" batch scan item into per-document Zotero items, with metadata copied from the batch item and visual (not OCR-trusting) document identification.

Conventions are adaptable defaults. The choices below — the for review tag, the DONE title marker, the vFlat-style "one embedded photo per page" assumption, the letter/manuscript/article item-type mapping, and the "deepest collection only" rule — reflect one archival workflow. They are sensible defaults, not requirements; adjust the prose here and the constants in scripts/zsplit.py (e.g. DONE_PREFIX) to match your own library.

Hard rules

  • Never write under ~/Zotero/ (storage, settings, database). Local storage is read-only; every write goes through the Zotero web API.
  • Never delete the batch item, and leave its content alone. The single allowed edit: on a clean execute run, the script prepends DONE to its title (e.g. [Folder 42, Box 1] → DONE [Folder 42, Box 1]) so processed folders stand out in the library. Its PDF, tags, collections, and other metadata are never touched.
  • All new items get the for review tag.
  • New items go into the batch item's deepest collection only (the folder-level subcollection, e.g. "folder 42, box 1.2.1") — not parent collections, not anywhere else, unless you say otherwise.

Workflow

1. Locate

python3 ~/.claude/skills/zotero-split-scans/scripts/zsplit.py locate <ITEMKEY or "title query">

Resolves the batch item, copies its PDF out of local Zotero storage (~/Zotero/storage/<attKey>/, API download as fallback), extracts each page's embedded scan photo to the workdir /tmp/zotero-split/<batchKey>/, and writes batch.json (metadata + per-page OCR previews) and manifest.template.json.

vFlat pages each contain exactly one embedded JPEG (the camera photo) under an invisible OCR text layer — the script extracts the original photo; it only rasterizes as a fallback.

2. Inspect visually

Read every page image (page-001.jpeg, …) with the Read tool. Do not segment documents from the OCR previews alone — your visual recognition is more accurate. Decide:

  • Document boundaries (which pages belong together — letterheads, signatures, page numbers, paper/handwriting changes are the cues)
  • Item type per document:
    • letter — letters and memoranda
    • newspaperArticle / magazineArticle — press clippings
    • manuscript — everything else (default)
  • Title, creators, date as visible on the document
  • Whether any page is handwritten → produce a transcription from the image (do not rely on OCR)

3. Write the manifest

Write manifest.json in the workdir (start from manifest.template.json):

{
  "batch_key": "XXXXXXXX",
  "collections": ["<deepest collection key only>"],
  "documents": [
    {
      "pages": [1, 2],
      "itemType": "letter",
      "title": "",
      "creators": [
        {"creatorType": "author", "firstName": "Clay", "lastName": "Myers"},
        {"creatorType": "recipient", "firstName": "…", "lastName": "…"}
      ],
      "date": "1983-07-25",
      "transcription": null
    }
  ]
}

Metadata rules:

  • Every item needs a title — except letters, which may instead have at least an author creator. Never invent a title starting with [Letter (that pattern is Zotero's auto-generated display title; leave letter titles empty instead).
  • date as written on the document (ISO if a full date is known).
  • transcription: plain text for handwritten documents; becomes a child note. null otherwise.
  • Optional per-document fields passed through when the item type supports them: letterType, publicationTitle, place, abstractNote, manuscriptType, numPages, section. For an article's printed page range use bibPages (a string like "42-48") — not pages, which is reserved for selecting the scan pages of the document.
  • Tags, Archive, and Loc. in Archive are copied from the batch item automatically — don't put them in the manifest.

4. Execute

python3 ~/.claude/skills/zotero-split-scans/scripts/zsplit.py execute /tmp/zotero-split/<batchKey>/manifest.json

Splits the PDF with pypdf (preserves the OCR text layer), creates the items, uploads each split PDF, adds transcription notes, then runs a verification pass listing each new item's children. Warns if any batch pages were left unassigned.

When every document is created successfully, it finally prepends DONE to the batch item's title — your at-a-glance signal in the library for which folders are processed. This is idempotent (a re-run won't stack DONE DONE), and a run where any item failed to create leaves the title unmarked so DONE always means "fully split". Unassigned pages only warn; they don't block the marker.

5. Report

Tell the user: items created (keys + labels + web links from results.json), any attachment/note failures, any unassigned pages, whether the batch item was marked DONE (and if not, why — e.g. a creation failure left it unmarked), and a reminder that everything is tagged for review.

Gotchas

  • pyzotero.attachment_simple returns three buckets: success, failure, and unchanged. An already-uploaded identical file lands in unchanged — that is success, not failure.
  • Credentials live in ~/.zotero_env (ZOTERO_LIBRARY_ID / ZOTERO_LIBRARY_TYPE / ZOTERO_API_KEY). See .zotero_env.example in the repo.
  • Full-library q= searches sometimes time out; prefer passing the 8-char item key.
  • If the batch item was just scanned, the local client may not have synced yet — if the item isn't found via the API, ask the user to sync Zotero first.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/zotero-batch-scan-splitter-mrx3xwut/download' --output '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md.part' && mv '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md.part' '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Outils déclarés par l’auteur (à vérifier dans votre agent) : Bash(python3:*) Read

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md' && test -s '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/zotero-split-scans' && cp -R '.skill-downloads/zotero-batch-scan-splitter-mrx3xwut' '.claude/skills/zotero-split-scans'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/zotero-batch-scan-splitter-mrx3xwut'

openskills read 'zotero-batch-scan-splitter-mrx3xwut'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/zotero-batch-scan-splitter-mrx3xwut/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires