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.
curl -O https://raw.githubusercontent.com/LooseWireDev/mealforge/main/.agents/skills/trpc-drizzle-patterns/SKILL.mdgit clone --depth 1 https://github.com/LooseWireDev/mealforgeWrote 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.
[](https://agentmods.dev/skills/loosewiredev/mealforge/trpc-drizzle-patterns)<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>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.
| Model | Per session | Once 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 |
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.
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— throwsTRPCError({ code: 'UNAUTHORIZED' })when there is no session, and narrowsctx.sessionto 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
TRPCErrorwith 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
appRouterby the feature generator via the// forge:feature-imports/// forge:feature-routersanchors intrpc.ts. Never register by hand; never delete the anchors.
Drizzle
- Tables live in
apps/api/src/db/schema.ts; auth tables are separate inapps/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 inschema.tsand stay consistent. - Migrations:
drizzle.config.tsatapps/api/is already wired to the right dialect; generate migrations with drizzle-kit intosrc/db/migrations/. - Better Auth uses
drizzleAdapter(db, { provider: 'pg' | 'sqlite' })insrc/auth/auth.ts— the provider must match the database.
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.
- 6d ago First seen · 70 lines · 62 tokens per session scan A 4cf07afcde92
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.
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…
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.
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.
trpc
// server/trpc.ts import { initTRPC, TRPCError } from '@trpc/server'; import { type Context } from './context'; import superjson from 'superjson'.
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.
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.