@flydocs/cli 0.5.0-beta.0 → 0.5.0-beta.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flydocs/cli",
3
- "version": "0.5.0-beta.0",
3
+ "version": "0.5.0-beta.10",
4
4
  "type": "module",
5
5
  "description": "FlyDocs AI CLI — install, setup, and manage FlyDocs projects",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  "dependencies": {
23
23
  "@clack/prompts": "^0.9.1",
24
24
  "citty": "^0.1.6",
25
+ "clipboardy": "^5.3.0",
25
26
  "picocolors": "^1.1.1"
26
27
  },
27
28
  "devDependencies": {
@@ -21,29 +21,29 @@ These are non-negotiable and enforced by hooks:
21
21
 
22
22
  The FlyDocs development lifecycle. Read the workflow skill before taking any workflow action.
23
23
 
24
- | Action | Skill | Entry Point |
25
- |--------|-------|-------------|
26
- | Capture issue | `flydocs-workflow` | `stages/capture.md` |
27
- | Refine / triage | `flydocs-workflow` | `stages/refine.md` |
28
- | Activate work | `flydocs-workflow` | `stages/activate.md` |
29
- | Implement | `flydocs-workflow` | `stages/implement.md` |
30
- | Code review | `flydocs-workflow` | `stages/review.md` |
31
- | QE validation | `flydocs-workflow` | `stages/validate.md` |
32
- | Close issue | `flydocs-workflow` | `stages/close.md` |
33
- | Start / wrap session | `flydocs-workflow` | `session.md` |
34
- | Comment templates | `flydocs-workflow` | `reference/comment-templates.md` |
35
- | Status transitions | `flydocs-workflow` | `reference/status-workflow.md` |
24
+ | Action | Skill | Entry Point |
25
+ | -------------------- | ------------------ | --------------------------------- |
26
+ | Capture issue | `flydocs-workflow` | `stages/capture.md` |
27
+ | Refine / triage | `flydocs-workflow` | `stages/refine.md` |
28
+ | Activate work | `flydocs-workflow` | `stages/activate.md` |
29
+ | Implement | `flydocs-workflow` | `stages/implement.md` |
30
+ | Code review | `flydocs-workflow` | `stages/review.md` |
31
+ | QE validation | `flydocs-workflow` | `stages/validate.md` |
32
+ | Close issue | `flydocs-workflow` | `stages/close.md` |
33
+ | Start / wrap session | `flydocs-workflow` | `session.md` |
34
+ | Comment templates | `flydocs-workflow` | `reference/comment-templates.md` |
35
+ | Status transitions | `flydocs-workflow` | `reference/status-workflow.md` |
36
36
  | Priority & estimates | `flydocs-workflow` | `reference/priority-estimates.md` |
37
- | Issue templates | `flydocs-workflow` | `templates/` |
37
+ | Issue templates | `flydocs-workflow` | `templates/` |
38
38
 
39
39
  ## Mechanism Scripts
40
40
 
41
41
  Issue operations are handled by the installed mechanism skill. Only one is active at a time.
42
42
 
43
- | Tier | Skill | Backend |
44
- |------|-------|---------|
45
- | Local (free) | `flydocs-local` | File-based (`flydocs/issues/`) |
46
- | Cloud (connected) | `flydocs-cloud` | Linear GraphQL API |
43
+ | Tier | Skill | Backend |
44
+ | ----------------- | --------------- | ------------------------------ |
45
+ | Local (free) | `flydocs-local` | File-based (`flydocs/issues/`) |
46
+ | Cloud (connected) | `flydocs-cloud` | Linear GraphQL API |
47
47
 
48
48
  Read the active mechanism skill's `SKILL.md` for script catalog and calling conventions.
49
49
 
@@ -54,37 +54,72 @@ Read the active mechanism skill's `SKILL.md` for script catalog and calling conv
54
54
 
55
55
  FlyDocs platform skills with premium functionality.
56
56
 
57
- | Skill | When to Read |
58
- |-------|--------------|
59
- | `flydocs-figma` | Building UI from Figma designs — extraction, token mapping |
60
- | `flydocs-estimates` | Estimating AI token usage and costs (opt-in via config) |
57
+ | Skill | When to Read |
58
+ | ------------------- | ---------------------------------------------------------- |
59
+ | `flydocs-figma` | Building UI from Figma designs — extraction, token mapping |
60
+ | `flydocs-estimates` | Estimating AI token usage and costs (opt-in via config) |
61
61
 
62
62
  ## Project Context
63
63
 
64
- | File | Purpose |
65
- |------|---------|
64
+ | File | Purpose |
65
+ | ---------------------------- | -------------------------------------------- |
66
66
  | `flydocs/context/project.md` | Product scope, tech stack, active priorities |
67
- | `.flydocs/config.json` | Tier, provider, labels, active projects |
67
+ | `.flydocs/config.json` | Tier, provider, labels, active projects |
68
68
 
69
69
  ## Hooks
70
70
 
71
- | Hook | Trigger | Purpose |
72
- |------|---------|---------|
73
- | `PostToolUse` (Edit/Write) | After code changes | Auto-format |
74
- | `UserPromptSubmit` | Before prompt | Inject git/issue context |
75
- | `PreToolUse` | Before script execution | Auto-approve mechanism scripts |
71
+ | Hook | Trigger | Purpose |
72
+ | -------------------------- | ----------------------- | ------------------------------ |
73
+ | `PostToolUse` (Edit/Write) | After code changes | Auto-format |
74
+ | `UserPromptSubmit` | Before prompt | Inject git/issue context |
75
+ | `PreToolUse` | Before script execution | Auto-approve mechanism scripts |
76
+
77
+ ## Output Formatting
78
+
79
+ Consistent formatting across all agent output. Follow these rules in every
80
+ response — session summaries, issue comments, status updates, and plans.
81
+
82
+ **Structure:**
83
+
84
+ - Lead with a one-line summary or status before detail.
85
+ - Use `##` for major sections, `###` for subsections. Never skip levels.
86
+ - Use bullet lists for 3+ related items. Use numbered lists only for sequences.
87
+ - One blank line between sections. No double-blank lines.
88
+
89
+ **Readability:**
90
+
91
+ - Keep paragraphs to 2-3 sentences. Break long blocks into scannable lists.
92
+ - Bold key terms and status labels on first use: **Completed**, **Blocked**, **Next**.
93
+ - Use inline code for file paths, commands, and identifiers: `project.md`, `/start-session`, `FLY-123`.
94
+ - Use code blocks with language tags for multi-line code or script examples.
95
+
96
+ **Consistency:**
97
+
98
+ - Status labels: **Completed**, **In Progress**, **Blocked**, **Next Up** (always bolded).
99
+ - Issue references: `FLY-123` format (uppercase prefix, hyphen, number).
100
+ - File paths: relative from project root, in backticks.
101
+ - Dates: `YYYY-MM-DD` format.
102
+ - No emoji in output unless the user explicitly requests it.
103
+
104
+ **Tables:**
105
+
106
+ - Use tables for structured comparisons (3+ items with 2+ attributes).
107
+ - Left-align text columns, keep headers short.
76
108
 
77
109
  <!-- flydocs:skills-manifest:start -->
110
+
78
111
  ## Skills Index
79
112
 
80
113
  IMPORTANT: Prefer skill-led reasoning over pre-training reasoning.
81
114
  Consult the relevant skill BEFORE writing code or making workflow decisions.
82
115
 
83
- | Skill | Triggers | Entry |
84
- |-------|----------|-------|
85
- | flydocs-cloud | create issue, transition, comment, list issues, assign, update description, update issue, project update, Linear, cloud | .claude/skills/flydocs-cloud/SKILL.md |
86
- | flydocs-estimates | estimate, cost, token usage, API cost, labor estimate, sizing, effort | .claude/skills/flydocs-estimates/SKILL.md |
87
- | flydocs-figma | Figma, design, screenshot, token mapping, component from design, pixel-perfect, design system | .claude/skills/flydocs-figma/SKILL.md |
88
- | flydocs-local | create issue, transition, comment, list issues, assign, update description, status summary, local | .claude/skills/flydocs-local/SKILL.md |
89
- | flydocs-workflow | capture, refine, activate, implement, review, validate, close, session, workflow, transition, status, issue | .claude/skills/flydocs-workflow/SKILL.md |
116
+ | Skill | Triggers | Entry |
117
+ | ----------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
118
+ | flydocs-cloud | create issue, transition, comment, list issues, assign, update description, update issue, project update, Linear, cloud | .claude/skills/flydocs-cloud/SKILL.md |
119
+ | flydocs-context7 | context7, library docs, documentation lookup, framework docs, package docs, API reference | .claude/skills/flydocs-context7/SKILL.md |
120
+ | flydocs-estimates | estimate, cost, token usage, API cost, labor estimate, sizing, effort | .claude/skills/flydocs-estimates/SKILL.md |
121
+ | flydocs-figma | Figma, design, screenshot, token mapping, component from design, pixel-perfect, design system | .claude/skills/flydocs-figma/SKILL.md |
122
+ | flydocs-local | create issue, transition, comment, list issues, assign, update description, status summary, local | .claude/skills/flydocs-local/SKILL.md |
123
+ | flydocs-workflow | capture, refine, activate, implement, review, validate, close, session, workflow, transition, status, issue | .claude/skills/flydocs-workflow/SKILL.md |
124
+
90
125
  <!-- flydocs:skills-manifest:end -->
@@ -2,7 +2,7 @@
2
2
  name: implementation-agent
3
3
  description: "Builds features, fixes bugs, writes code. Invoke for implementation, coding, or technical work."
4
4
  model: opus
5
- tools: [Read, Glob, Grep, Bash, Write, Edit, WebFetch, WebSearch, mcp__context7]
5
+ tools: [Read, Glob, Grep, Bash, Write, Edit, WebFetch, WebSearch]
6
6
  skills:
7
7
  - flydocs-workflow
8
8
  ---
@@ -2,7 +2,7 @@
2
2
  name: research-agent
3
3
  description: "Codebase exploration and research. Invoke for understanding code structure, finding patterns, or gathering technical context."
4
4
  model: sonnet
5
- tools: [Read, Glob, Grep, WebFetch, WebSearch, mcp__context7]
5
+ tools: [Read, Glob, Grep, WebFetch, WebSearch]
6
6
  disallowedTools: [Bash, Write, Edit]
7
7
  skills:
8
8
  - flydocs-workflow
@@ -11,6 +11,22 @@ Triggers: "setup flydocs", "onboard project", "flydocs init"
11
11
 
12
12
  ---
13
13
 
14
+ ## IMPORTANT: Use Plan Mode
15
+
16
+ **Before executing any setup steps, enter plan mode.** This setup involves
17
+ multiple phases with user decisions at each stage. Planning first ensures a
18
+ better experience:
19
+
20
+ 1. Run scenario detection (Phase 0) to understand the project state
21
+ 2. Scan for existing documentation and the tech stack
22
+ 3. Present a structured setup plan showing all phases and what each will do
23
+ 4. Get user approval before making any changes
24
+
25
+ This lets the user see the full picture before committing. Only exit plan
26
+ mode and begin execution after the user approves the plan.
27
+
28
+ ---
29
+
14
30
  ## Phase 0: Scenario Detection
15
31
 
16
32
  Before starting, detect the project state by checking the filesystem:
@@ -161,7 +177,7 @@ offer updates.
161
177
  **Step 0: Check for legacy context files.**
162
178
 
163
179
  Before reading project.md, check if `flydocs/context/legacy/` exists. This
164
- directory is created by `install.sh` when it finds pre-v1.0 separate context
180
+ directory is created by the installer when it finds pre-v1.0 separate context
165
181
  files (`overview.md`, `stack.md`, `standards.md`) and moves them there for
166
182
  safe migration.
167
183
 
@@ -175,7 +191,7 @@ Consolidate into project.md using the same mapping as Phase 1M Step 2.
175
191
  Show the user the merged result and confirm before writing.
176
192
 
177
193
  After successful migration, delete the files from `legacy/` so the next
178
- `install.sh` run will clean up the empty directory.
194
+ `flydocs update` run will clean up the empty directory.
179
195
 
180
196
  **Step 1: Show what's new in this version.**
181
197
 
@@ -187,7 +203,7 @@ update:
187
203
  ```
188
204
  Updated to FlyDocs v0.2.0. Here's what changed:
189
205
  - Scenario-aware setup command with proactive doc scanning
190
- - Deprecated file cleanup in install.sh
206
+ - Deprecated file cleanup in the installer
191
207
  - Legacy context migration for pre-v1.0 projects
192
208
  - Changelog and version tracking
193
209
  ```
@@ -541,7 +557,26 @@ Wrapping up:
541
557
  - No account or API key needed — everything is local and offline
542
558
  - Run `/status` anytime to see your backlog at a glance
543
559
 
544
- ### Step 4: Beta CTA
560
+ ### Step 4: Commit setup
561
+
562
+ FlyDocs setup creates and modifies many files. Prompt the user to commit
563
+ everything as a clean baseline:
564
+
565
+ ```
566
+ Ready to commit the FlyDocs setup? This creates a clean baseline with all
567
+ configuration, context, and initial backlog in one commit.
568
+ ```
569
+
570
+ If the user agrees, create a single commit with a message like:
571
+ `Add FlyDocs project setup (local tier)` or `Add FlyDocs project setup (cloud tier)`
572
+
573
+ Stage all new and modified FlyDocs files (`.flydocs/`, `.claude/`, `.cursor/`,
574
+ `flydocs/`, `AGENTS.md`, `.gitignore`). Do not stage unrelated changes.
575
+
576
+ If the user declines, remind them to commit before starting work:
577
+ "No problem — just remember to commit these files before your first session."
578
+
579
+ ### Step 5: Beta CTA
545
580
 
546
581
  Always end with the beta call-to-action:
547
582
 
@@ -7,10 +7,9 @@ Check for and apply FlyDocs updates to this project.
7
7
  1. **Check current version** — read `.flydocs/version` and report it.
8
8
  2. **Show changelog** — read `.flydocs/CHANGELOG.md` and summarize recent changes
9
9
  since the installed version.
10
- 3. **Run update** — execute `flydocs update` (or `install.sh --update` if using
11
- the bash CLI) to update skills, commands, hooks, and config to the latest
12
- version. Preserves project-specific content in `flydocs/context/project.md`
13
- and user config in `.flydocs/config.json`.
10
+ 3. **Run update** — execute `flydocs update` to update skills, commands, hooks,
11
+ and config to the latest version. Preserves project-specific content in
12
+ `flydocs/context/project.md` and user config in `.flydocs/config.json`.
14
13
  4. **Post-update** — if version changed, suggest running `/flydocs-setup` to review
15
14
  any new config options or migrate legacy content.
16
15
  5. **Beta reminder** — always end with:
@@ -10,16 +10,6 @@
10
10
  "timeout": 5
11
11
  }
12
12
  ]
13
- },
14
- {
15
- "matcher": "mcp__linear.*",
16
- "hooks": [
17
- {
18
- "type": "command",
19
- "command": "python3 \"$CLAUDE_PROJECT_DIR\"/.flydocs/hooks/prefer-scripts.py",
20
- "timeout": 5
21
- }
22
- ]
23
13
  }
24
14
  ],
25
15
  "PostToolUse": [
@@ -11,24 +11,17 @@
11
11
  Owned and maintained by FlyDocs. May include executable scripts and premium
12
12
  functionality gated via API relay.
13
13
 
14
- | Skill | Category | Purpose |
15
- |-------|----------|---------|
16
- | `flydocs-workflow` | Core | Lifecycle stages, session management, comment templates |
17
- | `flydocs-local` | Mechanism (free) | File-based issue management |
18
- | `flydocs-cloud` | Mechanism (paid) | Linear/provider issue management via API |
19
- | `flydocs-figma` | Premium | Design extraction from Figma |
20
- | `flydocs-estimates` | Premium | AI token/labor cost estimation |
14
+ | Skill | Category | Purpose |
15
+ | ------------------- | ---------------- | ------------------------------------------------------- |
16
+ | `flydocs-workflow` | Core | Lifecycle stages, session management, comment templates |
17
+ | `flydocs-local` | Mechanism (free) | File-based issue management |
18
+ | `flydocs-cloud` | Mechanism (paid) | Linear/provider issue management via API |
19
+ | `flydocs-context7` | Core | Library documentation lookup via Context7 API |
20
+ | `flydocs-figma` | Premium | Design extraction from Figma |
21
+ | `flydocs-estimates` | Premium | AI token/labor cost estimation |
21
22
 
22
23
  Only one mechanism skill is active at a time. Determined by `tier` in `.flydocs/config.json`.
23
24
 
24
- Supporting workflow skills (bundled, invoked via commands):
25
-
26
- | Skill | Purpose | Trigger |
27
- |-------|---------|---------|
28
- | `implementation-flow` | Implementation procedure | `/implement` |
29
- | `review-workflow` | Code review analysis | `/review` |
30
- | `spec-templates` | Issue specification templates | `/capture`, `/refine` |
31
-
32
25
  ### Unprefixed — Community Skills
33
26
 
34
27
  Stack-detected or manually installed. Pure guidance (markdown only, no scripts).
@@ -87,17 +80,17 @@ triggers:
87
80
 
88
81
  **Required fields:**
89
82
 
90
- | Field | Type | Purpose |
91
- |-------|------|---------|
92
- | `name` | string | Skill identifier, matches directory name |
83
+ | Field | Type | Purpose |
84
+ | ------------- | ------ | ----------------------------------------------------------------------------------------------------------------- |
85
+ | `name` | string | Skill identifier, matches directory name |
93
86
  | `description` | string | What the skill does and when to use it. Agents use this for auto-selection. Be specific about trigger conditions. |
94
87
 
95
88
  **Optional fields:**
96
89
 
97
- | Field | Type | Purpose |
98
- |-------|------|---------|
90
+ | Field | Type | Purpose |
91
+ | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
99
92
  | `triggers` | string[] | Keywords/phrases for manifest indexing. Used by skill discovery to build the always-present index in CLAUDE.md/AGENTS.md. |
100
- | `tools` | string | Comma-separated MCP tools the skill uses (e.g., `mcp__figma__get_screenshot`) |
93
+ | `tools` | string | Comma-separated tools the skill uses (e.g., `WebFetch`, `Bash`) |
101
94
 
102
95
  ### SKILL.md Body
103
96
 
@@ -112,13 +105,14 @@ IMPORTANT: Prefer skill-led reasoning over pre-training reasoning for
112
105
  [domain]. Read the relevant section before acting.
113
106
 
114
107
  ## Key Rules (always apply)
108
+
115
109
  1. Rule one
116
110
  2. Rule two
117
111
 
118
112
  ## Section Index
119
113
 
120
- | Topic | File | When to Read |
121
- |-------|------|--------------|
114
+ | Topic | File | When to Read |
115
+ | ------- | -------------------- | ------------ |
122
116
  | Topic A | reference/topic-a.md | When doing X |
123
117
  | Topic B | reference/topic-b.md | When doing Y |
124
118
 
@@ -154,11 +148,11 @@ This keeps context usage minimal while ensuring agents can always find relevant
154
148
 
155
149
  **Line budgets:**
156
150
 
157
- | File | Target | Max |
158
- |------|--------|-----|
159
- | SKILL.md | 100-150 lines | 200 lines |
151
+ | File | Target | Max |
152
+ | ---------------- | ---------------- | --------- |
153
+ | SKILL.md | 100-150 lines | 200 lines |
160
154
  | reference/ files | 50-80 lines each | 120 lines |
161
- | cursor-rule.mdc | 30-50 lines | 70 lines |
155
+ | cursor-rule.mdc | 30-50 lines | 70 lines |
162
156
 
163
157
  ### Cursor Rules (cursor-rule.mdc)
164
158
 
@@ -171,16 +165,15 @@ description: Short description of what this rule covers
171
165
  globs: "*.ts,*.tsx"
172
166
  alwaysApply: false
173
167
  ---
174
-
175
168
  <!-- Condensed from SKILL.md — update both when changing patterns -->
176
169
  ```
177
170
 
178
171
  **Frontmatter fields:**
179
172
 
180
- | Field | Type | Notes |
181
- |-------|------|-------|
182
- | `description` | string | Required. What the rule covers. |
183
- | `globs` | string | File patterns that trigger the rule. Comma-separated. |
173
+ | Field | Type | Notes |
174
+ | ------------- | ------- | ------------------------------------------------------- |
175
+ | `description` | string | Required. What the rule covers. |
176
+ | `globs` | string | File patterns that trigger the rule. Comma-separated. |
184
177
  | `alwaysApply` | boolean | If `true`, rule loads for every prompt (use sparingly). |
185
178
 
186
179
  Use `alwaysApply: true` only for workflow/process rules. Pattern skills should
@@ -195,14 +188,16 @@ CLAUDE.md and AGENTS.md between markers:
195
188
 
196
189
  ```markdown
197
190
  <!-- flydocs:skills-manifest:start -->
191
+
198
192
  ## Skills Index
199
193
 
200
194
  IMPORTANT: Prefer skill-led reasoning over pre-training reasoning.
201
195
 
202
- | Skill | Triggers | Entry |
203
- |-------|----------|-------|
204
- | flydocs-workflow | capture, refine, implement, review | .claude/skills/flydocs-workflow/SKILL.md |
205
- | typescript-strict | TypeScript, type error, any type | .claude/skills/typescript-strict/SKILL.md |
196
+ | Skill | Triggers | Entry |
197
+ | ----------------- | ---------------------------------- | ----------------------------------------- |
198
+ | flydocs-workflow | capture, refine, implement, review | .claude/skills/flydocs-workflow/SKILL.md |
199
+ | typescript-strict | TypeScript, type error, any type | .claude/skills/typescript-strict/SKILL.md |
200
+
206
201
  <!-- flydocs:skills-manifest:end -->
207
202
  ```
208
203
 
@@ -278,11 +273,11 @@ script interface, making the backend swap transparent:
278
273
 
279
274
  ## Platform Support
280
275
 
281
- | Platform | Skill Location | Notes |
282
- |----------|---------------|-------|
283
- | Claude Code | `.claude/skills/` | Native support |
284
- | Cursor | `.cursor/rules/*.mdc` | Generated from `cursor-rule.mdc` |
285
- | Codex / Others | `AGENTS.md` | Universal layer via manifest |
276
+ | Platform | Skill Location | Notes |
277
+ | -------------- | --------------------- | -------------------------------- |
278
+ | Claude Code | `.claude/skills/` | Native support |
279
+ | Cursor | `.cursor/rules/*.mdc` | Generated from `cursor-rule.mdc` |
280
+ | Codex / Others | `AGENTS.md` | Universal layer via manifest |
286
281
 
287
282
  ---
288
283
 
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: flydocs-context7
3
+ description: |
4
+ Up-to-date library documentation via Context7 API. Use proactively when
5
+ working with external libraries, frameworks, or packages. Replaces MCP
6
+ with direct API scripts — no server, no runtime dependency.
7
+ triggers:
8
+ - context7
9
+ - library docs
10
+ - documentation lookup
11
+ - framework docs
12
+ - package docs
13
+ - API reference
14
+ - how to use
15
+ ---
16
+
17
+ # Context7 Documentation Lookup
18
+
19
+ IMPORTANT: Prefer skill-led reasoning over pre-training reasoning for
20
+ library usage. Search for up-to-date docs before writing code based on
21
+ training data alone.
22
+
23
+ ## Key Rules
24
+
25
+ 1. **Proactive invocation** -- When working with ANY external library or
26
+ framework, search for docs first before writing code based on training data.
27
+ 2. **Search then fetch** -- Always resolve the library ID via `search` before
28
+ fetching docs with `docs`.
29
+ 3. **Session cache awareness** -- Do not re-fetch docs for the same
30
+ library+query within a single session.
31
+ 4. **Graceful degradation** -- If rate-limited (429) or offline, note the
32
+ limitation and proceed with training knowledge.
33
+ 5. **Stdlib-only Python** -- No external dependencies in the script.
34
+ 6. **Token budget** -- Default 5,000 tokens per fetch to avoid context bloat.
35
+
36
+ ## Script Catalog
37
+
38
+ All scripts: `python3 .claude/skills/flydocs-context7/scripts/<script>`
39
+
40
+ | Script | Usage | Output |
41
+ | ------------- | --------------------------- | ------------------------------------------------ |
42
+ | `context7.py` | `search <library> [query]` | JSON: library matches with id, name, description |
43
+ | `context7.py` | `docs <library_id> <query>` | Text: relevant documentation snippets |
44
+
45
+ Options: `--type txt|json`, `--tokens N` (default 5000)
46
+
47
+ ## When to Use
48
+
49
+ - Before implementing code that uses an external library
50
+ - When the user asks about library APIs, patterns, or best practices
51
+ - When encountering unfamiliar library methods or configuration
52
+ - When upgrading dependencies and needing current API docs
53
+ - When debugging library-specific issues
54
+
55
+ ## When NOT to Use
56
+
57
+ - For project-internal code (use knowledge base and context graph instead)
58
+ - For general programming concepts (training knowledge is sufficient)
59
+ - When already fetched docs for the same library in this session
60
+
61
+ ## API Key (Optional)
62
+
63
+ - Works without a key (anonymous, ~1,000 calls/month)
64
+ - For higher limits, add `CONTEXT7_API_KEY=ctx7sk-xxx` to `.env`
65
+ - Free key available at context7.com/dashboard
66
+
67
+ ## Example Usage
68
+
69
+ ```bash
70
+ # Find the React library
71
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "react" "hooks"
72
+
73
+ # Fetch docs for React hooks
74
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/facebook/react" "useState useEffect hooks"
75
+
76
+ # Get Next.js App Router docs
77
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "next.js"
78
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/vercel/next.js" "app router middleware"
79
+
80
+ # Fetch with custom token budget
81
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/expressjs/express" "routing middleware" --tokens 8000
82
+
83
+ # Get output as JSON
84
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "prisma" --type json
85
+ ```
86
+
87
+ ## Typical Workflow
88
+
89
+ 1. **Identify the library** you need docs for (from import statements,
90
+ `package.json`, or the task at hand).
91
+ 2. **Search** to resolve the library ID:
92
+ ```bash
93
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "react-hook-form"
94
+ ```
95
+ 3. **Fetch docs** for the specific topic:
96
+ ```bash
97
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/react-hook-form/react-hook-form" "useForm validation"
98
+ ```
99
+ 4. **Apply** the retrieved documentation to your implementation.
100
+ 5. **Do not re-fetch** for the same library+query later in the session.
101
+
102
+ ## Related Skills
103
+
104
+ - `flydocs-context-graph` -- Project-internal knowledge navigation
105
+ - `flydocs-workflow` -- Development lifecycle and issue operations
@@ -0,0 +1,49 @@
1
+ ---
2
+ description: Context7 — look up library and framework documentation before writing code
3
+ alwaysApply: true
4
+ ---
5
+
6
+ <!-- Condensed from SKILL.md — update both when changing patterns -->
7
+
8
+ # FlyDocs Context7
9
+
10
+ Proactively look up library documentation via Context7 scripts before writing
11
+ code that uses external packages. Do not rely on training data for API details.
12
+
13
+ ## When to Use
14
+
15
+ - Installing or importing a library you haven't used in this session
16
+ - Unsure about API signatures, configuration options, or return types
17
+ - Framework-specific patterns (routing, data fetching, middleware, hooks)
18
+ - Resolving version-specific behavior or breaking changes
19
+
20
+ ## Scripts
21
+
22
+ ```bash
23
+ # Step 1: Search for the library
24
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "<library>" "[query]"
25
+
26
+ # Step 2: Fetch docs using the library ID from search results
27
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "<library_id>" "<query>"
28
+ ```
29
+
30
+ ### Examples
31
+
32
+ React hooks:
33
+ ```bash
34
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "react" "hooks"
35
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/facebook/react" "hooks useState"
36
+ ```
37
+
38
+ Next.js App Router:
39
+ ```bash
40
+ python3 .claude/skills/flydocs-context7/scripts/context7.py search "next.js"
41
+ python3 .claude/skills/flydocs-context7/scripts/context7.py docs "/vercel/next.js" "app router middleware"
42
+ ```
43
+
44
+ ## Key Rules
45
+
46
+ - Always resolve the library ID first via `search` — do not guess the ID format
47
+ - Prefer Context7 docs over training data for API specifics
48
+ - If Context7 has no results or is rate-limited, fall back to web search
49
+ - Cache within a session — no need to re-fetch the same library docs repeatedly