kmaruthi2002/universal-llm-skills/ai-agents-and-tool-use

Claude Code and agent skill by kmaruthi2002/universal-llm-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Design, build, and debug LLM agents and tool-using systems: deciding between a fixed workflow and an autonomous agent, the agent loop and its stopping conditions, designing tools (names, schemas, descriptions, return values, error messages), planning, short- and long-term memory, multi-agent orchestration and delegation, human-in-the-loop approval, guardrails on actions, cost and runaway control, and tracing. Use when building an agent, giving a model function or tool calling, writing tool definitions, orchestrating sub-agents, or when an agent loops, picks the wrong tool, hallucinates tool arguments, or takes unsafe actions. For MCP server specifics use mcp-server-development; for general LLM plumbing use llm-application-development.

Install

npx vskill@latest install kmaruthi2002/universal-llm-skills/ai-agents-and-tool-use

SKILL.md

The same SKILL.md was published earlier as kmaruthi2002/universal-llm-skills/ai-agents-and-tool-use.

AI Agents and Tool Use

An agent is a model running in a loop: it observes, decides on an action (usually a tool call), receives the result, and repeats until it judges the task done. That loop is powerful because the model chooses the path, and dangerous for the same reason. Good agent engineering is about giving the model excellent tools and clear goals, bounding what it can do, and making every step visible.

Scope

Covers: workflow-vs-agent decisions, loop design, tool design, planning, memory, multi-agent patterns, human approval, action guardrails, cost control, and testing agents.

Neighbours: mcp-server-development (exposing tools via the Model Context Protocol), llm-application-development (API plumbing, streaming, retries), prompt-engineering (system prompt wording), ai-safety-and-guardrails (threat model, injection), llm-evaluation (measuring agent success), workflow-automation (non-LLM automation).

Workflow or agent?

The most important decision, and most often made wrongly in the agent direction.

FactorPrefer a workflow (fixed steps, model used inside steps)Prefer an agent (model chooses steps)
Step sequenceKnown in advanceDepends on what is discovered along the way
Variability of inputsLow to moderateHigh; open-ended tasks
Need for predictability, auditabilityHigh (compliance, finance)Tolerates variation
Cost and latency sensitivityHighCan afford extra calls
Error toleranceLowErrors are recoverable or reviewed
TestingEasy per stepHarder; requires trajectory-level evaluation

Middle grounds are often best: a workflow with one agentic step ("research this sub-question with up to five searches"), or an agent restricted to a small toolset with mandatory checkpoints. Start with the simplest structure, and add autonomy only where measurement shows the rigid version fails.

Core principles

1. Tools are an interface for a model user — design them like a good API

The model knows only the tool's name, description, and schema. It cannot read your source code. Vague names, ambiguous parameters, and silent failures produce wrong calls. Invest in tool design as you would in a public API — arguably more, because this user cannot ask questions.

2. The environment's feedback drives the loop

Agents improve their next step based on tool results. Results that are informative (clear errors, relevant data, hints about what to do next) make the agent self-correcting. Results that are empty, huge, or cryptic make it flail.

3. Bound everything

Maximum iterations, maximum tokens, maximum wall-clock time, maximum spend, and a limited set of permitted actions. An unbounded agent will eventually loop, and a looping agent with a credit card is an incident.

4. Authority stays with the system, not the model

The model proposes actions; your code decides whether they are allowed. Authorisation uses the real user's identity and permissions. Consequential or irreversible actions need explicit human confirmation or a policy check outside the model. Anything the agent reads (web pages, emails, documents, tool outputs) can contain injected instructions; the agent's privileges should be such that obeying an injection cannot cause serious harm.

5. Make the trajectory observable

Every thought (where exposed), tool call, argument, result, and decision must be logged and replayable. Agent bugs are trajectory bugs: the failure is often several steps before the visible symptom.

6. Fewer, better tools beat many overlapping ones

Each additional tool adds selection ambiguity and context cost. Overlapping tools (three ways to search) cause inconsistent choices. Consolidate where tools serve one intent.

Discovering context

  • What task does the agent accomplish, and how is success judged? Write down three to five realistic tasks end to end, including a failure case.
  • What actions are needed, and which of them are reversible, consequential, or external (sending messages, spending money, deleting, deploying)?
  • What systems will the tools touch, and what credentials and scopes are available? Can you get narrower ones?
  • Who is the human in the loop, if any, and how fast can they respond?
  • What does the harness or framework already provide (loop, tool registry, memory, tracing)? Use the project's existing framework conventions if there is one. Check current documentation for the model's tool-calling format, parallel tool calls, and limits.
  • Budgets: acceptable cost and time per task.

The agent loop

A minimal loop:

  1. Build context: system prompt (goal, rules, tool guidance), task, relevant memory, history so far.
  2. Call the model with tool definitions.
  3. If it requests tool calls: validate arguments, check authorisation and policy, execute (possibly in parallel if independent), capture results or errors, append to history.
  4. If it returns a final answer, or a stop condition triggers, exit.
  5. Otherwise go to 1.

Design decisions in the loop:

  • Stopping conditions: model declares completion; iteration, token, time, or cost cap reached; repeated identical calls detected (loop detection); unrecoverable error; human cancels. When a cap is hit, end gracefully with a summary of progress, not a crash.
  • Definition of done: tell the model concretely what "done" means and to verify it (run the tests, re-read the file, confirm the record was saved) before declaring completion. Agents often declare victory early.
  • Parallel tool calls: allow them for independent reads; serialise writes and dependent steps.
  • Error recovery: return errors as tool results; let the model retry with corrected arguments a bounded number of times.
  • Context growth: long trajectories overflow context. Truncate or summarise old tool results, keep a running task state (plan, progress, findings), and drop raw data already used.

Tool design

Names
  • Verb-object, specific, unambiguous: search_orders, get_order_by_id, cancel_order. Not orders, handle, do_action.
  • Consistent naming scheme across tools; namespace by system when many exist (crm_search_contacts, billing_get_invoice).
Descriptions

The description is the most important part. Write it for a capable newcomer:

  • what the tool does and returns;
  • when to use it, and when not to (and which tool to use instead);
  • important constraints (rate limits, side effects, irreversibility, cost);
  • the meaning and format of each parameter, with an example value;
  • common mistakes to avoid.

Several clear sentences are normal; a one-line description is usually too thin.

Parameters and schemas
  • Use precise types, enums for closed sets, formats for dates and IDs, required vs optional clearly marked, and sensible defaults.
  • Accept natural identifiers the model will actually have (an email, an order number) rather than internal surrogate keys it must first look up — or provide the lookup tool.
  • Avoid parameters that require the model to compute something error-prone (offsets, encoded strings). Do it in the tool.
  • Keep the number of parameters small; split tools that have modes controlled by a flag into separate tools when the modes have different semantics.
  • Make destructive behaviour explicit in the tool's identity (delete_file), never a hidden flag on an innocuous-sounding tool.
Return values
  • Return what the model needs for its next decision, in a compact, readable form. Raw API dumps with dozens of irrelevant fields waste context and confuse.
  • Prefer human-meaningful fields (names, titles, statuses) alongside IDs.
  • Paginate or truncate large results, and say so in the result ("showing 20 of 340; refine the query or request page 2").
  • Include next-step hints when helpful.
Errors

Errors are instructions for recovery. Compare:

  • Poor: Error 400.
  • Good: No customer found with email "jon@exmple.com". Check spelling or search by name with search_customers.

Distinguish errors the model can fix (bad argument) from ones it cannot (service down, permission denied), so it can decide to retry, change approach, or stop and report.

Idempotency and side effects
  • Reads should be safe to repeat.
  • Writes should be idempotent where possible (idempotency keys, upserts), because agents retry.
  • Long-running operations: return a job ID and provide a status tool rather than blocking.
Test tools with the model, not just with code

Give the model realistic tasks and read the trajectories. Where it picks the wrong tool, passes bad arguments, or misreads results, revise names, descriptions, and outputs. This tool-description iteration is one of the highest-return activities in agent work.

Planning

  • For multi-step tasks, asking the agent to write a short plan first (and to update it as it learns) improves coherence and gives you a checkpoint for human review.
  • Keep plans as explicit state (a list with statuses) in context or in a scratch file, not only implicit in reasoning.
  • Re-plan on surprises; do not let the agent stubbornly follow a plan that tool results have invalidated.
  • For high-stakes tasks, have a human approve the plan before execution.

Memory

KindWhat it isHow to implement
Working memoryThe current context: task, plan, recent stepsThe prompt; manage by truncation and summarisation
Task state / scratchpadNotes, findings, progress for this taskA structured block in context or a file/tool the agent writes to
Long-term memoryFacts and preferences across sessionsA store (database, files, vector index) with explicit read/write tools or automatic retrieval
Episodic memoryRecords of past tasks and outcomesLogs indexed for retrieval; useful for learning from past failures

Cautions for long-term memory: it can store wrong or injected facts that then persist; it accumulates stale information; it may hold personal data subject to deletion requests. Make memory inspectable and editable by users, validate what is written, scope it per user or tenant, and expire it.

Multi-agent orchestration

Patterns:

  • Orchestrator–workers: a lead agent decomposes the task and delegates sub-tasks to worker agents (often with narrower tools and fresh context), then synthesises. Good for broad research or parallelisable work.
  • Pipeline of specialists: fixed sequence of agents with different roles (draft, review, fix).
  • Generator–critic: one produces, another evaluates against criteria; loop until pass or cap.
  • Routing: a classifier dispatches to specialised agents.

Benefits: parallelism, clean context per sub-task, specialised prompts and tools. Costs: more tokens (often several times a single agent), coordination failures, lost context between agents, harder debugging.

Make delegation work:

  • Give each sub-agent a self-contained brief: the goal, the context it needs, constraints, the expected output format, and what not to do. Sub-agents do not share the orchestrator's history unless you pass it.
  • Define the hand-back format so the orchestrator can merge results.
  • Avoid duplicated work by assigning non-overlapping scopes.
  • Cap the number of agents and depth of delegation.
  • Do not use multi-agent architectures for tasks a single agent handles well; measure.

Human in the loop

Choose the intervention points by consequence:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kmaruthi2002/universal-llm-skills/ai-agents-and-tool-use/badge)](https://verified-skill.com/skills/kmaruthi2002/universal-llm-skills/ai-agents-and-tool-use)

Something wrong with this skill or its page? Tell us.