patterns

patterns is a skill for Claude Code from pchalasani/claude-code-tools. It costs 26 tokens per session (1,089 once invoked), scanned B, a copy of patterns, MIT.

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 Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code.

Part of the langroid plugin — 2 skills shipped together

Good fit Use it to build agents that return structured tool results, handle external operations, keep state across retries, and control tasks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pchalasani/claude-code-tools/patterns
About the project

pchalasani/claude-code-tools is a collection of command-line tools, skills, agents, hooks, plugins, and commands for improving work with Claude Code, Codex-CLI, and similar coding agents. It is used by developers who want reusable productivity features and workflows for terminal-based AI coding assistants. The catalogue entries are components of, or extensions for, these coding-agent workflows.

pchalasani/claude-code-tools · 2,041 stars · on GitHub

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.

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.

Or install langroid, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/pchalasani/claude-code-tools/patterns/github.svg)](https://agentmods.dev/skills/pchalasani/claude-code-tools/patterns)
Your own site
<a href="https://agentmods.dev/skills/pchalasani/claude-code-tools/patterns"><img src="https://agentmods.dev/badge/skills/pchalasani/claude-code-tools/patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/pchalasani/claude-code-tools/patterns"><img src="https://agentmods.dev/badge/skills/pchalasani/claude-code-tools/patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00026 $0.01089
Opus 5.5 $0.00010 $0.00436
Sonnet 5.5 $0.00005 $0.00218
Haiku 4.5 $0.00003 $0.00109

Measured 3mo ago against content hash a5f10e981edf, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 3mo 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. 3mo 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 (2,041 stars, last pushed today), licensed MIT. It adds 26 tokens to every session and 1,089 once invoked, about $0.0001 per session on Opus 5.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

patterns compared with skills from other repositories

patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
patternspchalasani/claude-code-toolsSkill2.0ktodayMITB26Claude Code
tinyjsmomozi1996/momo-codeSkill1.1k1mo agononeA75Claude Code, Codex
datamolsynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A67Claude Code, Codex
clinicaltrials-databasesynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A47Claude Code, Codex
openalex-databasesynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A76Claude Code, Codex
glycoengineeringsynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A75Claude Code, Codex
esmsynthetic-sciences/openscienceSkill4.5kyesterdayApache-2.0A86Claude Code, Codex