From sema
Semantic code search and code intelligence. Use for 'where is X', 'how does Y work', 'find Z logic' queries, symbol definitions, references, and structural queries. Finds code by concept, not exact text.
npx claudepluginhub jrc2139/claude-plugin-sema --plugin semaThis skill uses the workspace's default tool permissions.
Requires sema v0.2.0+. First search automatically indexes your codebase (no manual setup needed). Use `sema "<query>"` for semantic code search. Hybrid search (semantic + keyword) is the default.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
Requires sema v0.2.0+. First search automatically indexes your codebase (no manual setup needed). Use sema "<query>" for semantic code search. Hybrid search (semantic + keyword) is the default.
Direct database queries for symbol lookup and structural filtering. These require a previously built index (automatic on first search).
# Find symbol definitions
sema find <symbol> # Find by exact name
sema find <symbol> --prefix # Prefix match
sema find <symbol> --kind function # Filter by kind (function, class, method, etc.)
sema find <symbol> --exported # Only exported symbols
sema find <symbol> --semantic # Semantic search for similar symbols (requires server)
sema find <symbol> --refs # Include references alongside definitions
# Find symbol references
sema refs <symbol> # Find chunks that reference a symbol
# Query by structural metadata
sema query --kind function --exported --no-docstring # Undocumented public functions
sema query --kind method --min-complexity 10 # Complex methods
sema query --role test --language zig # All test code in Zig
sema query --parent MyClass --kind method # All methods in MyClass
# Show file skeleton with symbol nesting
sema outline <file> # Compact view
sema outline <file> -v # Include signatures
# Impact analysis: where is a symbol used?
sema blast <symbol> # Definition + grouped references
# Codebase map: cluster files by semantic similarity
sema map # Auto-detect cluster count
sema map --clusters 5 # Force 5 clusters
sema map --depth 2 # Hierarchical sub-clustering
sema map --json # JSON output
--kind <type>: function, class, method, struct, enum, interface, etc.--exported: Only exported/public symbols--no-docstring: Symbols without documentation--has-docstring: Symbols with documentation--min-complexity N: Minimum cyclomatic complexity--max-complexity N: Maximum cyclomatic complexity--role <role>: definition, test, configuration--parent <symbol>: Filter by parent symbol-l, --language <lang>: Filter by language-n <n>: Max results (default: 5)# Hybrid search (default) - best for natural language questions
sema "where is authentication handled?"
sema "error handling patterns" -l python
# Keyword search (-k) - fast, no model loading, good for identifiers
sema -k "parseArgs"
sema -k "ConfigLoader"
# Search within a directory
sema "API endpoints" src/
sema "database queries" ./backend/
# With filters
sema "error handling" -l zig -n 10
sema -g "src/**/*.ts" "authentication"
sema --exclude "**/tests/*" "main function"
<path>: Search within directory (positional, e.g., sema "query" src/)-k, --keyword: BM25 text search (no model loading, instant)-n <num>: Max results (default: 5)-l <lang>: Filter by language (python, javascript, zig, etc.)-g <pattern>: Filter by file path glob (e.g., "src/**/*.ts")--exclude <pattern>: Exclude files matching glob pattern (e.g., "**/tests/", ".md")-c, --compact: File paths only| Mode | Flag | Best For | First Run | Speed |
|---|---|---|---|---|
| Hybrid | (default) | Natural language questions | Keyword results immediately; run sema index for semantic | ~50ms (subsequent) |
| Keyword | -k | Exact identifiers, function names | FTS-only index built instantly, no model loading | ~5ms |
Auto-Indexing: On first search, sema builds a keyword (FTS) index automatically.
-k): FTS-only, instant, no model neededsema index for full semantic searchauto_embed: true in config to auto-download model and embed on first searchServer Lifecycle: The server auto-starts when embeddings exist and auto-shuts down after 30 minutes of inactivity.
If the user wants semantic (hybrid) search and no index exists yet, offer to run sema index in the background:
sema index . # Downloads model on first run, then indexes
run_in_background: true so the user can keep workingsema stopsema list shows running servers and sema doctor checks system healthUse sema find:
Use sema refs:
Use sema query:
Use sema outline:
Use sema blast:
Use sema map:
Use sema (hybrid search):
Use sema -k (keyword search):
Use grep:
Configure sema behavior in .sema/config.json or ~/.config/sema/config.json:
Search Mode (db.mode):
"hybrid" (default): Semantic + keyword search. Loads embedding model, best for natural language queries"keyword": FTS-only search. No model loading, instant ~5ms startup, good for identifiersEmbedding Models (default: e5-small-v2):
e5-small-v2: Small, 256 dimensions, balanced speed/quality (default)e5-large-v2: Larger model, better semantic understandingembeddinggemma-300m: Gemma-based embedder, good for domain-specific codeExample config:
{
"db": {
"mode": "hybrid"
}
}
By default, sema respects .gitignore files when indexing. You can also use .semaignore files for sema-specific exclusions (same syntax as .gitignore):
# .semaignore - exclude from sema but keep in git
generated/
*.min.js
vendor/
.semaignore files work at any directory level, just like .gitignore.
To index everything (ignore no patterns):
sema index --no-gitignore .
Or in config:
{
"respect_ignore": false
}