patterns

A set of design patterns for Langroid, a framework for building applications with multiple AI agents. It provides indexed examples for configuring agents, tools, tasks, and integrations.

In plain words
What is it for?
Use it to build agents that return structured tool results, handle external operations, keep state across retries, and control tasks.
Why use it?
It reduces the need to work out common Langroid setups from scratch. Each pattern points to a complete code example for a specific task.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pchalasani/claude-code-tools/patterns
Any agent
npx skills add pchalasani/claude-code-tools --skill patterns
Clone the repo
git clone --depth 1 https://github.com/pchalasani/claude-code-tools

Made for: Claude Code, Codex.

Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,089 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.01089
Opus 5 $0.00013 $0.00544
Sonnet 5 $0.00005 $0.00218
Haiku 4.5 $0.00003 $0.00109

Measured 2d ago against content hash a5f10e981edf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

patterns scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Unrestricted tool accessmediumExcessive agency

A wildcard tool grant or "run any command" leaves no least-privilege boundary at all.

to enable ALL tools from an MCP server or just SPECIFIC tools selectively,
Origin

This is a copy

100% identical to patterns — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/langroid/skills/patterns/SKILL.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Langroid Patterns

Instructions

Below is an INDEX of design patterns organized by category. Each item describes WHAT you might want to implement, followed by a REFERENCE to a document with a complete code example.

Scan this index to find patterns matching your needs, then consult the corresponding document.


Agent & Task Basics

  1. Task Returns Tool Directly

    Create a Langroid Agent equipped with a single Tool (a ToolMessage), and wrap it in a Task so that running the task returns that ToolMessage directly. Use this pattern when you want a simple LLM agent that returns a structured response.

    • Reference: ./task-return-tool.md

Tool Handlers

  1. Stateful Handler on Agent

    Define a STATEFUL tool handler as a METHOD on the agent (not inside the ToolMessage). Use this pattern when: (a) the tool handler needs to execute external operations (API calls, database queries, file I/O), (b) you need to track state across retries (e.g., failure counter), (c) the handler needs access to agent-level resources (connections, configs), or (d) you want Langroid to automatically loop errors back to the LLM for self-correction. The method name must match the request field of the ToolMessage. Return a string for errors (LLM sees it and can retry), or DoneTool(content=result) to terminate successfully.

    • Reference: ./agent-tool-handler-with-state.md
  2. Handler with Validation

    Validate tool output against agent state before accepting it. Use this pattern when: (a) the LLM's tool output must preserve certain content from the input (e.g., placeholders, required fields), (b) you want automatic retry if validation fails, (c) you need to compare tool output against context the LLM received. Define a handler method on a custom agent class that stores the input context as state, validates the tool output, and returns an error string for retry or AgentDoneTool for success (note: use AgentDoneTool, NOT DoneTool). Use done_sequences=["T[ToolName], A"] so the handler runs before task termination.

Read the full file on GitHub · 119 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 119 lines · 26 tokens per session scan B a5f10e981edf

Subscribe to this mod's changes

patterns is a skill published in the GitHub repository pchalasani/claude-code-tools (1,989 stars, last pushed 2d ago), licensed MIT. It adds 26 tokens to every session and 1,089 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it B with 1 finding (unrestricted tool access). It is 100% identical to patterns, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

verify-behavior

Verify or reproduce visible product behavior by driving the real UI with pi-computer-use's checked tools, requiring verified expect postconditions and durable state evidence for meaningful UI flows. Use when triage needs visual reproduction, implementation needs behavioral proof, review needs interactive confirmation…

nicknisi/dotfiles · 68 tokens

bro

Restate the last message in plain human language, with no jargon.

nicknisi/dotfiles · 16 tokens

database-engineer

SQLite database expertise for migrations, multi-tenant patterns, transactional safety, FTS5 virtual tables, and schema evolution. Use this skill for ANY work involving schema changes, data migrations, INSERT/UPSERT semantics, FTS5 rebuilds, transaction rollback design, multi-tenant data isolation, or SQLite…

Vinix24/vnx-orchestration · 121 tokens

monitoring-specialist

System monitoring, alerting, and observability implementation.

Vinix24/vnx-orchestration · 15 tokens

panel

Multi-provider deliberation panel for COMPLEX, multi-view questions — architecture, strategy, market research, and codebase sweeps. Runs a 4-stage deliberation across the provider fleet (diverge → contrarian red-team → adversarial verify → cited synthesis), the same multi-perspective rigour the plan-gate already…

Vinix24/vnx-orchestration · 100 tokens

t0-orchestrator

Master orchestration for the VNX multi-terminal system. Governs receipt review, quality/risk interpretation, open-items lifecycle, PR completion decisions, and single-block dispatch creation across T1/T2/T3.

Vinix24/vnx-orchestration · 48 tokens