mealforge: Skill for Claude Code

.agents/skills/trpc-drizzle-patterns/SKILL.md

trpc-drizzle-patterns is a skill for Claude Code, Codex from LooseWireDev/mealforge. It costs 62 tokens per session (877 once invoked), scanned A, original, MIT.

Coding patterns for a TypeScript backend built with Hono, tRPC, Drizzle, and Better Auth. They explain request context, public and logged-in procedures, feature routers, and Zod schemas for validating inputs.

In plain words
What is it for?
Use them when writing or reviewing backend code in the API application, especially procedures, routers, database-backed services, authentication-aware endpoints, or client API calls.
Why use it?
They help keep authentication checks and data flow consistent between the backend and its web or mobile clients. They also reduce repeated session checks and unclear API structure.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is LooseWireDev/mealforge's own configuration. It tells Claude Code and Codex how to work on mealforge itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mealforge configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { router, publicProcedure, protectedProcedure } from '../../trpc';.

Reuse

Borrowing it

Nothing to install: this file belongs to LooseWireDev/mealforge. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/LooseWireDev/mealforge/main/.agents/skills/trpc-drizzle-patterns/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/LooseWireDev/mealforge

Made for: Claude Code, Codex.

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 trpc-drizzle-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/loosewiredev/mealforge/trpc-drizzle-patterns.svg)](https://agentmods.dev/skills/loosewiredev/mealforge/trpc-drizzle-patterns)
Your own site
<a href="https://agentmods.dev/skills/loosewiredev/mealforge/trpc-drizzle-patterns"><img src="https://agentmods.dev/badge/skills/loosewiredev/mealforge/trpc-drizzle-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 877 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.
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.00062 $0.00877
Opus 5 $0.00031 $0.00439
Sonnet 5 $0.00012 $0.00175
Haiku 4.5 $0.00006 $0.00088

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

Security

Grade A, and why

trpc-drizzle-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 6d 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.

.agents/skills/trpc-drizzle-patterns/SKILL.md · 70 lines

How it starts

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

tRPC + Drizzle Patterns (Hono backend)

Context and procedures

apps/api/src/trpc.ts is the hub. It defines:

export interface Context {
  req: Request;
  session: Session | null; // Session = typeof auth.$Infer.Session (Better Auth)
}

createContext resolves the session once per request via auth.api.getSession({ headers: req.headers }).

  • publicProcedure — no auth requirement.
  • protectedProcedure — throws TRPCError({ code: 'UNAUTHORIZED' }) when there is no session, and narrows ctx.session to non-null for everything chained after it. Use it for anything user-specific; never re-check the session manually inside a protected handler.

Feature routers

Each feature owns a router in apps/api/src/features/<name>/router.ts:

import { z } from 'zod';
import { router, publicProcedure, protectedProcedure } from '../../trpc';
import { listThings } from './service';

export const thingRouter = router({
  list: publicProcedure.query(() => listThings()),
  create: protectedProcedure
    .input(z.object({ name: z.string().min(1) }))
    .mutation(({ ctx, input }) => createThing(ctx.session.user.id, input)),
});

Rules:

  • Every input is a Zod schema. No unvalidated input.
  • Routers stay thin — business logic lives in the feature's service.ts, with explicit return types on every exported function.
  • Services throw TRPCError with the right code (NOT_FOUND, FORBIDDEN, ...). No try/catch in services or routers — errors propagate to the tRPC error handler.
  • Feature routers are registered in appRouter by the feature generator via the // forge:feature-imports / // forge:feature-routers anchors in trpc.ts. Never register by hand; never delete the anchors.

Drizzle

  • Tables live in apps/api/src/db/schema.ts; auth tables are separate in apps/api/src/auth/authSchema.ts (owned by Better Auth — don't hand-edit).
  • The project is either postgres (drizzle-orm/pg-core: pgTable, serial, ...) or sqlite (drizzle-orm/sqlite-core: sqliteTable, integer, ...) — check the existing imports in schema.ts and stay consistent.
  • Migrations: drizzle.config.ts at apps/api/ is already wired to the right dialect; generate migrations with drizzle-kit into src/db/migrations/.
  • Better Auth uses drizzleAdapter(db, { provider: 'pg' | 'sqlite' }) in src/auth/auth.ts — the provider must match the database.

Read the full file on GitHub · 70 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. 6d ago First seen · 70 lines · 62 tokens per session scan A 4cf07afcde92

Subscribe to this mod's changes

trpc-drizzle-patterns is a skill published in the GitHub repository LooseWireDev/mealforge (1 stars, last pushed 1mo ago), licensed MIT. It adds 62 tokens to every session and 877 once invoked, about $0.0003 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-08-31.

Related

Other skills, from other repositories

scraperapi-nodejs-sdk

Best-practices reference for the ScraperAPI Node.js / JavaScript SDK (scraperapi-sdk npm package). Consult whenever the user is writing, debugging, or reviewing JavaScript or TypeScript code that calls ScraperAPI. Use when user asks: "scrape a website with Node.js and ScraperAPI", "ScraperAPI JavaScript example", "how…

scraperapi/scraperapi-skills · 187 tokens

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for @cyanheads/mcp-ts-core. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

cyanheads/pubmed-mcp-server · 54 tokens

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for @cyanheads/mcp-ts-core. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

cyanheads/clinicaltrialsgov-mcp-server · 54 tokens

trpc

// server/trpc.ts import { initTRPC, TRPCError } from '@trpc/server'; import { type Context } from './context'; import superjson from 'superjson'.

Plazmodium/odin-workflow · 35 tokens

knowject-api-to-types

A Knowject skill that generates TypeScript types from an OpenAPI document, which describes an API's available requests and data shapes, and connects them to a typed client.

lynxlangya/knowject · 213 tokens

api-errors

McpError constructor, JsonRpcErrorCode reference, and error handling patterns for @cyanheads/mcp-ts-core. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.

cyanheads/secedgar-mcp-server · 54 tokens