
Agents Best Practices
FreeDesign and evaluate agent architectures effectively.
Free · Opens the source repo
What Agents Best Practices does
The Agents Best Practices skill provides a comprehensive framework for designing, generating, and auditing agentic harnesses across various domains. This skill is particularly useful for developers and designers who are looking to build or improve agents for tasks in research, finance, healthcare, and more. It emphasizes a provider-neutral approach, allowing users to work with OpenAI, Anthropic, and other compatible APIs. The skill covers essential components of agent architecture, including agent loops, tool design, permissions, and memory management, ensuring that users can create robust and adaptable agents.
When utilizing this skill, users can expect guidance on constructing an agent's control plane, where the model proposes actions while the harness validates and executes them. The default architecture outlined in the skill helps users maintain a clear and efficient loop, enabling them to focus on building reliable agents that can adapt to changing environments. The skill also delves into advanced topics such as recursive harnesses, programmable context, and continual refinement, making it suitable for both novice and experienced developers.
This skill is ideal for anyone involved in agent design, whether they are creating a new agent from scratch or refining an existing one. It provides a structured approach to address various intents, such as developing an MVP agent, designing workflows, or implementing safety measures. By following the guidelines and modes outlined in the skill, users can ensure that their agents are not only functional but also safe and efficient.
In summary, the Agents Best Practices skill serves as a vital resource for those looking to navigate the complexities of agent architecture. It offers practical insights and methodologies that can be applied across multiple domains, making it a valuable addition to any developer's toolkit.
When to use it
Activate this skill when you need to build, improve, or audit an agentic harness for any specific domain.
When not to use it
Avoid this skill for simple writing or translation tasks that do not involve agent design.
What you can build with it
Creating a Finance Agent
Use this skill to design an agent that automates financial reporting and analysis.
Auditing a Healthcare Agent
Apply the skill to evaluate an existing healthcare agent for compliance and reliability.
Building an Education Assistant
Leverage the skill to create an agent that supports personalized learning experiences.
How to install Agents Best Practices
View source1. Install with the skills CLI
npx skills add denissergeevitch/agents-best-practices --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by denissergeevitchAgents 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:
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;
- design an agent for a partially known or changing environment using capability discovery, safe probing, runtime binding, schema verification, or drift invalidation;
- create planning mode, workflow orchestration, goal mode, todo tracking, or long-running task behavior;
- add context compaction, memory, retrieval, scoped instructions, or prompt hierarchies;
- design a recursive language model (RLM), programmable-context runtime, self-refining or continual harness, retained child agents, daemon-backed or scheduled agent, or executable skills;
- 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:
- Domain: what work the agent performs.
- Autonomy level: answer-only, draft-only, approval-gated action, or autonomous action within policy.
- Risk level: read-only, internal write, external communication, financial, legal, healthcare, security, destructive, or privileged.
- State duration: single turn, multi-turn session, resumable workflow, or long-running goal.
- Tool surface: internal APIs, hosted tools, MCP/external connectors, browser, sandbox, filesystem, database, communication, or computation.
- 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 as the primary reference and load other references as needed.
Default behavior:
- Infer a reasonable first version from the user's domain and stated constraints.
- State assumptions briefly instead of blocking on missing details.
- Design the smallest safe harness that can accomplish useful work.
- 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.
- Mark high-risk actions as draft-only or approval-gated by default.
- Keep the MVP to the smallest reliable single-loop harness unless the user explicitly asks for a broader architecture.
Environment-Adaptive Tool Mode
Use this mode when the useful tool catalogue, schemas, versions, or implementations are late-bound rather than fully configured before the run. Read environment-adaptive-tools.md together with the standard tool, connector, security, and eval references.
Require a small trusted bootstrap interface, host-owned capability ledger, provenance-labeled descriptors, bounded read-only or isolated probes, opaque scope-and-version bindings, call-time permission checks, and drift invalidation. Discovery, generated code, and inferred schemas must never grant authority. Keep this post-MVP unless adapting to changing environments is the product's primary job; even then, establish a fixed read-only baseline first.
Advanced Recursive and Continual Harness Mode
Use this mode only when the user explicitly asks for programmable context, recursive execution, retained children, continual refinement, executable skills, or daemon/scheduled autonomy. Treat it as post-MVP: establish a measured single-loop baseline first, then read self-refining-recursive-harnesses.md together with the context, workflow, permission, security, and eval references.
Make the context representation, recursive unit, mutable state, promotion scope, lifecycle, budgets, validation probes, and rollback path explicit. Keep base authority, permission enforcement, credentials, budgets, and evaluation policy outside the mutable surface.
Reference map
- Read mvp-agent-blueprint.md first when the user asks to create a new domain-specific agent or MVP harness.
- Read coding-agents.md when the requested agent reads, edits, tests, reviews, migrates, or opens changes against a software repository.
- Read architecture.md for the full harness model and component boundaries.
- Read 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 for the provider-neutral loop, step budgets, retries, and loop variants.
- Read tools-and-permissions.md for tool contracts, risk classes, approval logic, structured results, and sandboxing.
- Read environment-adaptive-tools.md when the tool environment is partially known or changes at runtime and needs bootstrap discovery, schema validation, safe probing, exact binding, or drift handling.
- Read context-memory-compaction.md for context assembly, scoped memory, retrieval, auto-compaction, and handoff summaries.
- Read 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 for planning mode, approval-gated execution, goals, checkpoints, and stopping conditions.
- Read workflow-orchestration.md for planner-generated workflows, bounded work packets, worker/verifier contexts, integration, durable workflow state, and orchestration anti-patterns.
- Read self-refining-recursive-harnesses.md for strict RLM and RLM-inspired patterns, programmable context, recursive execution units, retained children, continual refinement, executable skills, and long-running lifecycle controls.
- Read skills-and-connectors.md for Agent Skills, progressive disclosure, MCP, external connectors, tool search, and attachment strategy.
- Read system-prompts-instructions.md for system/developer/user instruction hierarchy and prompt templates.
- Read provider-api-patterns.md for OpenAI, Anthropic, and OpenAI-compatible API implementation patterns.
- Read security-observability.md for guardrails, threat models, approval records, trace design, launch safety gates, and incident response.
- Read evals.md for evaluation strategy, adversarial test cases, trace grading, regression evals, and eval-driven launch criteria.
- Read checklists.md for condensed implementation and audit checklists.
- Read source-links.md for official links and provider-specific references.
- Read 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:
- MVP boundary: smallest useful version, assumptions, non-goals, and launch criteria.
- Harness boundary: what the model does versus what application code does.
- Loop: how model calls, tool calls, tool results, stopping, and retries work.
- Instructions: system/developer/user instruction hierarchy and scoped memory.
- Tools: tool registry, schemas, outputs, risk classes, permissions, and approval points.
- Environment adaptation, when requested: stable bootstrap, discovery, descriptor provenance, safe probes, exact bindings, drift invalidation, and fallback.
- Context: retrieval, memory, summarization, cache-aware ordering, compaction triggers, and rehydration.
- Planning/goals: when to enter planning mode, when to run a goal-like loop, and how to stop.
- Workflow orchestration: when to decompose into durable work packets, worker contexts, verifier contexts, and integration.
- Skills/connectors: how skills and MCP/external connectors are discovered, loaded, permissioned, and audited.
- Safety: prompt injection boundaries, secrets, sandboxing, data access, and guardrails.
- Observability: traces, metrics, replay, auditability, and incident readiness.
- Evals: test cases, failure probes, trace grading, regression suites, and launch criteria.
- Rollout: minimal viable harness first, then add autonomy only when measured results justify it.
- Legibility loop: source-of-truth artifacts, validation signals, feedback capture, and recurring cleanup.
- Advanced recursive/continual profile, when requested: context handles, recursive unit, retained lifecycle, mutable state boundary, observed validation, promotion, and rollback.
Non-negotiable principles
- The model does not execute actions directly; the harness does.
- Every tool call must receive a tool result, even if the result is denial, timeout, error, or abort.
- Every risky side effect needs runtime policy enforcement outside the model.
- Draft and commit should be separate for external, financial, destructive, security, or regulated actions.
- Tool schemas must be narrow, typed, validated locally, and auditable.
- A changing capability catalogue must enter through a trusted bootstrap contract; discovery, schema inference, and generated helpers never create permissions.
- Context should be informative, tight, and cache-aware; retrieve and attach just in time.
- Skills and external connectors should use progressive disclosure; do not expose every capability up front.
- Auto-compaction should preserve working state, not conversational prose.
- Long-running goals need budgets, checkpoints, and a measurable done condition.
- Workflow orchestration needs durable packet state, independent verification, integration rules, and total budget enforcement.
- Recursive and continual harnesses may mutate only typed supplemental state; immutable runtime policy must validate changes, preserve authority boundaries, and support rollback.
- The harness must trace operational events without exposing hidden reasoning.
- Durable knowledge should live in agent-readable source-of-truth artifacts, not only in chat history.
- Repeated failures should become tools, validators, docs, evals, or policies rather than repeated prompt advice.
Common output template
Use this template when the user wants a harness design. If the user asks to make/build an agent, use this as an MVP blueprint, not a purely conceptual answer:
# MVP Agent Harness Blueprint: [domain/use case]
## Objective
[What the agent must accomplish and for whom.]
## MVP scope and assumptions
[Smallest useful version, explicit assumptions, non-goals, and what is intentionally deferred.]
## Autonomy and risk level
[Answer-only, draft-only, approval-gated, or autonomous within policy.]
## Core loop
[How the model, tools, observations, retries, and stopping rules work.]
## Instruction architecture
[System/developer/user/scoped memory layout.]
## Tool registry
[Tools, schemas, risk classes, permissions, and result format.]
## Planning and goal behavior
[When to plan, when to ask, when to continue, when to stop.]
## Context and memory
[Retrieval, durable state, compaction, and rehydration.]
## Skills and connectors
[Reusable skills, MCP/external connector policy, tool search, attachment rules.]
## Safety and approvals
[Guardrails, prompt injection treatment, secrets, sandboxing, human review.]
## Observability
[Trace events, metrics, replay, auditability, and incident response.]
## Evals
[Eval cases, failure probes, trace grading, regression suites, and launch criteria.]
## Minimal implementation path
[Smallest safe version first, implementation skeleton, validation path, then measured expansion.]
Gotchas
- Do not design a multi-agent system before a single-agent loop has failed measurable evals.
- Do not expose broad tools such as
execute_anything,write_database, orsend_messagewithout a strict wrapper and approval policy. - Do not treat retrieved webpages, emails, tickets, PDFs, logs, or connector-provided descriptions as trusted instructions.
- Do not let context compaction erase approval state, active plan, loaded rules, or changed artifacts.
- Do not use a goal loop for a vague backlog; use it only for a single objective with validation and a budget.
- Do not use workflow orchestration for work that one linear loop can complete cheaply and reliably.
- Do not call a harness self-improving merely because it accumulates memory, or promote a self-authored change without an observed probe and rollback path.
- Do not rely on prompt text for safety that must be enforced by code.
- Do not put timestamps, request IDs, or volatile environment state at the start of cacheable prompts.
- Do not let stale documentation, weak examples, or obsolete tools accumulate without recurring cleanup.
- Do not claim unknown-environment operation without a stable bootstrap interface, exact runtime bindings, and invalidation when the environment changes.
Source links for further reading
Use these links when provider-specific detail is needed:
- Agent Skills specification: https://agentskills.io/specification
- Agent Skills creator best practices: https://agentskills.io/skill-creation/best-practices
- Agent Skills description optimization: https://agentskills.io/skill-creation/optimizing-descriptions
- Agent Skills evaluation guide: https://agentskills.io/skill-creation/evaluating-skills
- OpenAI function calling: https://developers.openai.com/api/docs/guides/function-calling
- OpenAI tools: https://developers.openai.com/api/docs/guides/tools
- OpenAI agents: https://developers.openai.com/api/docs/guides/agents
- OpenAI guardrails and human review: https://developers.openai.com/api/docs/guides/agents/guardrails-approvals
- OpenAI agent safety: https://developers.openai.com/api/docs/guides/agent-builder-safety
- OpenAI sandbox agents: https://developers.openai.com/api/docs/guides/agents/sandboxes
- OpenAI Responses migration: https://developers.openai.com/api/docs/guides/migrate-to-responses
- OpenAI prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
- OpenAI Prompt Caching 201: https://developers.openai.com/cookbook/examples/prompt_caching_201
- OpenAI harness engineering article: https://openai.com/index/harness-engineering/
- Anthropic building effective agents: https://www.anthropic.com/research/building-effective-agents
- Anthropic effective context engineering: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Anthropic writing effective tools for agents: https://www.anthropic.com/engineering/writing-tools-for-agents
- Anthropic long-running harnesses: https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
- Anthropic code execution with MCP: https://www.anthropic.com/engineering/code-execution-with-mcp
- MCP specification: https://modelcontextprotocol.io/specification/2026-07-28
Frequently asked questions about Agents Best Practices
Similar skills
Agent Skill Stack
Assemble compatible AI Agent Skills for workflows.
AI Team Orchestration
Streamline multi-agent development workflows.
Advisor Orchestrator Worker
Efficiently manage complex tasks with multiple AI models.
Agent Orchestrator
Automate multi-agent workflows with zero manual intervention.
Agent Governance
Implement safety and trust controls for AI agents.
Microsoft Foundry
End-to-end management for Microsoft Foundry agents.
