Skip to content

Context7 Platform -- Up-to-date docs for AI agents

CTX7-3085: fix(cli): download setup skills from GitHub, not the Skill Hub API (#3344)

Enes Gulesc1e314bc89f3
diff --git a/.changeset/setup-skills-from-github.md b/.changeset/setup-skills-from-github.md
new file mode 100644
index 00000000..0ac1f94d
--- /dev/null
+++ b/.changeset/setup-skills-from-github.md
@@ -0,0 +1,5 @@
+---
+"ctx7": patch
+---
+
+`ctx7 setup` now downloads the find-docs and context7-mcp skills directly from GitHub instead of the deprecated Skill Hub API.
diff --git a/packages/cli/src/commands/setup.ts b/packages/cli/src/commands/setup.ts
index ee8113f9..0f8da581 100644
--- a/packages/cli/src/commands/setup.ts
+++ b/packages/cli/src/commands/setup.ts
@@ -8,7 +8,6 @@ import { dirname, join } from "path";
import { log } from "../utils/logger.js";
import { checkboxWithHover } from "../utils/prompts.js";
import { trackEvent } from "../utils/tracking.js";
-import { downloadSkill } from "../utils/api.js";
import { installSkillFiles } from "../utils/installer.js";
import { performLogin } from "./auth.js";
import { saveTokens, getValidAccessToken } from "../utils/auth.js";
@@ -25,6 +24,8 @@ import {
} from "../setup/agents.js";
import {
customizeSkillFilesForAgent,
+ fetchSetupSkillFiles,
+ getBundledFindDocsSkillFiles,
getBundledMcpSkillFiles,
getBundledRuleContent,
getRuleContent,
@@ -315,15 +316,10 @@ async function loadMcpSkillPayload(deployment: SetupDeployment): Promise<McpSkil
return { files: bundled, status: "installed (bundled)" };
}
- try {
- const downloadData = await downloadSkill("/upstash/context7", "context7-mcp");
- if (downloadData.error || downloadData.files.length === 0) {
- throw new Error(downloadData.error || "no files");
- }
- return { files: downloadData.files, status: "installed" };
- } catch {
- return { files: bundled, status: "installed (bundled fallback)" };
- }
+ const files = await fetchSetupSkillFiles("context7-mcp");
+ return files
+ ? { files, status: "installed" }
+ : { files: bundled, status: "installed (bundled fallback)" };
}
/**
@@ -520,7 +516,7 @@ async function setupMcp(
async function setupCliAgent(
agentName: SetupAgent,
scope: Scope,
- downloadData: { files: Array<{ path: string; content: string }> }
+ skillFiles: Array<{ path: string; content: string }>
): Promise<{ skillPath: string; skillStatus: string; rulePath: string; ruleStatus: string }> {
const agent = getAgent(agentName);
@@ -530,7 +526,7 @@ async function setupCliAgent(
: join(process.cwd(), agent.skill.dir("project"));
let skillStatus: string;
try {
- const files = customizeSkillFilesForAgent(agentName, "find-docs", downloadData.files);
+ const files = customizeSkillFilesForAgent(agentName, "find-docs", skillFiles);
await installSkillFiles("find-docs", files, skillDir);
skillStatus = "installed";
} catch (err) {
@@ -562,14 +558,14 @@ async function setupCli(options: SetupOptions): Promise<void> {
log.blank();
const spinner = ora("Downloading find-docs skill...").start();
- const downloadData = await downloadSkill("/upstash/context7", "find-docs");
- if (downloadData.error || downloadData.files.length === 0) {
- spinner.fail(`Failed to download find-docs skill: ${downloadData.error || "no files"}`);
- return;
+ const downloaded = await fetchSetupSkillFiles("find-docs");
+ const files = downloaded ?? getBundledFindDocsSkillFiles();
+ if (downloaded) {
+ spinner.succeed("Downloaded find-docs skill");
+ } else {
+ spinner.warn("Could not download find-docs skill, using the bundled copy");
}
- spinner.succeed("Downloaded find-docs skill");
-
const installSpinner = ora("Installing...").start();
const results: Array<{
agent: string;
@@ -582,7 +578,7 @@ async function setupCli(options: SetupOptions): Promise<void> {
for (const agentName of agents) {
const agentDef = getAgent(agentName);
installSpinner.text = `Setting up ${agentDef.displayName}...`;
- const r = await setupCliAgent(agentName, scope, downloadData);
+ const r = await setupCliAgent(agentName, scope, files);
results.push({ agent: agentDef.displayName, ...r });
}
diff --git a/packages/cli/src/setup/templates.ts b/packages/cli/src/setup/templates.ts
index cc47baec..00e1e789 100644
--- a/packages/cli/src/setup/templates.ts
+++ b/packages/cli/src/setup/templates.ts
@@ -1,8 +1,8 @@
import type { SetupAgent } from "./agents.js";
const GITHUB_RAW_URLS = [
- "https://raw.githubusercontent.com/upstash/context7/master/rules",
- "https://raw.githubusercontent.com/upstash/context7/main/rules",
+ "https://raw.githubusercontent.com/upstash/context7/master",
+ "https://raw.githubusercontent.com/upstash/context7/main",
];
const FALLBACK_MCP = `Use Context7 MCP to fetch current documentation whenever the user asks about a library, framework, SDK, API, CLI tool, or cloud service — even well-known ones like React, Next.js, Prisma, Express, Tailwind, Django, or Spring Boot. This includes API syntax, configuration, version migration, library-specific debugging, setup instructions, and CLI tool usage. Use even when you think you know the answer — your training data may not reflect recent changes. Prefer this over web search for library docs.
@@ -47,25 +47,33 @@ function customizeRuleContent(mode: RuleMode, agent: SetupAgent, body: string):
return body;
}
-async function fetchRule(filename: string, fallback: string): Promise<string> {
+async function fetchRepoFile(path: string): Promise<string | null> {
for (const base of GITHUB_RAW_URLS) {
try {
- const res = await fetch(`${base}/${filename}`);
+ const res = await fetch(`${base}/${path}`);
if (res.ok) return await res.text();
} catch {
continue;
}
}
- return fallback;
+ return null;
}
export async function getRuleContent(mode: RuleMode, agent: SetupAgent): Promise<string> {
const [filename, fallback] =
mode === "mcp" ? ["context7-mcp.md", FALLBACK_MCP] : ["context7-cli.md", FALLBACK_CLI];
- const body = await fetchRule(filename, fallback);
+ const body = (await fetchRepoFile(`rules/${filename}`)) ?? fallback;
return customizeRuleContent(mode, agent, body);
}
+// Setup skills are single SKILL.md files in this repo's `skills/` directory.
+export async function fetchSetupSkillFiles(
+ name: "find-docs" | "context7-mcp"
+): Promise<Array<{ path: string; content: string }> | null> {
+ const content = await fetchRepoFile(`skills/${name}/SKILL.md`);
+ return content ? [{ path: "SKILL.md", content }] : null;
+}
+
export function getBundledRuleContent(mode: RuleMode, agent: SetupAgent): string {
return customizeRuleContent(mode, agent, mode === "mcp" ? FALLBACK_MCP : FALLBACK_CLI);
}
@@ -79,6 +87,15 @@ export function getBundledMcpSkillFiles(): Array<{ path: string; content: string
];
}
+export function getBundledFindDocsSkillFiles(): Array<{ path: string; content: string }> {
+ return [
+ {
+ path: "SKILL.md",
+ content: `---\nname: find-docs\ndescription: Fetch current library documentation with the ctx7 CLI.\n---\n\n# Find Docs\n\n${FALLBACK_CLI}`,
+ },
+ ];
+}
+
export function customizeSkillFilesForAgent(
agent: SetupAgent,
skillName: string,
diff --git a/skills/context7-cli/SKILL.md b/skills/context7-cli/SKILL.md
index 531aa8af..d8209ad4 100644
--- a/skills/context7-cli/SKILL.md
+++ b/skills/context7-cli/SKILL.md
@@ -1,11 +1,11 @@
---
name: context7-cli
-description: Use the ctx7 CLI to fetch library documentation, manage AI coding skills, and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, wants to install/search/generate skills, or needs to set up Context7 for their AI coding agent.
+description: Use the ctx7 CLI to fetch library documentation and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, or needs to set up Context7 for their AI coding agent.
---
# ctx7 CLI
-The Context7 CLI does three things: fetches up-to-date library documentation, manages AI coding skills, and sets up Context7 MCP for your editor.
+The Context7 CLI does two things: fetches up-to-date library documentation and sets up Context7 MCP for your editor.
Make sure the CLI is up to date before running commands:
@@ -22,7 +22,6 @@ npx ctx7@latest <command>
## What this skill covers
- **[Documentation](references/docs.md)** — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated.
-- **[Skills management](references/skills.md)** — Install, search, suggest, list, remove, and generate AI coding skills.
- **[Setup](references/setup.md)** — Configure Context7 MCP for Claude Code / Cursor / OpenCode.
## Quick Reference
@@ -32,18 +31,9 @@ npx ctx7@latest <command>
ctx7 library <name> <query> # Step 1: resolve library ID
ctx7 docs <libraryId> <query> # Step 2: fetch docs
-# Skills
-ctx7 skills install /owner/repo # Install from a repo (interactive)
-ctx7 skills install /owner/repo name # Install a specific skill
-ctx7 skills search <keywords> # Search the registry
-ctx7 skills suggest # Auto-suggest based on project deps
-ctx7 skills list # List installed skills
-ctx7 skills remove <name> # Uninstall a skill
-ctx7 skills generate # Generate a custom skill with AI (requires login)
-
# Setup
ctx7 setup # Configure Context7 MCP (interactive)
-ctx7 login # Log in for higher rate limits + skill generation
+ctx7 login # Log in for higher rate limits
ctx7 whoami # Check current login status
```
@@ -56,7 +46,7 @@ ctx7 logout # Clear stored tokens
ctx7 whoami # Show current login status (name + email)
```
-Most commands work without login. Exceptions: `skills generate` always requires it; `ctx7 setup` requires it unless `--api-key` or `--oauth` is passed. Login also unlocks higher rate limits on docs commands.
+Most commands work without login. Exception: `ctx7 setup` requires it unless `--api-key` or `--oauth` is passed. Login also unlocks higher rate limits on docs commands.
Set an API key via environment variable to skip interactive login entirely:
@@ -68,5 +58,3 @@ export CONTEXT7_API_KEY=your_key
- Library IDs require a `/` prefix — `/facebook/react` not `facebook/react`
- Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID
-- Repository format for skills is `/owner/repo` — e.g., `ctx7 skills install /anthropics/skills`
-- `skills generate` requires login — run `ctx7 login` first
diff --git a/skills/context7-cli/references/setup.md b/skills/context7-cli/references/setup.md
index 1beddace..af369a41 100644
--- a/skills/context7-cli/references/setup.md
+++ b/skills/context7-cli/references/setup.md
@@ -19,8 +19,7 @@ ctx7 setup --opencode # OpenCode only
# CLI + Skills mode — target a specific install location
ctx7 setup --cli --claude # Claude Code (~/.claude/skills)
ctx7 setup --cli --cursor # Cursor (~/.cursor/skills)
-ctx7 setup --cli --universal # Universal (~/.agents/skills)
-ctx7 setup --cli --antigravity # Antigravity (~/.config/agent/skills)
+ctx7 setup --cli --antigravity # Antigravity (~/.agent/skills)
ctx7 setup --project # Configure current project instead of globally
ctx7 setup --yes # Skip confirmation prompts
diff --git a/skills/context7-cli/references/skills.md b/skills/context7-cli/references/skills.md
deleted file mode 100644
index 0a21ee12..00000000
--- a/skills/context7-cli/references/skills.md
+++ /dev/null
@@ -1,118 +0,0 @@
-# Skills Commands
-
-Manage AI coding skills from the Context7 registry. Skills are Markdown files that teach AI coding agents best practices, patterns, and workflows for specific libraries or tasks.
-
-## Install
-
-Install skills from any GitHub repository. Repository format is always `/owner/repo`.
-
-```bash
-ctx7 skills install /anthropics/skills # Interactive — pick from a list
-ctx7 skills install /anthropics/skills pdf # Install a specific skill by name
-ctx7 skills install /anthropics/skills --all # Install everything without prompting
-```
-
-Target a specific IDE with a flag:
-```bash
-ctx7 skills install /anthropics/skills pdf --claude # Claude Code only
-ctx7 skills install /anthropics/skills pdf --cursor # Cursor only
-ctx7 skills install /anthropics/skills pdf --universal # Universal (.agents/skills/)
-ctx7 skills install /anthropics/skills --all --global # All skills, global install
-```
-
-Alias: `ctx7 si /anthropics/skills pdf`
-
-## Search
-
-Find skills across the entire registry by keyword. Shows an interactive list with install counts and trust scores. Select to install.
-
-```bash
-ctx7 skills search pdf
-ctx7 skills search typescript testing
-ctx7 skills search react nextjs
-```
-
-Alias: `ctx7 ss pdf`
-
-## Suggest
-
-Auto-detects your project dependencies and recommends relevant skills from the registry.
-
-```bash
-ctx7 skills suggest # Scan current project, install to project
-ctx7 skills suggest --global # Install suggestions globally
-ctx7 skills suggest --claude # Target Claude Code only
-```
-
-Reads `package.json`, `requirements.txt`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Gemfile`. Falls back to suggesting `ctx7 skills search` if no dependencies are detected.
-
-Alias: `ctx7 ssg`
-
-## Generate (AI-powered)
-
-Generate a custom skill tailored to your stack using AI. **Requires login.**
-
-```bash
-ctx7 skills generate
-ctx7 skills generate --claude # Install directly to Claude Code
-ctx7 skills generate --global # Install to global skills
-```
-
-Interactive flow:
-1. Describe the expertise you want (e.g., "OAuth authentication with NextAuth.js")
-2. Select relevant libraries from search results
-3. Answer 3 clarifying questions to focus the skill
-4. Review the generated skill, request changes if needed
-5. Choose where to install it
-
-**Limits:** Free accounts get 6 generations/week, Pro accounts get 10.
-
-Aliases: `ctx7 skills gen`, `ctx7 skills g`
-
-## List
-
-Show all installed skills for the current project or globally.
-
-```bash
-ctx7 skills list # Current project (all detected IDEs)
-ctx7 skills list --claude # Claude Code only
-ctx7 skills list --global # Global skills
-ctx7 skills list --global --claude # Global Claude Code skills
-```
-
-## Remove
-
-Uninstall a skill by name.
-
-```bash
-ctx7 skills remove pdf
-ctx7 skills remove pdf --claude # From Claude Code only
-ctx7 skills remove pdf --global # From global skills
-```
-
-Aliases: `ctx7 skills rm`, `ctx7 skills delete`
-
-## Info
-
-Browse all skills in a repository without installing — useful for previewing what's available.
-
-```bash
-ctx7 skills info /anthropics/skills
-```
-
-Output shows each skill name, description, and URL, plus quick install commands.
-
-## IDE Flags
-
-All skills commands accept these flags to target a specific AI coding assistant:
-
-| Flag | Directory | Used by |
-|------|-----------|---------|
-| `--universal` | `.agents/skills/` | Amp, Codex, Gemini CLI, OpenCode, GitHub Copilot |
-| `--claude` | `.claude/skills/` | Claude Code |
-| `--cursor` | `.cursor/skills/` | Cursor |
-| `--antigravity` | `.agent/skills/` | Antigravity |
-
-Without a flag, the CLI prompts you to select one or more targets interactively.
-
-Add `--global` to any flag to install in your home directory instead of the current project.