[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C1F1JCMMRCRF7R4QEAJSGH":3,"skill-same:01M7C1F1JCMMRCRF7R4QEAJSGH":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7C1F1JCMMRCRF7R4QEAJSGH","llm-app-patterns",null,"Production-ready patterns for building LLM applications, inspired by [Dify](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify) and industry best practices.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fllm-app-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: llm-app-patterns\ndescription: \"Production-ready patterns for building LLM applications, inspired by [Dify](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify) and industry best practices.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# 🤖 LLM Application Patterns\n\n> Production-ready patterns for building LLM applications, inspired by [Dify](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify) and industry best practices.\n\n## When to Use This Skill\n\nUse this skill when:\n\n- Designing LLM-powered applications\n- Implementing RAG (Retrieval-Augmented Generation)\n- Building AI agents with tools\n- Setting up LLMOps monitoring\n- Choosing between agent architectures\n\n---\n\n## 1. RAG Pipeline Architecture\n\n### Overview\n\nRAG (Retrieval-Augmented Generation) grounds LLM responses in your data.\n\n```\n┌─────────────┐     ┌─────────────┐     ┌─────────────┐\n│   Ingest    │────▶│   Retrieve  │────▶│   Generate  │\n│  Documents  │     │   Context   │     │   Response  │\n└─────────────┘     └─────────────┘     └─────────────┘\n      │                   │                   │\n      ▼                   ▼                   ▼\n ┌─────────┐       ┌───────────┐       ┌───────────┐\n │ Chunking│       │  Vector   │       │    LLM    │\n │Embedding│       │  Search   │       │  + Context│\n └─────────┘       └───────────┘       └───────────┘\n```\n\n### 1.1 Document Ingestion\n\n```python\n# Chunking strategies\nclass ChunkingStrategy:\n    # Fixed-size chunks (simple but may break context)\n    FIXED_SIZE = \"fixed_size\"  # e.g., 512 tokens\n\n    # Semantic chunking (preserves meaning)\n    SEMANTIC = \"semantic\"      # Split on paragraphs\u002Fsections\n\n    # Recursive splitting (tries multiple separators)\n    RECURSIVE = \"recursive\"    # [\"\\n\\n\", \"\\n\", \" \", \"\"]\n\n    # Document-aware (respects structure)\n    DOCUMENT_AWARE = \"document_aware\"  # Headers, lists, etc.\n\n# Recommended settings\nCHUNK_CONFIG = {\n    \"chunk_size\": 512,       # tokens\n    \"chunk_overlap\": 50,     # token overlap between chunks\n    \"separators\": [\"\\n\\n\", \"\\n\", \". \", \" \"],\n}\n```\n\n### 1.2 Embedding & Storage\n\n```python\n# Vector database selection\nVECTOR_DB_OPTIONS = {\n    \"pinecone\": {\n        \"use_case\": \"Production, managed service\",\n        \"scale\": \"Billions of vectors\",\n        \"features\": [\"Hybrid search\", \"Metadata filtering\"]\n    },\n    \"weaviate\": {\n        \"use_case\": \"Self-hosted, multi-modal\",\n        \"scale\": \"Millions of vectors\",\n        \"features\": [\"GraphQL API\", \"Modules\"]\n    },\n    \"chromadb\": {\n        \"use_case\": \"Development, prototyping\",\n        \"scale\": \"Thousands of vectors\",\n        \"features\": [\"Simple API\", \"In-memory option\"]\n    },\n    \"pgvector\": {\n        \"use_case\": \"Existing Postgres infrastructure\",\n        \"scale\": \"Millions of vectors\",\n        \"features\": [\"SQL integration\", \"ACID compliance\"]\n    }\n}\n\n# Embedding model selection\nEMBEDDING_MODELS = {\n    \"openai\u002Ftext-embedding-3-small\": {\n        \"dimensions\": 1536,\n        \"cost\": \"$0.02\u002F1M tokens\",\n        \"quality\": \"Good for most use cases\"\n    },\n    \"openai\u002Ftext-embedding-3-large\": {\n        \"dimensions\": 3072,\n        \"cost\": \"$0.13\u002F1M tokens\",\n        \"quality\": \"Best for complex queries\"\n    },\n    \"local\u002Fbge-large\": {\n        \"dimensions\": 1024,\n        \"cost\": \"Free (compute only)\",\n        \"quality\": \"Comparable to OpenAI small\"\n    }\n}\n```\n\n### 1.3 Retrieval Strategies\n\n```python\n# Basic semantic search\ndef semantic_search(query: str, top_k: int = 5):\n    query_embedding = embed(query)\n    results = vector_db.similarity_search(\n        query_embedding,\n        top_k=top_k\n    )\n    return results\n\n# Hybrid search (semantic + keyword)\ndef hybrid_search(query: str, top_k: int = 5, alpha: float = 0.5):\n    \"\"\"\n    alpha=1.0: Pure semantic\n    alpha=0.0: Pure keyword (BM25)\n    alpha=0.5: Balanced\n    \"\"\"\n    semantic_results = vector_db.similarity_search(query)\n    keyword_results = bm25_search(query)\n\n    # Reciprocal Rank Fusion\n    return rrf_merge(semantic_results, keyword_results, alpha)\n\n# Multi-query retrieval\ndef multi_query_retrieval(query: str):\n    \"\"\"Generate multiple query variations for better recall\"\"\"\n    queries = llm.generate_query_variations(query, n=3)\n    all_results = []\n    for q in queries:\n        all_results.extend(semantic_search(q))\n    return deduplicate(all_results)\n\n# Contextual compression\ndef compressed_retrieval(query: str):\n    \"\"\"Retrieve then compress to relevant parts only\"\"\"\n    docs = semantic_search(query, top_k=10)\n    compressed = llm.extract_relevant_parts(docs, query)\n    return compressed\n```\n\n### 1.4 Generation with Context\n\n```python\nRAG_PROMPT_TEMPLATE = \"\"\"\nAnswer the user's question based ONLY on the following context.\nIf the context doesn't contain enough information, say \"I don't have enough information to answer that.\"\n\nContext:\n{context}\n\nQuestion: {question}\n\nAnswer:\"\"\"\n\ndef generate_with_rag(question: str):\n    # Retrieve\n    context_docs = hybrid_search(question, top_k=5)\n    context = \"\\n\\n\".join([doc.content for doc in context_docs])\n\n    # Generate\n    prompt = RAG_PROMPT_TEMPLATE.format(\n        context=context,\n        question=question\n    )\n\n    response = llm.generate(prompt)\n\n    # Return with citations\n    return {\n        \"answer\": response,\n        \"sources\": [doc.metadata for doc in context_docs]\n    }\n```\n\n---\n\n## 2. Agent Architectures\n\n### 2.1 ReAct Pattern (Reasoning + Acting)\n\n```\nThought: I need to search for information about X\nAction: search(\"X\")\nObservation: [search results]\nThought: Based on the results, I should...\nAction: calculate(...)\nObservation: [calculation result]\nThought: I now have enough information\nAction: final_answer(\"The answer is...\")\n```\n\n```python\nREACT_PROMPT = \"\"\"\nYou are an AI assistant that can use tools to answer questions.\n\nAvailable tools:\n{tools_description}\n\nUse this format:\nThought: [your reasoning about what to do next]\nAction: [tool_name(arguments)]\nObservation: [tool result - this will be filled in]\n... (repeat Thought\u002FAction\u002FObservation as needed)\nThought: I have enough information to answer\nFinal Answer: [your final response]\n\nQuestion: {question}\n\"\"\"\n\nclass ReActAgent:\n    def __init__(self, tools: list, llm):\n        self.tools = {t.name: t for t in tools}\n        self.llm = llm\n        self.max_iterations = 10\n\n    def run(self, question: str) -> str:\n        prompt = REACT_PROMPT.format(\n            tools_description=self._format_tools(),\n            question=question\n        )\n\n        for _ in range(self.max_iterations):\n            response = self.llm.generate(prompt)\n\n            if \"Final Answer:\" in response:\n                return self._extract_final_answer(response)\n\n            action = self._parse_action(response)\n            observation = self._execute_tool(action)\n            prompt += f\"\\nObservation: {observation}\\n\"\n\n        return \"Max iterations reached\"\n```\n\n### 2.2 Function Calling Pattern\n\n```python\n# Define tools as functions with schemas\nTOOLS = [\n    {\n        \"name\": \"search_web\",\n        \"description\": \"Search the web for current information\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"query\": {\n                    \"type\": \"string\",\n                    \"description\": \"Search query\"\n                }\n            },\n            \"required\": [\"query\"]\n        }\n    },\n    {\n        \"name\": \"calculate\",\n        \"description\": \"Perform mathematical calculations\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"expression\": {\n                    \"type\": \"string\",\n                    \"description\": \"Math expression to evaluate\"\n                }\n            },\n            \"required\": [\"expression\"]\n        }\n    }\n]\n\nclass FunctionCallingAgent:\n    def run(self, question: str) -> str:\n        messages = [{\"role\": \"user\", \"content\": question}]\n\n        while True:\n            response = self.llm.chat(\n                messages=messages,\n                tools=TOOLS,\n                tool_choice=\"auto\"\n            )\n\n            if response.tool_calls:\n                for tool_call in response.tool_calls:\n                    result = self._execute_tool(\n                        tool_call.name,\n                        tool_call.arguments\n                    )\n                    messages.append({\n                        \"role\": \"tool\",\n                        \"tool_call_id\": tool_call.id,\n                        \"content\": str(result)\n                    })\n            else:\n                return response.content\n```\n\n### 2.3 Plan-and-Execute Pattern\n\n```python\nclass PlanAndExecuteAgent:\n    \"\"\"\n    1. Create a plan (list of steps)\n    2. Execute each step\n    3. Replan if needed\n    \"\"\"\n\n    def run(self, task: str) -> str:\n        # Planning phase\n        plan = self.planner.create_plan(task)\n        # Returns: [\"Step 1: ...\", \"Step 2: ...\", ...]\n\n        results = []\n        for step in plan:\n            # Execute each step\n            result = self.executor.execute(step, context=results)\n            results.append(result)\n\n            # Check if replan needed\n            if self._needs_replan(task, results):\n                new_plan = self.planner.replan(\n                    task,\n                    completed=results,\n                    remaining=plan[len(results):]\n                )\n                plan = new_plan\n\n        # Synthesize final answer\n        return self.synthesizer.summarize(task, results)\n```\n\n### 2.4 Multi-Agent Collaboration\n\n```python\nclass AgentTeam:\n    \"\"\"\n    Specialized agents collaborating on complex tasks\n    \"\"\"\n\n    def __init__(self):\n        self.agents = {\n            \"researcher\": ResearchAgent(),\n            \"analyst\": AnalystAgent(),\n            \"writer\": WriterAgent(),\n            \"critic\": CriticAgent()\n        }\n        self.coordinator = CoordinatorAgent()\n\n    def solve(self, task: str) -> str:\n        # Coordinator assigns subtasks\n        assignments = self.coordinator.decompose(task)\n\n        results = {}\n        for assignment in assignments:\n            agent = self.agents[assignment.agent]\n            result = agent.execute(\n                assignment.subtask,\n                context=results\n            )\n            results[assignment.id] = result\n\n        # Critic reviews\n        critique = self.agents[\"critic\"].review(results)\n\n        if critique.needs_revision:\n            # Iterate with feedback\n            return self.solve_with_feedback(task, results, critique)\n\n        return self.coordinator.synthesize(results)\n```\n\n---\n\n## 3. Prompt IDE Patterns\n\n### 3.1 Prompt Templates with Variables\n\n```python\nclass PromptTemplate:\n    def __init__(self, template: str, variables: list[str]):\n        self.template = template\n        self.variables = variables\n\n    def format(self, **kwargs) -> str:\n        # Validate all variables provided\n        missing = set(self.variables) - set(kwargs.keys())\n        if missing:\n            raise ValueError(f\"Missing variables: {missing}\")\n\n        return self.template.format(**kwargs)\n\n    def with_examples(self, examples: list[dict]) -> str:\n        \"\"\"Add few-shot examples\"\"\"\n        example_text = \"\\n\\n\".join([\n            f\"Input: {ex['input']}\\nOutput: {ex['output']}\"\n            for ex in examples\n        ])\n        return f\"{example_text}\\n\\n{self.template}\"\n\n# Usage\nsummarizer = PromptTemplate(\n    template=\"Summarize the following text in {style} style:\\n\\n{text}\",\n    variables=[\"style\", \"text\"]\n)\n\nprompt = summarizer.format(\n    style=\"professional\",\n    text=\"Long article content...\"\n)\n```\n\n### 3.2 Prompt Versioning & A\u002FB Testing\n\n```python\nclass PromptRegistry:\n    def __init__(self, db):\n        self.db = db\n\n    def register(self, name: str, template: str, version: str):\n        \"\"\"Store prompt with version\"\"\"\n        self.db.save({\n            \"name\": name,\n            \"template\": template,\n            \"version\": version,\n            \"created_at\": datetime.now(),\n            \"metrics\": {}\n        })\n\n    def get(self, name: str, version: str = \"latest\") -> str:\n        \"\"\"Retrieve specific version\"\"\"\n        return self.db.get(name, version)\n\n    def ab_test(self, name: str, user_id: str) -> str:\n        \"\"\"Return variant based on user bucket\"\"\"\n        variants = self.db.get_all_versions(name)\n        bucket = hash(user_id) % len(variants)\n        return variants[bucket]\n\n    def record_outcome(self, prompt_id: str, outcome: dict):\n        \"\"\"Track prompt performance\"\"\"\n        self.db.update_metrics(prompt_id, outcome)\n```\n\n### 3.3 Prompt Chaining\n\n```python\nclass PromptChain:\n    \"\"\"\n    Chain prompts together, passing output as input to next\n    \"\"\"\n\n    def __init__(self, steps: list[dict]):\n        self.steps = steps\n\n    def run(self, initial_input: str) -> dict:\n        context = {\"input\": initial_input}\n        results = []\n\n        for step in self.steps:\n            prompt = step[\"prompt\"].format(**context)\n            output = llm.generate(prompt)\n\n            # Parse output if needed\n            if step.get(\"parser\"):\n                output = step\"parser\"\n\n            context[step[\"output_key\"]] = output\n            results.append({\n                \"step\": step[\"name\"],\n                \"output\": output\n            })\n\n        return {\n            \"final_output\": context[self.steps[-1][\"output_key\"]],\n            \"intermediate_results\": results\n        }\n\n# Example: Research → Analyze → Summarize\nchain = PromptChain([\n    {\n        \"name\": \"research\",\n        \"prompt\": \"Research the topic: {input}\",\n        \"output_key\": \"research\"\n    },\n    {\n        \"name\": \"analyze\",\n        \"prompt\": \"Analyze these findings:\\n{research}\",\n        \"output_key\": \"analysis\"\n    },\n    {\n        \"name\": \"summarize\",\n        \"prompt\": \"Summarize this analysis in 3 bullet points:\\n{analysis}\",\n        \"output_key\": \"summary\"\n    }\n])\n```\n\n---\n\n## 4. LLMOps & Observability\n\n### 4.1 Metrics to Track\n\n```python\nLLM_METRICS = {\n    # Performance\n    \"latency_p50\": \"50th percentile response time\",\n    \"latency_p99\": \"99th percentile response time\",\n    \"tokens_per_second\": \"Generation speed\",\n\n    # Quality\n    \"user_satisfaction\": \"Thumbs up\u002Fdown ratio\",\n    \"task_completion\": \"% tasks completed successfully\",\n    \"hallucination_rate\": \"% responses with factual errors\",\n\n    # Cost\n    \"cost_per_request\": \"Average $ per API call\",\n    \"tokens_per_request\": \"Average tokens used\",\n    \"cache_hit_rate\": \"% requests served from cache\",\n\n    # Reliability\n    \"error_rate\": \"% failed requests\",\n    \"timeout_rate\": \"% requests that timed out\",\n    \"retry_rate\": \"% requests needing retry\"\n}\n```\n\n### 4.2 Logging & Tracing\n\n```python\nimport logging\nfrom opentelemetry import trace\n\ntracer = trace.get_tracer(__name__)\n\nclass LLMLogger:\n    def log_request(self, request_id: str, data: dict):\n        \"\"\"Log LLM request for debugging and analysis\"\"\"\n        log_entry = {\n            \"request_id\": request_id,\n            \"timestamp\": datetime.now().isoformat(),\n            \"model\": data[\"model\"],\n            \"prompt\": data[\"prompt\"][:500],  # Truncate for storage\n            \"prompt_tokens\": data[\"prompt_tokens\"],\n            \"temperature\": data.get(\"temperature\", 1.0),\n            \"user_id\": data.get(\"user_id\"),\n        }\n        logging.info(f\"LLM_REQUEST: {json.dumps(log_entry)}\")\n\n    def log_response(self, request_id: str, data: dict):\n        \"\"\"Log LLM response\"\"\"\n        log_entry = {\n            \"request_id\": request_id,\n            \"completion_tokens\": data[\"completion_tokens\"],\n            \"total_tokens\": data[\"total_tokens\"],\n            \"latency_ms\": data[\"latency_ms\"],\n            \"finish_reason\": data[\"finish_reason\"],\n            \"cost_usd\": self._calculate_cost(data),\n        }\n        logging.info(f\"LLM_RESPONSE: {json.dumps(log_entry)}\")\n\n# Distributed tracing\n@tracer.start_as_current_span(\"llm_call\")\ndef call_llm(prompt: str) -> str:\n    span = trace.get_current_span()\n    span.set_attribute(\"prompt.length\", len(prompt))\n\n    response = llm.generate(prompt)\n\n    span.set_attribute(\"response.length\", len(response))\n    span.set_attribute(\"tokens.total\", response.usage.total_tokens)\n\n    return response.content\n```\n\n### 4.3 Evaluation Framework\n\n```python\nclass LLMEvaluator:\n    \"\"\"\n    Evaluate LLM outputs for quality\n    \"\"\"\n\n    def evaluate_response(self,\n                          question: str,\n                          response: str,\n                          ground_truth: str = None) -> dict:\n        scores = {}\n\n        # Relevance: Does it answer the question?\n        scores[\"relevance\"] = self._score_relevance(question, response)\n\n        # Coherence: Is it well-structured?\n        scores[\"coherence\"] = self._score_coherence(response)\n\n        # Groundedness: Is it based on provided context?\n        scores[\"groundedness\"] = self._score_groundedness(response)\n\n        # Accuracy: Does it match ground truth?\n        if ground_truth:\n            scores[\"accuracy\"] = self._score_accuracy(response, ground_truth)\n\n        # Harmfulness: Is it safe?\n        scores[\"safety\"] = self._score_safety(response)\n\n        return scores\n\n    def run_benchmark(self, test_cases: list[dict]) -> dict:\n        \"\"\"Run evaluation on test set\"\"\"\n        results = []\n        for case in test_cases:\n            response = llm.generate(case[\"prompt\"])\n            scores = self.evaluate_response(\n                question=case[\"prompt\"],\n                response=response,\n                ground_truth=case.get(\"expected\")\n            )\n            results.append(scores)\n\n        return self._aggregate_scores(results)\n```\n\n---\n\n## 5. Production Patterns\n\n### 5.1 Caching Strategy\n\n```python\nimport hashlib\nfrom functools import lru_cache\n\nclass LLMCache:\n    def __init__(self, redis_client, ttl_seconds=3600):\n        self.redis = redis_client\n        self.ttl = ttl_seconds\n\n    def _cache_key(self, prompt: str, model: str, **kwargs) -> str:\n        \"\"\"Generate deterministic cache key\"\"\"\n        content = f\"{model}:{prompt}:{json.dumps(kwargs, sort_keys=True)}\"\n        return hashlib.sha256(content.encode()).hexdigest()\n\n    def get_or_generate(self, prompt: str, model: str, **kwargs) -> str:\n        key = self._cache_key(prompt, model, **kwargs)\n\n        # Check cache\n        cached = self.redis.get(key)\n        if cached:\n            return cached.decode()\n\n        # Generate\n        response = llm.generate(prompt, model=model, **kwargs)\n\n        # Cache (only cache deterministic outputs)\n        if kwargs.get(\"temperature\", 1.0) == 0:\n            self.redis.setex(key, self.ttl, response)\n\n        return response\n```\n\n### 5.2 Rate Limiting & Retry\n\n```python\nimport time\nfrom tenacity import retry, wait_exponential, stop_after_attempt\n\nclass RateLimiter:\n    def __init__(self, requests_per_minute: int):\n        self.rpm = requests_per_minute\n        self.timestamps = []\n\n    def acquire(self):\n        \"\"\"Wait if rate limit would be exceeded\"\"\"\n        now = time.time()\n\n        # Remove old timestamps\n        self.timestamps = [t for t in self.timestamps if now - t \u003C 60]\n\n        if len(self.timestamps) >= self.rpm:\n            sleep_time = 60 - (now - self.timestamps[0])\n            time.sleep(sleep_time)\n\n        self.timestamps.append(time.time())\n\n# Retry with exponential backoff\n@retry(\n    wait=wait_exponential(multiplier=1, min=4, max=60),\n    stop=stop_after_attempt(5)\n)\ndef call_llm_with_retry(prompt: str) -> str:\n    try:\n        return llm.generate(prompt)\n    except RateLimitError:\n        raise  # Will trigger retry\n    except APIError as e:\n        if e.status_code >= 500:\n            raise  # Retry server errors\n        raise  # Don't retry client errors\n```\n\n### 5.3 Fallback Strategy\n\n```python\nclass LLMWithFallback:\n    def __init__(self, primary: str, fallbacks: list[str]):\n        self.primary = primary\n        self.fallbacks = fallbacks\n\n    def generate(self, prompt: str, **kwargs) -> str:\n        models = [self.primary] + self.fallbacks\n\n        for model in models:\n            try:\n                return llm.generate(prompt, model=model, **kwargs)\n            except (RateLimitError, APIError) as e:\n                logging.warning(f\"Model {model} failed: {e}\")\n                continue\n\n        raise AllModelsFailedError(\"All models exhausted\")\n\n# Usage\nllm_client = LLMWithFallback(\n    primary=\"gpt-4-turbo\",\n    fallbacks=[\"gpt-3.5-turbo\", \"claude-3-sonnet\"]\n)\n```\n\n---\n\n## Architecture Decision Matrix\n\n| Pattern              | Use When         | Complexity | Cost      |\n| :------------------- | :--------------- | :--------- | :-------- |\n| **Simple RAG**       | FAQ, docs search | Low        | Low       |\n| **Hybrid RAG**       | Mixed queries    | Medium     | Medium    |\n| **ReAct Agent**      | Multi-step tasks | Medium     | Medium    |\n| **Function Calling** | Structured tools | Low        | Low       |\n| **Plan-Execute**     | Complex tasks    | High       | High      |\n| **Multi-Agent**      | Research tasks   | Very High  | Very High |\n\n---\n\n## Resources\n\n- [Dify Platform](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify)\n- [LangChain Docs](https:\u002F\u002Fpython.langchain.com\u002F)\n- [LlamaIndex](https:\u002F\u002Fwww.llamaindex.ai\u002F)\n- [Anthropic Cookbook](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fanthropic-cookbook)\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","# 🤖 LLM Application Patterns\n\n> Production-ready patterns for building LLM applications, inspired by [Dify](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify) and industry best practices.\n\n## When to Use This Skill\n\nUse this skill when:\n\n- Designing LLM-powered applications\n- Implementing RAG (Retrieval-Augmented Generation)\n- Building AI agents with tools\n- Setting up LLMOps monitoring\n- Choosing between agent architectures\n\n---\n\n## 1. RAG Pipeline Architecture\n\n### Overview\n\nRAG (Retrieval-Augmented Generation) grounds LLM responses in your data.\n\n```\n┌─────────────┐     ┌─────────────┐     ┌─────────────┐\n│   Ingest    │────▶│   Retrieve  │────▶│   Generate  │\n│  Documents  │     │   Context   │     │   Response  │\n└─────────────┘     └─────────────┘     └─────────────┘\n      │                   │                   │\n      ▼                   ▼                   ▼\n ┌─────────┐       ┌───────────┐       ┌───────────┐\n │ Chunking│       │  Vector   │       │    LLM    │\n │Embedding│       │  Search   │       │  + Context│\n └─────────┘       └───────────┘       └───────────┘\n```\n\n### 1.1 Document Ingestion\n\n```python\n# Chunking strategies\nclass ChunkingStrategy:\n    # Fixed-size chunks (simple but may break context)\n    FIXED_SIZE = \"fixed_size\"  # e.g., 512 tokens\n\n    # Semantic chunking (preserves meaning)\n    SEMANTIC = \"semantic\"      # Split on paragraphs\u002Fsections\n\n    # Recursive splitting (tries multiple separators)\n    RECURSIVE = \"recursive\"    # [\"\\n\\n\", \"\\n\", \" \", \"\"]\n\n    # Document-aware (respects structure)\n    DOCUMENT_AWARE = \"document_aware\"  # Headers, lists, etc.\n\n# Recommended settings\nCHUNK_CONFIG = {\n    \"chunk_size\": 512,       # tokens\n    \"chunk_overlap\": 50,     # token overlap between chunks\n    \"separators\": [\"\\n\\n\", \"\\n\", \". \", \" \"],\n}\n```\n\n### 1.2 Embedding & Storage\n\n```python\n# Vector database selection\nVECTOR_DB_OPTIONS = {\n    \"pinecone\": {\n        \"use_case\": \"Production, managed service\",\n        \"scale\": \"Billions of vectors\",\n        \"features\": [\"Hybrid search\", \"Metadata filtering\"]\n    },\n    \"weaviate\": {\n        \"use_case\": \"Self-hosted, multi-modal\",\n        \"scale\": \"Millions of vectors\",\n        \"features\": [\"GraphQL API\", \"Modules\"]\n    },\n    \"chromadb\": {\n        \"use_case\": \"Development, prototyping\",\n        \"scale\": \"Thousands of vectors\",\n        \"features\": [\"Simple API\", \"In-memory option\"]\n    },\n    \"pgvector\": {\n        \"use_case\": \"Existing Postgres infrastructure\",\n        \"scale\": \"Millions of vectors\",\n        \"features\": [\"SQL integration\", \"ACID compliance\"]\n    }\n}\n\n# Embedding model selection\nEMBEDDING_MODELS = {\n    \"openai\u002Ftext-embedding-3-small\": {\n        \"dimensions\": 1536,\n        \"cost\": \"$0.02\u002F1M tokens\",\n        \"quality\": \"Good for most use cases\"\n    },\n    \"openai\u002Ftext-embedding-3-large\": {\n        \"dimensions\": 3072,\n        \"cost\": \"$0.13\u002F1M tokens\",\n        \"quality\": \"Best for complex queries\"\n    },\n    \"local\u002Fbge-large\": {\n        \"dimensions\": 1024,\n        \"cost\": \"Free (compute only)\",\n        \"quality\": \"Comparable to OpenAI small\"\n    }\n}\n```\n\n### 1.3 Retrieval Strategies\n\n```python\n# Basic semantic search\ndef semantic_search(query: str, top_k: int = 5):\n    query_embedding = embed(query)\n    results = vector_db.similarity_search(\n        query_embedding,\n        top_k=top_k\n    )\n    return results\n\n# Hybrid search (semantic + keyword)\ndef hybrid_search(query: str, top_k: int = 5, alpha: float = 0.5):\n    \"\"\"\n    alpha=1.0: Pure semantic\n    alpha=0.0: Pure keyword (BM25)\n    alpha=0.5: Balanced\n    \"\"\"\n    semantic_results = vector_db.similarity_search(query)\n    keyword_results = bm25_search(query)\n\n    # Reciprocal Rank Fusion\n    return rrf_merge(semantic_results, keyword_results, alpha)\n\n# Multi-query retrieval\ndef multi_query_retrieval(query: str):\n    \"\"\"Generate multiple query variations for better recall\"\"\"\n    queries = llm.generate_query_variations(query, n=3)\n    all_results = []\n    for q in queries:\n        all_results.extend(semantic_search(q))\n    return deduplicate(all_results)\n\n# Contextual compression\ndef compressed_retrieval(query: str):\n    \"\"\"Retrieve then compress to relevant parts only\"\"\"\n    docs = semantic_search(query, top_k=10)\n    compressed = llm.extract_relevant_parts(docs, query)\n    return compressed\n```\n\n### 1.4 Generation with Context\n\n```python\nRAG_PROMPT_TEMPLATE = \"\"\"\nAnswer the user's question based ONLY on the following context.\nIf the context doesn't contain enough information, say \"I don't have enough information to answer that.\"\n\nContext:\n{context}\n\nQuestion: {question}\n\nAnswer:\"\"\"\n\ndef generate_with_rag(question: str):\n    # Retrieve\n    context_docs = hybrid_search(question, top_k=5)\n    context = \"\\n\\n\".join([doc.content for doc in context_docs])\n\n    # Generate\n    prompt = RAG_PROMPT_TEMPLATE.format(\n        context=context,\n        question=question\n    )\n\n    response = llm.generate(prompt)\n\n    # Return with citations\n    return {\n        \"answer\": response,\n        \"sources\": [doc.metadata for doc in context_docs]\n    }\n```\n\n---\n\n## 2. Agent Architectures\n\n### 2.1 ReAct Pattern (Reasoning + Acting)\n\n```\nThought: I need to search for information about X\nAction: search(\"X\")\nObservation: [search results]\nThought: Based on the results, I should...\nAction: calculate(...)\nObservation: [calculation result]\nThought: I now have enough information\nAction: final_answer(\"The answer is...\")\n```\n\n```python\nREACT_PROMPT = \"\"\"\nYou are an AI assistant that can use tools to answer questions.\n\nAvailable tools:\n{tools_description}\n\nUse this format:\nThought: [your reasoning about what to do next]\nAction: [tool_name(arguments)]\nObservation: [tool result - this will be filled in]\n... (repeat Thought\u002FAction\u002FObservation as needed)\nThought: I have enough information to answer\nFinal Answer: [your final response]\n\nQuestion: {question}\n\"\"\"\n\nclass ReActAgent:\n    def __init__(self, tools: list, llm):\n        self.tools = {t.name: t for t in tools}\n        self.llm = llm\n        self.max_iterations = 10\n\n    def run(self, question: str) -> str:\n        prompt = REACT_PROMPT.format(\n            tools_description=self._format_tools(),\n            question=question\n        )\n\n        for _ in range(self.max_iterations):\n            response = self.llm.generate(prompt)\n\n            if \"Final Answer:\" in response:\n                return self._extract_final_answer(response)\n\n            action = self._parse_action(response)\n            observation = self._execute_tool(action)\n            prompt += f\"\\nObservation: {observation}\\n\"\n\n        return \"Max iterations reached\"\n```\n\n### 2.2 Function Calling Pattern\n\n```python\n# Define tools as functions with schemas\nTOOLS = [\n    {\n        \"name\": \"search_web\",\n        \"description\": \"Search the web for current information\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"query\": {\n                    \"type\": \"string\",\n                    \"description\": \"Search query\"\n                }\n            },\n            \"required\": [\"query\"]\n        }\n    },\n    {\n        \"name\": \"calculate\",\n        \"description\": \"Perform mathematical calculations\",\n        \"parameters\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"expression\": {\n                    \"type\": \"string\",\n                    \"description\": \"Math expression to evaluate\"\n                }\n            },\n            \"required\": [\"expression\"]\n        }\n    }\n]\n\nclass FunctionCallingAgent:\n    def run(self, question: str) -> str:\n        messages = [{\"role\": \"user\", \"content\": question}]\n\n        while True:\n            response = self.llm.chat(\n                messages=messages,\n                tools=TOOLS,\n                tool_choice=\"auto\"\n            )\n\n            if response.tool_calls:\n                for tool_call in response.tool_calls:\n                    result = self._execute_tool(\n                        tool_call.name,\n                        tool_call.arguments\n                    )\n                    messages.append({\n                        \"role\": \"tool\",\n                        \"tool_call_id\": tool_call.id,\n                        \"content\": str(result)\n                    })\n            else:\n                return response.content\n```\n\n### 2.3 Plan-and-Execute Pattern\n\n```python\nclass PlanAndExecuteAgent:\n    \"\"\"\n    1. Create a plan (list of steps)\n    2. Execute each step\n    3. Replan if needed\n    \"\"\"\n\n    def run(self, task: str) -> str:\n        # Planning phase\n        plan = self.planner.create_plan(task)\n        # Returns: [\"Step 1: ...\", \"Step 2: ...\", ...]\n\n        results = []\n        for step in plan:\n            # Execute each step\n            result = self.executor.execute(step, context=results)\n            results.append(result)\n\n            # Check if replan needed\n            if self._needs_replan(task, results):\n                new_plan = self.planner.replan(\n                    task,\n                    completed=results,\n                    remaining=plan[len(results):]\n                )\n                plan = new_plan\n\n        # Synthesize final answer\n        return self.synthesizer.summarize(task, results)\n```\n\n### 2.4 Multi-Agent Collaboration\n\n```python\nclass AgentTeam:\n    \"\"\"\n    Specialized agents collaborating on complex tasks\n    \"\"\"\n\n    def __init__(self):\n        self.agents = {\n            \"researcher\": ResearchAgent(),\n            \"analyst\": AnalystAgent(),\n            \"writer\": WriterAgent(),\n            \"critic\": CriticAgent()\n        }\n        self.coordinator = CoordinatorAgent()\n\n    def solve(self, task: str) -> str:\n        # Coordinator assigns subtasks\n        assignments = self.coordinator.decompose(task)\n\n        results = {}\n        for assignment in assignments:\n            agent = self.agents[assignment.agent]\n            result = agent.execute(\n                assignment.subtask,\n                context=results\n            )\n            results[assignment.id] = result\n\n        # Critic reviews\n        critique = self.agents[\"critic\"].review(results)\n\n        if critique.needs_revision:\n            # Iterate with feedback\n            return self.solve_with_feedback(task, results, critique)\n\n        return self.coordinator.synthesize(results)\n```\n\n---\n\n## 3. Prompt IDE Patterns\n\n### 3.1 Prompt Templates with Variables\n\n```python\nclass PromptTemplate:\n    def __init__(self, template: str, variables: list[str]):\n        self.template = template\n        self.variables = variables\n\n    def format(self, **kwargs) -> str:\n        # Validate all variables provided\n        missing = set(self.variables) - set(kwargs.keys())\n        if missing:\n            raise ValueError(f\"Missing variables: {missing}\")\n\n        return self.template.format(**kwargs)\n\n    def with_examples(self, examples: list[dict]) -> str:\n        \"\"\"Add few-shot examples\"\"\"\n        example_text = \"\\n\\n\".join([\n            f\"Input: {ex['input']}\\nOutput: {ex['output']}\"\n            for ex in examples\n        ])\n        return f\"{example_text}\\n\\n{self.template}\"\n\n# Usage\nsummarizer = PromptTemplate(\n    template=\"Summarize the following text in {style} style:\\n\\n{text}\",\n    variables=[\"style\", \"text\"]\n)\n\nprompt = summarizer.format(\n    style=\"professional\",\n    text=\"Long article content...\"\n)\n```\n\n### 3.2 Prompt Versioning & A\u002FB Testing\n\n```python\nclass PromptRegistry:\n    def __init__(self, db):\n        self.db = db\n\n    def register(self, name: str, template: str, version: str):\n        \"\"\"Store prompt with version\"\"\"\n        self.db.save({\n            \"name\": name,\n            \"template\": template,\n            \"version\": version,\n            \"created_at\": datetime.now(),\n            \"metrics\": {}\n        })\n\n    def get(self, name: str, version: str = \"latest\") -> str:\n        \"\"\"Retrieve specific version\"\"\"\n        return self.db.get(name, version)\n\n    def ab_test(self, name: str, user_id: str) -> str:\n        \"\"\"Return variant based on user bucket\"\"\"\n        variants = self.db.get_all_versions(name)\n        bucket = hash(user_id) % len(variants)\n        return variants[bucket]\n\n    def record_outcome(self, prompt_id: str, outcome: dict):\n        \"\"\"Track prompt performance\"\"\"\n        self.db.update_metrics(prompt_id, outcome)\n```\n\n### 3.3 Prompt Chaining\n\n```python\nclass PromptChain:\n    \"\"\"\n    Chain prompts together, passing output as input to next\n    \"\"\"\n\n    def __init__(self, steps: list[dict]):\n        self.steps = steps\n\n    def run(self, initial_input: str) -> dict:\n        context = {\"input\": initial_input}\n        results = []\n\n        for step in self.steps:\n            prompt = step[\"prompt\"].format(**context)\n            output = llm.generate(prompt)\n\n            # Parse output if needed\n            if step.get(\"parser\"):\n                output = step\"parser\"\n\n            context[step[\"output_key\"]] = output\n            results.append({\n                \"step\": step[\"name\"],\n                \"output\": output\n            })\n\n        return {\n            \"final_output\": context[self.steps[-1][\"output_key\"]],\n            \"intermediate_results\": results\n        }\n\n# Example: Research → Analyze → Summarize\nchain = PromptChain([\n    {\n        \"name\": \"research\",\n        \"prompt\": \"Research the topic: {input}\",\n        \"output_key\": \"research\"\n    },\n    {\n        \"name\": \"analyze\",\n        \"prompt\": \"Analyze these findings:\\n{research}\",\n        \"output_key\": \"analysis\"\n    },\n    {\n        \"name\": \"summarize\",\n        \"prompt\": \"Summarize this analysis in 3 bullet points:\\n{analysis}\",\n        \"output_key\": \"summary\"\n    }\n])\n```\n\n---\n\n## 4. LLMOps & Observability\n\n### 4.1 Metrics to Track\n\n```python\nLLM_METRICS = {\n    # Performance\n    \"latency_p50\": \"50th percentile response time\",\n    \"latency_p99\": \"99th percentile response time\",\n    \"tokens_per_second\": \"Generation speed\",\n\n    # Quality\n    \"user_satisfaction\": \"Thumbs up\u002Fdown ratio\",\n    \"task_completion\": \"% tasks completed successfully\",\n    \"hallucination_rate\": \"% responses with factual errors\",\n\n    # Cost\n    \"cost_per_request\": \"Average $ per API call\",\n    \"tokens_per_request\": \"Average tokens used\",\n    \"cache_hit_rate\": \"% requests served from cache\",\n\n    # Reliability\n    \"error_rate\": \"% failed requests\",\n    \"timeout_rate\": \"% requests that timed out\",\n    \"retry_rate\": \"% requests needing retry\"\n}\n```\n\n### 4.2 Logging & Tracing\n\n```python\nimport logging\nfrom opentelemetry import trace\n\ntracer = trace.get_tracer(__name__)\n\nclass LLMLogger:\n    def log_request(self, request_id: str, data: dict):\n        \"\"\"Log LLM request for debugging and analysis\"\"\"\n        log_entry = {\n            \"request_id\": request_id,\n            \"timestamp\": datetime.now().isoformat(),\n            \"model\": data[\"model\"],\n            \"prompt\": data[\"prompt\"][:500],  # Truncate for storage\n            \"prompt_tokens\": data[\"prompt_tokens\"],\n            \"temperature\": data.get(\"temperature\", 1.0),\n            \"user_id\": data.get(\"user_id\"),\n        }\n        logging.info(f\"LLM_REQUEST: {json.dumps(log_entry)}\")\n\n    def log_response(self, request_id: str, data: dict):\n        \"\"\"Log LLM response\"\"\"\n        log_entry = {\n            \"request_id\": request_id,\n            \"completion_tokens\": data[\"completion_tokens\"],\n            \"total_tokens\": data[\"total_tokens\"],\n            \"latency_ms\": data[\"latency_ms\"],\n            \"finish_reason\": data[\"finish_reason\"],\n            \"cost_usd\": self._calculate_cost(data),\n        }\n        logging.info(f\"LLM_RESPONSE: {json.dumps(log_entry)}\")\n\n# Distributed tracing\n@tracer.start_as_current_span(\"llm_call\")\ndef call_llm(prompt: str) -> str:\n    span = trace.get_current_span()\n    span.set_attribute(\"prompt.length\", len(prompt))\n\n    response = llm.generate(prompt)\n\n    span.set_attribute(\"response.length\", len(response))\n    span.set_attribute(\"tokens.total\", response.usage.total_tokens)\n\n    return response.content\n```\n\n### 4.3 Evaluation Framework\n\n```python\nclass LLMEvaluator:\n    \"\"\"\n    Evaluate LLM outputs for quality\n    \"\"\"\n\n    def evaluate_response(self,\n                          question: str,\n                          response: str,\n                          ground_truth: str = None) -> dict:\n        scores = {}\n\n        # Relevance: Does it answer the question?\n        scores[\"relevance\"] = self._score_relevance(question, response)\n\n        # Coherence: Is it well-structured?\n        scores[\"coherence\"] = self._score_coherence(response)\n\n        # Groundedness: Is it based on provided context?\n        scores[\"groundedness\"] = self._score_groundedness(response)\n\n        # Accuracy: Does it match ground truth?\n        if ground_truth:\n            scores[\"accuracy\"] = self._score_accuracy(response, ground_truth)\n\n        # Harmfulness: Is it safe?\n        scores[\"safety\"] = self._score_safety(response)\n\n        return scores\n\n    def run_benchmark(self, test_cases: list[dict]) -> dict:\n        \"\"\"Run evaluation on test set\"\"\"\n        results = []\n        for case in test_cases:\n            response = llm.generate(case[\"prompt\"])\n            scores = self.evaluate_response(\n                question=case[\"prompt\"],\n                response=response,\n                ground_truth=case.get(\"expected\")\n            )\n            results.append(scores)\n\n        return self._aggregate_scores(results)\n```\n\n---\n\n## 5. Production Patterns\n\n### 5.1 Caching Strategy\n\n```python\nimport hashlib\nfrom functools import lru_cache\n\nclass LLMCache:\n    def __init__(self, redis_client, ttl_seconds=3600):\n        self.redis = redis_client\n        self.ttl = ttl_seconds\n\n    def _cache_key(self, prompt: str, model: str, **kwargs) -> str:\n        \"\"\"Generate deterministic cache key\"\"\"\n        content = f\"{model}:{prompt}:{json.dumps(kwargs, sort_keys=True)}\"\n        return hashlib.sha256(content.encode()).hexdigest()\n\n    def get_or_generate(self, prompt: str, model: str, **kwargs) -> str:\n        key = self._cache_key(prompt, model, **kwargs)\n\n        # Check cache\n        cached = self.redis.get(key)\n        if cached:\n            return cached.decode()\n\n        # Generate\n        response = llm.generate(prompt, model=model, **kwargs)\n\n        # Cache (only cache deterministic outputs)\n        if kwargs.get(\"temperature\", 1.0) == 0:\n            self.redis.setex(key, self.ttl, response)\n\n        return response\n```\n\n### 5.2 Rate Limiting & Retry\n\n```python\nimport time\nfrom tenacity import retry, wait_exponential, stop_after_attempt\n\nclass RateLimiter:\n    def __init__(self, requests_per_minute: int):\n        self.rpm = requests_per_minute\n        self.timestamps = []\n\n    def acquire(self):\n        \"\"\"Wait if rate limit would be exceeded\"\"\"\n        now = time.time()\n\n        # Remove old timestamps\n        self.timestamps = [t for t in self.timestamps if now - t \u003C 60]\n\n        if len(self.timestamps) >= self.rpm:\n            sleep_time = 60 - (now - self.timestamps[0])\n            time.sleep(sleep_time)\n\n        self.timestamps.append(time.time())\n\n# Retry with exponential backoff\n@retry(\n    wait=wait_exponential(multiplier=1, min=4, max=60),\n    stop=stop_after_attempt(5)\n)\ndef call_llm_with_retry(prompt: str) -> str:\n    try:\n        return llm.generate(prompt)\n    except RateLimitError:\n        raise  # Will trigger retry\n    except APIError as e:\n        if e.status_code >= 500:\n            raise  # Retry server errors\n        raise  # Don't retry client errors\n```\n\n### 5.3 Fallback Strategy\n\n```python\nclass LLMWithFallback:\n    def __init__(self, primary: str, fallbacks: list[str]):\n        self.primary = primary\n        self.fallbacks = fallbacks\n\n    def generate(self, prompt: str, **kwargs) -> str:\n        models = [self.primary] + self.fallbacks\n\n        for model in models:\n            try:\n                return llm.generate(prompt, model=model, **kwargs)\n            except (RateLimitError, APIError) as e:\n                logging.warning(f\"Model {model} failed: {e}\")\n                continue\n\n        raise AllModelsFailedError(\"All models exhausted\")\n\n# Usage\nllm_client = LLMWithFallback(\n    primary=\"gpt-4-turbo\",\n    fallbacks=[\"gpt-3.5-turbo\", \"claude-3-sonnet\"]\n)\n```\n\n---\n\n## Architecture Decision Matrix\n\n| Pattern              | Use When         | Complexity | Cost      |\n| :------------------- | :--------------- | :--------- | :-------- |\n| **Simple RAG**       | FAQ, docs search | Low        | Low       |\n| **Hybrid RAG**       | Mixed queries    | Medium     | Medium    |\n| **ReAct Agent**      | Multi-step tasks | Medium     | Medium    |\n| **Function Calling** | Structured tools | Low        | Low       |\n| **Plan-Execute**     | Complex tasks    | High       | High      |\n| **Multi-Agent**      | Research tasks   | Very High  | Very High |\n\n---\n\n## Resources\n\n- [Dify Platform](https:\u002F\u002Fgithub.com\u002Flanggenius\u002Fdify)\n- [LangChain Docs](https:\u002F\u002Fpython.langchain.com\u002F)\n- [LlamaIndex](https:\u002F\u002Fwww.llamaindex.ai\u002F)\n- [Anthropic Cookbook](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fanthropic-cookbook)\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",{"name":5,"risk":24,"source":25,"date_added":26,"description":7},"unknown","community","2026-02-27","main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fllm-app-patterns",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill llm-app-patterns",{"tool":42,"command":43},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill llm-app-patterns",{"tool":45,"command":46},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill llm-app-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Skills-技能包\u002FYYC3-Skills-技能包-antigravity-awesome-skills\u002Fplugins\u002Fantigravity-awesome-skills-claude\u002Fskills\u002Fllm-app-patterns\u002FSKILL.md",true,[],[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]