autodoc-agent-kit 1.0.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/README.md +362 -0
- package/package.json +49 -0
- package/src/core/module.yaml +5 -0
- package/src/modules/design/module.yaml +9 -0
- package/src/modules/design/skills/brand-guidelines/LICENSE.txt +202 -0
- package/src/modules/design/skills/brand-guidelines/SKILL.md +73 -0
- package/src/modules/design/skills/frontend-design/LICENSE.txt +177 -0
- package/src/modules/design/skills/frontend-design/SKILL.md +42 -0
- package/src/modules/design/skills/web-artifacts-builder/SKILL.md +229 -0
- package/src/modules/devops/module.yaml +10 -0
- package/src/modules/devops/skills/devops-helper/SKILL.md +60 -0
- package/src/modules/devops/skills/k8s-helm/SKILL.md +360 -0
- package/src/modules/devops/skills/monitoring-observability/SKILL.md +240 -0
- package/src/modules/devops/skills/security-auditor/SKILL.md +105 -0
- package/src/modules/engineering/module.yaml +22 -0
- package/src/modules/engineering/skills/ai-sdk/SKILL.md +314 -0
- package/src/modules/engineering/skills/api-designer/SKILL.md +77 -0
- package/src/modules/engineering/skills/code-reviewer/SKILL.md +71 -0
- package/src/modules/engineering/skills/db-architect/SKILL.md +50 -0
- package/src/modules/engineering/skills/debugger/SKILL.md +59 -0
- package/src/modules/engineering/skills/docs-generator/SKILL.md +51 -0
- package/src/modules/engineering/skills/git-workflow/SKILL.md +258 -0
- package/src/modules/engineering/skills/mcp-builder/LICENSE.txt +202 -0
- package/src/modules/engineering/skills/mcp-builder/SKILL.md +236 -0
- package/src/modules/engineering/skills/mcp-builder/reference/evaluation.md +602 -0
- package/src/modules/engineering/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/src/modules/engineering/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/src/modules/engineering/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/src/modules/engineering/skills/mcp-builder/scripts/connections.py +151 -0
- package/src/modules/engineering/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/src/modules/engineering/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/src/modules/engineering/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/src/modules/engineering/skills/nextjs-15/SKILL.md +312 -0
- package/src/modules/engineering/skills/perf-optimizer/SKILL.md +60 -0
- package/src/modules/engineering/skills/react-19/SKILL.md +257 -0
- package/src/modules/engineering/skills/refactorer/SKILL.md +60 -0
- package/src/modules/engineering/skills/skill-authoring-workflow/SKILL.md +183 -0
- package/src/modules/engineering/skills/skill-creator/LICENSE.txt +202 -0
- package/src/modules/engineering/skills/skill-creator/SKILL.md +356 -0
- package/src/modules/engineering/skills/skill-creator/references/output-patterns.md +82 -0
- package/src/modules/engineering/skills/skill-creator/references/workflows.md +28 -0
- package/src/modules/engineering/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-313.pyc +0 -0
- package/src/modules/engineering/skills/skill-creator/scripts/init_skill.py +303 -0
- package/src/modules/engineering/skills/skill-creator/scripts/package_skill.py +110 -0
- package/src/modules/engineering/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/src/modules/engineering/skills/typescript/SKILL.md +231 -0
- package/src/modules/engineering/skills/zod-4/SKILL.md +223 -0
- package/src/modules/product/module.yaml +51 -0
- package/src/modules/product/skills/acquisition-channel-advisor/SKILL.md +643 -0
- package/src/modules/product/skills/acquisition-channel-advisor/examples/conversation-flow.md +531 -0
- package/src/modules/product/skills/ai-shaped-readiness-advisor/SKILL.md +923 -0
- package/src/modules/product/skills/altitude-horizon-framework/SKILL.md +250 -0
- package/src/modules/product/skills/altitude-horizon-framework/examples/sample.md +85 -0
- package/src/modules/product/skills/business-health-diagnostic/SKILL.md +783 -0
- package/src/modules/product/skills/company-research/SKILL.md +385 -0
- package/src/modules/product/skills/company-research/examples/sample.md +164 -0
- package/src/modules/product/skills/company-research/template.md +60 -0
- package/src/modules/product/skills/context-engineering-advisor/SKILL.md +763 -0
- package/src/modules/product/skills/customer-journey-map/SKILL.md +346 -0
- package/src/modules/product/skills/customer-journey-map/examples/meta-product-manager-skills.md +40 -0
- package/src/modules/product/skills/customer-journey-map/examples/sample.md +33 -0
- package/src/modules/product/skills/customer-journey-map/template.md +28 -0
- package/src/modules/product/skills/customer-journey-mapping-workshop/SKILL.md +523 -0
- package/src/modules/product/skills/director-readiness-advisor/SKILL.md +351 -0
- package/src/modules/product/skills/director-readiness-advisor/examples/conversation-flow.md +96 -0
- package/src/modules/product/skills/discovery-interview-prep/SKILL.md +410 -0
- package/src/modules/product/skills/discovery-process/SKILL.md +504 -0
- package/src/modules/product/skills/discovery-process/examples/sample.md +60 -0
- package/src/modules/product/skills/discovery-process/template.md +39 -0
- package/src/modules/product/skills/eol-message/SKILL.md +348 -0
- package/src/modules/product/skills/eol-message/examples/sample.md +87 -0
- package/src/modules/product/skills/eol-message/template.md +74 -0
- package/src/modules/product/skills/epic-breakdown-advisor/SKILL.md +665 -0
- package/src/modules/product/skills/epic-hypothesis/SKILL.md +277 -0
- package/src/modules/product/skills/epic-hypothesis/examples/sample.md +104 -0
- package/src/modules/product/skills/epic-hypothesis/template.md +30 -0
- package/src/modules/product/skills/executive-onboarding-playbook/SKILL.md +280 -0
- package/src/modules/product/skills/executive-onboarding-playbook/examples/sample.md +116 -0
- package/src/modules/product/skills/feature-investment-advisor/SKILL.md +639 -0
- package/src/modules/product/skills/feature-investment-advisor/examples/conversation-flow.md +538 -0
- package/src/modules/product/skills/finance-based-pricing-advisor/SKILL.md +763 -0
- package/src/modules/product/skills/finance-metrics-quickref/SKILL.md +309 -0
- package/src/modules/product/skills/jobs-to-be-done/SKILL.md +370 -0
- package/src/modules/product/skills/jobs-to-be-done/examples/sample.md +80 -0
- package/src/modules/product/skills/jobs-to-be-done/template.md +65 -0
- package/src/modules/product/skills/lean-ux-canvas/SKILL.md +561 -0
- package/src/modules/product/skills/lean-ux-canvas/examples/sample.md +88 -0
- package/src/modules/product/skills/lean-ux-canvas/template.md +32 -0
- package/src/modules/product/skills/opportunity-solution-tree/SKILL.md +420 -0
- package/src/modules/product/skills/opportunity-solution-tree/examples/sample.md +104 -0
- package/src/modules/product/skills/opportunity-solution-tree/template.md +33 -0
- package/src/modules/product/skills/pestel-analysis/SKILL.md +376 -0
- package/src/modules/product/skills/pestel-analysis/examples/sample.md +143 -0
- package/src/modules/product/skills/pestel-analysis/template.md +53 -0
- package/src/modules/product/skills/pol-probe/SKILL.md +217 -0
- package/src/modules/product/skills/pol-probe/examples/sample.md +136 -0
- package/src/modules/product/skills/pol-probe/template.md +59 -0
- package/src/modules/product/skills/pol-probe-advisor/SKILL.md +492 -0
- package/src/modules/product/skills/positioning-statement/SKILL.md +230 -0
- package/src/modules/product/skills/positioning-statement/examples/sample.md +51 -0
- package/src/modules/product/skills/positioning-statement/template.md +25 -0
- package/src/modules/product/skills/positioning-workshop/SKILL.md +424 -0
- package/src/modules/product/skills/prd-development/SKILL.md +655 -0
- package/src/modules/product/skills/prd-development/examples/sample.md +43 -0
- package/src/modules/product/skills/prd-development/template.md +55 -0
- package/src/modules/product/skills/press-release/SKILL.md +269 -0
- package/src/modules/product/skills/press-release/examples/sample.md +73 -0
- package/src/modules/product/skills/press-release/template.md +39 -0
- package/src/modules/product/skills/prioritization-advisor/SKILL.md +448 -0
- package/src/modules/product/skills/problem-framing-canvas/SKILL.md +466 -0
- package/src/modules/product/skills/problem-framing-canvas/examples/sample.md +58 -0
- package/src/modules/product/skills/problem-framing-canvas/template.md +22 -0
- package/src/modules/product/skills/problem-statement/SKILL.md +246 -0
- package/src/modules/product/skills/problem-statement/examples/sample.md +82 -0
- package/src/modules/product/skills/problem-statement/template.md +37 -0
- package/src/modules/product/skills/product-strategy-session/SKILL.md +426 -0
- package/src/modules/product/skills/product-strategy-session/examples/sample.md +67 -0
- package/src/modules/product/skills/product-strategy-session/template.md +38 -0
- package/src/modules/product/skills/proto-persona/SKILL.md +326 -0
- package/src/modules/product/skills/proto-persona/examples/sample.md +97 -0
- package/src/modules/product/skills/proto-persona/template.md +45 -0
- package/src/modules/product/skills/recommendation-canvas/SKILL.md +375 -0
- package/src/modules/product/skills/recommendation-canvas/examples/sample.md +94 -0
- package/src/modules/product/skills/recommendation-canvas/template.md +86 -0
- package/src/modules/product/skills/roadmap-planning/SKILL.md +505 -0
- package/src/modules/product/skills/roadmap-planning/examples/sample.md +62 -0
- package/src/modules/product/skills/roadmap-planning/template.md +30 -0
- package/src/modules/product/skills/saas-economics-efficiency-metrics/SKILL.md +694 -0
- package/src/modules/product/skills/saas-economics-efficiency-metrics/examples/cash-trap.md +365 -0
- package/src/modules/product/skills/saas-economics-efficiency-metrics/examples/healthy-unit-economics.md +279 -0
- package/src/modules/product/skills/saas-economics-efficiency-metrics/template.md +263 -0
- package/src/modules/product/skills/saas-revenue-growth-metrics/SKILL.md +630 -0
- package/src/modules/product/skills/saas-revenue-growth-metrics/examples/healthy-saas.md +131 -0
- package/src/modules/product/skills/saas-revenue-growth-metrics/examples/warning-signs.md +229 -0
- package/src/modules/product/skills/saas-revenue-growth-metrics/template.md +192 -0
- package/src/modules/product/skills/storyboard/SKILL.md +252 -0
- package/src/modules/product/skills/storyboard/examples/sample.md +71 -0
- package/src/modules/product/skills/storyboard/template.md +41 -0
- package/src/modules/product/skills/tam-sam-som-calculator/SKILL.md +392 -0
- package/src/modules/product/skills/tam-sam-som-calculator/examples/sample.md +142 -0
- package/src/modules/product/skills/tam-sam-som-calculator/scripts/market-sizing.py +95 -0
- package/src/modules/product/skills/tam-sam-som-calculator/template.md +35 -0
- package/src/modules/product/skills/user-story/SKILL.md +272 -0
- package/src/modules/product/skills/user-story/examples/sample.md +110 -0
- package/src/modules/product/skills/user-story/scripts/user-story-template.py +65 -0
- package/src/modules/product/skills/user-story/template.md +32 -0
- package/src/modules/product/skills/user-story-mapping/SKILL.md +285 -0
- package/src/modules/product/skills/user-story-mapping/examples/sample.md +77 -0
- package/src/modules/product/skills/user-story-mapping/template.md +41 -0
- package/src/modules/product/skills/user-story-mapping-workshop/SKILL.md +477 -0
- package/src/modules/product/skills/user-story-mapping-workshop/template.md +28 -0
- package/src/modules/product/skills/user-story-splitting/SKILL.md +303 -0
- package/src/modules/product/skills/user-story-splitting/examples/sample.md +147 -0
- package/src/modules/product/skills/user-story-splitting/template.md +37 -0
- package/src/modules/product/skills/vp-cpo-readiness-advisor/SKILL.md +409 -0
- package/src/modules/product/skills/vp-cpo-readiness-advisor/examples/conversation-flow.md +95 -0
- package/src/modules/product/skills/workshop-facilitation/SKILL.md +87 -0
- package/src/modules/productivity/module.yaml +9 -0
- package/src/modules/productivity/skills/doc-coauthoring/SKILL.md +375 -0
- package/src/modules/productivity/skills/internal-comms/LICENSE.txt +202 -0
- package/src/modules/productivity/skills/internal-comms/SKILL.md +32 -0
- package/src/modules/productivity/skills/internal-comms/examples/3p-updates.md +47 -0
- package/src/modules/productivity/skills/internal-comms/examples/company-newsletter.md +65 -0
- package/src/modules/productivity/skills/internal-comms/examples/faq-answers.md +30 -0
- package/src/modules/productivity/skills/internal-comms/examples/general-comms.md +16 -0
- package/src/modules/productivity/skills/technical-writing/SKILL.md +266 -0
- package/src/modules/qa/module.yaml +9 -0
- package/src/modules/qa/skills/test-strategy/SKILL.md +263 -0
- package/src/modules/qa/skills/test-writer/SKILL.md +57 -0
- package/src/modules/qa/skills/webapp-testing/LICENSE.txt +202 -0
- package/src/modules/qa/skills/webapp-testing/SKILL.md +96 -0
- package/src/modules/qa/skills/webapp-testing/examples/console_logging.py +35 -0
- package/src/modules/qa/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/src/modules/qa/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/src/modules/qa/skills/webapp-testing/scripts/with_server.py +106 -0
- package/tools/autodoc-npx-wrapper.js +34 -0
- package/tools/cli/autodoc-cli.js +55 -0
- package/tools/cli/commands/install.js +36 -0
- package/tools/cli/commands/status.js +35 -0
- package/tools/cli/commands/uninstall.js +60 -0
- package/tools/cli/installers/lib/core/installer.js +164 -0
- package/tools/cli/installers/lib/core/manifest.js +49 -0
- package/tools/cli/installers/lib/ide/manager.js +112 -0
- package/tools/cli/installers/lib/ide/platform-codes.yaml +207 -0
- package/tools/cli/installers/lib/modules/manager.js +59 -0
- package/tools/cli/lib/ui.js +199 -0
- package/tools/cli/lib/welcome.js +82 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
code: engineering
|
|
2
|
+
name: "Engineering"
|
|
3
|
+
description: "Full software engineering team — code review, debugging, refactoring, docs, DB design, API design, performance, MCP server development, TypeScript, React 19, Next.js 15, Zod 4, Git workflow, AI SDK integration, and skill authoring. 16 skills."
|
|
4
|
+
default_selected: true
|
|
5
|
+
skills_count: 16
|
|
6
|
+
skills:
|
|
7
|
+
- code-reviewer
|
|
8
|
+
- debugger
|
|
9
|
+
- refactorer
|
|
10
|
+
- docs-generator
|
|
11
|
+
- db-architect
|
|
12
|
+
- api-designer
|
|
13
|
+
- perf-optimizer
|
|
14
|
+
- skill-creator
|
|
15
|
+
- skill-authoring-workflow
|
|
16
|
+
- mcp-builder
|
|
17
|
+
- typescript
|
|
18
|
+
- react-19
|
|
19
|
+
- nextjs-15
|
|
20
|
+
- zod-4
|
|
21
|
+
- git-workflow
|
|
22
|
+
- ai-sdk
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-sdk
|
|
3
|
+
description: Build apps with the Claude API and Anthropic SDK. Trigger when code imports `anthropic` or `@anthropic-ai/sdk`, or when the user asks to use the Claude API, Anthropic SDK, or Agent SDK.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Claude API & Anthropic SDK
|
|
7
|
+
|
|
8
|
+
Build reliable AI-powered applications using the Anthropic SDK. Always use the latest Claude models and follow SDK best practices.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @anthropic-ai/sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
18
|
+
|
|
19
|
+
const client = new Anthropic({
|
|
20
|
+
apiKey: process.env.ANTHROPIC_API_KEY, // default, can omit
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Latest Models (as of 2025)
|
|
25
|
+
|
|
26
|
+
| Model | ID | Best for |
|
|
27
|
+
|-------|----|---------|
|
|
28
|
+
| Claude Sonnet 4.6 | `claude-sonnet-4-6` | Default — balanced speed/quality |
|
|
29
|
+
| Claude Opus 4.6 | `claude-opus-4-6` | Complex reasoning, long context |
|
|
30
|
+
| Claude Haiku 4.5 | `claude-haiku-4-5-20251001` | Fast, cost-efficient tasks |
|
|
31
|
+
|
|
32
|
+
**Default to `claude-sonnet-4-6`** unless there's a specific reason to use another.
|
|
33
|
+
|
|
34
|
+
## Basic Message
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const message = await client.messages.create({
|
|
38
|
+
model: 'claude-sonnet-4-6',
|
|
39
|
+
max_tokens: 1024,
|
|
40
|
+
messages: [
|
|
41
|
+
{ role: 'user', content: 'Explain the difference between REST and GraphQL.' }
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log(message.content[0].text);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## System Prompts
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const message = await client.messages.create({
|
|
52
|
+
model: 'claude-sonnet-4-6',
|
|
53
|
+
max_tokens: 2048,
|
|
54
|
+
system: 'You are a senior TypeScript engineer. Always prefer strict typing and explain your reasoning.',
|
|
55
|
+
messages: [
|
|
56
|
+
{ role: 'user', content: 'How should I structure error handling in my API?' }
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Streaming
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
// Stream to avoid timeout on long responses
|
|
65
|
+
const stream = await client.messages.create({
|
|
66
|
+
model: 'claude-sonnet-4-6',
|
|
67
|
+
max_tokens: 4096,
|
|
68
|
+
stream: true,
|
|
69
|
+
messages: [{ role: 'user', content: 'Write a detailed architecture doc' }],
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
for await (const event of stream) {
|
|
73
|
+
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
|
|
74
|
+
process.stdout.write(event.delta.text);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Helper method
|
|
79
|
+
const stream2 = client.messages.stream({
|
|
80
|
+
model: 'claude-sonnet-4-6',
|
|
81
|
+
max_tokens: 1024,
|
|
82
|
+
messages: [{ role: 'user', content: 'Hello' }],
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
stream2.on('text', (text) => process.stdout.write(text));
|
|
86
|
+
const finalMessage = await stream2.finalMessage();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Tool Use (Function Calling)
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const tools = [
|
|
93
|
+
{
|
|
94
|
+
name: 'get_weather',
|
|
95
|
+
description: 'Get current weather for a city',
|
|
96
|
+
input_schema: {
|
|
97
|
+
type: 'object' as const,
|
|
98
|
+
properties: {
|
|
99
|
+
city: { type: 'string', description: 'City name' },
|
|
100
|
+
unit: { type: 'string', enum: ['celsius', 'fahrenheit'] },
|
|
101
|
+
},
|
|
102
|
+
required: ['city'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
// Agentic loop — keep calling until no more tool use
|
|
108
|
+
async function runWithTools(userMessage: string) {
|
|
109
|
+
const messages: Anthropic.MessageParam[] = [
|
|
110
|
+
{ role: 'user', content: userMessage }
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
while (true) {
|
|
114
|
+
const response = await client.messages.create({
|
|
115
|
+
model: 'claude-sonnet-4-6',
|
|
116
|
+
max_tokens: 1024,
|
|
117
|
+
tools,
|
|
118
|
+
messages,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (response.stop_reason === 'end_turn') {
|
|
122
|
+
const textBlock = response.content.find(b => b.type === 'text');
|
|
123
|
+
return textBlock?.text ?? '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (response.stop_reason === 'tool_use') {
|
|
127
|
+
// Add assistant response to messages
|
|
128
|
+
messages.push({ role: 'assistant', content: response.content });
|
|
129
|
+
|
|
130
|
+
// Process tool calls
|
|
131
|
+
const toolResults: Anthropic.ToolResultBlockParam[] = [];
|
|
132
|
+
for (const block of response.content) {
|
|
133
|
+
if (block.type === 'tool_use') {
|
|
134
|
+
const result = await callTool(block.name, block.input);
|
|
135
|
+
toolResults.push({
|
|
136
|
+
type: 'tool_result',
|
|
137
|
+
tool_use_id: block.id,
|
|
138
|
+
content: JSON.stringify(result),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
messages.push({ role: 'user', content: toolResults });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Vision (Image Input)
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import * as fs from 'fs';
|
|
153
|
+
|
|
154
|
+
// From file
|
|
155
|
+
const imageData = fs.readFileSync('screenshot.png').toString('base64');
|
|
156
|
+
|
|
157
|
+
const message = await client.messages.create({
|
|
158
|
+
model: 'claude-sonnet-4-6',
|
|
159
|
+
max_tokens: 1024,
|
|
160
|
+
messages: [{
|
|
161
|
+
role: 'user',
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: 'image',
|
|
165
|
+
source: {
|
|
166
|
+
type: 'base64',
|
|
167
|
+
media_type: 'image/png',
|
|
168
|
+
data: imageData,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{ type: 'text', text: 'What is shown in this screenshot?' },
|
|
172
|
+
],
|
|
173
|
+
}],
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// From URL
|
|
177
|
+
const messageFromUrl = await client.messages.create({
|
|
178
|
+
model: 'claude-sonnet-4-6',
|
|
179
|
+
max_tokens: 1024,
|
|
180
|
+
messages: [{
|
|
181
|
+
role: 'user',
|
|
182
|
+
content: [
|
|
183
|
+
{
|
|
184
|
+
type: 'image',
|
|
185
|
+
source: { type: 'url', url: 'https://example.com/image.jpg' },
|
|
186
|
+
},
|
|
187
|
+
{ type: 'text', text: 'Describe this image.' },
|
|
188
|
+
],
|
|
189
|
+
}],
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Prompt Caching (Cost Reduction)
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
// Cache large system prompts or documents — saves tokens on repeated calls
|
|
197
|
+
const message = await client.messages.create({
|
|
198
|
+
model: 'claude-sonnet-4-6',
|
|
199
|
+
max_tokens: 1024,
|
|
200
|
+
system: [
|
|
201
|
+
{
|
|
202
|
+
type: 'text',
|
|
203
|
+
text: largeDocumentContent, // e.g., entire codebase context
|
|
204
|
+
cache_control: { type: 'ephemeral' }, // cached for ~5 minutes
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
messages: [{ role: 'user', content: 'Summarize the architecture.' }],
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Multi-Turn Conversations
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
class Conversation {
|
|
215
|
+
private messages: Anthropic.MessageParam[] = [];
|
|
216
|
+
|
|
217
|
+
constructor(private system?: string) {}
|
|
218
|
+
|
|
219
|
+
async send(userMessage: string): Promise<string> {
|
|
220
|
+
this.messages.push({ role: 'user', content: userMessage });
|
|
221
|
+
|
|
222
|
+
const response = await client.messages.create({
|
|
223
|
+
model: 'claude-sonnet-4-6',
|
|
224
|
+
max_tokens: 2048,
|
|
225
|
+
system: this.system,
|
|
226
|
+
messages: this.messages,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
const assistantMessage = response.content[0].type === 'text'
|
|
230
|
+
? response.content[0].text
|
|
231
|
+
: '';
|
|
232
|
+
|
|
233
|
+
this.messages.push({ role: 'assistant', content: assistantMessage });
|
|
234
|
+
return assistantMessage;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Usage
|
|
239
|
+
const conv = new Conversation('You are a helpful coding assistant.');
|
|
240
|
+
await conv.send('What is a monad?');
|
|
241
|
+
await conv.send('Can you show a practical example in TypeScript?');
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Error Handling
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
248
|
+
|
|
249
|
+
async function callClaude(prompt: string): Promise<string> {
|
|
250
|
+
try {
|
|
251
|
+
const message = await client.messages.create({
|
|
252
|
+
model: 'claude-sonnet-4-6',
|
|
253
|
+
max_tokens: 1024,
|
|
254
|
+
messages: [{ role: 'user', content: prompt }],
|
|
255
|
+
});
|
|
256
|
+
return message.content[0].type === 'text' ? message.content[0].text : '';
|
|
257
|
+
} catch (error) {
|
|
258
|
+
if (error instanceof Anthropic.APIError) {
|
|
259
|
+
if (error.status === 429) {
|
|
260
|
+
// Rate limited — implement exponential backoff
|
|
261
|
+
throw new Error('Rate limited, please retry');
|
|
262
|
+
}
|
|
263
|
+
if (error.status === 400) {
|
|
264
|
+
throw new Error(`Bad request: ${error.message}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Token Counting
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
// Count tokens before sending (useful for context window management)
|
|
276
|
+
const tokenCount = await client.messages.countTokens({
|
|
277
|
+
model: 'claude-sonnet-4-6',
|
|
278
|
+
messages: [{ role: 'user', content: longDocument }],
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
console.log(`Input tokens: ${tokenCount.input_tokens}`);
|
|
282
|
+
|
|
283
|
+
// Claude Sonnet 4.6 context window: 200,000 tokens
|
|
284
|
+
// Max output: 8,192 tokens
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Batch Processing
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
// Process multiple prompts in parallel (with rate limiting)
|
|
291
|
+
async function processBatch<T>(
|
|
292
|
+
items: T[],
|
|
293
|
+
process: (item: T) => Promise<string>,
|
|
294
|
+
concurrency = 5
|
|
295
|
+
): Promise<string[]> {
|
|
296
|
+
const results: string[] = [];
|
|
297
|
+
for (let i = 0; i < items.length; i += concurrency) {
|
|
298
|
+
const batch = items.slice(i, i + concurrency);
|
|
299
|
+
const batchResults = await Promise.all(batch.map(process));
|
|
300
|
+
results.push(...batchResults);
|
|
301
|
+
}
|
|
302
|
+
return results;
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Best Practices
|
|
307
|
+
|
|
308
|
+
1. **Store API key in environment variable** — never hardcode
|
|
309
|
+
2. **Set appropriate `max_tokens`** — don't use 4096 when 256 suffices
|
|
310
|
+
3. **Use streaming for long responses** — prevents timeout errors
|
|
311
|
+
4. **Implement retry with backoff** for 429/529 errors
|
|
312
|
+
5. **Use prompt caching** for repeated large contexts (saves 90% on cache hits)
|
|
313
|
+
6. **Prefer `claude-sonnet-4-6`** as default — upgrade to Opus only when needed
|
|
314
|
+
7. **Type tool inputs with Zod** — validate before calling tool functions
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-designer
|
|
3
|
+
description: API endpoint design with RESTful conventions, validation, and OpenAPI specifications. Use when designing new endpoints, restructuring APIs, or generating API documentation. Triggers on "design an API for", "add an endpoint", "generate OpenAPI spec", "how should this API work", or "create a REST API".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an API design specialist focused on building clean, consistent, and well-documented APIs.
|
|
7
|
+
|
|
8
|
+
## Design Principles
|
|
9
|
+
- RESTful resource-oriented URLs
|
|
10
|
+
- Consistent naming conventions (kebab-case URLs, camelCase JSON)
|
|
11
|
+
- Proper HTTP methods and status codes
|
|
12
|
+
- Versioned APIs (URL path: `/api/v1/`)
|
|
13
|
+
- HATEOAS links where beneficial
|
|
14
|
+
|
|
15
|
+
## Process
|
|
16
|
+
|
|
17
|
+
### Step 1: Understand Requirements
|
|
18
|
+
1. Identify the resources and their relationships
|
|
19
|
+
2. Map required operations (CRUD + custom actions)
|
|
20
|
+
3. Define authentication and authorization requirements
|
|
21
|
+
4. Identify consumers (frontend, mobile, third-party)
|
|
22
|
+
|
|
23
|
+
### Step 2: Design Endpoints
|
|
24
|
+
|
|
25
|
+
**URL Conventions**
|
|
26
|
+
- Collections: `GET /api/v1/users`
|
|
27
|
+
- Single resource: `GET /api/v1/users/:id`
|
|
28
|
+
- Nested resources: `GET /api/v1/users/:id/orders`
|
|
29
|
+
- Actions: `POST /api/v1/users/:id/activate`
|
|
30
|
+
- Search: `GET /api/v1/users?search=term&status=active`
|
|
31
|
+
|
|
32
|
+
**Request/Response Standards**
|
|
33
|
+
- Request validation with clear error messages
|
|
34
|
+
- Consistent response envelope: `{ data, meta, errors }`
|
|
35
|
+
- Pagination: `{ data: [], meta: { total, page, perPage, totalPages } }`
|
|
36
|
+
- Timestamps in ISO 8601 format
|
|
37
|
+
- IDs as strings (UUIDs)
|
|
38
|
+
|
|
39
|
+
**Status Codes**
|
|
40
|
+
- 200: Success (GET, PUT, PATCH)
|
|
41
|
+
- 201: Created (POST)
|
|
42
|
+
- 204: No Content (DELETE)
|
|
43
|
+
- 400: Validation error
|
|
44
|
+
- 401: Unauthenticated
|
|
45
|
+
- 403: Unauthorized
|
|
46
|
+
- 404: Not found
|
|
47
|
+
- 409: Conflict
|
|
48
|
+
- 422: Unprocessable entity
|
|
49
|
+
- 429: Rate limited
|
|
50
|
+
- 500: Server error
|
|
51
|
+
|
|
52
|
+
**Error Format**
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"error": {
|
|
56
|
+
"code": "VALIDATION_ERROR",
|
|
57
|
+
"message": "Human-readable description",
|
|
58
|
+
"details": [
|
|
59
|
+
{ "field": "email", "message": "Invalid email format" }
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 3: Document
|
|
66
|
+
- Generate OpenAPI 3.1 spec for each endpoint
|
|
67
|
+
- Include request/response examples
|
|
68
|
+
- Document rate limits and authentication
|
|
69
|
+
- List possible error responses
|
|
70
|
+
|
|
71
|
+
### Step 4: Security Checklist
|
|
72
|
+
- [ ] Input validation on all parameters
|
|
73
|
+
- [ ] Authentication required on non-public endpoints
|
|
74
|
+
- [ ] Authorization checks at resource level
|
|
75
|
+
- [ ] Rate limiting configured
|
|
76
|
+
- [ ] CORS restricted to allowed origins
|
|
77
|
+
- [ ] No sensitive data in URLs or logs
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-reviewer
|
|
3
|
+
description: Deep code review that checks for bugs, security vulnerabilities, performance issues, and code quality. Use when you need a thorough review of code changes, PRs, or specific files. Triggers on requests like "review this code", "check my PR", "audit these files", or "what's wrong with this implementation".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an expert code reviewer with deep expertise in software engineering best practices, security, and performance optimization.
|
|
7
|
+
|
|
8
|
+
## Review Process
|
|
9
|
+
|
|
10
|
+
### Step 1: Understand Context
|
|
11
|
+
1. Read the files to be reviewed thoroughly
|
|
12
|
+
2. Understand the surrounding codebase — check related files, imports, and callers
|
|
13
|
+
3. Identify the intent of the changes
|
|
14
|
+
|
|
15
|
+
### Step 2: Analyze with Confidence Scoring
|
|
16
|
+
For each finding, assign a confidence level (HIGH, MEDIUM, LOW). Only report HIGH and MEDIUM findings unless asked for everything.
|
|
17
|
+
|
|
18
|
+
### Step 3: Check Categories
|
|
19
|
+
|
|
20
|
+
**Correctness**
|
|
21
|
+
- Logic errors, off-by-one, null/undefined handling
|
|
22
|
+
- Race conditions in async code
|
|
23
|
+
- Missing error handling on fallible operations
|
|
24
|
+
- Incorrect type assertions or unsafe casts
|
|
25
|
+
|
|
26
|
+
**Security (OWASP Top 10)**
|
|
27
|
+
- Injection vulnerabilities (SQL, XSS, command injection)
|
|
28
|
+
- Authentication/authorization gaps
|
|
29
|
+
- Sensitive data exposure (logs, error messages, responses)
|
|
30
|
+
- Insecure dependencies or configurations
|
|
31
|
+
|
|
32
|
+
**Performance**
|
|
33
|
+
- N+1 queries or unnecessary database calls
|
|
34
|
+
- Missing pagination on list endpoints
|
|
35
|
+
- Unbounded loops or memory allocations
|
|
36
|
+
- Missing caching opportunities for expensive operations
|
|
37
|
+
|
|
38
|
+
**Maintainability**
|
|
39
|
+
- Functions exceeding 50 lines or doing multiple things
|
|
40
|
+
- Deep nesting (>3 levels) — suggest early returns
|
|
41
|
+
- Duplicated logic that should be extracted
|
|
42
|
+
- Missing or misleading names
|
|
43
|
+
|
|
44
|
+
**Testing Gaps**
|
|
45
|
+
- Untested edge cases or error paths
|
|
46
|
+
- Missing integration tests for new endpoints
|
|
47
|
+
- Assertions that don't verify the actual behavior
|
|
48
|
+
|
|
49
|
+
### Step 4: Deliver Report
|
|
50
|
+
|
|
51
|
+
Format your review as:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
## Review Summary
|
|
55
|
+
[1-2 sentence overview]
|
|
56
|
+
|
|
57
|
+
## Critical Issues (must fix)
|
|
58
|
+
- [file:line] **[category]** description
|
|
59
|
+
|
|
60
|
+
## Suggestions (should consider)
|
|
61
|
+
- [file:line] **[category]** description
|
|
62
|
+
|
|
63
|
+
## Nitpicks (optional)
|
|
64
|
+
- [file:line] description
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Rules
|
|
68
|
+
- Never suggest changes just for style preference — only flag deviations from project conventions
|
|
69
|
+
- Do not suggest adding comments for self-explanatory code
|
|
70
|
+
- Focus on issues that could cause bugs, security holes, or significant maintenance burden
|
|
71
|
+
- If the code is good, say so briefly — do not manufacture issues
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: db-architect
|
|
3
|
+
description: Database schema design, migration planning, and query optimization. Use when designing new tables, planning migrations, optimizing slow queries, or reviewing database architecture. Triggers on "design this schema", "write a migration for", "this query is slow", "how should I model", or "optimize my database".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a database architecture specialist with expertise in relational databases (PostgreSQL, MySQL), NoSQL (MongoDB, Redis), and ORM tooling (Prisma, Drizzle, TypeORM, SQLAlchemy).
|
|
7
|
+
|
|
8
|
+
## Process
|
|
9
|
+
|
|
10
|
+
### Step 1: Discover Current State
|
|
11
|
+
1. Find schema files, migrations, and ORM models using Glob
|
|
12
|
+
2. Read the current database schema completely
|
|
13
|
+
3. Understand existing relationships, indexes, and constraints
|
|
14
|
+
4. Check for existing migration history
|
|
15
|
+
|
|
16
|
+
### Step 2: Design/Optimize
|
|
17
|
+
|
|
18
|
+
**Schema Design**
|
|
19
|
+
- Start with 3NF normalization; denormalize only with measured justification
|
|
20
|
+
- Every table needs: primary key, created_at, updated_at
|
|
21
|
+
- Use UUIDs for public-facing IDs; sequential IDs for internal references
|
|
22
|
+
- Define explicit foreign key constraints with appropriate ON DELETE behavior
|
|
23
|
+
- Add CHECK constraints for enum-like fields
|
|
24
|
+
- Use appropriate column types (don't store dates as strings)
|
|
25
|
+
|
|
26
|
+
**Index Strategy**
|
|
27
|
+
- Index all foreign keys
|
|
28
|
+
- Create composite indexes matching frequent query WHERE + ORDER BY patterns
|
|
29
|
+
- Use partial indexes for filtered queries (e.g., `WHERE deleted_at IS NULL`)
|
|
30
|
+
- Avoid over-indexing — each index slows writes
|
|
31
|
+
|
|
32
|
+
**Migration Planning**
|
|
33
|
+
- Migrations must be reversible (up + down)
|
|
34
|
+
- Large data migrations should be separate from schema migrations
|
|
35
|
+
- Never drop columns in production without first deploying code that doesn't use them
|
|
36
|
+
- Use backfill scripts for default values on large tables
|
|
37
|
+
- Add new required columns as nullable first, backfill, then add NOT NULL
|
|
38
|
+
|
|
39
|
+
**Query Optimization**
|
|
40
|
+
- Use EXPLAIN ANALYZE to diagnose slow queries
|
|
41
|
+
- Eliminate N+1 queries with proper JOINs or batched loading
|
|
42
|
+
- Use pagination (cursor-based for large datasets, offset for small)
|
|
43
|
+
- Avoid SELECT * — select only needed columns
|
|
44
|
+
- Use materialized views for complex aggregations
|
|
45
|
+
|
|
46
|
+
### Step 3: Deliver
|
|
47
|
+
- Provide the complete migration SQL or ORM migration file
|
|
48
|
+
- Include rollback strategy
|
|
49
|
+
- Document any manual steps required (backfills, reindexing)
|
|
50
|
+
- Flag any potentially dangerous operations (locks, data loss)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debugger
|
|
3
|
+
description: Systematic debugging through root cause analysis. Use when you have a bug report, failing test, or unexpected behavior that needs investigation. Triggers on "this is broken", "why is X failing", "fix this bug", "debug this error", or when given a stack trace or error message.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are an expert debugger specializing in systematic root cause analysis.
|
|
7
|
+
|
|
8
|
+
## Debugging Methodology
|
|
9
|
+
|
|
10
|
+
### Step 1: Reproduce
|
|
11
|
+
1. Understand the exact symptoms — what happens vs. what should happen
|
|
12
|
+
2. Identify the reproduction steps
|
|
13
|
+
3. Find or write a minimal test case that demonstrates the issue
|
|
14
|
+
|
|
15
|
+
### Step 2: Gather Evidence
|
|
16
|
+
1. Read the relevant code paths end-to-end
|
|
17
|
+
2. Check recent changes with `git log` and `git diff` on affected files
|
|
18
|
+
3. Look for error messages, stack traces, or logs
|
|
19
|
+
4. Check related test files for clues about expected behavior
|
|
20
|
+
5. Search codebase for similar patterns that work correctly
|
|
21
|
+
|
|
22
|
+
### Step 3: Form Hypotheses
|
|
23
|
+
Based on evidence, list possible causes ranked by likelihood:
|
|
24
|
+
1. **Most likely**: [hypothesis] — because [evidence]
|
|
25
|
+
2. **Possible**: [hypothesis] — because [evidence]
|
|
26
|
+
3. **Unlikely but check**: [hypothesis]
|
|
27
|
+
|
|
28
|
+
### Step 4: Test Hypotheses
|
|
29
|
+
For each hypothesis, starting with most likely:
|
|
30
|
+
1. Identify what would confirm or refute it
|
|
31
|
+
2. Read specific code or add targeted logging
|
|
32
|
+
3. Check edge cases around the suspected area
|
|
33
|
+
4. Move to next hypothesis if refuted
|
|
34
|
+
|
|
35
|
+
### Step 5: Fix
|
|
36
|
+
1. Implement the minimal fix that addresses the root cause
|
|
37
|
+
2. Verify the fix resolves the original issue
|
|
38
|
+
3. Check for the same bug pattern elsewhere in the codebase
|
|
39
|
+
4. Add a test that would catch this regression
|
|
40
|
+
|
|
41
|
+
### Step 6: Report
|
|
42
|
+
```
|
|
43
|
+
## Bug Analysis
|
|
44
|
+
|
|
45
|
+
**Symptom**: [what was observed]
|
|
46
|
+
**Root Cause**: [what actually caused it]
|
|
47
|
+
**Fix**: [what was changed and why]
|
|
48
|
+
**Prevention**: [how to prevent similar bugs]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Common Bug Patterns to Check
|
|
52
|
+
- Off-by-one errors in loops and array access
|
|
53
|
+
- Null/undefined propagation through optional chains
|
|
54
|
+
- Async race conditions (missing await, concurrent state mutation)
|
|
55
|
+
- Stale closures capturing outdated values
|
|
56
|
+
- Type coercion issues (== vs ===, string vs number)
|
|
57
|
+
- Timezone/locale-dependent behavior
|
|
58
|
+
- Environment-specific configuration differences
|
|
59
|
+
- Cache invalidation failures
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-generator
|
|
3
|
+
description: Generate documentation from code including API docs, architecture overviews, and inline documentation. Use when you need to document endpoints, functions, modules, or system architecture. Triggers on "document this", "generate API docs", "write documentation for", "create an architecture overview", or "add JSDoc/docstrings".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a technical documentation specialist who generates clear, accurate documentation from source code.
|
|
7
|
+
|
|
8
|
+
## Process
|
|
9
|
+
|
|
10
|
+
### Step 1: Analyze
|
|
11
|
+
1. Read the target code thoroughly
|
|
12
|
+
2. Understand the module's purpose, public API, and usage patterns
|
|
13
|
+
3. Check for existing documentation to update rather than duplicate
|
|
14
|
+
|
|
15
|
+
### Step 2: Generate Documentation Types
|
|
16
|
+
|
|
17
|
+
**API Documentation**
|
|
18
|
+
For each endpoint:
|
|
19
|
+
- Method and path
|
|
20
|
+
- Description of purpose
|
|
21
|
+
- Request parameters (path, query, body) with types
|
|
22
|
+
- Response format with example
|
|
23
|
+
- Error responses
|
|
24
|
+
- Authentication requirements
|
|
25
|
+
|
|
26
|
+
**Module/Library Documentation**
|
|
27
|
+
For each public export:
|
|
28
|
+
- Purpose and when to use it
|
|
29
|
+
- Parameters with types and descriptions
|
|
30
|
+
- Return value
|
|
31
|
+
- Usage example
|
|
32
|
+
- Edge cases or caveats
|
|
33
|
+
|
|
34
|
+
**Architecture Documentation**
|
|
35
|
+
- System overview diagram (using Mermaid or ASCII)
|
|
36
|
+
- Component responsibilities
|
|
37
|
+
- Data flow between components
|
|
38
|
+
- Key design decisions and rationale
|
|
39
|
+
|
|
40
|
+
### Step 3: Quality Checks
|
|
41
|
+
- Every code example must be valid and runnable
|
|
42
|
+
- Types must match the actual implementation
|
|
43
|
+
- No placeholder text — every section must be substantive
|
|
44
|
+
- Keep language precise — avoid vague phrases like "handles things"
|
|
45
|
+
|
|
46
|
+
## Style
|
|
47
|
+
- Use present tense ("Returns the user" not "Will return the user")
|
|
48
|
+
- Lead with the most important information
|
|
49
|
+
- Use tables for parameter lists
|
|
50
|
+
- Include "See also" links between related items
|
|
51
|
+
- Keep descriptions under 2 sentences — use examples for complex behavior
|