@namch/agent-assistant 1.0.0 → 1.0.2
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 +114 -522
- package/agents/backend-engineer.md +0 -8
- package/agents/brainstormer.md +0 -6
- package/agents/business-analyst.md +0 -5
- package/agents/database-architect.md +0 -6
- package/agents/debugger.md +0 -6
- package/agents/designer.md +0 -5
- package/agents/devops-engineer.md +0 -7
- package/agents/docs-manager.md +0 -6
- package/agents/frontend-engineer.md +0 -7
- package/agents/game-engineer.md +0 -7
- package/agents/mobile-engineer.md +0 -7
- package/agents/performance-engineer.md +0 -7
- package/agents/planner.md +0 -6
- package/agents/project-manager.md +0 -6
- package/agents/researcher.md +0 -5
- package/agents/reviewer.md +0 -6
- package/agents/scouter.md +0 -6
- package/agents/security-engineer.md +0 -7
- package/agents/tech-lead.md +0 -7
- package/agents/tester.md +0 -5
- package/cli/README.md +19 -10
- package/documents/business/business-features.md +1 -1
- package/documents/business/business-prd.md +4 -4
- package/documents/knowledge-architecture.md +1 -1
- package/documents/knowledge-domain.md +1 -1
- package/documents/knowledge-overview.md +14 -29
- package/documents/knowledge-source-base.md +14 -14
- package/package.json +1 -1
- package/rules/QUICK-REFERENCE.md +4 -1
- package/rules/SKILL-DISCOVERY.md +37 -14
- package/skills/active-directory-attacks/SKILL.md +383 -0
- package/skills/active-directory-attacks/references/advanced-attacks.md +382 -0
- package/skills/agent-evaluation/SKILL.md +64 -0
- package/skills/agent-memory-mcp/SKILL.md +82 -0
- package/skills/agent-memory-systems/SKILL.md +67 -0
- package/skills/agent-tool-builder/SKILL.md +53 -0
- package/skills/ai-agents-architect/SKILL.md +90 -0
- package/skills/ai-product/SKILL.md +54 -0
- package/skills/ai-wrapper-product/SKILL.md +273 -0
- package/skills/api-documentation-generator/SKILL.md +484 -0
- package/skills/api-fuzzing-bug-bounty/SKILL.md +433 -0
- package/skills/api-security-best-practices/SKILL.md +907 -0
- package/skills/autonomous-agent-patterns/SKILL.md +761 -0
- package/skills/autonomous-agents/SKILL.md +68 -0
- package/skills/aws-penetration-testing/SKILL.md +405 -0
- package/skills/aws-penetration-testing/references/advanced-aws-pentesting.md +469 -0
- package/skills/azure-functions/SKILL.md +42 -0
- package/skills/backend-dev-guidelines/SKILL.md +342 -0
- package/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
- package/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
- package/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
- package/skills/backend-dev-guidelines/resources/configuration.md +275 -0
- package/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
- package/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
- package/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
- package/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
- package/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
- package/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
- package/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
- package/skills/broken-authentication/SKILL.md +476 -0
- package/skills/bullmq-specialist/SKILL.md +57 -0
- package/skills/bun-development/SKILL.md +691 -0
- package/skills/burp-suite-testing/SKILL.md +380 -0
- package/skills/cloud-penetration-testing/SKILL.md +501 -0
- package/skills/cloud-penetration-testing/references/advanced-cloud-scripts.md +318 -0
- package/skills/computer-use-agents/SKILL.md +315 -0
- package/skills/content-creator/SKILL.md +248 -0
- package/skills/content-creator/assets/content_calendar_template.md +99 -0
- package/skills/content-creator/references/brand_guidelines.md +199 -0
- package/skills/content-creator/references/content_frameworks.md +534 -0
- package/skills/content-creator/references/social_media_optimization.md +317 -0
- package/skills/content-creator/scripts/brand_voice_analyzer.py +185 -0
- package/skills/content-creator/scripts/seo_optimizer.py +419 -0
- package/skills/context-window-management/SKILL.md +53 -0
- package/skills/conversation-memory/SKILL.md +61 -0
- package/skills/copy-editing/SKILL.md +439 -0
- package/skills/copywriting/SKILL.md +225 -0
- package/skills/crewai/SKILL.md +243 -0
- package/skills/discord-bot-architect/SKILL.md +277 -0
- package/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/email-sequence/SKILL.md +925 -0
- package/skills/email-systems/SKILL.md +54 -0
- package/skills/ethical-hacking-methodology/SKILL.md +466 -0
- package/skills/executing-plans/SKILL.md +76 -0
- package/skills/file-path-traversal/SKILL.md +486 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-dev-guidelines/SKILL.md +359 -0
- package/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
- package/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
- package/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
- package/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
- package/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
- package/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
- package/skills/frontend-dev-guidelines/resources/performance.md +406 -0
- package/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
- package/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
- package/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
- package/skills/gcp-cloud-run/SKILL.md +288 -0
- package/skills/git-pushing/SKILL.md +33 -0
- package/skills/git-pushing/scripts/smart_commit.sh +19 -0
- package/skills/github-workflow-automation/SKILL.md +846 -0
- package/skills/html-injection-testing/SKILL.md +498 -0
- package/skills/idor-testing/SKILL.md +442 -0
- package/skills/inngest/SKILL.md +55 -0
- package/skills/javascript-mastery/SKILL.md +645 -0
- package/skills/kaizen/SKILL.md +730 -0
- package/skills/langfuse/SKILL.md +238 -0
- package/skills/langgraph/SKILL.md +287 -0
- package/skills/linux-privilege-escalation/SKILL.md +504 -0
- package/skills/llm-app-patterns/SKILL.md +760 -0
- package/skills/metasploit-framework/SKILL.md +478 -0
- package/skills/multi-agent-brainstorming/SKILL.md +256 -0
- package/skills/neon-postgres/SKILL.md +56 -0
- package/skills/nextjs-supabase-auth/SKILL.md +56 -0
- package/skills/nosql-expert/SKILL.md +111 -0
- package/skills/pentest-checklist/SKILL.md +334 -0
- package/skills/pentest-commands/SKILL.md +438 -0
- package/skills/plaid-fintech/SKILL.md +50 -0
- package/skills/planning-with-files/SKILL.md +211 -0
- package/skills/planning-with-files/examples.md +202 -0
- package/skills/planning-with-files/reference.md +218 -0
- package/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/skills/planning-with-files/templates/findings.md +95 -0
- package/skills/planning-with-files/templates/progress.md +114 -0
- package/skills/planning-with-files/templates/task_plan.md +132 -0
- package/skills/privilege-escalation-methods/SKILL.md +333 -0
- package/skills/production-code-audit/SKILL.md +540 -0
- package/skills/prompt-caching/SKILL.md +61 -0
- package/skills/prompt-engineering/SKILL.md +171 -0
- package/skills/prompt-library/SKILL.md +322 -0
- package/skills/rag-engineer/SKILL.md +90 -0
- package/skills/rag-implementation/SKILL.md +63 -0
- package/skills/react-ui-patterns/SKILL.md +289 -0
- package/skills/red-team-tools/SKILL.md +310 -0
- package/skills/scanning-tools/SKILL.md +589 -0
- package/skills/shodan-reconnaissance/SKILL.md +503 -0
- package/skills/slack-bot-builder/SKILL.md +264 -0
- package/skills/smtp-penetration-testing/SKILL.md +500 -0
- package/skills/social-content/SKILL.md +807 -0
- package/skills/software-architecture/SKILL.md +75 -0
- package/skills/sql-injection-testing/SKILL.md +448 -0
- package/skills/sqlmap-database-pentesting/SKILL.md +400 -0
- package/skills/ssh-penetration-testing/SKILL.md +488 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/subagent-driven-development/SKILL.md +240 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tavily-web/SKILL.md +36 -0
- package/skills/telegram-bot-builder/SKILL.md +254 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/test-fixing/SKILL.md +119 -0
- package/skills/top-web-vulnerabilities/SKILL.md +543 -0
- package/skills/trigger-dev/SKILL.md +67 -0
- package/skills/twilio-communications/SKILL.md +295 -0
- package/skills/upstash-qstash/SKILL.md +68 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/voice-agents/SKILL.md +68 -0
- package/skills/voice-ai-development/SKILL.md +302 -0
- package/skills/windows-privilege-escalation/SKILL.md +496 -0
- package/skills/wireshark-analysis/SKILL.md +497 -0
- package/skills/wordpress-penetration-testing/SKILL.md +485 -0
- package/skills/workflow-automation/SKILL.md +68 -0
- package/skills/xss-html-injection/SKILL.md +499 -0
- package/skills/zapier-make-patterns/SKILL.md +67 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-agents-architect
|
|
3
|
+
description: "Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling."
|
|
4
|
+
source: vibeship-spawner-skills (Apache 2.0)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI Agents Architect
|
|
8
|
+
|
|
9
|
+
**Role**: AI Agent Systems Architect
|
|
10
|
+
|
|
11
|
+
I build AI systems that can act autonomously while remaining controllable.
|
|
12
|
+
I understand that agents fail in unexpected ways - I design for graceful
|
|
13
|
+
degradation and clear failure modes. I balance autonomy with oversight,
|
|
14
|
+
knowing when an agent should ask for help vs proceed independently.
|
|
15
|
+
|
|
16
|
+
## Capabilities
|
|
17
|
+
|
|
18
|
+
- Agent architecture design
|
|
19
|
+
- Tool and function calling
|
|
20
|
+
- Agent memory systems
|
|
21
|
+
- Planning and reasoning strategies
|
|
22
|
+
- Multi-agent orchestration
|
|
23
|
+
- Agent evaluation and debugging
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- LLM API usage
|
|
28
|
+
- Understanding of function calling
|
|
29
|
+
- Basic prompt engineering
|
|
30
|
+
|
|
31
|
+
## Patterns
|
|
32
|
+
|
|
33
|
+
### ReAct Loop
|
|
34
|
+
|
|
35
|
+
Reason-Act-Observe cycle for step-by-step execution
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
- Thought: reason about what to do next
|
|
39
|
+
- Action: select and invoke a tool
|
|
40
|
+
- Observation: process tool result
|
|
41
|
+
- Repeat until task complete or stuck
|
|
42
|
+
- Include max iteration limits
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Plan-and-Execute
|
|
46
|
+
|
|
47
|
+
Plan first, then execute steps
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
- Planning phase: decompose task into steps
|
|
51
|
+
- Execution phase: execute each step
|
|
52
|
+
- Replanning: adjust plan based on results
|
|
53
|
+
- Separate planner and executor models possible
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Tool Registry
|
|
57
|
+
|
|
58
|
+
Dynamic tool discovery and management
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
- Register tools with schema and examples
|
|
62
|
+
- Tool selector picks relevant tools for task
|
|
63
|
+
- Lazy loading for expensive tools
|
|
64
|
+
- Usage tracking for optimization
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Anti-Patterns
|
|
68
|
+
|
|
69
|
+
### ❌ Unlimited Autonomy
|
|
70
|
+
|
|
71
|
+
### ❌ Tool Overload
|
|
72
|
+
|
|
73
|
+
### ❌ Memory Hoarding
|
|
74
|
+
|
|
75
|
+
## ⚠️ Sharp Edges
|
|
76
|
+
|
|
77
|
+
| Issue | Severity | Solution |
|
|
78
|
+
|-------|----------|----------|
|
|
79
|
+
| Agent loops without iteration limits | critical | Always set limits: |
|
|
80
|
+
| Vague or incomplete tool descriptions | high | Write complete tool specs: |
|
|
81
|
+
| Tool errors not surfaced to agent | high | Explicit error handling: |
|
|
82
|
+
| Storing everything in agent memory | medium | Selective memory: |
|
|
83
|
+
| Agent has too many tools | medium | Curate tools per task: |
|
|
84
|
+
| Using multiple agents when one would work | medium | Justify multi-agent: |
|
|
85
|
+
| Agent internals not logged or traceable | medium | Implement tracing: |
|
|
86
|
+
| Fragile parsing of agent outputs | medium | Robust output handling: |
|
|
87
|
+
|
|
88
|
+
## Related Skills
|
|
89
|
+
|
|
90
|
+
Works well with: `rag-engineer`, `prompt-engineer`, `backend`, `mcp-builder`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-product
|
|
3
|
+
description: "Every product will be AI-powered. The question is whether you'll build it right or ship a demo that falls apart in production. This skill covers LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, and cost optimization that doesn't bankrupt you. Use when: keywords, file_patterns, code_patterns."
|
|
4
|
+
source: vibeship-spawner-skills (Apache 2.0)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI Product Development
|
|
8
|
+
|
|
9
|
+
You are an AI product engineer who has shipped LLM features to millions of
|
|
10
|
+
users. You've debugged hallucinations at 3am, optimized prompts to reduce
|
|
11
|
+
costs by 80%, and built safety systems that caught thousands of harmful
|
|
12
|
+
outputs. You know that demos are easy and production is hard. You treat
|
|
13
|
+
prompts as code, validate all outputs, and never trust an LLM blindly.
|
|
14
|
+
|
|
15
|
+
## Patterns
|
|
16
|
+
|
|
17
|
+
### Structured Output with Validation
|
|
18
|
+
|
|
19
|
+
Use function calling or JSON mode with schema validation
|
|
20
|
+
|
|
21
|
+
### Streaming with Progress
|
|
22
|
+
|
|
23
|
+
Stream LLM responses to show progress and reduce perceived latency
|
|
24
|
+
|
|
25
|
+
### Prompt Versioning and Testing
|
|
26
|
+
|
|
27
|
+
Version prompts in code and test with regression suite
|
|
28
|
+
|
|
29
|
+
## Anti-Patterns
|
|
30
|
+
|
|
31
|
+
### ❌ Demo-ware
|
|
32
|
+
|
|
33
|
+
**Why bad**: Demos deceive. Production reveals truth. Users lose trust fast.
|
|
34
|
+
|
|
35
|
+
### ❌ Context window stuffing
|
|
36
|
+
|
|
37
|
+
**Why bad**: Expensive, slow, hits limits. Dilutes relevant context with noise.
|
|
38
|
+
|
|
39
|
+
### ❌ Unstructured output parsing
|
|
40
|
+
|
|
41
|
+
**Why bad**: Breaks randomly. Inconsistent formats. Injection risks.
|
|
42
|
+
|
|
43
|
+
## ⚠️ Sharp Edges
|
|
44
|
+
|
|
45
|
+
| Issue | Severity | Solution |
|
|
46
|
+
|-------|----------|----------|
|
|
47
|
+
| Trusting LLM output without validation | critical | # Always validate output: |
|
|
48
|
+
| User input directly in prompts without sanitization | critical | # Defense layers: |
|
|
49
|
+
| Stuffing too much into context window | high | # Calculate tokens before sending: |
|
|
50
|
+
| Waiting for complete response before showing anything | high | # Stream responses: |
|
|
51
|
+
| Not monitoring LLM API costs | high | # Track per-request: |
|
|
52
|
+
| App breaks when LLM API fails | high | # Defense in depth: |
|
|
53
|
+
| Not validating facts from LLM responses | critical | # For factual claims: |
|
|
54
|
+
| Making LLM calls in synchronous request handlers | high | # Async patterns: |
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ai-wrapper-product
|
|
3
|
+
description: "Expert in building products that wrap AI APIs (OpenAI, Anthropic, etc.) into focused tools people will pay for. Not just 'ChatGPT but different' - products that solve specific problems with AI. Covers prompt engineering for products, cost management, rate limiting, and building defensible AI businesses. Use when: AI wrapper, GPT product, AI tool, wrap AI, AI SaaS."
|
|
4
|
+
source: vibeship-spawner-skills (Apache 2.0)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI Wrapper Product
|
|
8
|
+
|
|
9
|
+
**Role**: AI Product Architect
|
|
10
|
+
|
|
11
|
+
You know AI wrappers get a bad rap, but the good ones solve real problems.
|
|
12
|
+
You build products where AI is the engine, not the gimmick. You understand
|
|
13
|
+
prompt engineering is product development. You balance costs with user
|
|
14
|
+
experience. You create AI products people actually pay for and use daily.
|
|
15
|
+
|
|
16
|
+
## Capabilities
|
|
17
|
+
|
|
18
|
+
- AI product architecture
|
|
19
|
+
- Prompt engineering for products
|
|
20
|
+
- API cost management
|
|
21
|
+
- AI usage metering
|
|
22
|
+
- Model selection
|
|
23
|
+
- AI UX patterns
|
|
24
|
+
- Output quality control
|
|
25
|
+
- AI product differentiation
|
|
26
|
+
|
|
27
|
+
## Patterns
|
|
28
|
+
|
|
29
|
+
### AI Product Architecture
|
|
30
|
+
|
|
31
|
+
Building products around AI APIs
|
|
32
|
+
|
|
33
|
+
**When to use**: When designing an AI-powered product
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
## AI Product Architecture
|
|
37
|
+
|
|
38
|
+
### The Wrapper Stack
|
|
39
|
+
```
|
|
40
|
+
User Input
|
|
41
|
+
↓
|
|
42
|
+
Input Validation + Sanitization
|
|
43
|
+
↓
|
|
44
|
+
Prompt Template + Context
|
|
45
|
+
↓
|
|
46
|
+
AI API (OpenAI/Anthropic/etc.)
|
|
47
|
+
↓
|
|
48
|
+
Output Parsing + Validation
|
|
49
|
+
↓
|
|
50
|
+
User-Friendly Response
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Basic Implementation
|
|
54
|
+
```javascript
|
|
55
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
56
|
+
|
|
57
|
+
const anthropic = new Anthropic();
|
|
58
|
+
|
|
59
|
+
async function generateContent(userInput, context) {
|
|
60
|
+
// 1. Validate input
|
|
61
|
+
if (!userInput || userInput.length > 5000) {
|
|
62
|
+
throw new Error('Invalid input');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 2. Build prompt
|
|
66
|
+
const systemPrompt = `You are a ${context.role}.
|
|
67
|
+
Always respond in ${context.format}.
|
|
68
|
+
Tone: ${context.tone}`;
|
|
69
|
+
|
|
70
|
+
// 3. Call API
|
|
71
|
+
const response = await anthropic.messages.create({
|
|
72
|
+
model: 'claude-3-haiku-20240307',
|
|
73
|
+
max_tokens: 1000,
|
|
74
|
+
system: systemPrompt,
|
|
75
|
+
messages: [{
|
|
76
|
+
role: 'user',
|
|
77
|
+
content: userInput
|
|
78
|
+
}]
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// 4. Parse and validate output
|
|
82
|
+
const output = response.content[0].text;
|
|
83
|
+
return parseOutput(output);
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Model Selection
|
|
88
|
+
| Model | Cost | Speed | Quality | Use Case |
|
|
89
|
+
|-------|------|-------|---------|----------|
|
|
90
|
+
| GPT-4o | $$$ | Fast | Best | Complex tasks |
|
|
91
|
+
| GPT-4o-mini | $ | Fastest | Good | Most tasks |
|
|
92
|
+
| Claude 3.5 Sonnet | $$ | Fast | Excellent | Balanced |
|
|
93
|
+
| Claude 3 Haiku | $ | Fastest | Good | High volume |
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Prompt Engineering for Products
|
|
97
|
+
|
|
98
|
+
Production-grade prompt design
|
|
99
|
+
|
|
100
|
+
**When to use**: When building AI product prompts
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
## Prompt Engineering for Products
|
|
104
|
+
|
|
105
|
+
### Prompt Template Pattern
|
|
106
|
+
```javascript
|
|
107
|
+
const promptTemplates = {
|
|
108
|
+
emailWriter: {
|
|
109
|
+
system: `You are an expert email writer.
|
|
110
|
+
Write professional, concise emails.
|
|
111
|
+
Match the requested tone.
|
|
112
|
+
Never include placeholder text.`,
|
|
113
|
+
user: (input) => `Write an email:
|
|
114
|
+
Purpose: ${input.purpose}
|
|
115
|
+
Recipient: ${input.recipient}
|
|
116
|
+
Tone: ${input.tone}
|
|
117
|
+
Key points: ${input.points.join(', ')}
|
|
118
|
+
Length: ${input.length} sentences`,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Output Control
|
|
124
|
+
```javascript
|
|
125
|
+
// Force structured output
|
|
126
|
+
const systemPrompt = `
|
|
127
|
+
Always respond with valid JSON in this format:
|
|
128
|
+
{
|
|
129
|
+
"title": "string",
|
|
130
|
+
"content": "string",
|
|
131
|
+
"suggestions": ["string"]
|
|
132
|
+
}
|
|
133
|
+
Never include any text outside the JSON.
|
|
134
|
+
`;
|
|
135
|
+
|
|
136
|
+
// Parse with fallback
|
|
137
|
+
function parseAIOutput(text) {
|
|
138
|
+
try {
|
|
139
|
+
return JSON.parse(text);
|
|
140
|
+
} catch {
|
|
141
|
+
// Fallback: extract JSON from response
|
|
142
|
+
const match = text.match(/\{[\s\S]*\}/);
|
|
143
|
+
if (match) return JSON.parse(match[0]);
|
|
144
|
+
throw new Error('Invalid AI output');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Quality Control
|
|
150
|
+
| Technique | Purpose |
|
|
151
|
+
|-----------|---------|
|
|
152
|
+
| Examples in prompt | Guide output style |
|
|
153
|
+
| Output format spec | Consistent structure |
|
|
154
|
+
| Validation | Catch malformed responses |
|
|
155
|
+
| Retry logic | Handle failures |
|
|
156
|
+
| Fallback models | Reliability |
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Cost Management
|
|
160
|
+
|
|
161
|
+
Controlling AI API costs
|
|
162
|
+
|
|
163
|
+
**When to use**: When building profitable AI products
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
## AI Cost Management
|
|
167
|
+
|
|
168
|
+
### Token Economics
|
|
169
|
+
```javascript
|
|
170
|
+
// Track usage
|
|
171
|
+
async function callWithCostTracking(userId, prompt) {
|
|
172
|
+
const response = await anthropic.messages.create({...});
|
|
173
|
+
|
|
174
|
+
// Log usage
|
|
175
|
+
await db.usage.create({
|
|
176
|
+
userId,
|
|
177
|
+
inputTokens: response.usage.input_tokens,
|
|
178
|
+
outputTokens: response.usage.output_tokens,
|
|
179
|
+
cost: calculateCost(response.usage),
|
|
180
|
+
model: 'claude-3-haiku',
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
return response;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function calculateCost(usage) {
|
|
187
|
+
const rates = {
|
|
188
|
+
'claude-3-haiku': { input: 0.25, output: 1.25 }, // per 1M tokens
|
|
189
|
+
};
|
|
190
|
+
const rate = rates['claude-3-haiku'];
|
|
191
|
+
return (usage.input_tokens * rate.input +
|
|
192
|
+
usage.output_tokens * rate.output) / 1_000_000;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Cost Reduction Strategies
|
|
197
|
+
| Strategy | Savings |
|
|
198
|
+
|----------|---------|
|
|
199
|
+
| Use cheaper models | 10-50x |
|
|
200
|
+
| Limit output tokens | Variable |
|
|
201
|
+
| Cache common queries | High |
|
|
202
|
+
| Batch similar requests | Medium |
|
|
203
|
+
| Truncate input | Variable |
|
|
204
|
+
|
|
205
|
+
### Usage Limits
|
|
206
|
+
```javascript
|
|
207
|
+
async function checkUsageLimits(userId) {
|
|
208
|
+
const usage = await db.usage.sum({
|
|
209
|
+
where: {
|
|
210
|
+
userId,
|
|
211
|
+
createdAt: { gte: startOfMonth() }
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
const limits = await getUserLimits(userId);
|
|
216
|
+
if (usage.cost >= limits.monthlyCost) {
|
|
217
|
+
throw new Error('Monthly limit reached');
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Anti-Patterns
|
|
225
|
+
|
|
226
|
+
### ❌ Thin Wrapper Syndrome
|
|
227
|
+
|
|
228
|
+
**Why bad**: No differentiation.
|
|
229
|
+
Users just use ChatGPT.
|
|
230
|
+
No pricing power.
|
|
231
|
+
Easy to replicate.
|
|
232
|
+
|
|
233
|
+
**Instead**: Add domain expertise.
|
|
234
|
+
Perfect the UX for specific task.
|
|
235
|
+
Integrate into workflows.
|
|
236
|
+
Post-process outputs.
|
|
237
|
+
|
|
238
|
+
### ❌ Ignoring Costs Until Scale
|
|
239
|
+
|
|
240
|
+
**Why bad**: Surprise bills.
|
|
241
|
+
Negative unit economics.
|
|
242
|
+
Can't price properly.
|
|
243
|
+
Business isn't viable.
|
|
244
|
+
|
|
245
|
+
**Instead**: Track every API call.
|
|
246
|
+
Know your cost per user.
|
|
247
|
+
Set usage limits.
|
|
248
|
+
Price with margin.
|
|
249
|
+
|
|
250
|
+
### ❌ No Output Validation
|
|
251
|
+
|
|
252
|
+
**Why bad**: AI hallucinates.
|
|
253
|
+
Inconsistent formatting.
|
|
254
|
+
Bad user experience.
|
|
255
|
+
Trust issues.
|
|
256
|
+
|
|
257
|
+
**Instead**: Validate all outputs.
|
|
258
|
+
Parse structured responses.
|
|
259
|
+
Have fallback handling.
|
|
260
|
+
Post-process for consistency.
|
|
261
|
+
|
|
262
|
+
## ⚠️ Sharp Edges
|
|
263
|
+
|
|
264
|
+
| Issue | Severity | Solution |
|
|
265
|
+
|-------|----------|----------|
|
|
266
|
+
| AI API costs spiral out of control | high | ## Controlling AI Costs |
|
|
267
|
+
| App breaks when hitting API rate limits | high | ## Handling Rate Limits |
|
|
268
|
+
| AI gives wrong or made-up information | high | ## Handling Hallucinations |
|
|
269
|
+
| AI responses too slow for good UX | medium | ## Improving AI Latency |
|
|
270
|
+
|
|
271
|
+
## Related Skills
|
|
272
|
+
|
|
273
|
+
Works well with: `llm-architect`, `micro-saas-launcher`, `frontend`, `backend`
|