ultimate-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/caveman/SKILL.md +67 -0
- package/.agents/skills/compress/SKILL.md +111 -0
- package/.agents/skills/compress/scripts/__init__.py +9 -0
- package/.agents/skills/compress/scripts/__main__.py +3 -0
- package/.agents/skills/compress/scripts/benchmark.py +78 -0
- package/.agents/skills/compress/scripts/cli.py +73 -0
- package/.agents/skills/compress/scripts/compress.py +227 -0
- package/.agents/skills/compress/scripts/detect.py +121 -0
- package/.agents/skills/compress/scripts/validate.py +189 -0
- package/.agents/skills/context7-cli/SKILL.md +73 -0
- package/.agents/skills/context7-cli/references/docs.md +121 -0
- package/.agents/skills/context7-cli/references/setup.md +43 -0
- package/.agents/skills/context7-cli/references/skills.md +118 -0
- package/.agents/skills/emil-design-eng/SKILL.md +679 -0
- package/.agents/skills/lean-ctx/SKILL.md +149 -0
- package/.agents/skills/lean-ctx/scripts/install.sh +95 -0
- package/.agents/skills/scrapling-official/LICENSE.txt +28 -0
- package/.agents/skills/scrapling-official/SKILL.md +390 -0
- package/.agents/skills/scrapling-official/examples/01_fetcher_session.py +26 -0
- package/.agents/skills/scrapling-official/examples/02_dynamic_session.py +26 -0
- package/.agents/skills/scrapling-official/examples/03_stealthy_session.py +26 -0
- package/.agents/skills/scrapling-official/examples/04_spider.py +58 -0
- package/.agents/skills/scrapling-official/examples/README.md +45 -0
- package/.agents/skills/scrapling-official/references/fetching/choosing.md +78 -0
- package/.agents/skills/scrapling-official/references/fetching/dynamic.md +352 -0
- package/.agents/skills/scrapling-official/references/fetching/static.md +432 -0
- package/.agents/skills/scrapling-official/references/fetching/stealthy.md +255 -0
- package/.agents/skills/scrapling-official/references/mcp-server.md +214 -0
- package/.agents/skills/scrapling-official/references/migrating_from_beautifulsoup.md +86 -0
- package/.agents/skills/scrapling-official/references/parsing/adaptive.md +212 -0
- package/.agents/skills/scrapling-official/references/parsing/main_classes.md +586 -0
- package/.agents/skills/scrapling-official/references/parsing/selection.md +494 -0
- package/.agents/skills/scrapling-official/references/spiders/advanced.md +344 -0
- package/.agents/skills/scrapling-official/references/spiders/architecture.md +94 -0
- package/.agents/skills/scrapling-official/references/spiders/getting-started.md +164 -0
- package/.agents/skills/scrapling-official/references/spiders/proxy-blocking.md +235 -0
- package/.agents/skills/scrapling-official/references/spiders/requests-responses.md +196 -0
- package/.agents/skills/scrapling-official/references/spiders/sessions.md +205 -0
- package/.github/banner.png +0 -0
- package/.pi/SYSTEM.md +40 -0
- package/.pi/settings.json +5 -0
- package/PLAN.md +11 -0
- package/README.md +58 -0
- package/extensions/lean-ctx-enforce.ts +166 -0
- package/package.json +17 -0
- package/skills-lock.json +35 -0
- package/wiki/README.md +10 -0
- package/wiki/decisions/0001-establish-project-wiki-and-decision-record-format.md +25 -0
- package/wiki/decisions/0002-add-project-banner-to-readme.md +26 -0
- package/wiki/decisions/0003-remove-redundant-readme-title-heading.md +26 -0
- package/wiki/decisions/0004-publish-package-to-npm-as-ultimate-pi.md +26 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import re
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
URL_REGEX = re.compile(r"https?://[^\s)]+")
|
|
6
|
+
FENCE_OPEN_REGEX = re.compile(r"^(\s{0,3})(`{3,}|~{3,})(.*)$")
|
|
7
|
+
HEADING_REGEX = re.compile(r"^(#{1,6})\s+(.*)", re.MULTILINE)
|
|
8
|
+
BULLET_REGEX = re.compile(r"^\s*[-*+]\s+", re.MULTILINE)
|
|
9
|
+
|
|
10
|
+
# crude but effective path detection
|
|
11
|
+
# Requires either a path prefix (./ ../ / or drive letter) or a slash/backslash within the match
|
|
12
|
+
PATH_REGEX = re.compile(r"(?:\./|\.\./|/|[A-Za-z]:\\)[\w\-/\\\.]+|[\w\-\.]+[/\\][\w\-/\\\.]+")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ValidationResult:
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self.is_valid = True
|
|
18
|
+
self.errors = []
|
|
19
|
+
self.warnings = []
|
|
20
|
+
|
|
21
|
+
def add_error(self, msg):
|
|
22
|
+
self.is_valid = False
|
|
23
|
+
self.errors.append(msg)
|
|
24
|
+
|
|
25
|
+
def add_warning(self, msg):
|
|
26
|
+
self.warnings.append(msg)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def read_file(path: Path) -> str:
|
|
30
|
+
return path.read_text(errors="ignore")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# ---------- Extractors ----------
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def extract_headings(text):
|
|
37
|
+
return [(level, title.strip()) for level, title in HEADING_REGEX.findall(text)]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def extract_code_blocks(text):
|
|
41
|
+
"""Line-based fenced code block extractor.
|
|
42
|
+
|
|
43
|
+
Handles ``` and ~~~ fences with variable length (CommonMark: closing
|
|
44
|
+
fence must use same char and be at least as long as opening). Supports
|
|
45
|
+
nested fences (e.g. an outer 4-backtick block wrapping inner 3-backtick
|
|
46
|
+
content).
|
|
47
|
+
"""
|
|
48
|
+
blocks = []
|
|
49
|
+
lines = text.split("\n")
|
|
50
|
+
i = 0
|
|
51
|
+
n = len(lines)
|
|
52
|
+
while i < n:
|
|
53
|
+
m = FENCE_OPEN_REGEX.match(lines[i])
|
|
54
|
+
if not m:
|
|
55
|
+
i += 1
|
|
56
|
+
continue
|
|
57
|
+
fence_char = m.group(2)[0]
|
|
58
|
+
fence_len = len(m.group(2))
|
|
59
|
+
open_line = lines[i]
|
|
60
|
+
block_lines = [open_line]
|
|
61
|
+
i += 1
|
|
62
|
+
closed = False
|
|
63
|
+
while i < n:
|
|
64
|
+
close_m = FENCE_OPEN_REGEX.match(lines[i])
|
|
65
|
+
if (
|
|
66
|
+
close_m
|
|
67
|
+
and close_m.group(2)[0] == fence_char
|
|
68
|
+
and len(close_m.group(2)) >= fence_len
|
|
69
|
+
and close_m.group(3).strip() == ""
|
|
70
|
+
):
|
|
71
|
+
block_lines.append(lines[i])
|
|
72
|
+
closed = True
|
|
73
|
+
i += 1
|
|
74
|
+
break
|
|
75
|
+
block_lines.append(lines[i])
|
|
76
|
+
i += 1
|
|
77
|
+
if closed:
|
|
78
|
+
blocks.append("\n".join(block_lines))
|
|
79
|
+
# Unclosed fences are silently skipped — they indicate malformed markdown
|
|
80
|
+
# and including them would cause false-positive validation failures.
|
|
81
|
+
return blocks
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def extract_urls(text):
|
|
85
|
+
return set(URL_REGEX.findall(text))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def extract_paths(text):
|
|
89
|
+
return set(PATH_REGEX.findall(text))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def count_bullets(text):
|
|
93
|
+
return len(BULLET_REGEX.findall(text))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# ---------- Validators ----------
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def validate_headings(orig, comp, result):
|
|
100
|
+
h1 = extract_headings(orig)
|
|
101
|
+
h2 = extract_headings(comp)
|
|
102
|
+
|
|
103
|
+
if len(h1) != len(h2):
|
|
104
|
+
result.add_error(f"Heading count mismatch: {len(h1)} vs {len(h2)}")
|
|
105
|
+
|
|
106
|
+
if h1 != h2:
|
|
107
|
+
result.add_warning("Heading text/order changed")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def validate_code_blocks(orig, comp, result):
|
|
111
|
+
c1 = extract_code_blocks(orig)
|
|
112
|
+
c2 = extract_code_blocks(comp)
|
|
113
|
+
|
|
114
|
+
if c1 != c2:
|
|
115
|
+
result.add_error("Code blocks not preserved exactly")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def validate_urls(orig, comp, result):
|
|
119
|
+
u1 = extract_urls(orig)
|
|
120
|
+
u2 = extract_urls(comp)
|
|
121
|
+
|
|
122
|
+
if u1 != u2:
|
|
123
|
+
result.add_error(f"URL mismatch: lost={u1 - u2}, added={u2 - u1}")
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def validate_paths(orig, comp, result):
|
|
127
|
+
p1 = extract_paths(orig)
|
|
128
|
+
p2 = extract_paths(comp)
|
|
129
|
+
|
|
130
|
+
if p1 != p2:
|
|
131
|
+
result.add_warning(f"Path mismatch: lost={p1 - p2}, added={p2 - p1}")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def validate_bullets(orig, comp, result):
|
|
135
|
+
b1 = count_bullets(orig)
|
|
136
|
+
b2 = count_bullets(comp)
|
|
137
|
+
|
|
138
|
+
if b1 == 0:
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
diff = abs(b1 - b2) / b1
|
|
142
|
+
|
|
143
|
+
if diff > 0.15:
|
|
144
|
+
result.add_warning(f"Bullet count changed too much: {b1} -> {b2}")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# ---------- Main ----------
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def validate(original_path: Path, compressed_path: Path) -> ValidationResult:
|
|
151
|
+
result = ValidationResult()
|
|
152
|
+
|
|
153
|
+
orig = read_file(original_path)
|
|
154
|
+
comp = read_file(compressed_path)
|
|
155
|
+
|
|
156
|
+
validate_headings(orig, comp, result)
|
|
157
|
+
validate_code_blocks(orig, comp, result)
|
|
158
|
+
validate_urls(orig, comp, result)
|
|
159
|
+
validate_paths(orig, comp, result)
|
|
160
|
+
validate_bullets(orig, comp, result)
|
|
161
|
+
|
|
162
|
+
return result
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ---------- CLI ----------
|
|
166
|
+
|
|
167
|
+
if __name__ == "__main__":
|
|
168
|
+
import sys
|
|
169
|
+
|
|
170
|
+
if len(sys.argv) != 3:
|
|
171
|
+
print("Usage: python validate.py <original> <compressed>")
|
|
172
|
+
sys.exit(1)
|
|
173
|
+
|
|
174
|
+
orig = Path(sys.argv[1]).resolve()
|
|
175
|
+
comp = Path(sys.argv[2]).resolve()
|
|
176
|
+
|
|
177
|
+
res = validate(orig, comp)
|
|
178
|
+
|
|
179
|
+
print(f"\nValid: {res.is_valid}")
|
|
180
|
+
|
|
181
|
+
if res.errors:
|
|
182
|
+
print("\nErrors:")
|
|
183
|
+
for e in res.errors:
|
|
184
|
+
print(f" - {e}")
|
|
185
|
+
|
|
186
|
+
if res.warnings:
|
|
187
|
+
print("\nWarnings:")
|
|
188
|
+
for w in res.warnings:
|
|
189
|
+
print(f" - {w}")
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context7-cli
|
|
3
|
+
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.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ctx7 CLI
|
|
7
|
+
|
|
8
|
+
The Context7 CLI does three things: fetches up-to-date library documentation, manages AI coding skills, and sets up Context7 MCP for your editor.
|
|
9
|
+
|
|
10
|
+
Make sure the CLI is up to date before running commands:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g ctx7@latest
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Or run directly without installing:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx ctx7@latest <command>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What this skill covers
|
|
23
|
+
|
|
24
|
+
- **[Documentation](references/docs.md)** — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated.
|
|
25
|
+
- **[Skills management](references/skills.md)** — Install, search, suggest, list, remove, and generate AI coding skills.
|
|
26
|
+
- **[Setup](references/setup.md)** — Configure Context7 MCP for Claude Code / Cursor / OpenCode.
|
|
27
|
+
|
|
28
|
+
## Quick Reference
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Documentation
|
|
32
|
+
ctx7 library <name> <query> # Step 1: resolve library ID
|
|
33
|
+
ctx7 docs <libraryId> <query> # Step 2: fetch docs
|
|
34
|
+
ctx7 docs <libraryId> <query> --research # Retry with deep research if the default answer didn't satisfy
|
|
35
|
+
|
|
36
|
+
# Skills
|
|
37
|
+
ctx7 skills install /owner/repo # Install from a repo (interactive)
|
|
38
|
+
ctx7 skills install /owner/repo name # Install a specific skill
|
|
39
|
+
ctx7 skills search <keywords> # Search the registry
|
|
40
|
+
ctx7 skills suggest # Auto-suggest based on project deps
|
|
41
|
+
ctx7 skills list # List installed skills
|
|
42
|
+
ctx7 skills remove <name> # Uninstall a skill
|
|
43
|
+
ctx7 skills generate # Generate a custom skill with AI (requires login)
|
|
44
|
+
|
|
45
|
+
# Setup
|
|
46
|
+
ctx7 setup # Configure Context7 MCP (interactive)
|
|
47
|
+
ctx7 login # Log in for higher rate limits + skill generation
|
|
48
|
+
ctx7 whoami # Check current login status
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Authentication
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
ctx7 login # Opens browser for OAuth
|
|
55
|
+
ctx7 login --no-browser # Prints URL instead of opening browser
|
|
56
|
+
ctx7 logout # Clear stored tokens
|
|
57
|
+
ctx7 whoami # Show current login status (name + email)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
Set an API key via environment variable to skip interactive login entirely:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
export CONTEXT7_API_KEY=your_key
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Common Mistakes
|
|
69
|
+
|
|
70
|
+
- Library IDs require a `/` prefix — `/facebook/react` not `facebook/react`
|
|
71
|
+
- Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID
|
|
72
|
+
- Repository format for skills is `/owner/repo` — e.g., `ctx7 skills install /anthropics/skills`
|
|
73
|
+
- `skills generate` requires login — run `ctx7 login` first
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Documentation Commands
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
If the user already provided a library ID in `/org/project` or `/org/project/version` format, pass it directly to `ctx7 docs`.
|
|
6
|
+
|
|
7
|
+
## Step 1: Resolve a Library
|
|
8
|
+
|
|
9
|
+
Resolves a package/product name to a Context7-compatible library ID and returns matching libraries.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
ctx7 library react "How to clean up useEffect with async operations"
|
|
13
|
+
ctx7 library nextjs "How to set up app router with middleware"
|
|
14
|
+
ctx7 library prisma "How to define one-to-many relations with cascade delete"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
### Result fields
|
|
20
|
+
|
|
21
|
+
Each result includes:
|
|
22
|
+
|
|
23
|
+
- **Library ID** — Context7-compatible identifier (format: `/org/project`)
|
|
24
|
+
- **Name** — Library or package name
|
|
25
|
+
- **Description** — Short summary
|
|
26
|
+
- **Code Snippets** — Number of available code examples
|
|
27
|
+
- **Source Reputation** — Authority indicator (High, Medium, Low, or Unknown)
|
|
28
|
+
- **Benchmark Score** — Quality indicator (100 is the highest score)
|
|
29
|
+
- **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`.
|
|
30
|
+
|
|
31
|
+
### Selection process
|
|
32
|
+
|
|
33
|
+
1. Analyze the query to understand what library/package the user is looking for
|
|
34
|
+
2. Select the most relevant match based on:
|
|
35
|
+
- Name similarity to the query (exact matches prioritized)
|
|
36
|
+
- Description relevance to the query's intent
|
|
37
|
+
- Documentation coverage (prioritize libraries with higher Code Snippet counts)
|
|
38
|
+
- Source reputation (consider libraries with High or Medium reputation more authoritative)
|
|
39
|
+
- Benchmark score (higher is better, 100 is the maximum)
|
|
40
|
+
3. If multiple good matches exist, acknowledge this but proceed with the most relevant one
|
|
41
|
+
4. If no good matches exist, clearly state this and suggest query refinements
|
|
42
|
+
5. For ambiguous queries, request clarification before proceeding with a best-guess match
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
### Version-specific IDs
|
|
47
|
+
|
|
48
|
+
If the user mentions a specific version, use a version-specific library ID:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# General (latest indexed)
|
|
52
|
+
ctx7 docs /vercel/next.js "How to set up app router"
|
|
53
|
+
|
|
54
|
+
# Version-specific
|
|
55
|
+
ctx7 docs /vercel/next.js/v14.3.0-canary.87 "How to set up app router"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The available versions are listed in the `ctx7 library` output. Use the closest match to what the user specified.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Output as JSON for scripting
|
|
62
|
+
ctx7 library react "How to use hooks for state management" --json | jq '.[0].id'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Step 2: Query Documentation
|
|
66
|
+
|
|
67
|
+
Retrieves up-to-date documentation and code examples for the resolved library.
|
|
68
|
+
|
|
69
|
+
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`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
ctx7 docs /facebook/react "How to clean up useEffect with async operations"
|
|
73
|
+
ctx7 docs /vercel/next.js "How to add authentication middleware to app router"
|
|
74
|
+
ctx7 docs /prisma/prisma "How to define one-to-many relations with cascade delete"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
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.
|
|
78
|
+
|
|
79
|
+
### Retry with `--research` if you weren't satisfied
|
|
80
|
+
|
|
81
|
+
If the default `ctx7 docs` answer didn't satisfy, re-run the same command **with `--research`** before giving up or answering from training data. This retries using sandboxed agents that git-pull the actual source repos plus a live web search, then synthesizes a fresh answer. More costly than the default — use it as a targeted retry.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
ctx7 docs /vercel/next.js "How does middleware matcher handle dynamic segments in v15?" --research
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Writing good queries
|
|
88
|
+
|
|
89
|
+
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.
|
|
90
|
+
|
|
91
|
+
| Quality | Example |
|
|
92
|
+
|---------|---------|
|
|
93
|
+
| Good | `"How to set up authentication with JWT in Express.js"` |
|
|
94
|
+
| Good | `"React useEffect cleanup function with async operations"` |
|
|
95
|
+
| Bad | `"auth"` |
|
|
96
|
+
| Bad | `"hooks"` |
|
|
97
|
+
|
|
98
|
+
Use the user's full question as the query when possible — vague one-word queries return generic results.
|
|
99
|
+
|
|
100
|
+
The output contains two types of content: **code snippets** (titled, with language-tagged blocks) and **info snippets** (prose explanations with breadcrumb context).
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Output as structured JSON
|
|
104
|
+
ctx7 docs /facebook/react "How to use hooks for state management" --json
|
|
105
|
+
|
|
106
|
+
# Pipe to other tools — output is clean when not in a TTY (no spinners or colors)
|
|
107
|
+
ctx7 docs /facebook/react "How to use hooks for state management" | head -50
|
|
108
|
+
ctx7 docs /vercel/next.js "How to add middleware for route protection" | grep -A5 "middleware"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Authentication
|
|
112
|
+
|
|
113
|
+
Works without authentication. For higher rate limits:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Option A: environment variable
|
|
117
|
+
export CONTEXT7_API_KEY=your_key
|
|
118
|
+
|
|
119
|
+
# Option B: OAuth login
|
|
120
|
+
ctx7 login
|
|
121
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
## ctx7 setup
|
|
4
|
+
|
|
5
|
+
One-time command to configure Context7 for your AI coding agent. Prompts for mode on first run:
|
|
6
|
+
- **MCP server** — registers the Context7 MCP server so the agent can call tools natively
|
|
7
|
+
- **CLI + Skills** — installs a `find-docs` skill that guides the agent to use `ctx7` CLI commands (no MCP required)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ctx7 setup # Interactive — prompts for mode, then agent/install target
|
|
11
|
+
ctx7 setup --mcp # Skip prompt, use MCP server mode
|
|
12
|
+
ctx7 setup --cli # Skip prompt, use CLI + Skills mode
|
|
13
|
+
|
|
14
|
+
# MCP mode — target a specific agent
|
|
15
|
+
ctx7 setup --claude # Claude Code only
|
|
16
|
+
ctx7 setup --cursor # Cursor only
|
|
17
|
+
ctx7 setup --opencode # OpenCode only
|
|
18
|
+
|
|
19
|
+
# CLI + Skills mode — target a specific install location
|
|
20
|
+
ctx7 setup --cli --claude # Claude Code (~/.claude/skills)
|
|
21
|
+
ctx7 setup --cli --cursor # Cursor (~/.cursor/skills)
|
|
22
|
+
ctx7 setup --cli --universal # Universal (~/.agents/skills)
|
|
23
|
+
ctx7 setup --cli --antigravity # Antigravity (~/.config/agent/skills)
|
|
24
|
+
|
|
25
|
+
ctx7 setup --project # Configure current project instead of globally
|
|
26
|
+
ctx7 setup --yes # Skip confirmation prompts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Authentication options:**
|
|
30
|
+
```bash
|
|
31
|
+
ctx7 setup --api-key YOUR_KEY # Use an existing API key (both MCP and CLI + Skills mode)
|
|
32
|
+
ctx7 setup --oauth # OAuth endpoint — MCP mode only (IDE handles the auth flow)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
**What gets written — MCP mode:**
|
|
38
|
+
- MCP server entry in the agent's config file (`.mcp.json` for Claude, `.cursor/mcp.json` for Cursor, `.opencode.json` for OpenCode)
|
|
39
|
+
- A Context7 rule file instructing the agent to use Context7 for library docs
|
|
40
|
+
- A `context7-mcp` skill in the agent's skills directory
|
|
41
|
+
|
|
42
|
+
**What gets written — CLI + Skills mode:**
|
|
43
|
+
- A `find-docs` skill in the chosen agent's skills directory, guiding the agent to use `ctx7 library` and `ctx7 docs` commands
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Skills Commands
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Install skills from any GitHub repository. Repository format is always `/owner/repo`.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ctx7 skills install /anthropics/skills # Interactive — pick from a list
|
|
11
|
+
ctx7 skills install /anthropics/skills pdf # Install a specific skill by name
|
|
12
|
+
ctx7 skills install /anthropics/skills --all # Install everything without prompting
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Target a specific IDE with a flag:
|
|
16
|
+
```bash
|
|
17
|
+
ctx7 skills install /anthropics/skills pdf --claude # Claude Code only
|
|
18
|
+
ctx7 skills install /anthropics/skills pdf --cursor # Cursor only
|
|
19
|
+
ctx7 skills install /anthropics/skills pdf --universal # Universal (.agents/skills/)
|
|
20
|
+
ctx7 skills install /anthropics/skills --all --global # All skills, global install
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Alias: `ctx7 si /anthropics/skills pdf`
|
|
24
|
+
|
|
25
|
+
## Search
|
|
26
|
+
|
|
27
|
+
Find skills across the entire registry by keyword. Shows an interactive list with install counts and trust scores. Select to install.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
ctx7 skills search pdf
|
|
31
|
+
ctx7 skills search typescript testing
|
|
32
|
+
ctx7 skills search react nextjs
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Alias: `ctx7 ss pdf`
|
|
36
|
+
|
|
37
|
+
## Suggest
|
|
38
|
+
|
|
39
|
+
Auto-detects your project dependencies and recommends relevant skills from the registry.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ctx7 skills suggest # Scan current project, install to project
|
|
43
|
+
ctx7 skills suggest --global # Install suggestions globally
|
|
44
|
+
ctx7 skills suggest --claude # Target Claude Code only
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Reads `package.json`, `requirements.txt`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Gemfile`. Falls back to suggesting `ctx7 skills search` if no dependencies are detected.
|
|
48
|
+
|
|
49
|
+
Alias: `ctx7 ssg`
|
|
50
|
+
|
|
51
|
+
## Generate (AI-powered)
|
|
52
|
+
|
|
53
|
+
Generate a custom skill tailored to your stack using AI. **Requires login.**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ctx7 skills generate
|
|
57
|
+
ctx7 skills generate --claude # Install directly to Claude Code
|
|
58
|
+
ctx7 skills generate --global # Install to global skills
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Interactive flow:
|
|
62
|
+
1. Describe the expertise you want (e.g., "OAuth authentication with NextAuth.js")
|
|
63
|
+
2. Select relevant libraries from search results
|
|
64
|
+
3. Answer 3 clarifying questions to focus the skill
|
|
65
|
+
4. Review the generated skill, request changes if needed
|
|
66
|
+
5. Choose where to install it
|
|
67
|
+
|
|
68
|
+
**Limits:** Free accounts get 6 generations/week, Pro accounts get 10.
|
|
69
|
+
|
|
70
|
+
Aliases: `ctx7 skills gen`, `ctx7 skills g`
|
|
71
|
+
|
|
72
|
+
## List
|
|
73
|
+
|
|
74
|
+
Show all installed skills for the current project or globally.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
ctx7 skills list # Current project (all detected IDEs)
|
|
78
|
+
ctx7 skills list --claude # Claude Code only
|
|
79
|
+
ctx7 skills list --global # Global skills
|
|
80
|
+
ctx7 skills list --global --claude # Global Claude Code skills
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Remove
|
|
84
|
+
|
|
85
|
+
Uninstall a skill by name.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
ctx7 skills remove pdf
|
|
89
|
+
ctx7 skills remove pdf --claude # From Claude Code only
|
|
90
|
+
ctx7 skills remove pdf --global # From global skills
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Aliases: `ctx7 skills rm`, `ctx7 skills delete`
|
|
94
|
+
|
|
95
|
+
## Info
|
|
96
|
+
|
|
97
|
+
Browse all skills in a repository without installing — useful for previewing what's available.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ctx7 skills info /anthropics/skills
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Output shows each skill name, description, and URL, plus quick install commands.
|
|
104
|
+
|
|
105
|
+
## IDE Flags
|
|
106
|
+
|
|
107
|
+
All skills commands accept these flags to target a specific AI coding assistant:
|
|
108
|
+
|
|
109
|
+
| Flag | Directory | Used by |
|
|
110
|
+
|------|-----------|---------|
|
|
111
|
+
| `--universal` | `.agents/skills/` | Amp, Codex, Gemini CLI, OpenCode, GitHub Copilot |
|
|
112
|
+
| `--claude` | `.claude/skills/` | Claude Code |
|
|
113
|
+
| `--cursor` | `.cursor/skills/` | Cursor |
|
|
114
|
+
| `--antigravity` | `.agent/skills/` | Antigravity |
|
|
115
|
+
|
|
116
|
+
Without a flag, the CLI prompts you to select one or more targets interactively.
|
|
117
|
+
|
|
118
|
+
Add `--global` to any flag to install in your home directory instead of the current project.
|