llm-app-patterns
建構生產級 LLM 應用程式
建構 LLM 應用程式需要應對複雜的架構決策。此技能提供經過實戰驗證的模式,適用於 RAG 流程、代理系統和生產營運。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「llm-app-patterns」。 使用者詢問:公司的退款政策是什麼?
預期結果:
- 從向量資料庫中檢索相關政策文件
- 基於檢索的上下文生成答案,並附上來源引用
- 回傳包含信心分數和文件參考的回應
正在使用「llm-app-patterns」。 使用者詢問:規劃一個關於氣候變遷影響的研究專案
預期結果:
- 建立包含以下步驟的計畫:收集資料、分析趨勢、識別來源、起草報告
- 透過工具呼叫依序執行每個步驟
- 將研究結果整合成綜合性的研究大綱
安全審計
安全This skill is a documentation file containing educational content about LLM application patterns. All static analysis findings are false positives caused by markdown formatting. The backticks flagged are code block delimiters and ASCII art borders, not shell command execution. URLs are documentation references, not active network calls. Code examples like hashlib.sha256 are illustrative and use secure algorithms. No executable code or security risks detected.
品質評分
你能建構什麼
RAG 知識庫
使用混合搜尋和上下文壓縮,建構基於文件內容的問答系統。
代理任務自動化
建立多步驟代理,使用 ReAct 或 Plan-and-Execute 模式進行搜尋、計算和資訊整合。
LLM 生產監控
實作 LLM 應用程式的可觀測性,包含指標追蹤、分散式追蹤和評估框架。
試試這些提示
Answer the user's question based ONLY on the following context. If the context doesn't contain enough information, say you don't have enough information.
Context:
{context}
Question: {question}
Answer:You are an AI assistant that can use tools to answer questions.
Available tools:
{tools_description}
Use this format:
Thought: [your reasoning about what to do next]
Action: [tool_name(arguments)]
Observation: [tool result]
... (repeat as needed)
Thought: I have enough information to answer
Final Answer: [your response]
Question: {question}Input: {example1_input}
Output: {example1_output}
Input: {example2_input}
Output: {example2_output}
Input: {user_input}
Output:Step 1 (Research): Research the topic: {input}
Step 2 (Analyze): Analyze these findings: {research}
Step 3 (Summarize): Summarize this analysis in 3 bullet points: {analysis}最佳實務
- 使用結合語意和關鍵字匹配的混合搜尋,以提升檢索準確性
- 針對確定性提示實作快取,以降低延遲和成本
- 追蹤關鍵指標如延遲、Token 使用量和使用者滿意度,以持續改進
避免
- 使用固定大小分塊而不考慮文件結構,這會破壞上下文
- 跳過評估和監控,導致無法偵測品質下降
- 當主要 LLM 供應商發生中斷時,未實作備援策略