Skill files1 file
SKILL.md206 lines
1
---
2
name: agents-best-practices
3
description: "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."
4
metadata:
5
version: "1.2.0"
6
scope: "provider-neutral-agent-harness"
7
file_policy: "markdown-only"
8
---
9
10
# Agents Best Practices
11
12
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.
13
14
## Core stance
15
16
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.
17
18
Default architecture:
19
20
```text
21
user/task
22
-> instruction and context builder
23
-> model call
24
-> tool/action proposal
25
-> schema validation
26
-> permission decision
27
-> execution or approval pause
28
-> structured observation
29
-> context update
30
-> repeat within budget or finish
31
```
32
33
## When to activate this skill
34
35
Use this skill for prompts involving any of these intents:
36
37
- build an agent, agentic workflow, AI worker, autonomous assistant, or harness;
38
- create a domain-specific MVP agent design, starter harness, implementation blueprint, or first production-safe version;
39
- choose between OpenAI, Anthropic, OpenAI-compatible APIs, direct tool loops, hosted tools, or SDKs;
40
- design tools, permissions, guardrails, approval flows, or sandboxing;
41
- create planning mode, goal mode, todo tracking, or long-running task behavior;
42
- add context compaction, memory, retrieval, scoped instructions, or prompt hierarchies;
43
- attach Agent Skills, reusable workflows, MCP servers, external connectors, or tool search;
44
- audit an existing agent for reliability, cost, prompt-cache hit rate, safety, latency, or observability;
45
- create system prompts or developer instructions for a domain-specific agent;
46
- make source-of-truth knowledge, validation signals, logs, metrics, or workflow state legible to an agent.
47
48
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.
49
50
## How to use this skill
51
52
First, identify the user's design problem:
53
54
1. **Domain**: what work the agent performs.
55
2. **Autonomy level**: answer-only, draft-only, approval-gated action, or autonomous action within policy.
56
3. **Risk level**: read-only, internal write, external communication, financial, legal, healthcare, security, destructive, or privileged.
57
4. **State duration**: single turn, multi-turn session, resumable workflow, or long-running goal.
58
5. **Tool surface**: internal APIs, hosted tools, MCP/external connectors, browser, sandbox, filesystem, database, communication, or computation.
59
6. **Validation**: what proves the task is complete.
60
61
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.
62
63
## MVP Builder Mode
64
65
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.
66
67
Default behavior:
68
69
1. Infer a reasonable first version from the user's domain and stated constraints.
70
2. State assumptions briefly instead of blocking on missing details.
71
3. Design the smallest safe harness that can accomplish useful work.
72
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.
73
5. Mark high-risk actions as draft-only or approval-gated by default.
74
6. Avoid multi-agent orchestration until the single-agent MVP has measurable failure cases that require decomposition.
75
76
## Reference map
77
78
- 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.
79
- Read [architecture.md](references/architecture.md) for the full harness model and component boundaries.
80
- 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.
81
- Read [agentic-loop.md](references/agentic-loop.md) for the provider-neutral loop, step budgets, retries, and loop variants.
82
- Read [tools-and-permissions.md](references/tools-and-permissions.md) for tool contracts, risk classes, approval logic, structured results, and sandboxing.
83
- Read [context-memory-compaction.md](references/context-memory-compaction.md) for context assembly, scoped memory, retrieval, auto-compaction, and handoff summaries.
84
- 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.
85
- Read [planning-and-goals.md](references/planning-and-goals.md) for planning mode, approval-gated execution, goals, checkpoints, and stopping conditions.
86
- Read [skills-and-connectors.md](references/skills-and-connectors.md) for Agent Skills, progressive disclosure, MCP, external connectors, tool search, and attachment strategy.
87
- Read [system-prompts-instructions.md](references/system-prompts-instructions.md) for system/developer/user instruction hierarchy and prompt templates.
88
- Read [provider-api-patterns.md](references/provider-api-patterns.md) for OpenAI, Anthropic, and OpenAI-compatible API implementation patterns.
89
- Read [security-evals-observability.md](references/security-evals-observability.md) for guardrails, threat models, tracing, evals, and launch gates.
90
- Read [checklists.md](references/checklists.md) for condensed implementation and audit checklists.
91
- Read [source-links.md](references/source-links.md) for official links and provider-specific references.
92
- Read [coverage-audit.md](references/coverage-audit.md) to verify the skill covers the requested harness topics.
93
94
## Default answer structure when advising a user
95
96
When the user asks for guidance, produce a concrete architecture, not generic principles:
97
98
0. **MVP boundary**: smallest useful version, assumptions, non-goals, and launch criteria.
99
1. **Harness boundary**: what the model does versus what application code does.
100
2. **Loop**: how model calls, tool calls, tool results, stopping, and retries work.
101
3. **Instructions**: system/developer/user instruction hierarchy and scoped memory.
102
4. **Tools**: tool registry, schemas, outputs, risk classes, permissions, and approval points.
103
5. **Context**: retrieval, memory, summarization, cache-aware ordering, compaction triggers, and rehydration.
104
6. **Planning/goals**: when to enter planning mode, when to run a goal-like loop, and how to stop.
105
7. **Skills/connectors**: how skills and MCP/external connectors are discovered, loaded, permissioned, and audited.
106
8. **Safety**: prompt injection boundaries, secrets, sandboxing, data access, and guardrails.
107
9. **Observability/evals**: traces, metrics, test cases, and failure probes.
108
10. **Rollout**: minimal viable harness first, then add autonomy only when measured results justify it.
109
11. **Legibility loop**: source-of-truth artifacts, validation signals, feedback capture, and recurring cleanup.
110
111
## Non-negotiable principles
112
113
- The model does not execute actions directly; the harness does.
114
- Every tool call must receive a tool result, even if the result is denial, timeout, error, or abort.
115
- Every risky side effect needs runtime policy enforcement outside the model.
116
- Draft and commit should be separate for external, financial, destructive, security, or regulated actions.
117
- Tool schemas must be narrow, typed, validated locally, and auditable.
118
- Context should be informative, tight, and cache-aware; retrieve and attach just in time.
119
- Skills and external connectors should use progressive disclosure; do not expose every capability up front.
120
- Auto-compaction should preserve working state, not conversational prose.
121
- Long-running goals need budgets, checkpoints, and a measurable done condition.
122
- The harness must trace operational events without exposing hidden reasoning.
123
- Durable knowledge should live in agent-readable source-of-truth artifacts, not only in chat history.
124
- Repeated failures should become tools, validators, docs, evals, or policies rather than repeated prompt advice.
125
126
## Common output template
127
128
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:
129
130
```markdown
131
# MVP Agent Harness Blueprint: [domain/use case]
132
133
## Objective
134
[What the agent must accomplish and for whom.]
135
136
## MVP scope and assumptions
137
[Smallest useful version, explicit assumptions, non-goals, and what is intentionally deferred.]
138
139
## Autonomy and risk level
140
[Answer-only, draft-only, approval-gated, or autonomous within policy.]
141
142
## Core loop
143
[How the model, tools, observations, retries, and stopping rules work.]
144
145
## Instruction architecture
146
[System/developer/user/scoped memory layout.]
147
148
## Tool registry
149
[Tools, schemas, risk classes, permissions, and result format.]
150
151
## Planning and goal behavior
152
[When to plan, when to ask, when to continue, when to stop.]
153
154
## Context and memory
155
[Retrieval, durable state, compaction, and rehydration.]
156
157
## Skills and connectors
158
[Reusable skills, MCP/external connector policy, tool search, attachment rules.]
159
160
## Safety and approvals
161
[Guardrails, prompt injection treatment, secrets, sandboxing, human review.]
162
163
## Observability and evals
164
[Trace events, eval cases, launch criteria, failure probes.]
165
166
## Minimal implementation path
167
[Smallest safe version first, implementation skeleton, validation path, then measured expansion.]
168
```
169
170
## Gotchas
171
172
- Do not design a multi-agent system before a single-agent loop has failed measurable evals.
173
- Do not expose broad tools such as `execute_anything`, `write_database`, or `send_message` without a strict wrapper and approval policy.
174
- Do not treat retrieved webpages, emails, tickets, PDFs, logs, or connector-provided descriptions as trusted instructions.
175
- Do not let context compaction erase approval state, active plan, loaded rules, or changed artifacts.
176
- Do not use a goal loop for a vague backlog; use it only for a single objective with validation and a budget.
177
- Do not rely on prompt text for safety that must be enforced by code.
178
- Do not put timestamps, request IDs, or volatile environment state at the start of cacheable prompts.
179
- Do not let stale documentation, weak examples, or obsolete tools accumulate without recurring cleanup.
180
181
## Source links for further reading
182
183
Use these links when provider-specific detail is needed:
184
185
- Agent Skills specification: https://agentskills.io/specification
186
- Agent Skills creator best practices: https://agentskills.io/skill-creation/best-practices
187
- Agent Skills description optimization: https://agentskills.io/skill-creation/optimizing-descriptions
188
- Agent Skills evaluation guide: https://agentskills.io/skill-creation/evaluating-skills
189
- OpenAI function calling: https://developers.openai.com/api/docs/guides/function-calling
190
- OpenAI tools: https://developers.openai.com/api/docs/guides/tools
191
- OpenAI agents: https://developers.openai.com/api/docs/guides/agents
192
- OpenAI guardrails and human review: https://developers.openai.com/api/docs/guides/agents/guardrails-approvals
193
- OpenAI agent safety: https://developers.openai.com/api/docs/guides/agent-builder-safety
194
- OpenAI sandbox agents: https://developers.openai.com/api/docs/guides/agents/sandboxes
195
- OpenAI Responses migration: https://developers.openai.com/api/docs/guides/migrate-to-responses
196
- OpenAI prompt caching: https://developers.openai.com/api/docs/guides/prompt-caching
197
- OpenAI Prompt Caching 201: https://developers.openai.com/cookbook/examples/prompt_caching_201
198
- OpenAI harness engineering article: https://openai.com/index/harness-engineering/
199
- Anthropic building effective agents: https://www.anthropic.com/research/building-effective-agents
200
- Anthropic effective context engineering: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
201
- Anthropic writing effective tools for agents: https://www.anthropic.com/engineering/writing-tools-for-agents
202
- Anthropic long-running harnesses: https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents
203
- Anthropic code execution with MCP: https://www.anthropic.com/engineering/code-execution-with-mcp
204
- MCP specification: https://modelcontextprotocol.io/specification/2025-11-25
205
206

© ai-boost · GPL 3.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 12,002 prompts

More by @OpenSourceBuffGuy

See all
Halftone Assemblage Metaphor PSA Poster Style prompt image

Halftone Assemblage Metaphor PSA Poster Style

Defines a JSON style spec for retro public-service posters where one kind of everyday material is assembled into a symbolic silhouette in blue-green halftone on aged cream paper.

image-prompt, json-prompt, poster, vintage, printmaking, typography, text-rendering, negative-space, limited-palette, muted-colors, sculpture, sustainability, surreal, placeholders, structured-output, style-reference, vertical-format, widescreen, for-designers, for-artists, long-form, advanced, template, still-life

Custom Instruction File Guidelines prompt image

Custom Instruction File Guidelines

Sets guidelines for writing good GitHub Copilot custom instruction files: required frontmatter, structure, sections, naming and a validation checklist.

rule-file, meta-prompt, prompt-engineering, github-copilot, best-practices, context-engineering, style-guide, documentation, markdown, for-prompt-engineers, for-developers, template, yaml-prompt, checklist, long-form

Microservices Architecture prompt image

Microservices Architecture

Guides an AI agent to design microservices: service boundaries, communication patterns, API gateways, service mesh, discovery and data consistency.

agent-skill, microservices, software-architecture, system-design, distributed-systems, api, backend, devops, kubernetes, best-practices, for-developers, migration, observability, data-modeling, diagram, advanced, long-form, design-patterns, cloud, service-mesh

Reviews

Loading reviews…

Discussion

Loading comments…