Skip to content
Back to skills

Context7

ASecurity

> **On-demand CLI/skill (context7 is NOT loaded as an MCP server).** Use this > skill to fetch up-to-date library documentation via the `ctx7` CLI or the > Context7 HTTP API.

  • 18 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 17, 2026
ai-agentsgobashreactnextjsexpressgitapidocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned October 17, 2026

npx -y skills add HiAi-gg/hiai-opencode --skill context7 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context7?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Context7
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hiai-gg-context7/badge)](https://www.skillsdirectory.com/skills/hiai-gg-context7)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# context7

> **On-demand CLI/skill (context7 is NOT loaded as an MCP server).** Use this
> skill to fetch up-to-date library documentation via the `ctx7` CLI or the
> Context7 HTTP API.

## ⚠️ INVALID COMMAND — NEVER USE

**`ctx7 search` does not exist and will fail.** Never run:

- `npx -y ctx7 search ...`
- `npx ctx7 search ...`
- `ctx7 search ...`

Any command containing `ctx7 search` is invalid. Use only the two-step
`library` → `docs` flow described below.

## When to use

Use this skill when you need **up-to-date documentation for a third-party
library or framework** (library APIs, function signatures, code examples,
version-specific behavior).

Do **not** use it for:

- Local codebase exploration — use the native `grep` / `glob` tools or the
  `explore` agent instead.
- General web search — use `firecrawl` (if available) or your web tools.

## Method 1 — `ctx7` CLI (preferred)

The CLI package is **`ctx7`** (run with `npx -y ctx7`). Fetching docs is two steps:
**resolve the library name → an ID, then query that ID.**

```bash
# Step 1 — resolve a library name to a Context7 ID (format: /org/project).
# Pass a query describing your goal so results rank by relevance.
npx -y ctx7 library react "how to clean up useEffect with async operations"
#   → returns matches, each with a "Context7-compatible library ID", e.g. /reactjs/react.dev
#   add --json and parse: npx -y ctx7 library react "..." --json | jq -r '.[0].id'

# Step 2 — fetch docs for that ID + a specific natural-language question.
npx -y ctx7 docs /reactjs/react.dev "how to clean up useEffect with async operations"
#   add --json for structured output
```

**Valid subcommands are ONLY `library` and `docs`.** Other subcommands that exist:
`ctx7 login`, `ctx7 whoami`, `ctx7 setup`, `ctx7 upgrade` — but these are for
auth/setup only, not for doc lookups.

### Handling broad queries

For a broad query like **"svelte kit static site prerender seo"**:

1. First extract the library/framework name: `sveltekit` or `svelte`
2. Run Step 1 with the library: `npx -y ctx7 library sveltekit "static site prerender seo" --json`
3. Pick the best matching ID from results, then run Step 2

**Never try to stuff an entire query into `ctx7 search`** — there is no such
command. Always resolve the library first, then query the ID.

Notes:

- Library IDs **always start with `/`**. `ctx7 docs react "hooks"` fails — use the
  full `/org/project` ID from Step 1.
- Version-specific docs: use the version ID from Step 1, e.g.
  `ctx7 docs /vercel/next.js/v14.3.0-canary.87 "app router setup"`.
- Works **without auth**; `export CONTEXT7_API_KEY=<key>` (already set in this env via
  bob.env) just raises rate limits. Silence telemetry with `CTX7_TELEMETRY_DISABLED=1`.

## Method 2 — HTTP API (fallback, no install)

Works without a key (key → higher limits):

```bash
# Search for a library → take .results[0].id (e.g. "/reactjs/react.dev")
curl -sS "https://context7.com/api/v1/search?query=react" \
  -H "Authorization: Bearer ${CONTEXT7_API_KEY:-}" | jq -r '.results[0].id'

# Fetch docs by that ID (note the leading slash is part of the path)
curl -sS "https://context7.com/api/v1/reactjs/react.dev?type=txt&topic=useEffect%20cleanup" \
  -H "Authorization: Bearer ${CONTEXT7_API_KEY:-}"
```

## Best practices

- **Resolve once, reuse.** Keep the resolved `/org/project` ID in your reasoning;
  don't re-resolve within a session.
- **Ask specific questions.** "How to set up JWT auth in Express" beats "auth".
- **Trim the result.** Quote the relevant snippets into your answer rather than
  dumping the whole payload (cap with `-k`).

## context7 vs grep_app

| Tool                      | Best for                                          |
| ------------------------- | ------------------------------------------------- |
| **context7** (this skill) | Official docs, API references, framework guides   |
| **grep_app** (MCP)        | Real-world usage examples from public GitHub code |

Use them together: context7 to learn the API, grep_app to see how others use it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.