an agent skill · the AI layer of the Build stage

/ai

Ask an agent to "add AI" and it wires a single SDK call to a model it named from memory — no eval, no guardrail, a price quote three months stale. ai builds the model-powered behavior — model routing, the context harness, structured outputs, tools/MCP, the agent loop, RAG, memory, evals, guardrails, and AI cost — re-verifying every volatile fact against the live source, pruning the harness instead of only adding to it, and proving the system works with a real eval before it calls the job done.

# natural language — no flags, no fixed pipeline /ai build a grounded support agent — route a cheap model, add RAG with citations, then prove it with an eval set

runs onClaude CodeCodexCursorAntigravityopencodeGrok BuildHermes

The router is the skill. There is no fixed pipeline to run start-to-finish — each job stands alone and enters where your request is. The animation traces one path; the sections below map the whole surface it routes across.

Own the cognition, not the substrate

ai owns the model-powered behavior — the part of a product whose core uncertainty or capability comes from a model: model choice and routing, the prompt/context harness, structured outputs, tool and MCP consumption, the agent loop, retrieval behavior, memory, evals, guardrails, and AI-specific cost and observability. It is the intelligence layer of the Build stage — peer of frontend and backend. It references the substrates the cognition runs on rather than re-teaching or overriding them: backend serves, data governs, frontend renders, quality verifies, operate runs.

ai owns

the cognition & the decision record behind it

  • model choice + routing — price-per-intelligence pick, cascade, honest degradation, open-vs-closed
  • the prompt/context harness — attention budget, JIT retrieval, compaction, prune-before-add
  • structured output + tools/MCP — typed contracts, the agent loop, tool/MCP consumption
  • retrieval + memory — RAG behavior, chunk→hybrid→rerank→agentic, durable memory
  • evals ⭐ — the completion gate: dataset, aligned judge, harness, pass^k
  • guardrails + AI cost/telemetry — controls table, OTel-GenAI, cost-lever ordering

references / hands off to

consume or recommend; own none

  • architecture — upstream: boundaries, NFR budget, threat model, build-vs-buy
  • backend — MCP/tool endpoints, vector-store-as-served, gateways, durable infra
  • data — governed pipelines + the vector store as a dataset, retention/PII
  • frontend — chat UI and the streaming render
  • quality · operate — the independent gate; the deploy & monitoring platform
  • automation — deterministic multi-system workflows, even when one step calls a model

Implement inside the decision. When compatible upstream artifacts are supplied — a solution-architecture doc, contracts, an NFR budget, a threat model, a handoff.yaml — ai builds against them. When they don't exist (a standalone run), it says so explicitly rather than inventing a contract or threat model to fill the gap.

The faceted router

SKILL.md is a router, not a script. Every request selects the smallest sufficient route: one primary job — the ten below — combined with at most one base surface that reshapes how the job applies to the deployment shape, plus the additive multi-agent overlay when the system is also multi-agent. Read the selected references completely; load two or three at most, never the whole pack. Ten jobs and five surfaces compose across deployment shapes without ever reading all sixteen references at once.

facetoptionsrule
① Primary job routing · context-engineering · structured-outputs · tools/MCP · agent-construction · RAG · memory · evaluation ⭐ · guardrails · observability&cost Exactly one. Pick the single job the request needs; the default entry is the surface's spine (e.g. retrieval for a RAG app).
② Base surface chat-assistant (default / start-simplest) · autonomous-agent · rag-app · batch-and-pipeline At most one. The deployment shape reshapes how every job applies — it points to the job references, it doesn't redefine them.
③ Multi-agent overlay surface-multi-agent — orchestrated specialists on top of a base shape Additive. Stacks on top of the base surface, never replaces it. A multi-agent RAG app is rag-app + multi-agent.
Retrieval-first before any code — or any model name. The model/SDK/price/spec layer changes monthly; memorized names and numbers are stale. Before generating any provider-specific code or quoting a model, price, version, or spec revision, re-verify it against the live source — pricing pages, npm view/PyPI, HF model cards, the spec changelog. Our own research literally caught a stale model cache; the method is the deliverable, never a frozen value.

The ten primary jobs

Each job is one reference, read fully only when its route is selected — grounded in named canon, producing a running implementation plus the decision record behind it. This is the whole surface, not a headline slice.

I need to…ReadGrounded inProduces
Pick/route a model or provider · set a cost/latency/effort budget · add fallback/degradation · decide open-vs-closed / self-host model-selection-and-routing.md price-per-intelligence · routing cascade · open ≠ open-source Cost-aware model pick, routing cascade (the #1 cost lever), fallback that degrades honestly, effort knobs, license read
Engineer the prompt/context harness — attention budget, JIT retrieval, compaction, note-taking — or prune an over-grown one prompt-and-context-engineering.md whole-token-budget · Model/Harness/Agent · long-horizon levers Curated token budget, progressive disclosure, long-horizon levers, harness-hygiene / prune-before-add discipline
Get typed/structured output or conformant tool arguments · pick constrained-decoding vs reask/retry vs provider-native structured-outputs.md schema-first (Zod / Pydantic) · three enforcement mechanisms Schema-first contract, the three enforcement mechanisms + when each, tool-arg conformance
Design/consume tool calls or integrate MCP · decide direct-API vs CLI vs MCP · build against the MCP spec/SDKs tool-and-mcp-integration.md typed + validate-retry · MCP anatomy · spec → SDK pin-v1 → registry Tool contract (typed + validate-retry), MCP build chain, direct/CLI/MCP decision
Build an agent — the loop, termination, multi-agent shape, durability decision, framework pick agent-construction.md workflow-vs-agent · four multi-agent shapes + when-NOT · durable execution Workflow-vs-agent shape, tool contract, four multi-agent shapes + when-NOT, durable-execution + license flag, framework pick with what-NOT
Add retrieval/RAG behavior — chunking, embeddings, hybrid search, rerank, agentic retrieval, vector-store choice retrieval-and-rag.md contextual/late chunk → hybrid + RRF → rerank → agentic · pgvector-default 5-stage pipeline, pgvector-default vector-store decision, retrieval eval'd separately
Give the system durable memory across turns / sessions memory.md short-vs-long-term · fact-store / temporal-KG / self-editing / ontology Short-vs-long-term split, four philosophies as options, benchmark-subordinated recall eval
Prove the system works — build a dataset, an aligned judge, a harness, a CI gate evaluation.md error-analysis-first · Critique-Shadowing judge + jury · pass^k Error-analysis taxonomy, aligned judge + jury, three harness shapes, offline/online/regression/safety, pass^k
Add guardrails/safety — moderation, rails, validators, code-exec guards, approval gates, red-team guardrails-and-safety.md uniform 5-way controls table · prompt self-verification Controls table (control→impl→verified) + self-audit, self-verification, validate-the-guardrail-like-a-judge
Instrument AI cost and behavior — traces, token/cost/latency/cache telemetry, online-eval monitors observability-and-cost.md OTel-GenAI gen_ai.* · cache-as-architecture · cost-lever ordering Vendor-neutral OTel-GenAI semconv, cache-as-architecture, cost-lever ordering (cascade→cache→batch), license-pattern read

Full router table & invariants: SKILL.md.

Five surface overlays

One base surface, at most, reshapes every job for the deployment shape — the same eval job is bounded differently on an interactive assistant than on an unattended batch pipeline. The multi-agent overlay is additive — it stacks on top of whichever base you picked, never replaces it — and carries a distinct teal identity throughout this page.

Chat assistant surface-chat-assistant.md

Streaming, conversational, human-in-loop (the default / start-simplest): single-call-before-loop default, session-scoped memory, online-eval fit, a lighter (self-verification) guardrail posture.

reshapessingle-call default · session memory · online eval

Autonomous agent surface-autonomous-agent.md

Long-horizon loop, tools, runs unattended: compaction / JIT / note-taking / sub-agent isolation as structural, harness-hygiene on every model upgrade, approval-gate default, the durable-execution border, pass^k.

reshapescompaction · approval gate · durability · pass^k

RAG / knowledge app surface-rag-app.md

Retrieval-centric, grounded, citation-bearing: retrieval-and-rag is the spine, citations as a schema contract, cite-or-retract as the load-bearing guardrail, index-staleness as a monitored failure.

reshapesretrieval spine · citation schema · cite-or-retract

Batch / pipeline surface-batch-and-pipeline.md

Offline classify/extract at scale, no human in loop: cheap-tier routing default, cost-lever ordering (cascade → batch's flat 50% → cache → effort floor), schema-heavy output, offline/regression eval only.

reshapescheap-tier routing · batch 50% · schema-heavy

Multi-agent additive ⭐

Orchestrator + tool-scoped specialists — not swarms. Carries the honest when-NOT-to-multi-agent (coordination cost, ~15× tokens), four shapes, per-base composition — it stacks on top of the base surface, never replaces it.

reshapesorchestrator · when-NOT · ~15× tokens · per-base

The evaluation flagship

Most of the field treats evals as an afterthought; here evals are the completion gate. A route never asserts "it works" from memory — it builds the dataset error-analysis-first, aligns a binary judge against human labels, runs the right suites, and reports pass^k for reliability. This is the distinctive that separates a demo from a system, and it is a first-class job, not a footnote.

Evals are the completion gate — error-analysis-first, aligned judge, pass^k. Never asserted from memory.

The eval is an artifact, built like one

# evals are the completion gate, not an afterthought
dataset:     error-analysis-first  # open-code failures → taxonomy
judge:       binary + aligned      # precision/recall vs human labels
method:      Critique-Shadowing    # + jury for high-stakes
suites:      offline · online · regression · safety
reliability: pass^k                # not a single lucky pass
subtract:    decompose the judge   # one axis per call, not one mega-rubric

What to trust — and what not to

  • aligned judgebinary, validated on precision/recall vs human labels — trustworthy
  • raw LLM-as-judgeun-calibrated, drifts, over-scores its own family — align it first
  • a benchmark scoreengagement, not proof — >50% of SWE-bench "passes" are unmergeable

Four suites, each answering a different question

  • offlinedid this change regress the golden set before ship?
  • onlineis production drifting? monitored, not one-shot
  • safetyred-team + guardrail suite — validate the guardrail like a judge
The sharp distinction: ai builds evals into the product — the completion gate that says a route is done. quality verifies independently — the adversarial release gate. Both exist on purpose; ai never claims quality's gate, and never asserts a pass it didn't run. Eval concerns are first-class:
error taxonomyaligned binary judgejury for high-stakespass^k reliabilitycite-or-retractsafety / red-team suite

What makes this different

Two stances set ai apart from the vendor-SDK collections and single-topic skills: it subtracts where the field only adds, and it treats the churning model/price/license layer as a first-class, date-stamped concern rather than frozen trivia.

Verify-and-subtract, not just assemble

Every recommendation names what to build, what NOT to build, and what to remove. The field is loud on adding and silent on pruning — be the exception.

  • prune the harness — better models need less scaffolding; strip it on every upgrade
  • budget the tokens — cheaper ≠ less spend; design for prompt caching first
  • decompose the judge — one axis per call, not one mega-rubric that hides drift
  • decide when NOT to multi-agent — coordination cost, ~15× tokens; a single agent often wins
  • distrust benchmarks — build the domain-specific eval before trusting a leaderboard

Anti-staleness & the license spread

The model/price/version layer churns monthly — our own research caught a stale model cache. Every volatile fact is date-stamped and re-verified; volatile_facts travels in the handoff so a frozen value can't leak downstream.

  • re-verify before quoting — pricing page · npm view/PyPI · HF card · spec changelog
  • open ≠ open-source — a restricted weights license is not MIT/Apache; read it
MIT / Apache
truly open — use, modify, resell freely
Llama / open-weights
weights out, restricted license — acceptable-use + scale caps
BSL / SSPL / ELv2
source-available — self-host yes, resell no (open-core cluster)

The universal invariants

Six rules govern every route, whichever references it loads — the behavioral spine, condensed.

What a pass produces

ai's deliverable is a running behavior plus the decision record behind it, closed on an eval that was run, not asserted. A full pass emits up to four kinds of artifact — the behavior, its eval suite, its guardrails/telemetry, and the fillable checklists that ship in the pack — plus the machine-readable handoff.yaml companion when downstream work is expected. Each records the decision and options, the trade-off accepted (including what was removed), and — for any model/SDK fact — the date it was verified and how to re-verify it.

phase 1inspectrequest, codebase, upstream artifacts
phase 2routeone job · ≤1 base · +multi-agent
phase 3re-verifyvolatile model/SDK facts, live
phase 4produceconcrete pick + what-NOT, subtract
phase 5proveeval by surface · pass^k

The running behavior

agent loop · RAG pipeline · routing cascade

The model-powered behavior itself — the implementation, not a plan — wired to the chosen surface and provider.

The eval suite

assets/eval-harness-starter.md · llm-judge-rubric-template.md

A dataset, an aligned judge, and the harness — run, with pass^k reported, not an assertion.

Guardrails & telemetry

guardrails-controls-checklist · otel-genai-observability-checklist

The controls table (control→impl→verified) and the OTel-GenAI fields — uniform, with a self-audit count.

Decision worksheets

model-selection-scorecard · context-budget-worksheet · rag-pipeline-checklist

Fillable scorecards for the model pick, the token budget, and the retrieval pipeline — the record behind the call.

Agent & tool contract

assets/agent-loop-and-tool-contract-checklist.md

The loop, termination, and typed tool contract — checked, not narrated, with the when-NOT-to-multi-agent call.

handoff.yaml + volatile_facts

assets/handoff.yaml · references/handoff.md

The routing index into the behavior, its evals, and telemetry — carrying volatile_facts so frozen model numbers can't leak.

The handoff seam

ai consumes architecture's artifacts upstream — boundaries, NFR budgets, the threat model, build-vs-buy — and, when downstream build/verify work is expected, emits a compact handoff.yaml beside the running behavior: a routing index into the behavior, eval suite, guardrails, and telemetry, never a copy of them, always carrying volatile_facts. Standalone by default; the companion appears only when a consumer will actually read it.

ai builds

skill: ai
status: complete
objective: ""   # only required field
artifacts_created: [behavior, evals,
  guardrails, telemetry]
decisions: · assumptions: · constraints:
evaluation: suite run · pass^k reported
volatile_facts: [model, price, ver +
  date + re-verify pointer]
recommended_next: quality · operate
  · backend · frontend · data

quality · operate

The behavior plus its eval suite and safety border for the independent red-team and release gate, and the AI-specific telemetry to deploy and monitor the running system.

backend · frontend · data

The tool/MCP + vector-store contract to serve, the streaming shape to render, and the retrieval behavior whose governed pipeline and dataset live with data.

Seam discipline. The running behavior and its eval suite are the real deliverables; if a consumer needs more than the index gives, the artifact itself is incomplete — the yaml never grows to compensate. Every volatile model/SDK/price/spec fact leaves date-stamped with a re-verify pointer. Never silently invoke a build skill; name it in recommended_next.

Start here

Install once. It's a plain SKILL.md router — no flags, no config, no scripts — so it activates on natural-language phrasing ("route a cheaper model", "add RAG with citations", "write an eval set", "add a guardrail", "build the agent loop", "instrument token cost") rather than a fixed command.

# skills.sh ecosystem (installs globally to supported clients) npx skills add gabros20/ai-skill -g -y # clone + installer (per-host targets) git clone https://github.com/gabros20/ai-skill && cd ai-skill ./install.sh codex # or: claude | cursor | antigravity | opencode | grok | hermes | agents | all # use — natural language, any host /ai route a cheaper model for the classifier and add a fallback that degrades honestly /ai build a multi-agent research assistant with RAG, then prove it with an eval set # → rag-app + multi-agent /ai write an eval harness with an aligned judge and report pass^k

The same install runs on any Agent Skills host. Codex installs to ${CODEX_HOME:-$HOME/.codex}/skills and triggers with $ai; agents remains a separate cross-agent installation target.

install targets by host
hostinstall targetcommand
Claude Code~/.claude/skills./install.sh claude
Codex${CODEX_HOME:-$HOME/.codex}/skills./install.sh codex
Cross-agent path~/.agents/skills./install.sh agents
Cursor CLI~/.cursor/skills./install.sh cursor
Antigravity (IDE + agy)~/.gemini/…/skills./install.sh antigravity
opencode~/.config/opencode/skills./install.sh opencode
Grok Build~/.grok/skills./install.sh grok
Hermes~/.hermes/skills./install.sh hermes

Prefer npx skills add gabros20/ai-skill -g -y when you have Node — it maps supported clients itself.

what's in the repo
skills/ai/ the skill: SKILL.md (router) + 16 references/ + assets/ docs/ installation · usage · recipes site/ this guide — deploys to aiengskill.vercel.app install.sh installer (claude | codex | cursor | antigravity | opencode | grok | hermes | agents | all) README.md · CHANGELOG.md · LICENSE

More docs: docs/installation.md · docs/usage.md · docs/recipes.md.