Build Zotero Library logo

Build Zotero Library

Community
danepps
build-zotero-library

Build or extend a verified Zotero collection for a research project, including attached full-text PDFs when requested. Use when the user asks Codex to build, populate, curate, or add sources or PDFs to a Zotero library or collection; gather books, articles, cases, reports, or other research sources into Zotero; attach open-access PDFs or files the user supplies; or audit newly added Zotero items and attachments. Search for candidates, prevent duplicates, record field-level provenance, write through the Zotero Web API, and enforce post-write verification before reporting completion.

Overview

Publisherdanepps
Repositorylegal-research-skills
Skill namebuild-zotero-library
Stars
46
Forks
9
Bundled files
10
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 10 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by danepps on GitHub. Read the source before you install it.

Installation

Install the Build Zotero Library AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/danepps/legal-research-skills/tree/main/codex/build-zotero-library
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/danepps/legal-research-skills.git /tmp/legal-research-skills
mkdir -p .claude/skills
cp -r /tmp/legal-research-skills/codex/build-zotero-library .claude/skills/build-zotero-library
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Build Zotero Library in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Build Zotero Library on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Build Zotero Library is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Build Zotero Library

Build a useful research collection without inventing sources or leaving uncertain records behind. Treat Zotero writes as a reviewed data pipeline: scope, discover, verify, deduplicate, preview, write, re-fetch, audit.

Start a hidden run

Create run state inside the active project, not beside the final user-facing work:

bash
python3 <skill-dir>/scripts/init_run.py \
  --project-dir <project-dir> \
  --request "<user request>" \
  --library user:<id> \
  --collection-name "<target collection>"

Add --require-pdfs whenever the request requires attached full text. Do not omit it merely because authenticated acquisition may be difficult; the validator must keep the run incomplete until every target has a verified PDF or the user accepts a narrower result.

Use the printed run directory for every artifact. Read references/run-format.md before populating it. Do not expose API keys in files, commands, logs, or chat.

Infer a sensible scope when the request is specific. Ask only when a missing choice would materially change the collection: target library, new collection name, source types, date range, jurisdiction, or whether representative rather than exhaustive coverage is wanted. Creating a new collection is authorized only when the user requested one or clearly requested a named destination that does not exist.

Confirm access and destination

Before proposing candidates, the lead reads a complete inventory of the target library. Save it inside the hidden run directory:

bash
python3 <skill-dir>/scripts/zotero_api.py inventory --library user:<id> \
  --output <run-dir>/library-inventory.json

For a large library, inspect the overall inventory and locally filter relevant slices. A narrow search or a worker's statement that a work is absent does not establish absence from the library. The lead owns the inventory and duplicate decision; give any discovery worker the relevant existing-item list. child_count includes notes and non-PDF attachments and never proves that full text is present.

Use the connected Zotero MCP tools for semantic library search, metadata reads, and full text when available. Use the bundled Web API helper for exact collection reads and all writes:

bash
python3 <skill-dir>/scripts/zotero_api.py key-info
python3 <skill-dir>/scripts/zotero_api.py collections --library user:<id>
python3 <skill-dir>/scripts/zotero_api.py collection-items --library user:<id> --collection <key>

For a new installation, configure the recipient’s own ZOTERO_API_KEY, ZOTERO_LIBRARY_ID, and ZOTERO_LIBRARY_TYPE securely in the host environment. The helper reads those variables first; its macOS Keychain fallback is specific to an existing Codex Zotero setup and is optional. Resolve the recipient’s destination from the API and current request; never copy another researcher’s library IDs or credentials. Never read Claude configuration as a credential source. Pass --library group:<id> explicitly for a group library.

The helper does not read MCP configuration files at any scope. A library exposed by a project-specific connected tool can therefore be usable for reads while the shell helper has no credentials for writes. Discover libraries through the active runtime, show their real names, and verify the chosen destination through the route that will perform the operation. Missing shell credentials do not prove that no library exists. If the write route is unavailable, report that limitation and its remedy before preparing a write; do not substitute the Keychain's default library for the requested destination or claim that a read-only connection can perform the write.

Before any write:

  1. Confirm the target library and collection key.
  2. Search both the collection and the wider library for duplicates using title, creator, ISBN, DOI, and close variants.
  3. Record the search queries, possible matches, and unique, duplicate, or uncertain decision in candidates.jsonl.
  4. Recheck duplicates immediately before each write, including late additions and items created earlier in this run. Reuse an existing item by adding collection membership rather than creating a duplicate. Because that modifies external state, preview the proposed membership change just like a new item.

Discover and verify candidates

Search the local project and Zotero library first when relevant, then authoritative external sources. For books prefer publisher pages, national or university library catalogs, ISBN-linked catalog records, and Google Books. For articles prefer the journal, DOI registry, institutional repository, author manuscript, HeinOnline, SSRN, or another source that proves bibliographic identity. For cases and government materials prefer official repositories.

If a source is available only through an authenticated database (HeinOnline, a library proxy, a publisher paywall), do not try to automate access. Ask the user to download the PDF themselves and attach it with --file --source-mode file, recording the provenance URL with --source-url. Never type, request, store, or infer institutional credentials, and never drive a two-factor login.

For every candidate:

  1. Open at least one source establishing that the work exists.
  2. Cross-check surprising, conflicting, or high-risk metadata against a second independent source.
  3. Record field-level provenance for every material field written: title, creators, date, publication, publisher, volume, issue, pages, edition, ISBN, DOI, URL, and item type as applicable.
  4. Do not fill plausible metadata from memory. Leave a nonrequired field blank when it cannot be verified.
  5. Use the edition's actual imprint and date. Preserve verified contributor roles; do not force an unsupported role into Zotero.
  6. Put stable identifiers in their native fields. Normalize DOI values without a doi.org prefix. Prefer ISBN-13 when the edition supplies it.

For law-review articles, preserve the source title's leading article and question mark; use the specific issue's year. Distinguish a real subtitle from an appended piece-type label using the first page. Preserve verified student-note, comment, essay, or foreword designations separately in extra as a genre: line without overwriting other provenance. Verify journal abbreviations before populating journalAbbreviation; never invent one. These fields require the same provenance as other metadata.

Precheck proposed records before writing:

bash
python3 <skill-dir>/scripts/verify_items.py --input <run-dir>/planned-items.json \
  --output <run-dir>/precheck.json

An identifier-based PASS proves bibliographic identity and detects contradictions; it does not prove every Zotero field. The provenance ledger carries that burden. NO_IDENTIFIER, UNRESOLVED, UNAVAILABLE, and MISMATCH require more research or a documented manual verification, not optimism.

Preview and write

Show the user a compact preview before a broad or judgment-heavy write: destination, item count, representative inclusions, exclusions, and unresolved duplicate or scope questions. A routine write that directly matches a precise request may proceed without an extra confirmation. Never silently broaden the project.

Write no more than 50 items per request. The helper adds an idempotency token and records the exact request hash and API response:

bash
python3 <skill-dir>/scripts/zotero_api.py create-items \
  --library user:<id> \
  --input <run-dir>/planned-items.json \
  --output <run-dir>/write-result.json

Inspect the response's successful, unchanged, and failed maps. Do not report an item as added merely because the HTTP request returned successfully.

For corrections, fetch the current item and use a version-guarded partial update:

bash
python3 <skill-dir>/scripts/zotero_api.py patch-item \
  --library user:<id> --key <item-key> --version <version> \
  --input <patch.json>

Do not delete preexisting items. If a newly created item cannot be corrected or verified, disclose the problem and request approval before deleting it.

Acquire and attach requested PDFs

Prefer an open publisher, journal, repository, author, SSRN, government, or other authorized direct PDF URL. Attach direct PDF bytes and append the verified result to the run ledger:

bash
python3 <skill-dir>/scripts/attach_pdf.py \
  --library user:<id> --item <parent-key> --url <pdf-url> \
  --ledger <run-dir>/attachment-results.jsonl

For a PDF the user downloaded themselves from an authenticated source, attach the local file with its provenance URL:

bash
python3 <skill-dir>/scripts/attach_pdf.py \
  --library user:<id> --item <parent-key> --file <path-to.pdf> --source-mode file \
  --source-url <item-url> --ledger <run-dir>/attachment-results.jsonl

If a reused Zotero item already has a stored PDF, verify its bytes instead of adding a duplicate:

bash
python3 <skill-dir>/scripts/attach_pdf.py \
  --library user:<id> --item <parent-key> --verify-existing \
  --ledger <run-dir>/attachment-results.jsonl

The helper parses PDF structure and page content streams with pypdf or PyPDF2, rejects malformed or unreadable files, re-fetches Zotero attachment metadata, matches Zotero's MD5, and computes a local SHA-256. It writes VERIFIED only after parsing and the parent, content type, and stored hash checks pass. If neither parser is available, the attachment remains unverified; install a parser or disclose the incomplete PDF requirement. This is structural verification, not visual inspection or proof that the PDF contains the intended work.

For each new attachment, the helper fetches the parent item's verified Zotero metadata and stores the PDF as Creator - Year - Title.pdf. It uses two creator surnames, switches to FirstCreator et al. for three or more, omits unavailable components, removes filesystem-unsafe characters, and limits the UTF-8 filename length. Use --filename only when a source needs a distinct descriptive label, such as a supplement; the override is normalized to the same safe PDF rules. Do not preserve opaque download names when parent metadata is available. --verify-existing audits an existing filename but does not rename it.

Re-fetch and enforce the gate

Verify exactly what Zotero stored, using the keys returned by the write response and the existing keys of every reused target item:

bash
python3 <skill-dir>/scripts/verify_items.py \
  --library user:<id> --keys <K1,K2,...> \
  --output <run-dir>/verification.json

python3 <skill-dir>/scripts/validate_run.py <run-dir> --require-ready

The verification output records the destination library and fetched item metadata. The gate checks target collection membership and agreement with planned bibliographic fields for every added or reused item. A local-input precheck cannot substitute for this readback. Collection and library list helpers follow every API page; --limit controls page size, not total coverage.

For a genuine item without a resolvable ISBN or DOI, add a line to manual-verifications.jsonl following the run-format reference. A MANUAL_PASS requires an opened authoritative source, the item key, the source URL, access time, checked fields, and a concise note. Search snippets, memory, and secondary mentions do not qualify.

Do not call the run complete unless the validator prints READY. For a --require-pdfs run, READY also requires one structurally verified PDF attachment for every added or reused target item. Repair failed writes, duplicates, provenance gaps, attachment gaps, and verification failures, then re-run the gate. A network outage may justify a candid incomplete or limited handoff, never a fabricated pass.

Report

Return a concise summary containing:

  • destination library and collection;
  • items added, reused, skipped as duplicates, and excluded;
  • the validator's status and verification counts;
  • any MANUAL_PASS items and their verification basis;
  • material judgment calls, remaining limits, and decisions the user should make.

Keep run artifacts hidden unless the user asks to inspect them. Do not publish a memo merely to describe the run.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Build Zotero Library AI skill do?

Build or extend a verified Zotero collection for a research project, including attached full-text PDFs when requested. Use when the user asks Codex to build, populate, curate, or add sources or PDFs to a Zotero library or collection; gather books, articles, cases, reports, or other research sources into Zotero; attach open-access PDFs or files the user supplies; or audit newly added Zotero items and attachments. Search for candidates, prevent duplicates, record field-level provenance, write through the Zotero Web API, and enforce post-write verification before reporting completion.

Why use Build Zotero Library on TypingMind?

Because you install it once and use it with any model. Build Zotero Library is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Build Zotero Library in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/danepps/legal-research-skills/tree/main/codex/build-zotero-library. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Build Zotero Library?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Build Zotero Library?

As many as you like. As long as a model supports skills, you can use Build Zotero Library with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Build Zotero Library AI skill free?

Yes. It is published on GitHub by danepps under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇