prompt-engineering
Best practices for engineering high-quality system prompts for AI agents with emphasis on XML structure, clarity, few-shot examples, and token efficiency. PROACTIVELY activate for: (1) system prompt creation and optimization, (2) instruction clarity improvement and few-shot example design, (3) XML tag structure implementation and prompt templates. Triggers: "system prompt", "optimize prompt", "prompt engineering"
What this skill does
# Prompt Engineering: Structured System Prompts for Production Agents ## Core Principles Effective system prompts are the foundation of reliable AI agents. Well-engineered prompts provide clear role definition, structured instructions, and concrete examples, while maintaining token efficiency and clarity. **Mandatory Standard**: All Vibekit agents MUST use XML tags to section system prompts for improved model comprehension. ## XML Tag Structure (Required Pattern) ### Standard XML Sections ```xml <role> You are a senior software architect specializing in Python development. Your expertise includes system design, API architecture, and database modeling. </role> <instructions> When analyzing a technical requirement: 1. Read the complete specification 2. Identify core components and their relationships 3. Propose a modular architecture 4. Document key decisions with rationale 5. Highlight potential risks and mitigations </instructions> <tools> You have access to the following tools: - file_reader: Read source code files - code_analyzer: Analyze code quality and patterns - diagram_generator: Create architecture diagrams Use tools when: - You need to examine existing code - Analysis requires data you don't have - Visual representation would clarify the design </tools> <output_format> Provide your response in this format: **Analysis Summary** [Brief overview of the system] **Architecture Proposal** [Detailed architecture description] **Key Decisions** 1. [Decision]: [Rationale] **Risks & Mitigations** [Identified risks with mitigation strategies] </output_format> <examples> Example 1: API Design Request User: "Design a REST API for user management" Assistant: [Shows complete structured response] Example 2: Database Schema Design User: "Create a schema for an e-commerce platform" Assistant: [Shows complete structured response] </examples> <constraints> - ALWAYS validate input before processing - NEVER expose sensitive information in responses - MUST follow the established architectural patterns - DO NOT make assumptions about undocumented requirements </constraints> ``` ### Why XML Tags? **Benefits**: 1. **Model Comprehension**: Large language models parse XML structure effectively, understanding section boundaries 2. **Maintainability**: Sections can be updated independently without affecting others 3. **Clarity**: Clear visual separation of different prompt components 4. **Composability**: Sections can be conditionally included or reused across prompts **Anthropic Research**: Claude models specifically benefit from XML-tagged prompts, showing improved adherence to instructions within tagged sections. ## Role Definition (Opening Section) ### Effective Role Patterns ```xml <role> You are [SPECIFIC TITLE] with [X] years of experience in [DOMAIN]. Your core competencies: - [Competency 1]: [Brief description] - [Competency 2]: [Brief description] - [Competency 3]: [Brief description] Your working style: - You ask clarifying questions before making assumptions - You provide step-by-step reasoning for complex decisions - You cite sources and acknowledge uncertainty when appropriate </role> ``` **Best Practices**: - Be specific (not "helpful assistant" but "senior DevOps engineer") - Include relevant experience areas - Define behavioral expectations (how agent should work) - Establish communication style **Anti-Pattern**: ```xml <!-- BAD: Vague and generic --> <role> You are a helpful AI assistant that answers questions. </role> <!-- GOOD: Specific and detailed --> <role> You are a principal software engineer specializing in distributed systems and microservices architecture. You have 10+ years designing large-scale systems at companies like Google and Netflix. Your strengths: - Trade-off analysis for architectural decisions - Performance optimization and scalability planning - Clear communication of complex technical concepts </role> ``` ## Instruction Structure (Core Logic) ### Hierarchical Instructions ```xml <instructions> ## Primary Objective [One-sentence goal statement] ## When you receive a request: ### Phase 1: Analysis 1. Read all provided context and requirements 2. Identify ambiguities and ask clarifying questions 3. List assumptions you're making 4. Note any missing information needed ### Phase 2: Planning 1. Break down the problem into logical components 2. Identify dependencies between components 3. Propose a high-level approach 4. Present the plan for user approval ### Phase 3: Execution (only after approval) 1. Implement the solution step-by-step 2. Document each decision with rationale 3. Run validation checks 4. Summarize what was accomplished ## Decision-Making Framework When choosing between options: - Evaluate technical feasibility - Consider maintainability and scalability - Assess security and performance implications - Document trade-offs clearly </instructions> ``` **Best Practices**: - Use hierarchical headings (##, ###) for organization - Number sequential steps - Define decision criteria explicitly - Separate analysis from execution - Include validation checkpoints **Anti-Pattern**: ```xml <!-- BAD: Unstructured wall of text --> <instructions> You should analyze the code and find bugs and suggest fixes and make sure the code is good and follows best practices and has tests and... </instructions> <!-- GOOD: Clear, structured steps --> <instructions> ## Code Review Process 1. **Syntax & Style** - Check for linting errors - Verify formatting compliance - Review naming conventions 2. **Logic & Correctness** - Trace execution paths - Identify edge cases - Check error handling 3. **Testing** - Verify test coverage (minimum 80%) - Review test quality - Suggest missing test cases </instructions> ``` ## Few-Shot Examples (Critical for Reliability) ### Effective Few-Shot Pattern ```xml <examples> ## Example 1: Simple Query <user_input> What's the best way to handle authentication in a REST API? </user_input> <assistant_response> **Analysis** You're asking about authentication strategies for REST APIs. This is a foundational security decision that affects the entire system. **Recommended Approach: JWT with Refresh Tokens** Rationale: - Stateless authentication (no server-side session storage) - Scalable across multiple servers - Includes expiration for security - Refresh token pattern prevents constant re-login **Implementation Pattern** 1. User login returns access token (short-lived, 15 min) + refresh token (long-lived, 7 days) 2. Access token sent in Authorization header: `Bearer <token>` 3. When access token expires, use refresh token to get new access token 4. Refresh tokens stored securely (HTTP-only cookies or secure storage) **Security Considerations** - Use HTTPS only - Implement token rotation - Add rate limiting on auth endpoints - Consider multi-factor authentication **Code Example** [Provides actual code implementation] </assistant_response> ## Example 2: Complex Design Task <user_input> Design a data pipeline for processing 1M events per second. </user_input> <assistant_response> **Clarifying Questions (Always Ask First)** 1. What's the event payload size? 2. What processing is required (filtering, enrichment, aggregation)? 3. What's the acceptable latency? 4. What's the retention period for raw data? 5. What's the budget constraint? [Assuming answers provided...] **Architecture Proposal** [Shows complete structured response with diagrams] </assistant_response> ## Example 3: Error Handling <user_input> How should I handle errors in async Python code? </user_input> <assistant_response> [Shows structured response with code examples and anti-patterns] </assistant_response> </examples> ``` **Why Few-Shot Works**: - Demonstrates expected response format - Shows reasoning process - Establishes quality bar - Reduces ambiguity **Guidelines**: - Include 3-5 diverse examples - Show edge cases (not just happy path) - Demonstrate clarifying questions - Inc
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.