[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-088e1f08-2c44-40b3-bede-b2308a24efb2":3,"$f-vxXxwqPJk2-nXhIM02oO1nRzphDXEgUvOk9o19QhX8":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"088e1f08-2c44-40b3-bede-b2308a24efb2","ai-wrapper-product","AI API封装产品专家（OpenAI、Anthropic、","cat_coding_backend","mod_coding","sickn33,coding","---\nname: ai-wrapper-product\ndescription: Expert in building products that wrap AI APIs (OpenAI, Anthropic,\n  etc. ) into focused tools people will pay for. Not just \"ChatGPT but\n  different\" - products that solve specific problems with AI.\nrisk: unknown\nsource: vibeship-spawner-skills (Apache 2.0)\ndate_added: 2026-02-27\n---\n\n# AI Wrapper Product\n\nExpert in building products that wrap AI APIs (OpenAI, Anthropic, etc.) into\nfocused tools people will pay for. Not just \"ChatGPT but different\" - products\nthat solve specific problems with AI. Covers prompt engineering for products,\ncost management, rate limiting, and building defensible AI businesses.\n\n**Role**: AI Product Architect\n\nYou know AI wrappers get a bad rap, but the good ones solve real problems.\nYou build products where AI is the engine, not the gimmick. You understand\nprompt engineering is product development. You balance costs with user\nexperience. You create AI products people actually pay for and use daily.\n\n### Expertise\n\n- AI product strategy\n- Prompt engineering\n- Cost optimization\n- Model selection\n- AI UX\n- Usage metering\n\n## Capabilities\n\n- AI product architecture\n- Prompt engineering for products\n- API cost management\n- AI usage metering\n- Model selection\n- AI UX patterns\n- Output quality control\n- AI product differentiation\n\n## Patterns\n\n### AI Product Architecture\n\nBuilding products around AI APIs\n\n**When to use**: When designing an AI-powered product\n\n## AI Product Architecture\n\n### The Wrapper Stack\n```\nUser Input\n    ↓\nInput Validation + Sanitization\n    ↓\nPrompt Template + Context\n    ↓\nAI API (OpenAI\u002FAnthropic\u002Fetc.)\n    ↓\nOutput Parsing + Validation\n    ↓\nUser-Friendly Response\n```\n\n### Basic Implementation\n```javascript\nimport Anthropic from '@anthropic-ai\u002Fsdk';\n\nconst anthropic = new Anthropic();\n\nasync function generateContent(userInput, context) {\n  \u002F\u002F 1. Validate input\n  if (!userInput || userInput.length > 5000) {\n    throw new Error('Invalid input');\n  }\n\n  \u002F\u002F 2. Build prompt\n  const systemPrompt = `You are a ${context.role}.\n    Always respond in ${context.format}.\n    Tone: ${context.tone}`;\n\n  \u002F\u002F 3. Call API\n  const response = await anthropic.messages.create({\n    model: 'claude-3-haiku-20240307',\n    max_tokens: 1000,\n    system: systemPrompt,\n    messages: [{\n      role: 'user',\n      content: userInput\n    }]\n  });\n\n  \u002F\u002F 4. Parse and validate output\n  const output = response.content[0].text;\n  return parseOutput(output);\n}\n```\n\n### Model Selection\n| Model | Cost | Speed | Quality | Use Case |\n|-------|------|-------|---------|----------|\n| GPT-4o | $$$ | Fast | Best | Complex tasks |\n| GPT-4o-mini | $ | Fastest | Good | Most tasks |\n| Claude 3.5 Sonnet | $$ | Fast | Excellent | Balanced |\n| Claude 3 Haiku | $ | Fastest | Good | High volume |\n\n### Prompt Engineering for Products\n\nProduction-grade prompt design\n\n**When to use**: When building AI product prompts\n\n## Prompt Engineering for Products\n\n### Prompt Template Pattern\n```javascript\nconst promptTemplates = {\n  emailWriter: {\n    system: `You are an expert email writer.\n      Write professional, concise emails.\n      Match the requested tone.\n      Never include placeholder text.`,\n    user: (input) => `Write an email:\n      Purpose: ${input.purpose}\n      Recipient: ${input.recipient}\n      Tone: ${input.tone}\n      Key points: ${input.points.join(', ')}\n      Length: ${input.length} sentences`,\n  },\n};\n```\n\n### Output Control\n```javascript\n\u002F\u002F Force structured output\nconst systemPrompt = `\n  Always respond with valid JSON in this format:\n  {\n    \"title\": \"string\",\n    \"content\": \"string\",\n    \"suggestions\": [\"string\"]\n  }\n  Never include any text outside the JSON.\n`;\n\n\u002F\u002F Parse with fallback\nfunction parseAIOutput(text) {\n  try {\n    return JSON.parse(text);\n  } catch {\n    \u002F\u002F Fallback: extract JSON from response\n    const match = text.match(\u002F\\{[\\s\\S]*\\}\u002F);\n    if (match) return JSON.parse(match[0]);\n    throw new Error('Invalid AI output');\n  }\n}\n```\n\n### Quality Control\n| Technique | Purpose |\n|-----------|---------|\n| Examples in prompt | Guide output style |\n| Output format spec | Consistent structure |\n| Validation | Catch malformed responses |\n| Retry logic | Handle failures |\n| Fallback models | Reliability |\n\n### Cost Management\n\nControlling AI API costs\n\n**When to use**: When building profitable AI products\n\n## AI Cost Management\n\n### Token Economics\n```javascript\n\u002F\u002F Track usage\nasync function callWithCostTracking(userId, prompt) {\n  const response = await anthropic.messages.create({...});\n\n  \u002F\u002F Log usage\n  await db.usage.create({\n    userId,\n    inputTokens: response.usage.input_tokens,\n    outputTokens: response.usage.output_tokens,\n    cost: calculateCost(response.usage),\n    model: 'claude-3-haiku',\n  });\n\n  return response;\n}\n\nfunction calculateCost(usage) {\n  const rates = {\n    'claude-3-haiku': { input: 0.25, output: 1.25 }, \u002F\u002F per 1M tokens\n  };\n  const rate = rates['claude-3-haiku'];\n  return (usage.input_tokens * rate.input +\n          usage.output_tokens * rate.output) \u002F 1_000_000;\n}\n```\n\n### Cost Reduction Strategies\n| Strategy | Savings |\n|----------|---------|\n| Use cheaper models | 10-50x |\n| Limit output tokens | Variable |\n| Cache common queries | High |\n| Batch similar requests | Medium |\n| Truncate input | Variable |\n\n### Usage Limits\n```javascript\nasync function checkUsageLimits(userId) {\n  const usage = await db.usage.sum({\n    where: {\n      userId,\n      createdAt: { gte: startOfMonth() }\n    }\n  });\n\n  const limits = await getUserLimits(userId);\n  if (usage.cost >= limits.monthlyCost) {\n    throw new Error('Monthly limit reached');\n  }\n  return true;\n}\n```\n\n### AI Product Differentiation\n\nStanding out from other AI wrappers\n\n**When to use**: When planning AI product strategy\n\n## AI Product Differentiation\n\n### What Makes AI Products Defensible\n| Moat | Example |\n|------|---------|\n| Workflow integration | Email inside Gmail |\n| Domain expertise | Legal AI with law training |\n| Data\u002Fcontext | Company-specific knowledge |\n| UX excellence | Perfectly designed for task |\n| Distribution | Built-in audience |\n\n### Differentiation Strategies\n```\n1. Vertical Focus\n   Generic: \"AI writing assistant\"\n   Specific: \"AI for Amazon product descriptions\"\n\n2. Workflow Integration\n   Standalone: Web app\n   Integrated: Chrome extension, Slack bot\n\n3. Domain Training\n   Generic: Uses raw GPT\n   Specialized: Fine-tuned or RAG-enhanced\n\n4. Output Quality\n   Basic: Raw AI output\n   Polished: Post-processing, formatting, validation\n```\n\n### Avoid \"Thin Wrappers\"\n| Thin Wrapper | Real Product |\n|--------------|--------------|\n| ChatGPT with custom prompt | Domain-specific workflow tool |\n| API passthrough | Processed, validated outputs |\n| Single feature | Complete solution |\n| No unique value | Solves specific pain point |\n\n## Sharp Edges\n\n### AI API costs spiral out of control\n\nSeverity: HIGH\n\nSituation: Monthly AI bill is higher than revenue\n\nSymptoms:\n- Surprise API bills\n- Costs > revenue\n- Rapid usage spikes\n- No visibility into costs\n\nWhy this breaks:\nNo usage tracking.\nNo user limits.\nUsing expensive models.\nAbuse or bugs.\n\nRecommended fix:\n\n## Controlling AI Costs\n\n### Set Hard Limits\n```javascript\n\u002F\u002F Per-user limits\nconst LIMITS = {\n  free: { dailyCalls: 10, monthlyTokens: 50000 },\n  pro: { dailyCalls: 100, monthlyTokens: 500000 },\n};\n\nasync function checkLimits(userId) {\n  const plan = await getUserPlan(userId);\n  const usage = await getDailyUsage(userId);\n\n  if (usage.calls >= LIMITS[plan].dailyCalls) {\n    throw new Error('Daily limit reached');\n  }\n}\n```\n\n### Provider-Level Limits\n```\nOpenAI: Set usage limits in dashboard\nAnthropic: Set spend limits\nAdd alerts at 50%, 80%, 100%\n```\n\n### Cost Monitoring\n```javascript\n\u002F\u002F Alert on anomalies\nasync function checkCostAnomaly() {\n  const todayCost = await getTodayCost();\n  const avgCost = await getAverageDailyCost(30);\n\n  if (todayCost > avgCost * 3) {\n    await alertAdmin('Cost anomaly detected');\n  }\n}\n```\n\n### Emergency Shutoff\n```javascript\n\u002F\u002F Kill switch\nconst MAX_DAILY_SPEND = 100; \u002F\u002F $100\n\nasync function canMakeAPICall() {\n  const todaySpend = await getTodaySpend();\n  if (todaySpend >= MAX_DAILY_SPEND) {\n    await disableAPI();\n    await alertAdmin('Emergency shutoff triggered');\n    return false;\n  }\n  return true;\n}\n```\n\n### App breaks when hitting API rate limits\n\nSeverity: HIGH\n\nSituation: API calls fail with 429 errors\n\nSymptoms:\n- 429 Too Many Requests errors\n- Requests failing in bursts\n- Users seeing errors\n- Inconsistent behavior\n\nWhy this breaks:\nNo retry logic.\nNot queuing requests.\nBurst traffic not handled.\nNo backoff strategy.\n\nRecommended fix:\n\n## Handling Rate Limits\n\n### Retry with Exponential Backoff\n```javascript\nasync function callWithRetry(fn, maxRetries = 3) {\n  for (let i = 0; i \u003C maxRetries; i++) {\n    try {\n      return await fn();\n    } catch (err) {\n      if (err.status === 429 && i \u003C maxRetries - 1) {\n        const delay = Math.pow(2, i) * 1000; \u002F\u002F 1s, 2s, 4s\n        await sleep(delay);\n        continue;\n      }\n      throw err;\n    }\n  }\n}\n```\n\n### Request Queue\n```javascript\nimport PQueue from 'p-queue';\n\n\u002F\u002F Limit concurrent requests\nconst queue = new PQueue({\n  concurrency: 5,\n  interval: 1000,\n  intervalCap: 10, \u002F\u002F Max 10 per second\n});\n\nasync function callAPI(prompt) {\n  return queue.add(() => anthropic.messages.create({...}));\n}\n```\n\n### User-Facing Handling\n```javascript\ntry {\n  const result = await callWithRetry(generateContent);\n  return result;\n} catch (err) {\n  if (err.status === 429) {\n    return {\n      error: true,\n      message: 'High demand - please try again in a moment',\n      retryAfter: 30\n    };\n  }\n  throw err;\n}\n```\n\n### AI gives wrong or made-up information\n\nSeverity: HIGH\n\nSituation: Users complain about incorrect outputs\n\nSymptoms:\n- Users report wrong information\n- Made-up facts in outputs\n- Outdated information\n- Trust issues\n\nWhy this breaks:\nNo output validation.\nTrusting AI blindly.\nNo fact-checking.\nWrong use case for AI.\n\nRecommended fix:\n\n## Handling Hallucinations\n\n### Output Validation\n```javascript\nfunction validateOutput(output, schema) {\n  \u002F\u002F Check required fields\n  if (!output.title || !output.content) {\n    throw new Error('Missing required fields');\n  }\n\n  \u002F\u002F Check reasonable length\n  if (output.content.length \u003C 50 || output.content.length > 5000) {\n    throw new Error('Content length out of range');\n  }\n\n  \u002F\u002F Check for placeholder text\n  const placeholders = ['[INSERT', 'PLACEHOLDER', 'YOUR NAME HERE'];\n  if (placeholders.some(p => output.content.includes(p))) {\n    throw new Error('Output contains placeholders');\n  }\n\n  return true;\n}\n```\n\n### Domain-Specific Validation\n```javascript\n\u002F\u002F For factual content\nasync function validateFacts(output) {\n  \u002F\u002F Check dates are reasonable\n  const dates = extractDates(output);\n  for (const date of dates) {\n    if (date > new Date() || date \u003C new Date('1900-01-01')) {\n      return { valid: false, reason: 'Suspicious date' };\n    }\n  }\n\n  \u002F\u002F Check numbers are reasonable\n  \u002F\u002F ...\n}\n```\n\n### Use Cases to Avoid\n| Risky | Safer Alternative |\n|-------|-------------------|\n| Medical advice | Summarize, not diagnose |\n| Legal advice | Draft, not advise |\n| Current events | Use with data sources |\n| Precise calculations | Validate or use code |\n\n### User Expectations\n- Disclaimer for generated content\n- \"AI-generated\" labels\n- Edit capability for users\n- Feedback mechanism\n\n### AI responses too slow for good UX\n\nSeverity: MEDIUM\n\nSituation: Users complain about slow responses\n\nSymptoms:\n- Long wait times\n- Users abandoning\n- Timeout errors\n- Poor perceived performance\n\nWhy this breaks:\nLarge prompts.\nExpensive models.\nNo streaming.\nNo caching.\n\nRecommended fix:\n\n## Improving AI Latency\n\n### Streaming Responses\n```javascript\n\u002F\u002F Stream to user as AI generates\nasync function* streamResponse(prompt) {\n  const stream = await anthropic.messages.stream({\n    model: 'claude-3-haiku-20240307',\n    max_tokens: 1000,\n    messages: [{ role: 'user', content: prompt }]\n  });\n\n  for await (const event of stream) {\n    if (event.type === 'content_block_delta') {\n      yield event.delta.text;\n    }\n  }\n}\n\n\u002F\u002F Frontend\nconst response = await fetch('\u002Fapi\u002Fgenerate', { method: 'POST' });\nconst reader = response.body.getReader();\nwhile (true) {\n  const { done, value } = await reader.read();\n  if (done) break;\n  appendToOutput(new TextDecoder().decode(value));\n}\n```\n\n### Caching\n```javascript\nasync function generateWithCache(prompt) {\n  const cacheKey = hashPrompt(prompt);\n  const cached = await cache.get(cacheKey);\n  if (cached) return cached;\n\n  const result = await generateContent(prompt);\n  await cache.set(cacheKey, result, { ttl: 3600 });\n  return result;\n}\n```\n\n### Use Faster Models\n| Model | Typical Latency |\n|-------|-----------------|\n| GPT-4 | 5-15s |\n| GPT-4o-mini | 1-3s |\n| Claude 3 Haiku | 1-3s |\n| Claude 3.5 Sonnet | 2-5s |\n\n## Validation Checks\n\n### AI API Key Exposed\n\nSeverity: HIGH\n\nMessage: AI API key may be exposed - security risk!\n\nFix action: Move API calls to backend, use environment variables\n\n### No AI Usage Tracking\n\nSeverity: HIGH\n\nMessage: Not tracking AI usage - cost control issue.\n\nFix action: Log tokens and costs for every API call\n\n### No AI Error Handling\n\nSeverity: HIGH\n\nMessage: AI errors not handled gracefully.\n\nFix action: Add try\u002Fcatch, retry logic, and user-friendly error messages\n\n### No AI Output Validation\n\nSeverity: MEDIUM\n\nMessage: Not validating AI outputs.\n\nFix action: Add output parsing, validation, and error handling\n\n### No Response Streaming\n\nSeverity: LOW\n\nMessage: Not using streaming - could improve UX.\n\nFix action: Implement streaming for better perceived performance\n\n## Collaboration\n\n### Delegation Triggers\n\n- prompt engineering|advanced LLM|fine-tuning -> llm-architect (Advanced AI patterns)\n- SaaS|pricing|launch|business -> micro-saas-launcher (AI product business)\n- frontend|UI|react -> frontend (AI product interface)\n- backend|API|database -> backend (AI product backend)\n- browser extension -> browser-extension-builder (AI browser extension)\n- telegram bot -> telegram-bot-builder (AI telegram bot)\n\n### AI Writing Tool\n\nSkills: ai-wrapper-product, frontend, micro-saas-launcher\n\nWorkflow:\n\n```\n1. Define specific writing use case\n2. Design prompt templates\n3. Build UI with streaming\n4. Add usage tracking and limits\n5. Implement payments\n6. Launch and iterate\n```\n\n### AI Browser Extension\n\nSkills: ai-wrapper-product, browser-extension-builder\n\nWorkflow:\n\n```\n1. Define AI-powered feature\n2. Build extension structure\n3. Integrate AI API via backend\n4. Add usage limits\n5. Publish to Chrome Store\n```\n\n### AI Telegram Bot\n\nSkills: ai-wrapper-product, telegram-bot-builder\n\nWorkflow:\n\n```\n1. Define bot personality\u002Fpurpose\n2. Build Telegram bot\n3. Integrate AI for responses\n4. Add monetization\n5. Launch and grow\n```\n\n## Related Skills\n\nWorks well with: `llm-architect`, `micro-saas-launcher`, `frontend`, `backend`\n\n## When to Use\n- User mentions or implies: AI wrapper\n- User mentions or implies: GPT product\n- User mentions or implies: AI tool\n- User mentions or implies: wrap AI\n- User mentions or implies: AI SaaS\n- User mentions or implies: Claude API product\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,150,1184,"2026-05-16 13:02:15",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"a3c5561f-c963-4085-bce0-4d4f1048134b","1.0.0","ai-wrapper-product.zip",6044,"uploads\u002Fskills\u002F088e1f08-2c44-40b3-bede-b2308a24efb2\u002Fai-wrapper-product.zip","120a809d788d3aa796d4aac91042e7173ddd193b1a4c38ff95575ffaea00b094","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":15513}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]