How to Use Context Hub: A Step-by-Step Guide for AI Coding Agents
Purpose
This post demonstrates how to set up and use Context Hub with your AI coding agent. I’ll cover installation, basic commands, and integration with Claude Code and Cursor.
Environment
- Node.js >= 18
- npm package manager
- AI coding agent (Claude Code or Cursor)
Step 1: Install Context Hub
First, install the CLI globally:
npm install -g @aisuite/chubVerify the installation:
chub --versionIf you see a version number, you’re ready to go.
Step 2: Search for Documentation
The chub search command finds relevant documentation:
# Search for OpenAI docschub search openai
# Search for Stripe payment docschub search "stripe payments"I ran a search for OpenAI and got results like:
openai/chat - OpenAI Chat Completions APIopenai/embeddings - OpenAI Embeddings APIopenai/assistants - OpenAI Assistants APIEach result has an ID (like openai/chat) that you use to fetch the actual documentation.
Step 3: Fetch Documentation
Use chub get with the ID and language flag:
# Fetch Python docs for OpenAI chatchub get openai/chat --lang py
# Fetch JavaScript docs for Stripe APIchub get stripe/api --lang jsThe --lang flag is important. It ensures you get language-specific documentation with the correct syntax and examples.
You can also fetch multiple docs at once:
chub get openai/chat stripe/api --lang jsOr save to a specific file:
chub get anthropic/sdk --lang py -o docs/anthropic.mdStep 4: Integrate with Claude Code
Claude Code can use Context Hub automatically if you install the built-in skill:
# Create skills directory if it doesn't existmkdir -p ~/.claude/skills
# Copy the skill filecp $(npm root -g)/@aisuite/chub/skills/get-api-docs/SKILL.md ~/.claude/skills/get-api-docs.mdAfter this, Claude Code will automatically fetch documentation when it needs current API info.
Step 5: Integrate with Cursor
For Cursor, copy the skill to your project’s rules:
# Create rules directory if it doesn't existmkdir -p .cursor/rules
# Copy the skill filecp $(npm root -g)/@aisuite/chub/skills/get-api-docs/SKILL.md .cursor/rules/get-api-docs.mdThe Agent Workflow
Once integrated, your agent follows this pattern:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐│ Search │ ─→ │ Fetch │ ─→ │ Use │ ─→ │ Annotate ││ chub search │ │ chub get │ │ Read docs │ │ Save learnings│└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘- Search - Agent finds relevant docs
- Fetch - Agent gets the documentation
- Use - Agent reads and applies the docs
- Annotate - Agent saves discoveries for next session
Verify Everything Works
Test your setup:
# Search for OpenAIchub search openai
# Fetch the chat docschub get openai/chat --lang pyIf you see documentation output, everything is working.
Common Issues
I ran into a couple issues during setup:
Issue 1: Node version too old
Error: This package requires Node.js >= 18Solution: Upgrade Node.js to version 18 or higher.
Issue 2: Command not found
command not found: chubSolution: The npm global bin directory isn’t in your PATH. Add it:
# Add npm global bin to PATH (add to your .bashrc or .zshrc)export PATH="$(npm bin -g):$PATH"Summary
In this post, I showed how to install and use Context Hub with AI coding agents. The key point is the simple workflow: install the CLI, search for docs, fetch with the language flag, and integrate the skill with your agent. Setup takes under 2 minutes, and then your agent has access to 600+ curated documentation entries.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
- 👨💻 Context Hub GitHub
- 👨💻 npm: @aisuite/chub
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments