/ai-product
Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization.
$ npx -y skills add coco-research/coco --skill ai-product --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/ai-product
Context preview
The summary Claude sees to decide when to auto-load this skill.
Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization.
SKILL.md
ai-product.SKILL.mdname: ai-product
description: "Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization."
domain: pm
supports: [claude-code, cursor, codex, generic]
version: 0.1.0
AI Product Development
Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization. Treats prompts as code, validates all outputs, and never trusts an LLM blindly.
**Use when**: building AI features into a product, integrating LLMs, designing RAG pipelines, implementing AI safety/guardrails, optimizing AI costs, building AI UX patterns, prompt engineering for production, handling hallucinations, streaming LLM responses, or evaluating AI output quality.
---
When This Skill Is Activated
1. Read this file fully before proceeding 2. Understand what AI feature the user is building 3. Apply the relevant patterns below (integration, RAG, UX, safety, cost) 4. Always address: output validation, error handling, cost awareness, user trust
---
Core Principle
Demos are easy. Production is hard. Every pattern below exists because something broke in production.
---
LLM Integration Patterns
Structured Output with Validation
Never parse free-text LLM output with regex. Use structured output modes and validate with a schema.
import { z } from "zod";
import OpenAI from "openai";
// 1. Define your schema
const ProductReviewSchema = z.object({
sentiment: z.enum(["positive", "negative", "neutral"]),
score: z.number().min(0).max(10),
summary: z.string().max(200),
keyTopics: z.array(z.string()).max(5),
});
type ProductReview = z.infer<typeof ProductReviewSchema>;
// 2. Call with structured output
const openai = new OpenAI();
async function analyzeReview(reviewText: string): Promise<ProductReview> {
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
response_format: { type: "json_object" },
messages: [
{
role: "system",
content: `Analyze the product review. Return JSON matching this schema:
{ sentiment: "positive"|"negative"|"neutral", score: 0-10, summary: string, keyTopics: string[] }`,
},
{ role: "user", content: reviewText },
],
});
const raw = JSON.parse(response.choices[0].message.content!);
// 3. Always validate — the model can return anything
const result = ProductReviewSchema.parse(raw);
return result;
}Streaming with Progress
Stream LLM responses to reduce perceived latency. Show users something is happening immediately.
async function streamResponse(prompt: string, onChunk: (text: string) => void) {
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: prompt }],
stream: true,
});
let fullText = "";
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content || "";
fullText += delta;
onChunk(delta); // Update UI incrementally
}
return fullText;
}
// React example: streaming into state
function useStreamingAI() {
const [text, setText] = useState("");
const [isStreaming, setIsStreaming] = useState(false);
const generate = async (prompt: string) => {
setIsStreaming(true);
setText("");
await streamResponse(prompt, (chunk) => {
setText((prev) => prev + chunk);
});
setIsStreaming(false);
};
return { text, isStreaming, generate };
}Prompt Versioning and Testing
Treat prompts as code. Version them. Test with regression suites.
// prompts/v3-review-analyzer.ts
export const REVIEW_ANALYZER_PROMPT = {
version: "3.0",
system: `You are a product review analyst. Extract sentiment, score, summary, and topics.
Always return valid JSON. Never hallucinate topics not mentioned in the review.`,
temperature: 0.1, // Low temp for consistent structured output
maxTokens: 500,
};
// tests/prompts/review-analyzer.test.ts
describe("Review Analyzer Prompt v3", () => {
const testCases = [
{
input: "This product is amazing! Great battery life and beautiful screen.",
expected: { sentiment: "positive", minScore: 7 },
},
{
input: "Terrible. Broke after 2 days. Worst purchase ever.",
expected: { sentiment: "negative", maxScore: 3 },
},
{
input: "It's okay. Does what it says but nothing special.",
expected: { sentiment: "neutral", minScore: 4, maxScore: 6 },
},
];
test.each(testCases)("correctly analyzes: $input", async ({ input, expected }) => {
const result = await analyzeReview(input);
expect(result.sentiment).toBe(expected.sentiment);
if (expected.minScore) expect(result.score).toBeGreaterThanOrEqual(expected.minScore);
if (expected.maxScore) expect(result.score).toBeLessThanOrEqual(expected.maxScore);
});
});---
RAG Architecture
When to Use RAG
| Approach | When | Example | |----------|------|---------| | Prompt only | Model already knows the answer | General knowledge questions | | RAG | Answer depends on your data | "What's our refund policy?" | | Fine-tuning | Model needs new behavior/style | Domain-specific tone or format | | RAG + Fine-tuning | Both custom data and custom behavior | Enterprise support bot |
RAG Pipeline
User Query
↓
Query Processing (rewrite, expand, decompose)
↓
Embedding (text → vector)
↓
Vector Search (find relevant chunks)
↓
Re-ranking (order by relevance)
↓
Context Assembly (fit within token budget)
↓
LLM Generation (with retrieved context)
↓
Citation Extraction + Validation
↓
Response with SourcesImplementation
import { OpenAI } from "openai";
const openai = new OpenAI();
// 1. Chunk documenRead more
name: ai-product description: "Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization." domain: pm supports: [claude-code, cursor, codex, generic] version: 0.1.0
AI Product Development
Expert in shipping production-grade AI-powered features — LLM integration patterns, RAG architecture, prompt engineering that scales, AI UX that users trust, safety and guardrails, streaming, and cost optimization. Treats prompts as code, validates all outputs, and never trusts an LLM blindly.
**Use when**: building AI features into a product, integrating LLMs, designing RAG pipelines, implementing AI safety/guardrails, optimizing AI costs, building AI UX patterns, prompt engineering for production, handling hallucinations, streaming LLM responses, or evaluating AI output quality.
---
When This Skill Is Activated
1. Read this file fully before proceeding 2. Understand what AI feature the user is building 3. Apply the relevant patterns below (integration, RAG, UX, safety, cost) 4. Always address: output validation, error handling, cost awareness, user trust
---
Core Principle
Demos are easy. Production is hard. Every pattern below exists because something broke in production.
---
LLM Integration Patterns
Structured Output with Validation
Never parse free-text LLM output with regex. Use structured output modes and validate with a schema.
import { z } from "zod";
import OpenAI from "openai";
// 1. Define your schema
const ProductReviewSchema = z.object({
sentiment: z.enum(["positive", "negative", "neutral"]),
score: z.number().min(0).max(10),
summary: z.string().max(200),
keyTopics: z.array(z.string()).max(5),
});
type ProductReview = z.infer<typeof ProductReviewSchema>;
// 2. Call with structured output
const openai = new OpenAI();
async function analyzeReview(reviewText: string): Promise<ProductReview> {
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
response_format: { type: "json_object" },
messages: [
{
role: "system",
content: `Analyze the product review. Return JSON matching this schema:
{ sentiment: "positive"|"negative"|"neutral", score: 0-10, summary: string, keyTopics: string[] }`,
},
{ role: "user", content: reviewText },
],
});
const raw = JSON.parse(response.choices[0].message.content!);
// 3. Always validate — the model can return anything
const result = ProductReviewSchema.parse(raw);
return result;
}Streaming with Progress
Stream LLM responses to reduce perceived latency. Show users something is happening immediately.
async function streamResponse(prompt: string, onChunk: (text: string) => void) {
const stream = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: prompt }],
stream: true,
});
let fullText = "";
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta?.content || "";
fullText += delta;
onChunk(delta); // Update UI incrementally
}
return fullText;
}
// React example: streaming into state
function useStreamingAI() {
const [text, setText] = useState("");
const [isStreaming, setIsStreaming] = useState(false);
const generate = async (prompt: string) => {
setIsStreaming(true);
setText("");
await streamResponse(prompt, (chunk) => {
setText((prev) => prev + chunk);
});
setIsStreaming(false);
};
return { text, isStreaming, generate };
}Prompt Versioning and Testing
Treat prompts as code. Version them. Test with regression suites.
// prompts/v3-review-analyzer.ts
export const REVIEW_ANALYZER_PROMPT = {
version: "3.0",
system: `You are a product review analyst. Extract sentiment, score, summary, and topics.
Always return valid JSON. Never hallucinate topics not mentioned in the review.`,
temperature: 0.1, // Low temp for consistent structured output
maxTokens: 500,
};
// tests/prompts/review-analyzer.test.ts
describe("Review Analyzer Prompt v3", () => {
const testCases = [
{
input: "This product is amazing! Great battery life and beautiful screen.",
expected: { sentiment: "positive", minScore: 7 },
},
{
input: "Terrible. Broke after 2 days. Worst purchase ever.",
expected: { sentiment: "negative", maxScore: 3 },
},
{
input: "It's okay. Does what it says but nothing special.",
expected: { sentiment: "neutral", minScore: 4, maxScore: 6 },
},
];
test.each(testCases)("correctly analyzes: $input", async ({ input, expected }) => {
const result = await analyzeReview(input);
expect(result.sentiment).toBe(expected.sentiment);
if (expected.minScore) expect(result.score).toBeGreaterThanOrEqual(expected.minScore);
if (expected.maxScore) expect(result.score).toBeLessThanOrEqual(expected.maxScore);
});
});---
RAG Architecture
When to Use RAG
| Approach | When | Example | |----------|------|---------| | Prompt only | Model already knows the answer | General knowledge questions | | RAG | Answer depends on your data | "What's our refund policy?" | | Fine-tuning | Model needs new behavior/style | Domain-specific tone or format | | RAG + Fine-tuning | Both custom data and custom behavior | Enterprise support bot |
RAG Pipeline
User Query
↓
Query Processing (rewrite, expand, decompose)
↓
Embedding (text → vector)
↓
Vector Search (find relevant chunks)
↓
Re-ranking (order by relevance)
↓
Context Assembly (fit within token budget)
↓
LLM Generation (with retrieved context)
↓
Citation Extraction + Validation
↓
Response with SourcesImplementation
import { OpenAI } from "openai";
const openai = new OpenAI();
// 1. Chunk documenMeet Coco. A superintelligent agent framework powered by an advisory board of 389 world-class minds. Scale your AI assistant into a complete engineering department with 142 skills, 277 commands, and persistent state. Universal compatibility. Local privacy. Free and open source.
Repo: coco-research/coco
Other skills on coco.
- /create-rule
Create Cursor rules for persistent AI guidance. Use when the user wants to create a rule, add coding standards, set up project conventions, configure file-specific patterns, create RULE.md files, or asks about .cursor/rules/ or AGENTS.md.
Open skill - /create-skill
Guides users through creating effective Agent Skills for Cursor. Use when the user wants to create, write, or author a new skill, or asks about skill structure, best practices, or SKILL.md format.
Open skill - /create-subagent
Create custom subagents for specialized AI tasks. Use when the user wants to create a new type of subagent, set up task-specific agents, configure code reviewers, debuggers, or domain-specific assistants with custom prompts.
Open skill - /migrate-to-skills
Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills format (.cursor/skills/). Use when the user wants to migrate rules or commands to skills, convert .mdc rules to SKILL.md format, or consolidate commands
Open skill - /update-cursor-settings
Modify Cursor/VSCode user settings in settings.json. Use when the user wants to change editor settings, preferences, configuration, themes, font size, tab size, format on save, auto save, keybindings, or any settings.json values.
Open skill - /agent-lightning
Train and optimize AI agents using Microsoft's Agent Lightning framework with reinforcement learning. Use when setting up agent training, instrumenting agents with tracing, configuring LightningStore, implementing reward functions, or optimizing prompts with RL/APO algorithms.
Open skill

