agentic-ai-skills
AGENTS.md1 starsChanged 4 months agoMITView on GitHub
Canonical source of truth. All tool-specific rule files are generated from this file. Run scripts/sync-rules.sh after editing. Run validate.sh to verify parity. Build production-grade agentic AI systems. Every decision optimizes for debuggability, safety, cost control, and graceful failure. Ship the simplest thing that works, then layer complexity only when measurably justified. All code is async-first Python 3.12+. Pick the simplest level that works. Most production systems are Level 1-3. Golden Rule: Start at Level 0. Move up only when the…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,196 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
15 rules. About 1 is common, 11 are distinctive, and 3 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Golden Rule: Start at Level 0. Move up only when the current level demonstrably fails.
- Distinctive: line 62
Never trust LLM output without validation against tool results and schemas.
- Common: line 94
Never put credentials in prompts or memory.
- Very specific: line 118
Use adaptive thinking (thinking={"type": "adaptive"}) with output_config.effort.
- Very specific: line 120
Default effort to high; drop to medium/low for routine or latency-bound work.
- Distinctive: line 131
Follow the test pyramid. Gate CI/CD on eval results.
- Distinctive: line 134
Run every commit. Must cover: SQL safety blocks mutations, guardrails block injections, sandbox prevents network, memory enforces limits, …
- Distinctive: line 138
Run every PR. Must cover: agent calls tools then answers, agent respects limits, fallback works on primary failure, output validation …
- Distinctive: line 142
Verify: expected tools used, answer contains keywords, resource bounds met, no errors.
- Distinctive: line 144
Eval gate: Every prompt or tool change must pass eval dataset before merge.
- Very specific: line 148
Avoid these. Detailed diagnostics live in the agent-debug skill.
- Distinctive: line 167
Add input guardrails — schema validation, injection detection.
- Distinctive: line 168
Add output guardrails — PII scrubbing, schema validation, grounding.
- Distinctive: line 172
Write unit tests — every tool, guardrail, parser (10+ each).
- Distinctive: line 173
Write integration tests — mock LLM, test the loop.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agentic AI Production Rules
Canonical source of truth. All tool-specific rule files are generated from this file. Run
scripts/sync-rules.shafter editing. Runvalidate.shto verify parity.
Project Overview
Build production-grade agentic AI systems. Every decision optimizes for debuggability, safety, cost control, and graceful failure. Ship the simplest thing that works, then layer complexity only when measurably justified. All code is async-first Python 3.12+.
Architecture Rules
Pick the simplest level that works. Most production systems are Level 1-3.
- Level 0 — Single LLM call. Use when no tools needed, single-turn.
- Level 1 — Prompt chain. Use for fixed, predictable step sequences.
- Level 2 — Router. Use when multiple known task types need specialized handlers.
- Level 3 — Tool-using agent (ReAct). Use when tool selection is dynamic.
- Level 4 — Multi-agent. Use only when agents need different permissions or models.
- Level 5 — Autonomous. Use sparingly for open-ended exploration.
Golden Rule: Start at Level 0. Move up only when the current level demonstrably fails.
Decision path: no tools → L0/L1; fixed sequence → L1/L2; dynamic tools → L3; split permissions → L4; open-ended → L5.
Tool Design Rules
Tools determine agent quality more than prompts. Follow all six principles:
- Verb-noun names —
run_sql,create_chart, notdo_stuff. - Rich descriptions — State WHEN to use, WHAT it returns, and edge cases.
- Constrained parameters — Use enums, patterns, min/max. No unconstrained strings.
- Small and focused — 10 small tools > 3 god-tools. Limit 3-7 tools per agent.
- Idempotent — Safe to retry without side effects where possible.
- Structured output — Return typed data, not free-form text. Enforce it with
output_config.format(JSON schema) orstrict: trueon the tool definition.
Expose tools via MCP (Model Context Protocol) for cross-platform interoperability. Past ~10 tools, defer loading and let tool search surface the relevant few per turn rather than splitting the work across more agents.
Safety Rules
Apply defense-in-depth. Every request passes through a 6-layer pipeline:
Input layers:
- Schema validation — Pydantic models, length limits, type checks.
- Content filtering — Regex for injection patterns, encoding normalization.
- ML classification — Prompt injection detector, toxicity filter.
- Semantic analysis — Intent classification, data exfiltration detection.
Processing layers: 5. Tool guardrails — Per-tool permissions, sandboxed execution, argument validation. 6. Output guardrails — PII scrubbing, schema validation, hallucination grounding check.
Non-negotiable safety rules:
- Detect and block: "ignore previous instructions", encoding bypass, HTML injection.
- SQL tools: Allow only SELECT. Block INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE.
- Wrap all external content in
<untrusted_content>markers. - Sandbox code execution: network=none, filesystem read-only, resource limits, non-root.
- Never trust LLM output without validation against tool results and schemas.
Reliability Rules
Retry policy:
- Exponential backoff with jitter:
base_delay * 2^attempt, capped at max_delay. - Max 3 attempts. Only retry transient errors: timeout, 429, 5xx, connection.
Circuit breaker:
- Track failures per provider. Open after 3 consecutive failures.
- Cooldown 30 seconds. Half-open allows one probe request. Success resets counter.
Model fallback chain:
- Primary → Fallback 1 → Fallback 2. Skip providers with open circuits.
Graceful degradation levels:
- Full agent with all tools.
- Agent without code execution.
- Direct LLM response, no tools.
- Cached response for similar queries.
- Polite error message with recovery ETA.
Dead letter queue:
- Store failed tasks for manual review and replay. Alert if DLQ > 50 items.
Context Rules
- Compaction — summarize earlier turns as context fills. Append the full response content back, not just the text, or the compaction state is lost.
- Context editing — clear stale tool results and thinking blocks when old outputs are no longer relevant, instead of summarizing them.
- Memory — persist learnings to files for anything that must survive the session.
- Never put credentials in prompts or memory. Both persist in history and replay.
Observability Rules
Trace every span. Emit structured events for: run start/end, LLM call/response, tool call/result, guardrail checks, errors. Use Langfuse or LangSmith.
Five alert rules:
- HighErrorRate — failures/total > 10% for 5 min → CRITICAL.
- CostSpike — cost > $10/hour → WARNING.
- HighLatency — P95 > 60s for 10 min → WARNING.
- AllProvidersDown — All LLM circuits open → CRITICAL.
- DLQGrowing — Dead letter queue > 50 items → WARNING.
Cost Rules
Per-request budgets (enforce before every LLM call):
max_cost_usd: default $0.50.max_tokens: default 100,000.max_iterations: default 10, hard cap 50.timeout_seconds: default 120, hard cap 600.- Truncate large tool outputs at 10,000 chars.
Reasoning depth:
- Use adaptive thinking (
thinking={"type": "adaptive"}) withoutput_config.effort. A fixedbudget_tokensis removed on current models and returns a 400. - Default
efforttohigh; drop tomedium/lowfor routine or latency-bound work. - Give agentic loops a
task_budgetso the model paces itself.max_tokenstruncates mid-thought; a task budget lets it finish gracefully.
Three caching strategies:
- Exact cache — Same question → same answer. TTL 1 hour.
- Semantic cache — Similarity > 0.95 → cached answer.
- Prompt cache — Mark stable system prompt with
cache_control. 90% cost reduction.
Testing Rules
Follow the test pyramid. Gate CI/CD on eval results.
Unit tests (10+ per component): Tools, guardrails, parsers, memory. Run every commit. Must cover: SQL safety blocks mutations, guardrails block injections, sandbox prevents network, memory enforces limits, each tool works in isolation.
Integration tests (3-5): Mock LLM agent loop, tool chaining, fallback logic. Run every PR. Must cover: agent calls tools then answers, agent respects limits, fallback works on primary failure, output validation catches issues.
E2E golden trajectories (5-10): Real LLM calls. Run nightly or pre-release. Verify: expected tools used, answer contains keywords, resource bounds met, no errors.
Eval gate: Every prompt or tool change must pass eval dataset before merge.
Anti-Patterns
Avoid these. Detailed diagnostics live in the agent-debug skill.
- Premature multi-agent — Use single agent with good tools first.
- God Agent — Keep 3-7 tools per agent, not 20+.
- No iteration limits — Always set max_iterations, max_tokens, max_cost.
- LLM for everything — Use code for precision, LLM for judgment.
- Raw API exposure — Wrap APIs in focused tool interfaces.
- Fire-and-forget — Trace every step, alert on anomalies.
- Trust the output — Validate against tool results and schemas.
- Monolithic prompt — Assemble prompts dynamically per context.
- No fallbacks — Always implement fallback chain + circuit breaker.
- Skipping eval — Gate CI/CD on eval for every change.
Quick-Start Checklist
- Define scope — what agent can and cannot do.
- Pick architecture level 0-5 (start at 0).
- Design tools first — clear schemas, rich descriptions, focused scope.
- Set all limits — max_iterations, max_tokens, max_cost, timeout.
- Add input guardrails — schema validation, injection detection.
- Add output guardrails — PII scrubbing, schema validation, grounding.
- Sandbox code execution — network=none, memory limits, non-root.
- Implement retry + fallback — exponential backoff, circuit breaker, model fallback.
- Trace everything — LLM calls, tool calls, decisions.
- Write unit tests — every tool, guardrail, parser (10+ each).
- Write integration tests — mock LLM, test the loop.
- Build eval dataset — 10+ golden trajectories, grow from production failures.
- Set up metrics — error rate, latency, cost, tool calls per run.
- Set up alerts — error spike, cost spike, latency, provider outage.
- Version prompts — store in YAML, review in PRs, gate on eval.
- Plan for incidents — DLQ, graceful degradation, runbook.
- Deploy with canary — progressive rollout with auto-rollback.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

