git clone https://github.com/shareAI-lab/learn-claude-code.git--- name: agent-builder description: | Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI system" (2) want to understand agent architecture, agentic patterns, or autonomous AI (3) need help with capabilities, subagents, planning, or skill mechanisms (4) ask about Claude Code, Cursor, or similar agent internals (5) want to build agents for business, research, creative, or operational tasks Keywords: agent, assistant, autonomous, workflow, tool use, multi-step, orchestration --- # Agent Builder Build AI agents for any domain - customer service, research, operations, creative work, or specialized business processes. ## The Core Philosophy > **The model already knows how to be an agent. Your job is to get out of the way.** An agent is not complex engineering. It's a simple loop that invites the model to act: ``` LOOP: Model sees: context + available capabilities Model decides: act or respond If act: execute capability, add result, continue If respond: return to user ``` **That's it.** The magic isn't in the code - it's in the model. Your code just provides the opportunity. ## The Three Elements ### 1. Capabilities (What can it DO?) Atomic actions the agent can perform: search, read, create, send, query, modify. **Design principle**: Start with 3-5 capabilities. Add more only when the agent consistently fails because a capability is missing. ### 2. Knowledge (What does it KNOW?) Domain expertise injected on-demand: policies, workflows, best practices, schemas. **Design principle**: Make knowledge available, not mandatory. Load it when relevant, not upfront. ### 3. Context (What has happened?) The conversation history - the thread connecting actions into coherent behavior. **Design principle**: Context is precious. Isolate noisy subtasks. Truncate verbose outputs. Protect clarity. ## Agent Design Thinking Before building, understand: - **Purpose**: What should this agent accomplish? - **Domain**: What world does it operate in? (customer service, research, operations, creative...) - **Capabilities**: What 3-5 actions are essential? - **Knowledge**: What expertise does it need access to? - **Trust**: What decisions can you delegate to the model? **CRITICAL**: Trust the model. Don't over-engineer. Don't pre-specify workflows. Give it capabilities and let it reason. ## Progressive Complexity Start simple. Add complexity only when real usage reveals the need: | Level | What to add | When to add it | |-------|-------------|----------------| | Basic | 3-5 capabilities | Always start here | | Planning | Progress tracking | Multi-step tasks lose coherence | | Subagents | Isolated child agents | Exploration pollutes context | | Skills | On-demand knowledge | Domain expertise needed | **Most agents never need to go beyond Level 2.** ## Domain Examples **Business**: CRM queries, email, calendar, approvals **Research**: Database search, document analysis, citations **Operations**: Monitoring, tickets, notifications, escalation **Creative**: Asset generation, editing, collaboration, review The pattern is universal. Only the capabilities change. ## Key Principles 1. **The model IS the agent** - Code just runs the loop 2. **Capabilities enable** - What it CAN do 3. **Knowledge informs** - What it KNOWS how to do 4. **Constraints focus** - Limits create clarity 5. **Trust liberates** - Let the model reason 6. **Iteration reveals** - Start minimal, evolve from usage ## Anti-Patterns | Pattern | Problem | Solution | |---------|---------|----------| | Over-engineering | Complexity before need | Start simple | | Too many capabilities | Model confusion | 3-5 to start | | Rigid workflows | Can't adapt | Let model decide | | Front-loaded knowledge | Context bloat | Load on-demand | | Micromanagement | Undercuts intelligence | Trust the model | ## Resources **Philosophy & Theory**: - `references/agent-philosophy.md` - Deep dive into why agents work **Implementation**: - `references/minimal-agent.py` - Complete working agent (~80 lines) - `references/tool-templates.py` - Capability definitions - `references/subagent-pattern.py` - Context isolation **Scaffolding**: - `scripts/init_agent.py` - Generate new agent projects ## The Agent Mindset **From**: "How do I make the system do X?" **To**: "How do I enable the model to do X?" **From**: "What's the workflow for this task?" **To**: "What capabilities would help accomplish this?" The best agent code is almost boring. Simple loops. Clear capabilities. Clean context. The magic isn't in the code. **Give the model capabilities and knowledge. Trust it to figure out the rest.**
1. **Define Requirements:** Clearly outline the agent’s purpose, core functions, and integrations. Use the prompt template to structure your inputs (e.g., `[USE_CASE] = 'automate customer onboarding'`, `[TOOLS_OR_FRAMEWORK] = 'LangChain + FastAPI'`). 2. **Gather Data:** Collect datasets for fine-tuning (e.g., support tickets, internal documentation) and APIs for integrations (e.g., CRM, payment gateways). Tip: Use tools like `pandas` to clean and preprocess data before training. 3. **Prototype:** Start with a minimal viable agent (e.g., classify queries + static responses) before adding complexity. Use tools like `LangSmith` to debug and iterate on prompts. 4. **Deploy:** Choose a deployment method based on scale: - **Local:** Use `FastAPI` or `Flask` for small-scale agents. - **Cloud:** Deploy on `AWS Lambda` (serverless) or `Google Cloud Run` for scalability. - **Containerized:** Package with `Docker` for reproducibility. 5. **Monitor & Iterate:** Track performance metrics (e.g., accuracy, response time) using tools like `Prometheus` or `Datadog`. Retrain models quarterly with new data. Tip: For complex agents, break the build into phases (e.g., Phase 1: Query classification, Phase 2: Response generation).
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/shareAI-lab/learn-claude-code/tree/main/skills/agent-builderCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Build a custom AI agent for [USE_CASE] using [TOOLS_OR_FRAMEWORK]. The agent should include: [CORE_FUNCTIONS], [INPUT_OUTPUT_SPECIFICATIONS], and [INTEGRATIONS]. Ensure it follows [BEST_PRACTICES] for [SCALABILITY/SECURITY/MAINTAINABILITY]. Provide a step-by-step implementation guide with code snippets.
### Custom AI Agent for Customer Support Automation
**Agent Name:** SupportBot Pro
**Purpose:** Automate 80% of Tier-1 customer support queries for a SaaS company with 5,000+ users.
**Core Functions:**
1. **Query Classification:** Uses a fine-tuned BERT model to categorize incoming tickets into: Billing, Technical, Feature Request, or General Inquiry (92% accuracy).
2. **Knowledge Base Lookup:** Queries a vector database (Pinecone) with embeddings from 10,000+ support articles to retrieve relevant solutions.
3. **Response Generation:** Generates contextual responses using a 7B-parameter LLM (Mistral-7B-Instruct) fine-tuned on company-specific data.
4. **Escalation Logic:** Routes complex queries to human agents via Slack API when confidence score < 75% or ticket is labeled "Technical."
5. **Feedback Loop:** Logs user ratings (thumbs up/down) to improve future responses.
**Input/Output Specifications:**
- **Input:** User query (text), user metadata (account tier, past interactions).
- **Output:** Structured JSON response with:
```json
{
"response": "string",
"confidence": 0.85,
"escalation_needed": false,
"suggested_articles": ["article_id_1", "article_id_2"],
"next_steps": ["escalate_to_agent", "suggest_related_issue"]
}
```
**Integrations:**
- **Slack:** Posts escalated tickets to #support-escalations channel with @mention to on-call agent.
- **Stripe API:** Fetches billing details for "Billing" queries to verify subscription status.
- **Zapier:** Triggers a follow-up email via Mailchimp for unresolved tickets after 24 hours.
**Implementation Guide:**
1. **Setup Environment:**
```bash
pip install langchain pinecone-client transformers slack_sdk stripe
```
2. **Fine-tune LLM:** Use the company’s support ticket dataset (10,000 samples) to fine-tune Mistral-7B with LoRA (4-bit quantization for efficiency).
3. **Deploy Vector DB:** Create a Pinecone index with 1536-dimensional embeddings from support articles (chunked into 512-token segments).
4. **Build Agent Logic:** Use LangChain’s AgentExecutor to chain the classification model, knowledge base lookup, and response generator.
5. **Add Monitoring:** Log all interactions to Datadog for performance tracking and error analysis.
**Expected Outcomes:**
- Reduces average response time from 2.3 hours to 5 minutes.
- Decreases human agent workload by 65% (measured via ticket volume).
- Improves customer satisfaction (CSAT) from 78% to 89% within 3 months.
**Next Steps:**
- A/B test with 20% of users to validate performance.
- Add multi-language support (Spanish, French) using a translation API.
- Implement proactive notifications for common issues (e.g., "Your trial is expiring in 3 days").skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan