@bgicli/bgicli 2.2.8 → 2.2.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.
Files changed (113) hide show
  1. package/data/skills/anthropic-algorithmic-art/SKILL.md +405 -0
  2. package/data/skills/anthropic-canvas-design/SKILL.md +130 -0
  3. package/data/skills/anthropic-claude-api/SKILL.md +243 -0
  4. package/data/skills/anthropic-doc-coauthoring/SKILL.md +375 -0
  5. package/data/skills/anthropic-docx/SKILL.md +590 -0
  6. package/data/skills/anthropic-frontend-design/SKILL.md +42 -0
  7. package/data/skills/anthropic-internal-comms/SKILL.md +32 -0
  8. package/data/skills/anthropic-mcp-builder/SKILL.md +236 -0
  9. package/data/skills/anthropic-pdf/SKILL.md +314 -0
  10. package/data/skills/anthropic-pptx/SKILL.md +232 -0
  11. package/data/skills/anthropic-skill-creator/SKILL.md +485 -0
  12. package/data/skills/anthropic-webapp-testing/SKILL.md +96 -0
  13. package/data/skills/anthropic-xlsx/SKILL.md +292 -0
  14. package/data/skills/arxiv-database/SKILL.md +362 -0
  15. package/data/skills/astropy/SKILL.md +329 -0
  16. package/data/skills/ctx-advanced-evaluation/SKILL.md +402 -0
  17. package/data/skills/ctx-bdi-mental-states/SKILL.md +311 -0
  18. package/data/skills/ctx-context-compression/SKILL.md +272 -0
  19. package/data/skills/ctx-context-degradation/SKILL.md +206 -0
  20. package/data/skills/ctx-context-fundamentals/SKILL.md +201 -0
  21. package/data/skills/ctx-context-optimization/SKILL.md +195 -0
  22. package/data/skills/ctx-evaluation/SKILL.md +251 -0
  23. package/data/skills/ctx-filesystem-context/SKILL.md +287 -0
  24. package/data/skills/ctx-hosted-agents/SKILL.md +260 -0
  25. package/data/skills/ctx-memory-systems/SKILL.md +225 -0
  26. package/data/skills/ctx-multi-agent-patterns/SKILL.md +257 -0
  27. package/data/skills/ctx-project-development/SKILL.md +291 -0
  28. package/data/skills/ctx-tool-design/SKILL.md +271 -0
  29. package/data/skills/dhdna-profiler/SKILL.md +162 -0
  30. package/data/skills/generate-image/SKILL.md +183 -0
  31. package/data/skills/geomaster/SKILL.md +365 -0
  32. package/data/skills/get-available-resources/SKILL.md +275 -0
  33. package/data/skills/hamelsmu-build-review-interface/SKILL.md +96 -0
  34. package/data/skills/hamelsmu-error-analysis/SKILL.md +164 -0
  35. package/data/skills/hamelsmu-eval-audit/SKILL.md +183 -0
  36. package/data/skills/hamelsmu-evaluate-rag/SKILL.md +177 -0
  37. package/data/skills/hamelsmu-generate-synthetic-data/SKILL.md +131 -0
  38. package/data/skills/hamelsmu-validate-evaluator/SKILL.md +212 -0
  39. package/data/skills/hamelsmu-write-judge-prompt/SKILL.md +144 -0
  40. package/data/skills/hf-cli/SKILL.md +174 -0
  41. package/data/skills/hf-mcp/SKILL.md +178 -0
  42. package/data/skills/hugging-face-dataset-viewer/SKILL.md +121 -0
  43. package/data/skills/hugging-face-datasets/SKILL.md +542 -0
  44. package/data/skills/hugging-face-evaluation/SKILL.md +651 -0
  45. package/data/skills/hugging-face-jobs/SKILL.md +1042 -0
  46. package/data/skills/hugging-face-model-trainer/SKILL.md +717 -0
  47. package/data/skills/hugging-face-paper-pages/SKILL.md +239 -0
  48. package/data/skills/hugging-face-paper-publisher/SKILL.md +624 -0
  49. package/data/skills/hugging-face-tool-builder/SKILL.md +110 -0
  50. package/data/skills/hugging-face-trackio/SKILL.md +115 -0
  51. package/data/skills/hugging-face-vision-trainer/SKILL.md +593 -0
  52. package/data/skills/huggingface-gradio/SKILL.md +245 -0
  53. package/data/skills/matlab/SKILL.md +376 -0
  54. package/data/skills/modal/SKILL.md +381 -0
  55. package/data/skills/openai-cloudflare-deploy/SKILL.md +224 -0
  56. package/data/skills/openai-develop-web-game/SKILL.md +149 -0
  57. package/data/skills/openai-doc/SKILL.md +80 -0
  58. package/data/skills/openai-figma/SKILL.md +42 -0
  59. package/data/skills/openai-figma-implement-design/SKILL.md +264 -0
  60. package/data/skills/openai-gh-address-comments/SKILL.md +25 -0
  61. package/data/skills/openai-gh-fix-ci/SKILL.md +69 -0
  62. package/data/skills/openai-imagegen/SKILL.md +174 -0
  63. package/data/skills/openai-jupyter-notebook/SKILL.md +107 -0
  64. package/data/skills/openai-linear/SKILL.md +87 -0
  65. package/data/skills/openai-netlify-deploy/SKILL.md +247 -0
  66. package/data/skills/openai-notion-knowledge-capture/SKILL.md +56 -0
  67. package/data/skills/openai-notion-meeting-intelligence/SKILL.md +60 -0
  68. package/data/skills/openai-notion-research-documentation/SKILL.md +59 -0
  69. package/data/skills/openai-notion-spec-to-implementation/SKILL.md +58 -0
  70. package/data/skills/openai-openai-docs/SKILL.md +69 -0
  71. package/data/skills/openai-pdf/SKILL.md +67 -0
  72. package/data/skills/openai-playwright/SKILL.md +147 -0
  73. package/data/skills/openai-render-deploy/SKILL.md +479 -0
  74. package/data/skills/openai-screenshot/SKILL.md +267 -0
  75. package/data/skills/openai-security-best-practices/SKILL.md +86 -0
  76. package/data/skills/openai-security-ownership-map/SKILL.md +206 -0
  77. package/data/skills/openai-security-threat-model/SKILL.md +81 -0
  78. package/data/skills/openai-sentry/SKILL.md +123 -0
  79. package/data/skills/openai-sora/SKILL.md +178 -0
  80. package/data/skills/openai-speech/SKILL.md +144 -0
  81. package/data/skills/openai-spreadsheet/SKILL.md +145 -0
  82. package/data/skills/openai-transcribe/SKILL.md +81 -0
  83. package/data/skills/openai-vercel-deploy/SKILL.md +77 -0
  84. package/data/skills/openai-yeet/SKILL.md +28 -0
  85. package/data/skills/pennylane/SKILL.md +224 -0
  86. package/data/skills/polars-bio/SKILL.md +374 -0
  87. package/data/skills/primekg/SKILL.md +97 -0
  88. package/data/skills/pymatgen/SKILL.md +689 -0
  89. package/data/skills/qiskit/SKILL.md +273 -0
  90. package/data/skills/qutip/SKILL.md +316 -0
  91. package/data/skills/recursive-decomposition/SKILL.md +185 -0
  92. package/data/skills/rowan/SKILL.md +427 -0
  93. package/data/skills/scholar-evaluation/SKILL.md +298 -0
  94. package/data/skills/sentry-create-alert/SKILL.md +210 -0
  95. package/data/skills/sentry-fix-issues/SKILL.md +126 -0
  96. package/data/skills/sentry-pr-code-review/SKILL.md +105 -0
  97. package/data/skills/sentry-python-sdk/SKILL.md +317 -0
  98. package/data/skills/sentry-setup-ai-monitoring/SKILL.md +217 -0
  99. package/data/skills/stable-baselines3/SKILL.md +297 -0
  100. package/data/skills/sympy/SKILL.md +498 -0
  101. package/data/skills/trailofbits-ask-questions-if-underspecified/SKILL.md +85 -0
  102. package/data/skills/trailofbits-audit-context-building/SKILL.md +302 -0
  103. package/data/skills/trailofbits-differential-review/SKILL.md +220 -0
  104. package/data/skills/trailofbits-insecure-defaults/SKILL.md +117 -0
  105. package/data/skills/trailofbits-modern-python/SKILL.md +333 -0
  106. package/data/skills/trailofbits-property-based-testing/SKILL.md +123 -0
  107. package/data/skills/trailofbits-semgrep-rule-creator/SKILL.md +172 -0
  108. package/data/skills/trailofbits-sharp-edges/SKILL.md +292 -0
  109. package/data/skills/trailofbits-variant-analysis/SKILL.md +142 -0
  110. package/data/skills/transformers.js/SKILL.md +637 -0
  111. package/data/skills/writing/SKILL.md +419 -0
  112. package/dist/bgi.js +66 -2
  113. package/package.json +1 -1
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: claude-api
3
+ description: "Build apps with the Claude API or Anthropic SDK. TRIGGER when: code imports `anthropic`/`@anthropic-ai/sdk`/`claude_agent_sdk`, or user asks to use Claude API, Anthropic SDKs, or Agent SDK. DO NOT TRIGGER when: code imports `openai`/other AI SDK, general programming, or ML/data-science tasks."
4
+ license: Complete terms in LICENSE.txt
5
+ ---
6
+
7
+ # Building LLM-Powered Applications with Claude
8
+
9
+ This skill helps you build LLM-powered applications with Claude. Choose the right surface based on your needs, detect the project language, then read the relevant language-specific documentation.
10
+
11
+ ## Defaults
12
+
13
+ Unless the user requests otherwise:
14
+
15
+ For the Claude model version, please use Claude Opus 4.6, which you can access via the exact model string `claude-opus-4-6`. Please default to using adaptive thinking (`thinking: {type: "adaptive"}`) for anything remotely complicated. And finally, please default to streaming for any request that may involve long input, long output, or high `max_tokens` — it prevents hitting request timeouts. Use the SDK's `.get_final_message()` / `.finalMessage()` helper to get the complete response if you don't need to handle individual stream events
16
+
17
+ ---
18
+
19
+ ## Language Detection
20
+
21
+ Before reading code examples, determine which language the user is working in:
22
+
23
+ 1. **Look at project files** to infer the language:
24
+
25
+ - `*.py`, `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile` → **Python** — read from `python/`
26
+ - `*.ts`, `*.tsx`, `package.json`, `tsconfig.json` → **TypeScript** — read from `typescript/`
27
+ - `*.js`, `*.jsx` (no `.ts` files present) → **TypeScript** — JS uses the same SDK, read from `typescript/`
28
+ - `*.java`, `pom.xml`, `build.gradle` → **Java** — read from `java/`
29
+ - `*.kt`, `*.kts`, `build.gradle.kts` → **Java** — Kotlin uses the Java SDK, read from `java/`
30
+ - `*.scala`, `build.sbt` → **Java** — Scala uses the Java SDK, read from `java/`
31
+ - `*.go`, `go.mod` → **Go** — read from `go/`
32
+ - `*.rb`, `Gemfile` → **Ruby** — read from `ruby/`
33
+ - `*.cs`, `*.csproj` → **C#** — read from `csharp/`
34
+ - `*.php`, `composer.json` → **PHP** — read from `php/`
35
+
36
+ 2. **If multiple languages detected** (e.g., both Python and TypeScript files):
37
+
38
+ - Check which language the user's current file or question relates to
39
+ - If still ambiguous, ask: "I detected both Python and TypeScript files. Which language are you using for the Claude API integration?"
40
+
41
+ 3. **If language can't be inferred** (empty project, no source files, or unsupported language):
42
+
43
+ - Use AskUserQuestion with options: Python, TypeScript, Java, Go, Ruby, cURL/raw HTTP, C#, PHP
44
+ - If AskUserQuestion is unavailable, default to Python examples and note: "Showing Python examples. Let me know if you need a different language."
45
+
46
+ 4. **If unsupported language detected** (Rust, Swift, C++, Elixir, etc.):
47
+
48
+ - Suggest cURL/raw HTTP examples from `curl/` and note that community SDKs may exist
49
+ - Offer to show Python or TypeScript examples as reference implementations
50
+
51
+ 5. **If user needs cURL/raw HTTP examples**, read from `curl/`.
52
+
53
+ ### Language-Specific Feature Support
54
+
55
+ | Language | Tool Runner | Agent SDK | Notes |
56
+ | ---------- | ----------- | --------- | ------------------------------------- |
57
+ | Python | Yes (beta) | Yes | Full support — `@beta_tool` decorator |
58
+ | TypeScript | Yes (beta) | Yes | Full support — `betaZodTool` + Zod |
59
+ | Java | Yes (beta) | No | Beta tool use with annotated classes |
60
+ | Go | Yes (beta) | No | `BetaToolRunner` in `toolrunner` pkg |
61
+ | Ruby | Yes (beta) | No | `BaseTool` + `tool_runner` in beta |
62
+ | cURL | N/A | N/A | Raw HTTP, no SDK features |
63
+ | C# | No | No | Official SDK |
64
+ | PHP | No | No | Official SDK |
65
+
66
+ ---
67
+
68
+ ## Which Surface Should I Use?
69
+
70
+ > **Start simple.** Default to the simplest tier that meets your needs. Single API calls and workflows handle most use cases — only reach for agents when the task genuinely requires open-ended, model-driven exploration.
71
+
72
+ | Use Case | Tier | Recommended Surface | Why |
73
+ | ----------------------------------------------- | --------------- | ------------------------- | --------------------------------------- |
74
+ | Classification, summarization, extraction, Q&A | Single LLM call | **Claude API** | One request, one response |
75
+ | Batch processing or embeddings | Single LLM call | **Claude API** | Specialized endpoints |
76
+ | Multi-step pipelines with code-controlled logic | Workflow | **Claude API + tool use** | You orchestrate the loop |
77
+ | Custom agent with your own tools | Agent | **Claude API + tool use** | Maximum flexibility |
78
+ | AI agent with file/web/terminal access | Agent | **Agent SDK** | Built-in tools, safety, and MCP support |
79
+ | Agentic coding assistant | Agent | **Agent SDK** | Designed for this use case |
80
+ | Want built-in permissions and guardrails | Agent | **Agent SDK** | Safety features included |
81
+
82
+ > **Note:** The Agent SDK is for when you want built-in file/web/terminal tools, permissions, and MCP out of the box. If you want to build an agent with your own tools, Claude API is the right choice — use the tool runner for automatic loop handling, or the manual loop for fine-grained control (approval gates, custom logging, conditional execution).
83
+
84
+ ### Decision Tree
85
+
86
+ ```
87
+ What does your application need?
88
+
89
+ 1. Single LLM call (classification, summarization, extraction, Q&A)
90
+ └── Claude API — one request, one response
91
+
92
+ 2. Does Claude need to read/write files, browse the web, or run shell commands
93
+ as part of its work? (Not: does your app read a file and hand it to Claude —
94
+ does Claude itself need to discover and access files/web/shell?)
95
+ └── Yes → Agent SDK — built-in tools, don't reimplement them
96
+ Examples: "scan a codebase for bugs", "summarize every file in a directory",
97
+ "find bugs using subagents", "research a topic via web search"
98
+
99
+ 3. Workflow (multi-step, code-orchestrated, with your own tools)
100
+ └── Claude API with tool use — you control the loop
101
+
102
+ 4. Open-ended agent (model decides its own trajectory, your own tools)
103
+ └── Claude API agentic loop (maximum flexibility)
104
+ ```
105
+
106
+ ### Should I Build an Agent?
107
+
108
+ Before choosing the agent tier, check all four criteria:
109
+
110
+ - **Complexity** — Is the task multi-step and hard to fully specify in advance? (e.g., "turn this design doc into a PR" vs. "extract the title from this PDF")
111
+ - **Value** — Does the outcome justify higher cost and latency?
112
+ - **Viability** — Is Claude capable at this task type?
113
+ - **Cost of error** — Can errors be caught and recovered from? (tests, review, rollback)
114
+
115
+ If the answer is "no" to any of these, stay at a simpler tier (single call or workflow).
116
+
117
+ ---
118
+
119
+ ## Architecture
120
+
121
+ Everything goes through `POST /v1/messages`. Tools and output constraints are features of this single endpoint — not separate APIs.
122
+
123
+ **User-defined tools** — You define tools (via decorators, Zod schemas, or raw JSON), and the SDK's tool runner handles calling the API, executing your functions, and looping until Claude is done. For full control, you can write the loop manually.
124
+
125
+ **Server-side tools** — Anthropic-hosted tools that run on Anthropic's infrastructure. Code execution is fully server-side (declare it in `tools`, Claude runs code automatically). Computer use can be server-hosted or self-hosted.
126
+
127
+ **Structured outputs** — Constrains the Messages API response format (`output_config.format`) and/or tool parameter validation (`strict: true`). The recommended approach is `client.messages.parse()` which validates responses against your schema automatically. Note: the old `output_format` parameter is deprecated; use `output_config: {format: {...}}` on `messages.create()`.
128
+
129
+ **Supporting endpoints** — Batches (`POST /v1/messages/batches`), Files (`POST /v1/files`), and Token Counting feed into or support Messages API requests.
130
+
131
+ ---
132
+
133
+ ## Current Models (cached: 2026-02-17)
134
+
135
+ | Model | Model ID | Context | Input $/1M | Output $/1M |
136
+ | ----------------- | ------------------- | -------------- | ---------- | ----------- |
137
+ | Claude Opus 4.6 | `claude-opus-4-6` | 200K (1M beta) | $5.00 | $25.00 |
138
+ | Claude Sonnet 4.6 | `claude-sonnet-4-6` | 200K (1M beta) | $3.00 | $15.00 |
139
+ | Claude Haiku 4.5 | `claude-haiku-4-5` | 200K | $1.00 | $5.00 |
140
+
141
+ **ALWAYS use `claude-opus-4-6` unless the user explicitly names a different model.** This is non-negotiable. Do not use `claude-sonnet-4-6`, `claude-sonnet-4-5`, or any other model unless the user literally says "use sonnet" or "use haiku". Never downgrade for cost — that's the user's decision, not yours.
142
+
143
+ **CRITICAL: Use only the exact model ID strings from the table above — they are complete as-is. Do not append date suffixes.** For example, use `claude-sonnet-4-5`, never `claude-sonnet-4-5-20250514` or any other date-suffixed variant you might recall from training data. If the user requests an older model not in the table (e.g., "opus 4.5", "sonnet 3.7"), read `shared/models.md` for the exact ID — do not construct one yourself.
144
+
145
+ A note: if any of the model strings above look unfamiliar to you, that's to be expected — that just means they were released after your training data cutoff. Rest assured they are real models; we wouldn't mess with you like that.
146
+
147
+ ---
148
+
149
+ ## Thinking & Effort (Quick Reference)
150
+
151
+ **Opus 4.6 — Adaptive thinking (recommended):** Use `thinking: {type: "adaptive"}`. Claude dynamically decides when and how much to think. No `budget_tokens` needed — `budget_tokens` is deprecated on Opus 4.6 and Sonnet 4.6 and must not be used. Adaptive thinking also automatically enables interleaved thinking (no beta header needed). **When the user asks for "extended thinking", a "thinking budget", or `budget_tokens`: always use Opus 4.6 with `thinking: {type: "adaptive"}`. The concept of a fixed token budget for thinking is deprecated — adaptive thinking replaces it. Do NOT use `budget_tokens` and do NOT switch to an older model.**
152
+
153
+ **Effort parameter (GA, no beta header):** Controls thinking depth and overall token spend via `output_config: {effort: "low"|"medium"|"high"|"max"}` (inside `output_config`, not top-level). Default is `high` (equivalent to omitting it). `max` is Opus 4.6 only. Works on Opus 4.5, Opus 4.6, and Sonnet 4.6. Will error on Sonnet 4.5 / Haiku 4.5. Combine with adaptive thinking for the best cost-quality tradeoffs. Use `low` for subagents or simple tasks; `max` for the deepest reasoning.
154
+
155
+ **Sonnet 4.6:** Supports adaptive thinking (`thinking: {type: "adaptive"}`). `budget_tokens` is deprecated on Sonnet 4.6 — use adaptive thinking instead.
156
+
157
+ **Older models (only if explicitly requested):** If the user specifically asks for Sonnet 4.5 or another older model, use `thinking: {type: "enabled", budget_tokens: N}`. `budget_tokens` must be less than `max_tokens` (minimum 1024). Never choose an older model just because the user mentions `budget_tokens` — use Opus 4.6 with adaptive thinking instead.
158
+
159
+ ---
160
+
161
+ ## Compaction (Quick Reference)
162
+
163
+ **Beta, Opus 4.6 only.** For long-running conversations that may exceed the 200K context window, enable server-side compaction. The API automatically summarizes earlier context when it approaches the trigger threshold (default: 150K tokens). Requires beta header `compact-2026-01-12`.
164
+
165
+ **Critical:** Append `response.content` (not just the text) back to your messages on every turn. Compaction blocks in the response must be preserved — the API uses them to replace the compacted history on the next request. Extracting only the text string and appending that will silently lose the compaction state.
166
+
167
+ See `{lang}/claude-api/README.md` (Compaction section) for code examples. Full docs via WebFetch in `shared/live-sources.md`.
168
+
169
+ ---
170
+
171
+ ## Reading Guide
172
+
173
+ After detecting the language, read the relevant files based on what the user needs:
174
+
175
+ ### Quick Task Reference
176
+
177
+ **Single text classification/summarization/extraction/Q&A:**
178
+ → Read only `{lang}/claude-api/README.md`
179
+
180
+ **Chat UI or real-time response display:**
181
+ → Read `{lang}/claude-api/README.md` + `{lang}/claude-api/streaming.md`
182
+
183
+ **Long-running conversations (may exceed context window):**
184
+ → Read `{lang}/claude-api/README.md` — see Compaction section
185
+
186
+ **Function calling / tool use / agents:**
187
+ → Read `{lang}/claude-api/README.md` + `shared/tool-use-concepts.md` + `{lang}/claude-api/tool-use.md`
188
+
189
+ **Batch processing (non-latency-sensitive):**
190
+ → Read `{lang}/claude-api/README.md` + `{lang}/claude-api/batches.md`
191
+
192
+ **File uploads across multiple requests:**
193
+ → Read `{lang}/claude-api/README.md` + `{lang}/claude-api/files-api.md`
194
+
195
+ **Agent with built-in tools (file/web/terminal):**
196
+ → Read `{lang}/agent-sdk/README.md` + `{lang}/agent-sdk/patterns.md`
197
+
198
+ ### Claude API (Full File Reference)
199
+
200
+ Read the **language-specific Claude API folder** (`{language}/claude-api/`):
201
+
202
+ 1. **`{language}/claude-api/README.md`** — **Read this first.** Installation, quick start, common patterns, error handling.
203
+ 2. **`shared/tool-use-concepts.md`** — Read when the user needs function calling, code execution, memory, or structured outputs. Covers conceptual foundations.
204
+ 3. **`{language}/claude-api/tool-use.md`** — Read for language-specific tool use code examples (tool runner, manual loop, code execution, memory, structured outputs).
205
+ 4. **`{language}/claude-api/streaming.md`** — Read when building chat UIs or interfaces that display responses incrementally.
206
+ 5. **`{language}/claude-api/batches.md`** — Read when processing many requests offline (not latency-sensitive). Runs asynchronously at 50% cost.
207
+ 6. **`{language}/claude-api/files-api.md`** — Read when sending the same file across multiple requests without re-uploading.
208
+ 7. **`shared/error-codes.md`** — Read when debugging HTTP errors or implementing error handling.
209
+ 8. **`shared/live-sources.md`** — WebFetch URLs for fetching the latest official documentation.
210
+
211
+ > **Note:** For Java, Go, Ruby, C#, PHP, and cURL — these have a single file each covering all basics. Read that file plus `shared/tool-use-concepts.md` and `shared/error-codes.md` as needed.
212
+
213
+ ### Agent SDK
214
+
215
+ Read the **language-specific Agent SDK folder** (`{language}/agent-sdk/`). Agent SDK is available for **Python and TypeScript only**.
216
+
217
+ 1. **`{language}/agent-sdk/README.md`** — Installation, quick start, built-in tools, permissions, MCP, hooks.
218
+ 2. **`{language}/agent-sdk/patterns.md`** — Custom tools, hooks, subagents, MCP integration, session resumption.
219
+ 3. **`shared/live-sources.md`** — WebFetch URLs for current Agent SDK docs.
220
+
221
+ ---
222
+
223
+ ## When to Use WebFetch
224
+
225
+ Use WebFetch to get the latest documentation when:
226
+
227
+ - User asks for "latest" or "current" information
228
+ - Cached data seems incorrect
229
+ - User asks about features not covered here
230
+
231
+ Live documentation URLs are in `shared/live-sources.md`.
232
+
233
+ ## Common Pitfalls
234
+
235
+ - Don't truncate inputs when passing files or content to the API. If the content is too long to fit in the context window, notify the user and discuss options (chunking, summarization, etc.) rather than silently truncating.
236
+ - **Opus 4.6 / Sonnet 4.6 thinking:** Use `thinking: {type: "adaptive"}` — do NOT use `budget_tokens` (deprecated on both Opus 4.6 and Sonnet 4.6). For older models, `budget_tokens` must be less than `max_tokens` (minimum 1024). This will throw an error if you get it wrong.
237
+ - **Opus 4.6 prefill removed:** Assistant message prefills (last-assistant-turn prefills) return a 400 error on Opus 4.6. Use structured outputs (`output_config.format`) or system prompt instructions to control response format instead.
238
+ - **128K output tokens:** Opus 4.6 supports up to 128K `max_tokens`, but the SDKs require streaming for large `max_tokens` to avoid HTTP timeouts. Use `.stream()` with `.get_final_message()` / `.finalMessage()`.
239
+ - **Tool call JSON parsing (Opus 4.6):** Opus 4.6 may produce different JSON string escaping in tool call `input` fields (e.g., Unicode or forward-slash escaping). Always parse tool inputs with `json.loads()` / `JSON.parse()` — never do raw string matching on the serialized input.
240
+ - **Structured outputs (all models):** Use `output_config: {format: {...}}` instead of the deprecated `output_format` parameter on `messages.create()`. This is a general API change, not 4.6-specific.
241
+ - **Don't reimplement SDK functionality:** The SDK provides high-level helpers — use them instead of building from scratch. Specifically: use `stream.finalMessage()` instead of wrapping `.on()` events in `new Promise()`; use typed exception classes (`Anthropic.RateLimitError`, etc.) instead of string-matching error messages; use SDK types (`Anthropic.MessageParam`, `Anthropic.Tool`, `Anthropic.Message`, etc.) instead of redefining equivalent interfaces.
242
+ - **Don't define custom types for SDK data structures:** The SDK exports types for all API objects. Use `Anthropic.MessageParam` for messages, `Anthropic.Tool` for tool definitions, `Anthropic.ToolUseBlock` / `Anthropic.ToolResultBlockParam` for tool results, `Anthropic.Message` for responses. Defining your own `interface ChatMessage { role: string; content: unknown }` duplicates what the SDK already provides and loses type safety.
243
+ - **Report and document output:** For tasks that produce reports, documents, or visualizations, the code execution sandbox has `python-docx`, `python-pptx`, `matplotlib`, `pillow`, and `pypdf` pre-installed. Claude can generate formatted files (DOCX, PDF, charts) and return them via the Files API — consider this for "report" or "document" type requests instead of plain stdout text.
@@ -0,0 +1,375 @@
1
+ ---
2
+ name: doc-coauthoring
3
+ description: Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
4
+ ---
5
+
6
+ # Doc Co-Authoring Workflow
7
+
8
+ This skill provides a structured workflow for guiding users through collaborative document creation. Act as an active guide, walking users through three stages: Context Gathering, Refinement & Structure, and Reader Testing.
9
+
10
+ ## When to Offer This Workflow
11
+
12
+ **Trigger conditions:**
13
+ - User mentions writing documentation: "write a doc", "draft a proposal", "create a spec", "write up"
14
+ - User mentions specific doc types: "PRD", "design doc", "decision doc", "RFC"
15
+ - User seems to be starting a substantial writing task
16
+
17
+ **Initial offer:**
18
+ Offer the user a structured workflow for co-authoring the document. Explain the three stages:
19
+
20
+ 1. **Context Gathering**: User provides all relevant context while Claude asks clarifying questions
21
+ 2. **Refinement & Structure**: Iteratively build each section through brainstorming and editing
22
+ 3. **Reader Testing**: Test the doc with a fresh Claude (no context) to catch blind spots before others read it
23
+
24
+ Explain that this approach helps ensure the doc works well when others read it (including when they paste it into Claude). Ask if they want to try this workflow or prefer to work freeform.
25
+
26
+ If user declines, work freeform. If user accepts, proceed to Stage 1.
27
+
28
+ ## Stage 1: Context Gathering
29
+
30
+ **Goal:** Close the gap between what the user knows and what Claude knows, enabling smart guidance later.
31
+
32
+ ### Initial Questions
33
+
34
+ Start by asking the user for meta-context about the document:
35
+
36
+ 1. What type of document is this? (e.g., technical spec, decision doc, proposal)
37
+ 2. Who's the primary audience?
38
+ 3. What's the desired impact when someone reads this?
39
+ 4. Is there a template or specific format to follow?
40
+ 5. Any other constraints or context to know?
41
+
42
+ Inform them they can answer in shorthand or dump information however works best for them.
43
+
44
+ **If user provides a template or mentions a doc type:**
45
+ - Ask if they have a template document to share
46
+ - If they provide a link to a shared document, use the appropriate integration to fetch it
47
+ - If they provide a file, read it
48
+
49
+ **If user mentions editing an existing shared document:**
50
+ - Use the appropriate integration to read the current state
51
+ - Check for images without alt-text
52
+ - If images exist without alt-text, explain that when others use Claude to understand the doc, Claude won't be able to see them. Ask if they want alt-text generated. If so, request they paste each image into chat for descriptive alt-text generation.
53
+
54
+ ### Info Dumping
55
+
56
+ Once initial questions are answered, encourage the user to dump all the context they have. Request information such as:
57
+ - Background on the project/problem
58
+ - Related team discussions or shared documents
59
+ - Why alternative solutions aren't being used
60
+ - Organizational context (team dynamics, past incidents, politics)
61
+ - Timeline pressures or constraints
62
+ - Technical architecture or dependencies
63
+ - Stakeholder concerns
64
+
65
+ Advise them not to worry about organizing it - just get it all out. Offer multiple ways to provide context:
66
+ - Info dump stream-of-consciousness
67
+ - Point to team channels or threads to read
68
+ - Link to shared documents
69
+
70
+ **If integrations are available** (e.g., Slack, Teams, Google Drive, SharePoint, or other MCP servers), mention that these can be used to pull in context directly.
71
+
72
+ **If no integrations are detected and in Claude.ai or Claude app:** Suggest they can enable connectors in their Claude settings to allow pulling context from messaging apps and document storage directly.
73
+
74
+ Inform them clarifying questions will be asked once they've done their initial dump.
75
+
76
+ **During context gathering:**
77
+
78
+ - If user mentions team channels or shared documents:
79
+ - If integrations available: Inform them the content will be read now, then use the appropriate integration
80
+ - If integrations not available: Explain lack of access. Suggest they enable connectors in Claude settings, or paste the relevant content directly.
81
+
82
+ - If user mentions entities/projects that are unknown:
83
+ - Ask if connected tools should be searched to learn more
84
+ - Wait for user confirmation before searching
85
+
86
+ - As user provides context, track what's being learned and what's still unclear
87
+
88
+ **Asking clarifying questions:**
89
+
90
+ When user signals they've done their initial dump (or after substantial context provided), ask clarifying questions to ensure understanding:
91
+
92
+ Generate 5-10 numbered questions based on gaps in the context.
93
+
94
+ Inform them they can use shorthand to answer (e.g., "1: yes, 2: see #channel, 3: no because backwards compat"), link to more docs, point to channels to read, or just keep info-dumping. Whatever's most efficient for them.
95
+
96
+ **Exit condition:**
97
+ Sufficient context has been gathered when questions show understanding - when edge cases and trade-offs can be asked about without needing basics explained.
98
+
99
+ **Transition:**
100
+ Ask if there's any more context they want to provide at this stage, or if it's time to move on to drafting the document.
101
+
102
+ If user wants to add more, let them. When ready, proceed to Stage 2.
103
+
104
+ ## Stage 2: Refinement & Structure
105
+
106
+ **Goal:** Build the document section by section through brainstorming, curation, and iterative refinement.
107
+
108
+ **Instructions to user:**
109
+ Explain that the document will be built section by section. For each section:
110
+ 1. Clarifying questions will be asked about what to include
111
+ 2. 5-20 options will be brainstormed
112
+ 3. User will indicate what to keep/remove/combine
113
+ 4. The section will be drafted
114
+ 5. It will be refined through surgical edits
115
+
116
+ Start with whichever section has the most unknowns (usually the core decision/proposal), then work through the rest.
117
+
118
+ **Section ordering:**
119
+
120
+ If the document structure is clear:
121
+ Ask which section they'd like to start with.
122
+
123
+ Suggest starting with whichever section has the most unknowns. For decision docs, that's usually the core proposal. For specs, it's typically the technical approach. Summary sections are best left for last.
124
+
125
+ If user doesn't know what sections they need:
126
+ Based on the type of document and template, suggest 3-5 sections appropriate for the doc type.
127
+
128
+ Ask if this structure works, or if they want to adjust it.
129
+
130
+ **Once structure is agreed:**
131
+
132
+ Create the initial document structure with placeholder text for all sections.
133
+
134
+ **If access to artifacts is available:**
135
+ Use `create_file` to create an artifact. This gives both Claude and the user a scaffold to work from.
136
+
137
+ Inform them that the initial structure with placeholders for all sections will be created.
138
+
139
+ Create artifact with all section headers and brief placeholder text like "[To be written]" or "[Content here]".
140
+
141
+ Provide the scaffold link and indicate it's time to fill in each section.
142
+
143
+ **If no access to artifacts:**
144
+ Create a markdown file in the working directory. Name it appropriately (e.g., `decision-doc.md`, `technical-spec.md`).
145
+
146
+ Inform them that the initial structure with placeholders for all sections will be created.
147
+
148
+ Create file with all section headers and placeholder text.
149
+
150
+ Confirm the filename has been created and indicate it's time to fill in each section.
151
+
152
+ **For each section:**
153
+
154
+ ### Step 1: Clarifying Questions
155
+
156
+ Announce work will begin on the [SECTION NAME] section. Ask 5-10 clarifying questions about what should be included:
157
+
158
+ Generate 5-10 specific questions based on context and section purpose.
159
+
160
+ Inform them they can answer in shorthand or just indicate what's important to cover.
161
+
162
+ ### Step 2: Brainstorming
163
+
164
+ For the [SECTION NAME] section, brainstorm [5-20] things that might be included, depending on the section's complexity. Look for:
165
+ - Context shared that might have been forgotten
166
+ - Angles or considerations not yet mentioned
167
+
168
+ Generate 5-20 numbered options based on section complexity. At the end, offer to brainstorm more if they want additional options.
169
+
170
+ ### Step 3: Curation
171
+
172
+ Ask which points should be kept, removed, or combined. Request brief justifications to help learn priorities for the next sections.
173
+
174
+ Provide examples:
175
+ - "Keep 1,4,7,9"
176
+ - "Remove 3 (duplicates 1)"
177
+ - "Remove 6 (audience already knows this)"
178
+ - "Combine 11 and 12"
179
+
180
+ **If user gives freeform feedback** (e.g., "looks good" or "I like most of it but...") instead of numbered selections, extract their preferences and proceed. Parse what they want kept/removed/changed and apply it.
181
+
182
+ ### Step 4: Gap Check
183
+
184
+ Based on what they've selected, ask if there's anything important missing for the [SECTION NAME] section.
185
+
186
+ ### Step 5: Drafting
187
+
188
+ Use `str_replace` to replace the placeholder text for this section with the actual drafted content.
189
+
190
+ Announce the [SECTION NAME] section will be drafted now based on what they've selected.
191
+
192
+ **If using artifacts:**
193
+ After drafting, provide a link to the artifact.
194
+
195
+ Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
196
+
197
+ **If using a file (no artifacts):**
198
+ After drafting, confirm completion.
199
+
200
+ Inform them the [SECTION NAME] section has been drafted in [filename]. Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
201
+
202
+ **Key instruction for user (include when drafting the first section):**
203
+ Provide a note: Instead of editing the doc directly, ask them to indicate what to change. This helps learning of their style for future sections. For example: "Remove the X bullet - already covered by Y" or "Make the third paragraph more concise".
204
+
205
+ ### Step 6: Iterative Refinement
206
+
207
+ As user provides feedback:
208
+ - Use `str_replace` to make edits (never reprint the whole doc)
209
+ - **If using artifacts:** Provide link to artifact after each edit
210
+ - **If using files:** Just confirm edits are complete
211
+ - If user edits doc directly and asks to read it: mentally note the changes they made and keep them in mind for future sections (this shows their preferences)
212
+
213
+ **Continue iterating** until user is satisfied with the section.
214
+
215
+ ### Quality Checking
216
+
217
+ After 3 consecutive iterations with no substantial changes, ask if anything can be removed without losing important information.
218
+
219
+ When section is done, confirm [SECTION NAME] is complete. Ask if ready to move to the next section.
220
+
221
+ **Repeat for all sections.**
222
+
223
+ ### Near Completion
224
+
225
+ As approaching completion (80%+ of sections done), announce intention to re-read the entire document and check for:
226
+ - Flow and consistency across sections
227
+ - Redundancy or contradictions
228
+ - Anything that feels like "slop" or generic filler
229
+ - Whether every sentence carries weight
230
+
231
+ Read entire document and provide feedback.
232
+
233
+ **When all sections are drafted and refined:**
234
+ Announce all sections are drafted. Indicate intention to review the complete document one more time.
235
+
236
+ Review for overall coherence, flow, completeness.
237
+
238
+ Provide any final suggestions.
239
+
240
+ Ask if ready to move to Reader Testing, or if they want to refine anything else.
241
+
242
+ ## Stage 3: Reader Testing
243
+
244
+ **Goal:** Test the document with a fresh Claude (no context bleed) to verify it works for readers.
245
+
246
+ **Instructions to user:**
247
+ Explain that testing will now occur to see if the document actually works for readers. This catches blind spots - things that make sense to the authors but might confuse others.
248
+
249
+ ### Testing Approach
250
+
251
+ **If access to sub-agents is available (e.g., in Claude Code):**
252
+
253
+ Perform the testing directly without user involvement.
254
+
255
+ ### Step 1: Predict Reader Questions
256
+
257
+ Announce intention to predict what questions readers might ask when trying to discover this document.
258
+
259
+ Generate 5-10 questions that readers would realistically ask.
260
+
261
+ ### Step 2: Test with Sub-Agent
262
+
263
+ Announce that these questions will be tested with a fresh Claude instance (no context from this conversation).
264
+
265
+ For each question, invoke a sub-agent with just the document content and the question.
266
+
267
+ Summarize what Reader Claude got right/wrong for each question.
268
+
269
+ ### Step 3: Run Additional Checks
270
+
271
+ Announce additional checks will be performed.
272
+
273
+ Invoke sub-agent to check for ambiguity, false assumptions, contradictions.
274
+
275
+ Summarize any issues found.
276
+
277
+ ### Step 4: Report and Fix
278
+
279
+ If issues found:
280
+ Report that Reader Claude struggled with specific issues.
281
+
282
+ List the specific issues.
283
+
284
+ Indicate intention to fix these gaps.
285
+
286
+ Loop back to refinement for problematic sections.
287
+
288
+ ---
289
+
290
+ **If no access to sub-agents (e.g., claude.ai web interface):**
291
+
292
+ The user will need to do the testing manually.
293
+
294
+ ### Step 1: Predict Reader Questions
295
+
296
+ Ask what questions people might ask when trying to discover this document. What would they type into Claude.ai?
297
+
298
+ Generate 5-10 questions that readers would realistically ask.
299
+
300
+ ### Step 2: Setup Testing
301
+
302
+ Provide testing instructions:
303
+ 1. Open a fresh Claude conversation: https://claude.ai
304
+ 2. Paste or share the document content (if using a shared doc platform with connectors enabled, provide the link)
305
+ 3. Ask Reader Claude the generated questions
306
+
307
+ For each question, instruct Reader Claude to provide:
308
+ - The answer
309
+ - Whether anything was ambiguous or unclear
310
+ - What knowledge/context the doc assumes is already known
311
+
312
+ Check if Reader Claude gives correct answers or misinterprets anything.
313
+
314
+ ### Step 3: Additional Checks
315
+
316
+ Also ask Reader Claude:
317
+ - "What in this doc might be ambiguous or unclear to readers?"
318
+ - "What knowledge or context does this doc assume readers already have?"
319
+ - "Are there any internal contradictions or inconsistencies?"
320
+
321
+ ### Step 4: Iterate Based on Results
322
+
323
+ Ask what Reader Claude got wrong or struggled with. Indicate intention to fix those gaps.
324
+
325
+ Loop back to refinement for any problematic sections.
326
+
327
+ ---
328
+
329
+ ### Exit Condition (Both Approaches)
330
+
331
+ When Reader Claude consistently answers questions correctly and doesn't surface new gaps or ambiguities, the doc is ready.
332
+
333
+ ## Final Review
334
+
335
+ When Reader Testing passes:
336
+ Announce the doc has passed Reader Claude testing. Before completion:
337
+
338
+ 1. Recommend they do a final read-through themselves - they own this document and are responsible for its quality
339
+ 2. Suggest double-checking any facts, links, or technical details
340
+ 3. Ask them to verify it achieves the impact they wanted
341
+
342
+ Ask if they want one more review, or if the work is done.
343
+
344
+ **If user wants final review, provide it. Otherwise:**
345
+ Announce document completion. Provide a few final tips:
346
+ - Consider linking this conversation in an appendix so readers can see how the doc was developed
347
+ - Use appendices to provide depth without bloating the main doc
348
+ - Update the doc as feedback is received from real readers
349
+
350
+ ## Tips for Effective Guidance
351
+
352
+ **Tone:**
353
+ - Be direct and procedural
354
+ - Explain rationale briefly when it affects user behavior
355
+ - Don't try to "sell" the approach - just execute it
356
+
357
+ **Handling Deviations:**
358
+ - If user wants to skip a stage: Ask if they want to skip this and write freeform
359
+ - If user seems frustrated: Acknowledge this is taking longer than expected. Suggest ways to move faster
360
+ - Always give user agency to adjust the process
361
+
362
+ **Context Management:**
363
+ - Throughout, if context is missing on something mentioned, proactively ask
364
+ - Don't let gaps accumulate - address them as they come up
365
+
366
+ **Artifact Management:**
367
+ - Use `create_file` for drafting full sections
368
+ - Use `str_replace` for all edits
369
+ - Provide artifact link after every change
370
+ - Never use artifacts for brainstorming lists - that's just conversation
371
+
372
+ **Quality over Speed:**
373
+ - Don't rush through stages
374
+ - Each iteration should make meaningful improvements
375
+ - The goal is a document that actually works for readers