agents-best-practices
Use this skill when designing, generating an MVP blueprint for, auditing, refactoring, or explaining an agentic harness for any domain. Covers provider-neutral agent architecture for OpenAI, Anthropic, and OpenAI-compatible APIs: agent loops, tool design, permissions, system prompts, planning, goals, context compaction, memory, skills, MCP/external connectors, observability, evals, prompt caching, agent-legible environments, feedback loops, and safety.
What this skill does
# Agents Best Practices Use this skill when the user asks how to build, improve, debug, or evaluate an agentic harness. This is a general-purpose agent architecture skill. Coding agents are one subdomain only; apply the same principles to research, finance, legal, support, operations, sales, healthcare, education, data analysis, procurement, and workflow automation agents. ## Core stance An agent harness is the control plane around a model. The model proposes actions; the harness validates, authorizes, executes, records, summarizes, and returns observations. Keep the loop simple and make the runtime rigorous. Default architecture: ```text user/task -> instruction and context builder -> model call -> tool/action proposal -> schema validation -> permission decision -> execution or approval pause -> structured observation -> context update -> repeat within budget or finish ``` ## When to activate this skill Use this skill for prompts involving any of these intents: - build an agent, agentic workflow, AI worker, autonomous assistant, or harness; - create a domain-specific MVP agent design, starter harness, implementation blueprint, or first production-safe version; - choose between OpenAI, Anthropic, OpenAI-compatible APIs, direct tool loops, hosted tools, or SDKs; - design tools, permissions, guardrails, approval flows, or sandboxing; - create planning mode, workflow orchestration, goal mode, todo tracking, or long-running task behavior; - add context compaction, memory, retrieval, scoped instructions, or prompt hierarchies; - attach Agent Skills, reusable workflows, MCP servers, external connectors, or tool search; - audit an existing agent for reliability, cost, prompt-cache hit rate, safety, latency, or observability; - create system prompts or developer instructions for a domain-specific agent; - make source-of-truth knowledge, validation signals, logs, metrics, or workflow state legible to an agent. Do not use this skill for ordinary single-turn writing, translation, or Q&A unless the user is asking about the design of an agent that will perform those tasks. ## How to use this skill First, identify the user's design problem: 1. **Domain**: what work the agent performs. 2. **Autonomy level**: answer-only, draft-only, approval-gated action, or autonomous action within policy. 3. **Risk level**: read-only, internal write, external communication, financial, legal, healthcare, security, destructive, or privileged. 4. **State duration**: single turn, multi-turn session, resumable workflow, or long-running goal. 5. **Tool surface**: internal APIs, hosted tools, MCP/external connectors, browser, sandbox, filesystem, database, communication, or computation. 6. **Validation**: what proves the task is complete. Then load the most relevant reference files, not all files by default. If the user asks to make or build an agent for a domain, default to MVP Builder Mode. ## MVP Builder Mode When the user asks to make, build, design, scaffold, or specify an agent for a domain, produce a concrete domain-specific MVP harness blueprint, not only advice. Use [mvp-agent-blueprint.md](references/mvp-agent-blueprint.md) as the primary reference and load other references as needed. Default behavior: 1. Infer a reasonable first version from the user's domain and stated constraints. 2. State assumptions briefly instead of blocking on missing details. 3. Design the smallest safe harness that can accomplish useful work. 4. Include the core agentic loop, tool registry, permission matrix, context/memory/compaction, planning mode, goal-like loop criteria, skills/connectors, prompt-cache/cost strategy, observability, evals, and launch path. 5. Mark high-risk actions as draft-only or approval-gated by default. 6. Keep the MVP to the smallest reliable single-loop harness unless the user explicitly asks for a broader architecture. ## Reference map - Read [mvp-agent-blueprint.md](references/mvp-agent-blueprint.md) first when the user asks to create a new domain-specific agent or MVP harness. - Read [coding-agents.md](references/coding-agents.md) when the requested agent reads, edits, tests, reviews, migrates, or opens changes against a software repository. - Read [architecture.md](references/architecture.md) for the full harness model and component boundaries. - Read [agent-legibility-feedback-loops.md](references/agent-legibility-feedback-loops.md) for source-of-truth knowledge bases, agent-legible environments, validation loops, mechanical invariants, and recurring cleanup. - Read [agentic-loop.md](references/agentic-loop.md) for the provider-neutral loop, step budgets, retries, and loop variants. - Read [tools-and-permissions.md](references/tools-and-permissions.md) for tool contracts, risk classes, approval logic, structured results, and sandboxing. - Read [context-memory-compaction.md](references/context-memory-compaction.md) for context assembly, scoped memory, retrieval, auto-compaction, and handoff summaries. - Read [prompt-caching-and-cost.md](references/prompt-caching-and-cost.md) for stable-prefix design, cache-aware context ordering, compaction/cache tradeoffs, telemetry, and cost control. - Read [planning-and-goals.md](references/planning-and-goals.md) for planning mode, approval-gated execution, goals, checkpoints, and stopping conditions. - Read [workflow-orchestration.md](references/workflow-orchestration.md) for planner-generated workflows, bounded work packets, worker/verifier contexts, integration, durable workflow state, and orchestration anti-patterns. - Read [skills-and-connectors.md](references/skills-and-connectors.md) for Agent Skills, progressive disclosure, MCP, external connectors, tool search, and attachment strategy. - Read [system-prompts-instructions.md](references/system-prompts-instructions.md) for system/developer/user instruction hierarchy and prompt templates. - Read [provider-api-patterns.md](references/provider-api-patterns.md) for OpenAI, Anthropic, and OpenAI-compatible API implementation patterns. - Read [security-evals-observability.md](references/security-evals-observability.md) for guardrails, threat models, tracing, evals, and launch gates. - Read [checklists.md](references/checklists.md) for condensed implementation and audit checklists. - Read [source-links.md](references/source-links.md) for official links and provider-specific references. - Read [coverage-audit.md](references/coverage-audit.md) to verify the skill covers the requested harness topics. ## Default answer structure when advising a user When the user asks for guidance, produce a concrete architecture, not generic principles: 0. **MVP boundary**: smallest useful version, assumptions, non-goals, and launch criteria. 1. **Harness boundary**: what the model does versus what application code does. 2. **Loop**: how model calls, tool calls, tool results, stopping, and retries work. 3. **Instructions**: system/developer/user instruction hierarchy and scoped memory. 4. **Tools**: tool registry, schemas, outputs, risk classes, permissions, and approval points. 5. **Context**: retrieval, memory, summarization, cache-aware ordering, compaction triggers, and rehydration. 6. **Planning/goals**: when to enter planning mode, when to run a goal-like loop, and how to stop. 7. **Workflow orchestration**: when to decompose into durable work packets, worker contexts, verifier contexts, and integration. 8. **Skills/connectors**: how skills and MCP/external connectors are discovered, loaded, permissioned, and audited. 9. **Safety**: prompt injection boundaries, secrets, sandboxing, data access, and guardrails. 10. **Observability/evals**: traces, metrics, test cases, and failure probes. 11. **Rollout**: minimal viable harness first, then add autonomy only when measured results justify it. 12. **Legibility loop**: source-of-truth artifacts, validation signals, feedback capture, and recurring cleanup. ## Non-negotiable principles - The model does not exec
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.