CLAUDE.md for TanStack Query (React Query)
AI fetches data with useEffect + useState. TanStack Query handles caching, deduplication, and refetching. Rules for query keys, staleTime, useMutation, invalidation, and prefetching.
Master the art of writing CLAUDE.md, .cursorrules, and other AI assistant configuration files.
AI fetches data with useEffect + useState. TanStack Query handles caching, deduplication, and refetching. Rules for query keys, staleTime, useMutation, invalidation, and prefetching.
AI generates C-style Zig with hidden allocations and ignored error unions. Rules for explicit allocators, error unions, comptime, and Zig's no-hidden-behavior philosophy.
AI generates Wasm code that leaks memory, has expensive JS-Wasm boundary crossings, and ignores the component model. Rules for safe, performant WebAssembly.
AI generates Docker and PM2 patterns for Vercel. Rules for serverless function limits, Edge vs Node runtime, env vars, preview deployments, and Vercel-optimized Next.js.
AI mixes Actix patterns into Axum. Rules for Axum extractors, State for shared data, tower middleware, Router::merge for composition, and IntoResponse for responses.
AI generates over-engineered Lua by applying patterns from larger languages. Rules for tables, metatables, coroutines, module patterns, and game scripting conventions.
AI generates pure web or pure native patterns in Ionic. Rules for Capacitor plugins, Ionic UI components, adaptive styling, platform detection, and hybrid app architecture.
AI generates legacy Redux or misuses Zustand as Redux. Rules for Redux Toolkit slices, Zustand minimal stores, server state with TanStack Query, and when to use each.
AI generates Flutter code with deeply nested widget trees and mismanaged state. Rules for widget extraction, Riverpod/Bloc state management, and Dart conventions.
AI generates imperative-style OCaml that ignores the module system and algebraic types. Rules for type-driven design, pattern matching, functors, and opam conventions.
AI generates Express code for Fiber. Rules for fasthttp differences, Fiber ctx, body parsing with BodyParser, route groups, middleware, and Go-native error handling.
AI generates notebooks with hidden state, non-linear execution, and unreproducible outputs. Rules for cell ordering, parameterization, and notebook-to-production patterns.
AI generates bare React Native patterns in Expo. Rules for Expo Router (file-based), EAS Build/Submit, Expo SDK modules, config plugins, and the managed workflow.
AI fights Actix Web's ownership model. Rules for web::Data shared state, typed extractors, guard-based routing, custom error responders, and middleware patterns.
AI generates OOP-style Elixir instead of idiomatic functional patterns. Rules for GenServers, pattern matching, pipe operators, Phoenix conventions, and OTP design.
AI logs errors to console instead of Sentry. Rules for SDK initialization, error boundaries, breadcrumbs, user/transaction context, performance tracing, and source maps.
AI generates ancient Perl patterns and makes legacy code harder to maintain. Rules for use strict/warnings, modern Perl, safe legacy changes, and incremental modernization.
AI generates legacy PHP patterns from the PHP 5 era. Rules for modern PHP 8.3: enums, readonly classes, match expressions, typed properties, and Laravel conventions.
AI generates REST-shaped GraphQL with one query per page. Rules for proper schema design, DataLoader resolvers, codegen for types, Apollo Client cache policies, and fragments.
AI generates Ansible with raw shell commands instead of modules and ignores idempotency. Rules for proper modules, vault secrets, roles, and idempotent patterns.
AI generates Node.js patterns in Bun, missing its built-in bundler, test runner, and SQLite. Rules for Bun.serve, bun:test, Bun.build, native SQLite, and bun install.
AI generates Express-style code in Gin. Rules for Gin-specific middleware, ShouldBind validation, custom error handling, route groups, and proper context usage.
AI mixes TypeORM's Active Record and Data Mapper patterns randomly. Rules for choosing one pattern, repository usage, QueryBuilder, migrations, and eager/lazy relations.
AI generates web React in React Native — div, className, CSS media queries. Rules for View/Text primitives, StyleSheet, React Navigation, and platform-specific code.
AI generates base R instead of tidyverse, ignores reproducibility, and creates messy scripts. Rules for tidyverse patterns, renv, R packages, and literate programming.
AI builds custom JWT auth when Auth0 and NextAuth.js handle everything. Rules for provider configuration, session callbacks, middleware route protection, and adapter patterns.
AI generates Ruby that works but ignores Rails conventions and Ruby idioms. Rules for ActiveRecord patterns, service objects, testing with RSpec, and Rubocop alignment.
AI generates hydration patterns in Qwik, defeating resumability. Rules for $ lazy boundaries, useSignal, routeLoader$, actions, and Qwik City conventions.
AI generates CloudFormation without DeletionPolicy, with overly permissive IAM, and hardcoded values. Rules for parameters, conditions, nested stacks, and safe updates.
AI generates .NET Framework MVC in modern .NET 8 projects. Rules for minimal APIs vs controllers, EF Core, DI, middleware pipeline, and top-level statements.
Adding a CLAUDE.md to your open source project helps AI-using contributors follow your conventions automatically. Here's how to write one for OSS.
AI mixes OOP and FP inconsistently in Scala. Rules for functional-first patterns, case classes, immutability, effects systems, and Scala 3 syntax.
AI generates REST endpoints in tRPC projects — defeating end-to-end type safety. Rules for procedures, routers, Zod input validation, React Query hooks, and the type-safe client.
AI generates PowerShell with Bash patterns instead of object pipelines. Rules for cmdlet naming, error handling, pipeline usage, module structure, and PSScriptAnalyzer.
AI generates Node.js patterns in Deno — require(), npm packages, no permissions. Rules for permission flags, JSR/URL imports, Deno.serve, std library, and deno.json config.
AI generates SQLAlchemy 1.x patterns in 2.0 projects — session.query(), legacy Column, no async. Rules for select(), Mapped types, AsyncSession, and Alembic.
AI generates OOP-style Clojure instead of data-oriented patterns. Rules for immutable maps, threading macros, REPL-driven development, and schema validation.
AI generates Electron patterns in Tauri — wrong process model, wrong IPC, wrong security. Rules for Tauri commands, capability-based permissions, events, and the Rust backend.
AI generates C# with outdated patterns. Rules for modern C# 12+: records, nullable references, minimal APIs, primary constructors, and proper async patterns.
AI generates React patterns in SolidJS — destructuring props kills reactivity, components re-run, and hooks don't exist. Rules for signals, Show/For, stores, and SolidStart.
AI generates Lerna 4 patterns that are deprecated. Rules for Lerna 8 with Nx integration, versioning strategies, publishing workflow, changelog generation, and CI configuration.
AI handles Stripe payments client-side — a security disaster. Rules for server-side checkout sessions, webhook signature verification, idempotency keys, and PCI-compliant patterns.
AI generates C/C++ with buffer overflows, dangling pointers, and undefined behavior. Rules for smart pointers, RAII, modern C++23, sanitizers, and CMake conventions.
COBOL still powers global banking. AI generates non-mainframe COBOL. Rules for COBOL-85/2014, copybooks, paragraph structure, CICS, DB2, and JCL conventions.
AI generates Java-style Kotlin instead of idiomatic Kotlin. Rules for data classes, sealed hierarchies, coroutines, extension functions, and Jetpack Compose.
AI manually configures what Spring Boot auto-configures. Rules for letting auto-config work, Spring Data JPA, Spring Security, @ConfigurationProperties, and actuator.
AI generates Amplify Gen 1 CLI patterns in Gen 2 projects. Rules for TypeScript backend definitions, data models, auth configuration, storage rules, and Lambda functions.
AI generates Node.js-specific Hono instead of Web Standard patterns. Rules for multi-runtime compatibility, Request/Response API, Zod OpenAPI, and middleware patterns.
AI uses Node.js APIs in Cloudflare Workers — they don't exist. Rules for Web Standard APIs, KV for cache, D1 for SQL, R2 for storage, Durable Objects, and wrangler dev.
AI generates slow, unvectorized MATLAB with growing arrays and outdated syntax. Rules for vectorization, preallocation, modern MATLAB features, and Simulink conventions.
AI generates Prisma or raw SQL patterns in Drizzle projects. Rules for schema-as-code in TypeScript, the query builder, relational queries, drizzle-kit, and type inference.
AI generates Java that compiles but uses outdated patterns. Rules for modern Java: records, sealed classes, pattern matching, and proper Stream API usage.
AI treats Electron like a web app — ignoring the main/renderer process split and security model. Rules for IPC, contextBridge, nodeIntegration: false, and process isolation.
AI generates npm patterns in pnpm workspaces — phantom dependencies and flat node_modules. Rules for workspace: protocol, strict isolation, catalog, filtering, and lockfile.
AI generates React SPA patterns in Remix. Rules for loaders and actions, nested routing, web-standard forms, progressive enhancement, and error boundaries.
AI generates imperative-style Haskell that ignores purity, monads, and algebraic types. Rules for pure functions, IO isolation, type classes, and idiomatic error handling.
AI generates VHDL that simulates but doesn't synthesize. Rules for synchronous design, clock domain crossings, reset strategies, synthesizable patterns, and testbenches.
AI generates raw PHP patterns in Laravel, ignoring Eloquent, Blade, and artisan. Rules for Eloquent relationships, Form Requests, Livewire, queues, and Laravel conventions.
AI generates Swift that compiles but uses class-heavy OOP instead of protocol-oriented patterns. Rules for SwiftUI, value types, async/await, and Apple's API design guidelines.
AI treats Firebase as a plain database — no security rules, relational data model. Rules for Firestore document design, security rules, Cloud Functions, Auth, and hosting.
AI generates Kubernetes YAML without resource limits, security contexts, or health probes. Rules for production-ready manifests, Helm charts, and K8s security.
AI ignores Prisma's type-safe client. Rules for schema.prisma design, relation queries, select for field filtering, transactions, seeding, and migration workflow.
AI assistants generate TypeScript that compiles but uses `any`, skips generics, and ignores your patterns. Rules for strict types, Zod validation, and framework conventions.
AI-generated Solidity has reentrancy vulnerabilities, unchecked gas costs, and missing access control. Rules for safe patterns, OpenZeppelin, and audit-ready contracts.
AI generates Express servers inside Lambda. Rules for event-driven handlers, cold start minimization, connection reuse outside the handler, Lambda layers, and least-privilege IAM.
AI ignores Rails conventions: fat controllers, bypassed ActiveRecord, manual auth. Rules for the Rails Way: skinny controllers, concerns, Turbo, Stimulus, and Hotwire.
AI generates React SPA patterns in Astro projects, shipping unnecessary JS. Rules for islands architecture, content collections, zero-JS defaults, and Astro integrations.
AI assistants generate Rust that compiles but fights the borrow checker. Rules for ownership patterns, error handling with thiserror/anyhow, and idiomatic traits.
AI generates manual monorepo patterns in Nx. Rules for Nx generators, affected commands, project graph, task caching, module boundaries, and Nx Cloud for remote cache.
AI generates Gradle with deprecated APIs and Groovy DSL. Rules for Kotlin DSL, version catalogs, convention plugins, and build cache optimization.
AI generates Rails-style Phoenix instead of LiveView-first patterns. Rules for LiveView components, contexts, Ecto changesets, PubSub for realtime, and BEAM-native patterns.
AI generates Dockerfiles that run as root with 2GB images. Rules for multi-stage builds, non-root users, layer caching, and container security best practices.
AI generates snapshot-heavy, over-mocked Jest tests. Rules for behavior testing, testing-library patterns, mock boundaries, test naming, and Jest vs Vitest configuration.
AI builds custom auth, custom storage, and custom realtime on Supabase. Rules for using Supabase Auth, RLS policies, Storage buckets, Realtime subscriptions, and Edge Functions.
AI generates monolithic Flask apps with everything in one file. Rules for blueprints, application factory pattern, Flask-SQLAlchemy, WTForms, and config management.
AI generates Svelte 4 reactive declarations in Svelte 5 projects. Rules for runes ($state, $derived, $effect), SvelteKit load functions, form actions, and server routes.
Go's conventions are strong but AI assistants still deviate. Rules for error wrapping, interface design, context propagation, and table-driven tests.
AI mixes Cypress patterns into Playwright — explicit waits, wrong selectors, no route mocking. Rules for locators, auto-waiting, page object model, route(), and fixtures.
AI generates Express patterns in Fastify — missing schema validation, serialization, and the plugin system. Rules for JSON Schema, encapsulation, hooks, and TypeProvider.
AI ignores Turborepo's pipeline, caching, and workspace model. Rules for turbo.json task config, internal packages, remote caching, workspace dependencies, and CI optimization.
AI generates module-based Angular in standalone projects and ignores signals. Rules for standalone components, signals, typed forms, RxJS patterns, and Angular CLI.
AI applies relational patterns to MongoDB — normalizing everything. Rules for document design, embedding vs referencing, Mongoose schemas, indexes, and aggregation pipelines.
AI-generated Terraform can create public S3 buckets, open security groups, and expensive instances. Rules for safe IaC: modules, state management, and cost control.
AI generates Flask-style FastAPI without Pydantic models or type hints. Rules for typed endpoints, dependency injection, async patterns, SQLAlchemy integration, and OpenAPI.
AI assistants generate Python that works but lacks type hints, uses bare exceptions, and ignores your framework patterns. These rules fix the most common issues.
AI generates Options API and Vue 2 patterns in Vue 3 projects. Rules for Composition API, script setup, composables, Pinia state management, and Nuxt 3 conventions.
AI generates fragile Cypress tests. Rules for data-testid selectors, custom commands, cy.intercept for API mocking, page objects, retry-ability, and CI configuration.
AI reinvents Django patterns that already exist — raw SQL instead of ORM, manual auth instead of django.contrib.auth. Rules for models, views, DRF, templates, and testing.
AI generates Storybook stories without args or controls. Rules for CSF3 format, args-based stories, play functions for interaction testing, decorators, and autodocs.
AI generates Express patterns in NestJS, bypassing modules, DI, and decorators. Rules for NestJS providers, guards, pipes, interceptors, and proper module organization.
AI generates slow, sequential GitHub Actions. Rules for job parallelism, dependency caching, matrix strategies, reusable workflows, concurrency groups, and proper secret handling.
AI mixes Next.js server patterns into React + Vite SPAs. Rules for client-side React: React Router, state management, Vite config, environment variables, and build optimization.
AI treats shadcn/ui as a library dependency. It's copied source code you own. Rules for component customization, cn() utility, cva variants, Radix primitives, and theming.
Express gives you freedom — AI fills it with inconsistent patterns. Rules for middleware ordering, centralized error handling, Zod validation, and security hardening.
AI generates Pages Router Next.js in App Router projects. Rules for React Server Components, server actions, metadata API, streaming, and layout conventions.
AI mixes Tailwind with custom CSS and uses arbitrary values. Rules for utility-first discipline, design scale, responsive prefixes, dark mode, and component extraction patterns.
Not every Next.js app has migrated to App Router. Rules for Pages Router: getServerSideProps, getStaticProps, ISR, API routes in pages/api/, and _app/_document patterns.
Stop staring at a blank file. Grab a copy-paste-ready CLAUDE.md template for your stack — Next.js, Python, Go, or a universal starter — and customize it in minutes.