ai-agent-integration
Advanced skill for implementing Large Language Model (LLM) features into applications, covering tool calling, Retrieval-Augmented Generation (RAG), prompt caching, and context management.
来源信息
- 仓库
- skeletorflet/opencode-kit
- 最近来源活动
- 2026年4月1日 13:09
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 10
- Forks
- 1
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- ai-agent-integration
- description
- Advanced skill for implementing Large Language Model (LLM) features into applications, covering tool calling, Retrieval-Augmented Generation (RAG), prompt caching, and context management.
# AI Agent Integration Patterns
This skill file documents best practices for integrating autonomous agents, chatbots, and generative AI features into enterprise architectures (2026 specs).
## 1. Tool Calling (Function Calling)
When implementing tool calling for AI models (e.g., using `openai`, `anthropic`, or standard `LangChain` wrappers):
- **Deterministic Names:** Use clear, hyphenated or snake_case tool names (e.g., `get_weather_data`).
- **Strict Zod/Pydantic Schemas:** Always back tool parameters with explicit schema validation. Do not trust the LLM to output perfect JSON.
- **Fail Gracefully:** Inform the LLM if a tool call fails. Provide the stack trace or a summary back as the tool output message so the model can auto-correct.
## 2. RAG Architectures (Retrieval-Augmented Generation)
- **Vector Stores:** Favor standalone vector DBs (like Pinecone, Weaviate) or Postgres + `pgvector` for embedding storage.
- **Chunking Strategy:** Chunk documents semantically (by headers or paragraphs), not blindly by character count. Add metadata (e.g., source file, author) to chunks for filtering.
- **Hybrid Search:** Always implement a hybrid search approach (Dense Vector + BM25 Lexical search) to retrieve both high-level semantic matches and exact keyword matches.
## 3. Context & Prompt Management
- **Prompt Caching:** Optimize Anthropic or OpenAI API usage natively by anchoring static system prompts. Organize messages sequentially without injecting dynamic timestamps frequently into system instructions to prevent cache eviction.
- **Sliding Windows:** Maintain a bounded conversation history. Discard messages older than a specific turn threshold or token limit and inject an AI-generated summary back into the context.
## 4. Multi-Agent Orchestration
- When architecting multiple agents (like the `.opencode` architecture), define strict boundaries. Use a "Project Planner" agent to create an execution plan, and specialized agents limited in scope to execute individual steps.
在 GitHub 查看