llm-patterns

llm-patterns is a skill for Claude Code from alinaqi/maggy. It costs 16 tokens per session (2,146 once invoked), scanned A, original, MIT.

A set of design patterns for applications where a large language model handles tasks such as classification, extraction, summarization, and decisions. It also explains which ordinary code should handle instead.

In plain words
What is it for?
Use it to structure AI applications, manage prompts, validate model responses, and test language-model behavior.
Why use it?
It separates flexible language-based work from validation, database access, authentication, and error handling that should remain predictable.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { classifyTicket } from '../../../src/core/services/ticket';.

Good fit Use it to structure AI applications, manage prompts, validate model responses, and test language-model behavior.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/alinaqi/maggy
agentmods
npx agentmods add skills/alinaqi/maggy/llm-patterns

Made for: Claude Code.

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 llm-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/alinaqi/maggy/llm-patterns.svg)](https://agentmods.dev/skills/alinaqi/maggy/llm-patterns)
Your own site
<a href="https://agentmods.dev/skills/alinaqi/maggy/llm-patterns"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/llm-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,146 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00016 $0.02146
Opus 5 $0.00008 $0.01073
Sonnet 5 $0.00003 $0.00429
Haiku 4.5 $0.00002 $0.00215

Measured 4d ago against content hash 62c7477c6966, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

llm-patterns scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/llm-patterns/SKILL.md · 329 lines

How it starts

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

LLM Patterns Skill

For AI-first applications where LLMs handle logical operations.


Core Principle

LLM for logic, code for plumbing.

Use LLMs for:

  • Classification, extraction, summarization
  • Decision-making with natural language reasoning
  • Content generation and transformation
  • Complex conditional logic that would be brittle in code

Use traditional code for:

  • Data validation (Zod/Pydantic)
  • API routing and HTTP handling
  • Database operations
  • Authentication/authorization
  • Orchestration and error handling

Project Structure

project/
├── src/
│   ├── core/
│   │   ├── prompts/           # Prompt templates
│   │   │   ├── classify.ts
│   │   │   └── extract.ts
│   │   ├── llm/               # LLM client and utilities
│   │   │   ├── client.ts      # LLM client wrapper
│   │   │   ├── schemas.ts     # Response schemas (Zod)
│   │   │   └── index.ts
│   │   └── services/          # Business logic using LLM
│   ├── infra/
│   └── ...
├── tests/
│   ├── unit/
│   ├── integration/
│   └── llm/                   # LLM-specific tests
│       ├── fixtures/          # Saved responses for deterministic tests
│       ├── evals/             # Evaluation test suites
│       └── mocks/             # Mock LLM responses
└── _project_specs/
    └── prompts/               # Prompt specifications

LLM Client Pattern

Typed LLM Wrapper

// core/llm/client.ts
import Anthropic from '@anthropic-ai/sdk';
import { z } from 'zod';

const client = new Anthropic();

interface LLMCallOptions<T> {
  prompt: string;
  schema: z.ZodSchema<T>;
  model?: string;
  maxTokens?: number;
}

export async function llmCall<T>({
  prompt,
  schema,
  model = 'claude-sonnet-4-20250514',
  maxTokens = 1024,
}: LLMCallOptions<T>): Promise<T> {
  const response = await client.messages.create({
    model,
    max_tokens: maxTokens,
    messages: [{ role: 'user', content: prompt }],
  });

  const text = response.content[0].type === 'text'
    ? response.content[0].text
    : '';

  // Parse and validate response
  const parsed = JSON.parse(text);
  return schema.parse(parsed);
}

Read the full file on GitHub · 329 lines

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. 4d ago First seen · 329 lines · 16 tokens per session scan A 62c7477c6966

Subscribe to this mod's changes

llm-patterns is a skill published in the GitHub repository alinaqi/maggy (705 stars, last pushed 21d ago), licensed MIT. It adds 16 tokens to every session and 2,146 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

ai-evaluation-engineering

An AI evaluation engineering specialist for testing models and prompts. The description does not provide enough detail to state which concrete operations it performs.

devcodex-labs/devcodex · 95 tokens

prompt-sensei

Stage-aware prompt coaching, prompt improvement, lookback analysis, prompting habit feedback, and local reports about prompt quality for AI coding agents such as Claude Code or Codex.

chengzhongwei/Prompt-sensei · 39 tokens

recipe-eval-prompt

Compares original and optimized prompts through repeated blind paired execution in git worktrees. Use when evaluating prompt improvement effects or learning prompt engineering through concrete examples.

shinpr/rashomon · 36 tokens

ai-feature-eval-harness

Design an evaluation plan for a product AI feature (LLM- or model-backed output): measurable success criteria, a held-out labeled eval dataset shape, per-criterion grading (code-based first, then LLM-based for nuanced judgment), and a pass threshold, then persist as AIEVALPLAN.md. Use when the task ships or changes a…

Mozurok/fhorja.dev · 205 tokens

15-playbook

A Chinese-language library of reusable Claude Code instruction templates and modifiers. It matches a natural-language request to a stored template instead of writing the full instruction manually.

xcodethink/open-claude-code-skills · 267 tokens

govkit-eval-suite-planning

Plan a provider-neutral evaluation suite for an LLM feature. Use when the user asks to plan model evaluations or invokes /govkit-eval-suite-planning.

Accelerated-Innovation/governed-ai-delivery · 40 tokens