Add skills

This commit is contained in:
2026-03-22 23:21:49 +02:00
parent 4cbbbae1ef
commit c09d9151ca
104 changed files with 23879 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
# Documentation Commands
Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework. Two-step workflow: resolve the library name to get its ID, then query docs using that ID.
If the user already provided a library ID in `/org/project` or `/org/project/version` format, pass it directly to `ctx7 docs`.
## Step 1: Resolve a Library
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.
```bash
ctx7 library react "How to clean up useEffect with async operations"
ctx7 library nextjs "How to set up app router with middleware"
ctx7 library prisma "How to define one-to-many relations with cascade delete"
```
Always pass a `query` argument — it is required and directly affects result ranking. Use the user's intent to form the query, which helps disambiguate when multiple libraries share a similar name. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
### Result fields
Each result includes:
- **Library ID** — Context7-compatible identifier (format: `/org/project`)
- **Name** — Library or package name
- **Description** — Short summary
- **Code Snippets** — Number of available code examples
- **Source Reputation** — Authority indicator (High, Medium, Low, or Unknown)
- **Benchmark Score** — Quality indicator (100 is the highest score)
- **Versions** — List of versions if available. Use one of those versions if the user provides a version in their query. The format is `/org/project/version`.
### Selection process
1. Analyze the query to understand what library/package the user is looking for
2. Select the most relevant match based on:
- Name similarity to the query (exact matches prioritized)
- Description relevance to the query's intent
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
- Source reputation (consider libraries with High or Medium reputation more authoritative)
- Benchmark score (higher is better, 100 is the maximum)
3. If multiple good matches exist, acknowledge this but proceed with the most relevant one
4. If no good matches exist, clearly state this and suggest query refinements
5. For ambiguous queries, request clarification before proceeding with a best-guess match
IMPORTANT: Do not call `ctx7 library` more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you have.
### Version-specific IDs
If the user mentions a specific version, use a version-specific library ID:
```bash
# General (latest indexed)
ctx7 docs /vercel/next.js "How to set up app router"
# Version-specific
ctx7 docs /vercel/next.js/v14.3.0-canary.87 "How to set up app router"
```
The available versions are listed in the `ctx7 library` output. Use the closest match to what the user specified.
```bash
# Output as JSON for scripting
ctx7 library react "How to use hooks for state management" --json | jq '.[0].id'
```
## Step 2: Query Documentation
Retrieves up-to-date documentation and code examples for the resolved library.
You must call `ctx7 library` first to obtain the exact Context7-compatible library ID required to use this command, UNLESS the user explicitly provides a library ID in the format `/org/project` or `/org/project/version`.
```bash
ctx7 docs /facebook/react "How to clean up useEffect with async operations"
ctx7 docs /vercel/next.js "How to add authentication middleware to app router"
ctx7 docs /prisma/prisma "How to define one-to-many relations with cascade delete"
```
IMPORTANT: Do not call `ctx7 docs` more than 3 times per question. If you cannot find what you need after 3 calls, use the best information you have.
### Writing good queries
The query directly affects the quality of results. Be specific and include relevant details. Do not include any sensitive or confidential information such as API keys, passwords, credentials, personal data, or proprietary code in your query.
| Quality | Example |
|---------|---------|
| Good | `"How to set up authentication with JWT in Express.js"` |
| Good | `"React useEffect cleanup function with async operations"` |
| Bad | `"auth"` |
| Bad | `"hooks"` |
Use the user's full question as the query when possible — vague one-word queries return generic results.
The output contains two types of content: **code snippets** (titled, with language-tagged blocks) and **info snippets** (prose explanations with breadcrumb context).
```bash
# Output as structured JSON
ctx7 docs /facebook/react "How to use hooks for state management" --json
# Pipe to other tools — output is clean when not in a TTY (no spinners or colors)
ctx7 docs /facebook/react "How to use hooks for state management" | head -50
ctx7 docs /vercel/next.js "How to add middleware for route protection" | grep -A5 "middleware"
```
## Authentication
Works without authentication. For higher rate limits:
```bash
# Option A: environment variable
export CONTEXT7_API_KEY=your_key
# Option B: OAuth login
ctx7 login
```

View File

@@ -0,0 +1,43 @@
# Setup
## ctx7 setup
One-time command to configure Context7 for your AI coding agent. Prompts for mode on first run:
- **MCP server** — registers the Context7 MCP server so the agent can call tools natively
- **CLI + Skills** — installs a `find-docs` skill that guides the agent to use `ctx7` CLI commands (no MCP required)
```bash
ctx7 setup # Interactive — prompts for mode, then agent/install target
ctx7 setup --mcp # Skip prompt, use MCP server mode
ctx7 setup --cli # Skip prompt, use CLI + Skills mode
# MCP mode — target a specific agent
ctx7 setup --claude # Claude Code only
ctx7 setup --cursor # Cursor only
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 --project # Configure current project instead of globally
ctx7 setup --yes # Skip confirmation prompts
```
**Authentication options:**
```bash
ctx7 setup --api-key YOUR_KEY # Use an existing API key (both MCP and CLI + Skills mode)
ctx7 setup --oauth # OAuth endpoint — MCP mode only (IDE handles the auth flow)
```
Without `--api-key` or `--oauth`, setup opens a browser for OAuth login. MCP mode additionally generates a new API key after login. `--oauth` is MCP-only.
**What gets written — MCP mode:**
- MCP server entry in the agent's config file (`.mcp.json` for Claude, `.cursor/mcp.json` for Cursor, `.opencode.json` for OpenCode)
- A Context7 rule file instructing the agent to use Context7 for library docs
- A `context7-mcp` skill in the agent's skills directory
**What gets written — CLI + Skills mode:**
- A `find-docs` skill in the chosen agent's skills directory, guiding the agent to use `ctx7 library` and `ctx7 docs` commands

View File

@@ -0,0 +1,118 @@
# 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.