Use ContextKit CLI to intelligently select code context for LLM prompts. Use when you need to find relevant code chunks for a query, index a codebase for semantic search, or optimize context for token budgets. Triggers on "find relevant code", "select context", "index codebase", "semantic code search", "optimize context window", or when preparing code context for AI assistants.
Install
npx skillscat add milo4jo/contextkit Install via the SkillsCat registry.
ContextKit
Intelligent context selection for LLM applications. Stop dumping your entire codebase into AI prompts.
Install
npm install -g @milo4jo/contextkitQuick Start
# Initialize in project root
contextkit init
# Add source directories
contextkit source add ./src
# Build the index (creates local embeddings)
contextkit index
# Find relevant context for a query
contextkit select "How does authentication work?"Commands
init
Initialize ContextKit in current directory. Creates .contextkit/ folder with config and database.
contextkit initsource
Manage source directories to index.
contextkit source add ./src
contextkit source add ./lib --name "Library Code"
contextkit source list
contextkit source remove ./srcindex
Build or update the semantic index. Processes files into chunks and generates embeddings locally.
contextkit index
contextkit index --force # Re-index everythingselect
Find relevant code chunks for a query. Returns formatted context ready for LLM prompts.
contextkit select "How does the payment flow work?"
contextkit select "authentication" --budget 4000 # Token budget
contextkit select "database queries" --format markdownOptions:
--budget <tokens>: Maximum tokens to return (default: 8000)--format <type>: Output format (markdown|plain|json)--top <n>: Maximum chunks to return
status
Show index status and statistics.
contextkit statusMCP Server
ContextKit includes an MCP server for Claude Desktop integration.
Setup
Add to claude_desktop_config.json:
{
"mcpServers": {
"contextkit": {
"command": "contextkit-mcp"
}
}
}Available Tools
contextkit_select: Find relevant context for a querycontextkit_index: Rebuild the codebase indexcontextkit_status: Check index status
Best Practices
- Index frequently changed code: Re-run
contextkit indexafter significant changes - Use specific queries: "How does JWT validation work?" beats "authentication"
- Adjust token budget: Match your model's context window minus other content
- Combine with manual context: Use ContextKit output alongside specific files you know are relevant
Typical Workflow
# Before asking Claude about your codebase:
contextkit select "your question here" | pbcopy
# Then paste into your prompt alongside the questionOr with MCP: Claude automatically calls contextkit_select when it needs code context.