Skip to content
doc-search logo

Document Search

doc-search

Token-efficient documentation search using Serena Document Index. 90%+ token savings vs reading full files. Use BEFORE reading README.md or docs/ files. Triggers on architecture questions, pattern lookups, and project-specific documentation needs.

SKILL.md

Full skill instructions

Document Search

Search project documentation efficiently using the Serena Document Index system.

Why This Matters

ApproachTokensUse Case
Read full README.md3000-8000Never (wasteful)
Read docs/​*.md2000-5000 eachRarely needed
Document Index Search100-500Always prefer
Section Retrieval200-800After finding relevant section

Rule: Never read documentation files until the document index fails to answer.

Document Index Location

.serena/​cache/​documents/​document_index.json

Index Types Available:

  • tag_index - Search by tags (architecture, api, testing, etc.)
  • title_index - Search by section titles
  • project_index - Filter by project (basecamp-server, interface-cli, etc.)
  • doc_type_index - Filter by document type (readme, guide, api-reference, etc.)
  • content_index - Keyword-based content search

Workflow Pattern

Step 1: Search Document Index (Python CLI)

# Search for relevant documentation sections
cd /​Users/​kun/​github/​1ambda/​dataops-platform
python3 scripts/​serena/​document_indexer.py --search "hexagonal architecture" --max-results 5

Step 2: Read Specific Section Only

After finding relevant section from search:

# Use section coordinates from search result
# Example: project-basecamp-server/​docs/​PATTERNS.md#module-placement-rules
# Read only that section (lines 45-80) instead of entire file
Read(file_path="project-basecamp-server/​docs/​PATTERNS.md", offset=45, limit=35)

Step 3: Alternative - Direct JSON Query

# For programmatic access in agent workflows
import json
from pathlib import Path

cache_path = Path(".serena/​cache/​documents/​document_index.json")
index = json.loads(cache_path.read_text())

# Search by tag
architecture_docs = index['tag_index'].get('architecture', [])

# Search by project
server_docs = index['project_index'].get('project-basecamp-server', [])

# Get section content
for ref in architecture_docs[:3]:
    print(f"Section: {ref['section_title']}")
    print(f"File: {ref['relative_path']}")
    print(f"Lines: {ref['line_start']}-{ref['line_end']}")

Decision Tree

Need documentation?
|
+-- What patterns exist for X?
|   +-- doc-search: tag_index["patterns"] or tag_index["architecture"]
|
+-- How to implement feature in project Y?
|   +-- doc-search: project_index["project-Y"] + tag_index["implementation"]
|
+-- What does README say about Z?
|   +-- doc-search: title_index["Z"] or content_index["keyword"]
|
+-- Full context needed?
    +-- Read specific section (lines from search result)
    +-- LAST RESORT: Read full file

Integration with mcp-efficiency

Document search is the first step before Serena symbol queries:

# 1. Search docs for patterns/​context
doc_search("hexagonal architecture", max_results=3)

# 2. Use Serena for code structure
serena.get_symbols_overview("module-core-domain/")

# 3. Find specific symbols
serena.find_symbol("RepositoryJpa", depth=1)

Common Search Queries

NeedSearch Query
Architecture patterns"hexagonal" OR "architecture"
API endpoints"api" OR "endpoint" OR "controller"
Testing patterns"test" OR "testing" OR "fixture"
Entity relationships"entity" OR "repository" OR "jpa"
CLI commands"command" OR "cli" OR "dli"
Configuration"config" OR "environment" OR "settings"

Token Savings Examples

TaskWithout Doc SearchWith Doc SearchSavings
Find architecture pattern5000 tokens (full PATTERNS.md)300 tokens94%
Check entity rules3000 tokens (full README)400 tokens87%
Find API reference4000 tokens (full docs)250 tokens94%
Implementation guide6000 tokens (multiple files)500 tokens92%

Updating the Index

# Rebuild after documentation changes
python3 scripts/​serena/​update-symbols.py --with-docs

# Incremental update (changed files only)
python3 scripts/​serena/​update-symbols.py --changed-only --with-docs

# Full rebuild
python3 scripts/​serena/​document_indexer.py --project-root . --rebuild

Anti-Patterns

Anti-PatternProblemSolution
Read full README.md first3000+ tokens wastedSearch index, read section
Read all docs/​*.md10000+ tokens wastedSearch by tag/​title
Skip doc search, use webSlower, less relevantUse indexed local docs
Guess file locationsMiss relevant docsUse project_index filter

Quick Reference

# CLI search (recommended)
python3 scripts/​serena/​document_indexer.py --search "QUERY" --max-results 5

# Build/​rebuild index
python3 scripts/​serena/​update-symbols.py --with-docs

# Check index stats
python3 -c "import json; d=json.load(open('.serena/​cache/​documents/​document_index.json')); print(d['metadata'])"

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View