Skip to content

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:

Install Context Hub globally
npm install -g @aisuite/chub

Verify the installation:

Verify installation
chub --version

If you see a version number, you’re ready to go.

Step 2: Search for Documentation

The chub search command finds relevant documentation:

Search for API documentation
# Search for OpenAI docs
chub search openai
# Search for Stripe payment docs
chub search "stripe payments"

I ran a search for OpenAI and got results like:

Sample search output
openai/chat - OpenAI Chat Completions API
openai/embeddings - OpenAI Embeddings API
openai/assistants - OpenAI Assistants API

Each 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 documentation
# Fetch Python docs for OpenAI chat
chub get openai/chat --lang py
# Fetch JavaScript docs for Stripe API
chub get stripe/api --lang js

The --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:

Fetch multiple docs
chub get openai/chat stripe/api --lang js

Or save to a specific file:

Save to file
chub get anthropic/sdk --lang py -o docs/anthropic.md

Step 4: Integrate with Claude Code

Claude Code can use Context Hub automatically if you install the built-in skill:

Install Claude Code skill
# Create skills directory if it doesn't exist
mkdir -p ~/.claude/skills
# Copy the skill file
cp $(npm root -g)/@aisuite/chub/skills/get-api-docs/SKILL.md ~/.claude/skills/get-api-docs.md

After 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:

Install Cursor skill
# Create rules directory if it doesn't exist
mkdir -p .cursor/rules
# Copy the skill file
cp $(npm root -g)/@aisuite/chub/skills/get-api-docs/SKILL.md .cursor/rules/get-api-docs.md

The Agent Workflow

Once integrated, your agent follows this pattern:

┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Search │ ─→ │ Fetch │ ─→ │ Use │ ─→ │ Annotate │
│ chub search │ │ chub get │ │ Read docs │ │ Save learnings│
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
  1. Search - Agent finds relevant docs
  2. Fetch - Agent gets the documentation
  3. Use - Agent reads and applies the docs
  4. Annotate - Agent saves discoveries for next session

Verify Everything Works

Test your setup:

Test Context Hub
# Search for OpenAI
chub search openai
# Fetch the chat docs
chub get openai/chat --lang py

If you see documentation output, everything is working.

Common Issues

I ran into a couple issues during setup:

Issue 1: Node version too old

Error: Node version
Error: This package requires Node.js >= 18

Solution: Upgrade Node.js to version 18 or higher.

Issue 2: Command not found

Error: Command not found
command not found: chub

Solution: The npm global bin directory isn’t in your PATH. Add it:

Fix PATH
# 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:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments