kerim/zotero-code-execution/skill
Claude Code and agent skill by kerim/zotero-code-execution
- community
Checking that the SKILL.md file is still in the repository.
Search Zotero library using code execution for efficient multi-strategy searches without crash risks. Use this skill when the user needs comprehensive Zotero searches with automatic deduplication and ranking.
Install
npx vskill@latest install kerim/zotero-code-execution/skillSKILL.md
Zotero MCP Code Execution Skill
Search your Zotero library using code execution for safe, efficient, comprehensive searches.
🎯 Core Concept
Instead of calling MCP tools directly (which loads all results into context and risks crashes), write Python code that:
- Fetches large datasets (50-100+ items per strategy)
- Filters and ranks in code execution environment
- Returns only top N results to context
Benefits:
- ✅ No crash risk (large data stays in code)
- ✅ Automatic multi-strategy search
- ✅ Automatic deduplication
- ✅ Automatic ranking
- ✅ One function call instead of 5-10
🚀 Basic Usage
For 90% of Zotero searches, use this simple pattern:
This automatically:
- Performs semantic search (multiple variations)
- Performs keyword search (multiple variations)
- Performs tag-based search
- Fetches 100+ items total
- Deduplicates results
- Ranks by relevance
- Returns only top 20 to context
📋 Common Patterns
Pattern 1: Simple Search (Most Common)
User asks: "Find papers about embodied cognition"
Pattern 2: Filtered Search
User asks: "Find recent journal articles about machine learning"
Pattern 3: Author Search
User asks: "What papers do I have by Kahneman?"
Pattern 4: Tag-Based Search
User asks: "Show me papers tagged with 'learning' and 'cognition'"
Pattern 5: Recent Papers
User asks: "What did I recently add?"
Pattern 6: Multi-Topic Search
User asks: "Find papers about both cognition and learning"
🔧 Advanced Usage
Custom Filtering Logic
Multi-Angle Custom Search
Iterative Refinement
📚 API Reference
SearchOrchestrator
Main class for automated searching.
comprehensive_search(query, max_results=20, use_semantic=True, use_keyword=True, use_tags=True, search_limit_per_strategy=50)
Performs multi-strategy search with automatic deduplication and ranking.
Parameters:
query(str): Search querymax_results(int): Maximum results to return (default: 20)use_semantic(bool): Use semantic search (default: True)use_keyword(bool): Use keyword search (default: True)use_tags(bool): Use tag search (default: True)search_limit_per_strategy(int): Items to fetch per strategy (default: 50)
Returns: List of ZoteroItem objects
filter_by_criteria(items, item_types=None, date_range=None, required_tags=None, excluded_tags=None)
Filter items by various criteria.
Parameters:
items(list): Items to filteritem_types(list): Allowed item types (e.g., ["journalArticle"])date_range(tuple): (min_year, max_year)required_tags(list): Tags that must be presentexcluded_tags(list): Tags that must not be present
Returns: Filtered list of ZoteroItem objects
ZoteroLibrary
Low-level interface to Zotero.
search_items(query, qmode="titleCreatorYear", item_type="-attachment", limit=100, tag=None)
Basic keyword search.
semantic_search(query, limit=100, search_type="hybrid")
Semantic/vector search.
search_by_tag(tags, item_type="-attachment", limit=100)
Search by tags.
get_recent(limit=50)
Get recently added items.
get_tags()
Get all tags in library.
format_results(items, include_abstracts=True, max_abstract_length=300)
Format items as markdown.
⚙️ Configuration
Default Parameters
Good defaults for most searches:
Adjusting Search Depth
For quick searches (fewer results, faster):
For thorough searches (more comprehensive):
🔍 How It Works
Behind the Scenes
When you call comprehensive_search("embodied cognition", max_results=20):
- Semantic Search (if enabled):
- Searches "embodied cognition" (hybrid mode) → 50 items
- Searches "embodied cognition" (vector mode) → 50 items
- Keyword Search (if enabled):
- Searches with qmode="everything" → 50 items
- Searches with qmode="titleCreatorYear" → 50 items
- Tag Search (if enabled):
- Extracts words from query
- Finds matching tags in library
- Searches by matching tags → 50 items
- Processing:
- Combines all results (~250 items)
- Deduplicates using item keys (~120 unique)
- Ranks by relevance score
- Returns top 20
- Context:
- Only the final 20 items go to LLM context
- All processing happens in code execution environment
Why This Is Better
Old Approach (Direct MCP):
New Approach (Code Execution):
🛠️ Error Handling
Always handle potential errors:
📖 Examples
See /Users/niyaro/Documents/Code/zotero-code-execution/examples.py for 8 complete working examples.
🎓 Quick Reference
| Task | Code | |
|---|---|---|
| Basic search | orchestrator.comprehensive_search(query, max_results=20) | |
| Filter by type | orchestrator.filter_by_criteria(items, item_types=["journalArticle"]) | |
| Filter by date | orchestrator.filter_by_criteria(items, date_range=(2020, 2025)) | |
| Search author | library.search_items(author, qmode="titleCreatorYear", limit=50) | |
| Search by tag | library.search_by_tag([tags], limit=50) | |
| Recent items | library.get_recent(limit=20) | |
| Format output | format_results(items, include_abstracts=True) |
💡 Tips
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskill/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 8
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kerim/zotero-code-execution/skill)