ai-agent-design
Skill4 starsChanged 9 months agoMITView on GitHub
Use this skill when building AI agents, designing multi-agent systems, integrating LLMs into applications, building RAG pipelines, working with vector databases, implementing MCP servers, or designing agent communication and orchestration patterns. Trigger on keywords like: agent, LLM, RAG, embeddings, vector DB, orchestration, tool use, memory, intent clarification, MCP, LangChain, LangGraph, CrewAI, AutoGen, Microsoft Agent Framework.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Muvon/octomind-taptheir own version, first seen Nov 12, 2026
- 05-deepak-patidar/claude-skillstheir own version, first seen Jul 7, 2026
- fabioc-aloha/alex-cognitive-architecturetheir own version, first seen Apr 26, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Muvon/octomind-tap★ 6same name
- 05-deepak-patidar/claude-skills★ 4same name
- fabioc-aloha/alex-cognitive-architecture★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository37 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- ai-assisted-learningSkill
- ai-prompting-patternsSkill
- api-designSkill
- backend-devSkill
- career-growthSkill
- client-communicationSkill
- code-explanationSkill
- code-readingSkill
- code-reviewSkill
- cross-functional-collabSkill
- database-designSkill
- debugging-mindsetSkill
- devops-cicdSkill
- doc-creationSkill
- focus-productivitySkill
- frontend-designSkill
- git-workflowSkill
- incident-responseSkill
- internal-commsSkill
- interview-prepSkill
- mcp-builderSkill
- performance-reviewSkill
- problem-solvingSkill
- prompt-engineeringSkill
- research-synthesisSkill
- resume-portfolioSkill
- self-healing-mindsetSkill
- side-project-planningSkill
- sprint-planningSkill
- system-designSkill
- technical-communicationSkill
- technical-mentoringSkill
- tech-researchSkill
- testingSkill
- threat-modelingSkill
- web-artifacts-builderSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 13 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 21
Before writing agent logic, generate a spec or task list file:
- Distinctive: line 73
Use semantic chunking — break on meaning, not character count
- Distinctive: line 75
Always include metadata: source, page, section, timestamp
- Distinctive: line 123
Always validate tool outputs before passing to the next step
- Distinctive: line 132
When an agent receives an ambiguous request:
- Distinctive: line 169
Use MCP when the tool needs to be reusable across multiple agents/platforms
- Distinctive: line 170
Use direct integration for project-specific, one-off tool implementations
- Distinctive: line 180
Validate and sanitize: all inputs before passing to tools
- Distinctive: line 183
Use system prompt injection protection — separate user input from system instructions with clear delimiters
- Distinctive: line 214
Run tests/lint on generated code before presenting
- Distinctive: line 215
Verify output format matches requirements
- Distinctive: line 216
Use a separate validator step (different model or prompt) to check generator output
- Distinctive: line 217
Never present unverified output as done
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AI Agent Design
Core Philosophy
Agents are not magic — they are systems with inputs, outputs, memory, tools, and decision logic. Design them with the same rigor as any production software. Every agent should have a clear purpose, defined boundaries, and explicit failure modes.
Agent Design Principles
1. Clarify Intent Before Acting
An agent must ask clarifying questions when the user's intent is ambiguous — before executing any irreversible action. Use this pattern:
- Is the goal clear? If not, ask one focused question.
- Are the constraints known? (scope, output format, data sources)
- What does success look like?
2. Specification Before Code
Before writing agent logic, generate a spec or task list file:
- Define the agent's role and responsibilities
- List all tools it needs access to
- Define input/output contracts
- Identify failure modes and fallback behavior
- Then write the code
3. Single Responsibility
Each agent should do one thing well. Prefer a team of specialized agents over one general-purpose agent.
Orchestration Patterns
| Pattern | When to Use | Description |
| Sequential | Linear pipelines | Agents chain in fixed order (draft → review → publish) |
| Supervisor | Complex multi-module tasks | Lead agent routes to specialized workers |
| ReAct | Autonomous problem solving | Combines reasoning (Thought) + acting (Tool Use) |
| Group Chat | Collaborative tasks | Multi-agent communication with human oversight |
| DAG | Stateful workflows | Directed acyclic graph for cyclical, stateful orchestration |
Framework Selection Guide
| Framework | Best For | Status |
| LangGraph | Complex stateful agents, cyclical workflows, multi-agent orchestration, production-grade | ✅ Active — GA May 2025 |
| LangChain | Simple RAG pipelines, linear workflows, quick prototypes | ✅ Active — use for RAG, not for agents |
| CrewAI | Role-based multi-agent teams ("Manager", "Researcher", "Writer") | ✅ Active |
| Microsoft Agent Framework | Enterprise agents in Azure ecosystem — replaces AutoGen + Semantic Kernel | ✅ Active — Public Preview Oct 2025, GA targeted Q1 2026 |
| AutoGen | Legacy — still works but no new features | ⚠️ Maintenance mode since Oct 2025 |
| Custom (MCP) | Lightweight, portable, interoperable agent tools via open standard | ✅ Active |
LangChain vs LangGraph — Which to Use
The LangChain team now explicitly recommends this split:
- LangGraph → for agents: stateful, cyclical, multi-agent, long-running tasks
- LangChain → for RAG and linear pipelines: simple document Q&A, step-by-step transforms
LangGraph is built on top of LangChain — you can use both together, starting with LangChain and dropping to LangGraph when you need more control.
RAG Pipeline Design
Standard RAG Flow
User Query → Embed Query → Vector Search → Retrieve Chunks → Augment Prompt → LLM → ResponseChunking Strategy (2026 Best Practice)
- Use semantic chunking — break on meaning, not character count
- Chunk size: 256–512 tokens for precision; 1024 for narrative content
- Always include metadata: source, page, section, timestamp
Hybrid Search (Recommended)
Combine dense vectors (semantic) + sparse vectors (keyword) for best recall:
Final Score = α × Dense Score + (1 - α) × Sparse ScoreVector Database Selection
| DB | Best For |
| pgvector | Existing PostgreSQL stack, simple use cases |
| Pinecone | Managed, production-scale, minimal ops |
| Weaviate | Multi-modal, hybrid search built-in |
| Milvus | High-performance, self-hosted, large scale |
| Chroma | Local dev, prototyping |
Agent Memory Architecture
| Type | Description | Implementation |
| In-context | Current conversation window | Chat history array |
| External short-term | Session-scoped memory | Redis / in-memory store |
| External long-term | Persistent across sessions | Vector DB + metadata |
| Episodic | Summarized past interactions | Summarization chain → vector store |
Context Rot Warning: Long context windows degrade agent quality over time. Implement a summarization step every N turns to maintain relevance.
Tool Use & Function Calling
Tool Definition Pattern
Every tool needs:
name: descriptive_tool_name
description: When to use this tool and what it does (be explicit)
parameters:
- name: param_name
type: string
description: What this parameter expects
required: trueTool Use Best Practices
- Tools should be idempotent where possible
- Always validate tool outputs before passing to the next step
- Implement timeouts and retries for external tool calls
- Log all tool invocations for debugging
Agent Communication Patterns
Intent Clarification Protocol
When an agent receives an ambiguous request:
- Identify the ambiguity — what specifically is unclear?
- Ask one question — the most important one, not all of them
- Propose a default — "I'll assume X unless you tell me otherwise"
- Confirm before irreversible actions — always ask before deleting, publishing, or sending
Progress Reporting
For long-running tasks, agents should report:
[Step 1/4] Fetching documents... ✓
[Step 2/4] Chunking and embedding... ✓
[Step 3/4] Querying vector store...Error Communication
✗ Tool failed: [tool_name]
Reason: [specific error]
Fallback: [what I'm doing instead]MCP (Model Context Protocol)
MCP is the open standard for connecting agents to external tools and data sources. Use it when building portable, interoperable agent tools.
MCP Server Structure
my-mcp-server/
├── server.py (or index.ts)
├── tools/
│ └── my_tool.py
└── README.mdWhen to Use MCP vs Direct Integration
- Use MCP when the tool needs to be reusable across multiple agents/platforms
- Use direct integration for project-specific, one-off tool implementations
See mcp-builder skill for detailed MCP server implementation guidance.
Security & Safety
- Never allow agents to execute arbitrary code without sandboxing
- Implement rate limiting on all LLM API calls
- Validate and sanitize all inputs before passing to tools
- Log all agent decisions for auditability
- Implement guardrails to prevent runaway token costs or recursive loops
- Use system prompt injection protection — separate user input from system instructions with clear delimiters
Resilient Agent Design (Self-Healing)
Agents fail in production. Design for recovery from the start.
Validate-and-Retry Loop (LoopAgent Pattern)
Generate output → Validate output → If invalid: feedback + regenerate
Max iterations: 3 ← circuit breaker to prevent infinite loopsPlan–Validate–Execute–Observe–Replan
PLAN: Generate plan, check feasibility before acting
EXECUTE: Take action
OBSERVE: Did it succeed? Check outputs, run tests
REPLAN: If observation shows failure → adjust and retry
STOP: If max retries hit → report failure clearly, ask for helpAgent Fallback Hierarchy
Primary approach fails → Try alternative approach
Alternative fails → Request clarification from developer
Clarification absent → Safe default action or graceful stopOutput Validation Before Presenting
- Run tests/lint on generated code before presenting
- Verify output format matches requirements
- Use a separate validator step (different model or prompt) to check generator output
- Never present unverified output as done
Circuit Breaker for Agents
Set hard limits to prevent runaway behavior:
- Max tool call iterations per task (e.g. 10)
- Max token spend per session
- Max retries per failing step (e.g. 3)
- Timeout per tool invocation
See self-healing-mindset skill for the full resilience philosophy and code patterns.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

