AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Agent Llm

skill-ksed8-cc-loopkit-agent-llm · by ksed8

Patterns for building on the Claude/Anthropic API — agent loops, tool design, prompt structure, structured output, context management, prompt caching, and evals. Use when writing code that calls Claude, designing an agentic loop, defining tools for an LLM, building RAG or an LLM-judge, or debugging refusals, truncation, streaming, or tool-call failures.

— No reviews yet
0 installs
33 views
0.0% view→install

Install

$ agentstack add skill-ksed8-cc-loopkit-agent-llm

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • ✓ Prompt-injection patterns
  • ✓ Secret / credential exfiltration
  • ✓ Dangerous shell & filesystem operations
  • ✓ Untrusted network calls
  • ✓ Known-malicious package signatures

What it can access

  • ✓ Network access No
  • ✓ Filesystem access No
  • ✓ Shell / process execution No
  • ✓ Environment & secrets No
  • ✓ Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ksed8-cc-loopkit-agent-llm)

Reliability & compatibility

✓ Security review passed
0 installs to date
— no reviews yet
● 2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Agent Llm? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Agent & LLM Patterns (Claude)

Guidance for writing application code that calls Claude well. This is about how to structure the integration, not the API surface.

Before writing any code that names a Claude model, calls the Anthropic SDK, or picks a model tier, load the claude-api skill — it has current model IDs, pricing, limits, and parameter details. Do not hardcode model IDs or pricing from memory; they go stale.

Prompt structure

  • Put stable, cacheable content first (system prompt, tool defs, long context); put the variable turn last. This maximizes prompt-cache hits.
  • Be explicit about the output contract. If you need JSON, say the exact shape and provide one example. Don't ask for "JSON" and hope.
  • Give the model an escape hatch ("if you cannot determine X, return null") so it stops fabricating to satisfy the format.
  • Separate instructions from data with clear delimiters (XML tags work well). Never interpolate untrusted user text directly into an instruction sentence — treat it as data inside a tag.

Tool design

  • One tool = one capability with a crisp verb name. Overlapping tools cause the model to dither.
  • The description is the prompt the model reads to decide when to call — write it for that decision, not as API docs. State when to use it and when NOT to.
  • Make schemas strict: enums over free strings, required fields marked, no ambiguous optional soup. A tight schema removes a class of retries.
  • Return errors the model can act on. {"error":"row not found","hint":"check the id"} beats a stack trace. The model reads tool results as its next observation.
  • Prefer returning structured data over prose from a tool; let the model narrate.

Agentic loops

  • The loop is: model → tooluse → you execute → toolresult → model, until it stops calling tools. Keep executing until there are no more tool calls, then surface the final text.
  • Bound the loop (max iterations / token budget) so a confused model can't spin forever. Log each step's tool + args for debuggability.
  • For structured final output, force a terminal tool call (a submit/finish tool with the result schema) rather than parsing prose — validation happens at the tool layer and the model retries on mismatch.
  • Isolate side-effecting tools (writes, sends, deletes) behind confirmation or a dry-run flag when the loop is autonomous.

Context management

  • Don't dump whole files/tables into context — retrieve the relevant slice. More context is slower, costlier, and dilutes attention.
  • For long-running agents, summarize prior steps into a compact running state rather than carrying the full transcript.
  • RAG: retrieve, then cite. Have the model quote the source span it used so answers are checkable; return null/"not found" when retrieval is empty instead of guessing.

Prompt caching

  • Cache the system prompt, tool definitions, and any large shared context (5-minute TTL). Structure calls so the cached prefix is byte-identical across requests.
  • A single changed byte early in the prompt busts the whole downstream cache — keep volatile content (timestamps, user turn) at the end.

Evals — don't ship a prompt you haven't measured

  • Build a small labeled set of real inputs with expected outputs before tuning the prompt. "It looked good in the playground" is not a signal.
  • Use an LLM-judge only for fuzzy criteria; for anything checkable (JSON valid? field present? number in range?) assert it in code.
  • Track a regression set. When you change the prompt or model, re-run it — prompt changes have non-local effects.
  • Measure cost and latency alongside quality; the cheapest model that passes the eval wins.

Common failure modes

  • Refusals / cutoffs / streaming / tool-call bugs: load claude-api and check the model's limits and the exact request shape before assuming a logic bug.
  • Truncated output: the response hit max_tokens — raise it or ask for less, don't retry blindly.
  • Model ignores the format: your instruction and your example disagree, or the format is buried mid-prompt. Move it to the end and make the example match exactly.
  • Non-determinism in tests: set temperature: 0 for eval runs; assert on structure/invariants, not exact wording.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.