Portable library
Rules
A rule is a Markdown file of standards that an LLM coding agent follows while it works in a repository, which keeps it in .claude/rules/. The values that differ between repositories go in the rule’s Project details section, which each repository fills in when it copies the rule.
Always loaded
5 rulesRules without paths front matter, which apply in every session.
-
Writing
Loads in every session
Spelling, grammar, numbers and units, technical writing for an audience from students to senior engineers, and a check to run before finishing. It covers all prose in a repository, including code comments and commit messages.
-
Commits
Loads in every session
Copy-ready commit messages, how much Git the LLM may run, one change per commit, the Conventional Commits format, and pull request descriptions, with no attribution lines. It relies on
writing.mdfor the text of each message, so adopt both. -
Dependencies
Loads in every session
How to build with no third-party code. Packages come only from the accounts a repository names as its own, checked by their owners on the registry and where their source lives. A third-party package is allowed only when it can't be avoided, because the platform, a closed format, a law or contract, or security requires it, and only after the user approves it. It covers what counts as a dependency, from the packages other packages bring in to continuous integration (CI) actions and copied code, the order to look for a solution in, what to tell the user when asking, updates, and the dependencies a repository already has. Set each language rule's Dependency policy to point to it. It relies on
writing.md, so adopt both. -
Testing
Loads in every session
How to test as strictly as the code allows. It covers never weakening a test to make it pass, covering every line and branch, mutation testing to check that the tests catch changes, exact and deterministic tests, performance budgets that fail the build, security tests with hostile input and fuzzing, required checks in CI, and a diff check for new skips and removed assertions. It relies on
writing.mdand on the language rules' test commands, and ondependencies.mdfor test tools where that rule is adopted. -
Pair programming
Loads in every session
How to work with the user as a pair, in which you write the code or draft the material, and they review it and make the calls that are theirs. It covers reading before you write, saying the plan first, asking before the decisions that are the user's, pushing back with reasons, small steps checked one at a time, fixing causes instead of silencing tools, focused changes, explanations at the depth the user wants, a review of your own diff, and an honest report. The other rules add what their own work needs: the changes listed in each one's "Decisions that are the user's" section, and the checks and warnings in each language rule's "Making a change" section. It relies on
writing.md, so adopt both.
Loaded for matching files
20 rulesRules with paths front matter. One applies only when the LLM works on a file that matches one of its patterns; each repository edits the list to fit.
-
Web front-end
Loads for 7 file patterns
**/*.html**/*.htm**/*.css**/*.scss**/*.js**/*.mjs**/*.ts
How to build a website or web app as a senior front-end developer, covering semantic HTML, CSS that meets the Web Content Accessibility Guidelines (WCAG) 2.2 at level AA, progressively enhanced JavaScript, languages and right-to-left layout, security and privacy, performance budgets, hosting limits, and the checks to run in the browser. It relies on
writing.mdfor page text and YAML checks, so adopt both. -
Rust
Loads for 8 file patterns
**/*.rs**/Cargo.tomlCargo.lockrust-toolchain.tomlclippy.tomlrustfmt.tomldeny.toml.cargo/**
How to write Rust as a senior engineer, covering type design, ownership, errors, text for users and its translations, hostile input, concurrency,
unsafe, public APIs, tests, lints, and dependencies. Its documentation section covers doc comments and crate docs for docs.rs, a tested README for each crate on crates.io, and the docs.rs and crates.io metadata. It relies onwriting.mdfor doc comments and error messages, so adopt both. -
C
Loads for 16 file patterns
**/*.c**/*.h**/*.h.in**/CMakeLists.txt**/*.cmakeCMakePresets.json**/meson.buildmeson.optionsmeson_options.txt**/Makefile**/*.mk**/Makefile.amconfigure.ac**/*.pc.in.clang-format.clang-tidy
How to write C as a senior engineer, covering what each standard from C99 to C23 adds and which compilers support it, type design, memory ownership and cleanup, strings and buffers, undefined behavior and integer traps, errors and
errno, files, processes, and signals, threads, text for users and its translations through gettext, hostile input and fuzzing, portability and freestanding code, headers and application binary interface (ABI) compatibility, header comments and library READMEs, tests under the sanitizers, warnings and hardening flags, and builds. It relies onwriting.mdfor comments and error messages, so adopt both. -
C++
Loads for 33 file patterns
**/*.cpp**/*.cc**/*.cxx**/*.c++**/*.hpp**/*.hh**/*.hxx**/*.h++**/*.h**/*.ipp**/*.tpp**/*.inl**/*.cppm**/*.ixx**/*.hpp.in**/*.h.in**/CMakeLists.txt**/*.cmakeCMakePresets.json**/meson.buildmeson.optionsmeson_options.txt**/BUILD.bazelMODULE.bazel**/Makefile**/*.mkvcpkg.jsonvcpkg-configuration.jsonconanfile.txtconanfile.py**/*.pc.in.clang-format.clang-tidy
How to write C++ as a senior engineer, covering what each standard from C++11 to C++26 adds and how to check that every compiler and standard library has it, type design and the rule of zero, ownership through destructors and smart pointers, the lifetimes of references, views, and iterators, undefined behavior and integer traps, exceptions and
std::expected, files and processes, threads and coroutines, text for users and its translations, locales, hostile input and fuzzing, portability and freestanding code, headers, modules, and ABI compatibility, header comments and library READMEs, tests under the sanitizers and the standard library's checked modes, warnings and hardening flags, performance, and builds. It relies onwriting.mdfor comments and error messages, so adopt both. C code in the same repository followsc.md. -
Kotlin
Loads for 8 file patterns
**/*.kt**/*.ktsgradle/libs.versions.tomlgradle.propertiesgradle/wrapper/gradle-wrapper.propertiesbuild-logic/**.editorconfig**/detekt*.yml
How to write Kotlin as a senior engineer, covering type design, null safety, errors, coroutines and Flow, text for users and its translations, hostile input, Java and platform interop, binary compatibility, KDoc and Dokka docs, module READMEs, tests, lints, and Gradle builds. It relies on
writing.mdfor KDoc and error messages, so adopt both. -
Java
Loads for 12 file patterns
**/*.java**/pom.xml**/*.gradle**/*.gradle.ktsgradle/libs.versions.tomlgradle.propertiesgradle/wrapper/gradle-wrapper.propertiesgradle/verification-metadata.xml.mvn/**build-logic/**.java-version.sdkmanrc
How to write Java as a senior engineer, covering the features each release adds and compiling with
--release, records and sealed types, nulls, traps such as boxed==andBigDecimal.equals, exceptions and interrupts, logging,java.timeand money, files and processes, virtual threads and other concurrency, text for users and its translations, untrusted input, including XML external entities and deserialization, the FFM API and JNI, public APIs and binary compatibility, Javadoc with snippets, READMEs and Maven Central metadata, JUnit tests, lints, and Gradle and Maven builds. It relies onwriting.mdfor Javadoc and error messages, so adopt both. -
Android and Jetpack Compose
Loads for 6 file patterns
**/*.kt**/AndroidManifest.xml**/src/*/res/****/proguard-rules.pro**/consumer-rules.pro**/schemas/**
How to build Android apps with Jetpack Compose as a senior mobile developer, covering app architecture, Compose state and performance, adaptive layouts, accessibility, translations, lifecycle and process death, background work, Room migrations, security and privacy, tests, and release builds. It relies on
kotlin.mdfor the language and onwriting.mdfor strings, so adopt all three. -
Kotlin Multiplatform
Loads for 8 file patterns
**/src/*Main/****/src/*Test/****/build.gradle.kts**/composeResources/****/*.swift**/Package.swift**/*.podspeciosApp/**
How to share Kotlin code between Android and iOS as a senior mobile developer, covering what to share, source sets and targets, common-code limits, platform APIs, the API that Swift sees, coroutines across platforms, the Xcode toolchain, and tests on every target. Its Compose Multiplatform section covers shared UI: setup and entry points, shared resources, iOS behavior and look, native views, accessibility, iOS performance, previews, and UI tests. It relies on
kotlin.md,android.md,swift.md, andwriting.md, so adopt all five. -
Swift and SwiftUI
Loads for 10 file patterns
**/*.swift**/Package.swift**/Package.resolved**/*.xcstrings**/*.xcprivacy**/*.entitlements**/Info.plist**/*.xcodeproj/****/.swiftlint.yml**/.swift-format
How to write Swift and SwiftUI as a senior mobile developer, covering type design, optionals and errors, memory, strict concurrency, SwiftUI state and identity, layout, accessibility, localization, persistence, security and privacy, Kotlin Multiplatform interop, tests, and release. It relies on
writing.mdfor doc comments and strings, so adopt both. -
Dart and Flutter
Loads for 8 file patterns
**/*.dart**/pubspec.yaml**/pubspec.lock**/analysis_options.yaml**/l10n.yaml**/*.arb**/build.yaml**/.fvmrc
How to build cross-platform mobile apps with Dart and Flutter as a senior mobile developer, covering Dart types, errors, and isolates, widgets and
build, layout and performance, state management, navigation, platform adaptation, accessibility, localization, platform channels, data and security, tests, and release. It relies onwriting.md, and onandroid.md,kotlin.md, andswift.mdfor native code, so adopt those that apply. -
Lua
Loads for 8 file patterns
**/*.lua**/*.rockspec.luacheckrc.luarc.jsonselene.tomlstylua.toml.stylua.toml.busted
How to write Lua as a senior engineer, covering the differences between Lua 5.1, 5.4, 5.5, and LuaJIT, locals and modules, tables and strings, numbers, errors and cleanup, metatables, coroutines inside a host's event loop, performance, text for users and its translations, untrusted input, sandboxing code the program didn't ship, the C API and LuaJIT's FFI, LuaCATS or LDoc docs, rockspecs, tests on every supported version, and lints. It relies on
writing.mdfor doc comments and error messages, so adopt both. -
Python
Loads for 16 file patterns
**/*.py**/*.pyi**/pyproject.tomluv.lockpoetry.lockpylock*.toml**/requirements*.txt**/requirements*.insetup.cfgtox.inipytest.inimypy.inipyrightconfig.jsonruff.toml.ruff.toml.python-version
How to write Python as a senior engineer, covering the features each version adds, type hints and data design, traps such as mutable default arguments and late-binding closures, exceptions, files and encodings, logging, time and money, text for users and its translations through gettext, untrusted input, threads, processes, and
asyncio, native code, public APIs, docstrings, READMEs and metadata for the Python Package Index (PyPI), tests with pytest, lints and type checking, and packaging withpyproject.tomland lock files. It relies onwriting.mdfor docstrings and error messages, so adopt both. -
TypeScript and JavaScript
Loads for 23 file patterns
**/*.ts**/*.tsx**/*.mts**/*.cts**/*.js**/*.jsx**/*.mjs**/*.cjs**/package.jsonpackage-lock.jsonpnpm-lock.yamlyarn.lockbun.lock**/tsconfig*.jsoneslint.config.*prettier.config.*.prettierrc*biome.jsonbiome.jsoncvitest.config.*.nvmrc.node-version.npmrc
How to write TypeScript and JavaScript as a senior engineer, on Node.js, in browsers, or both, covering runtimes and ES modules, Node.js running
.tsfiles directly, strict compiler options, type design, traps such as the default sort order and the limits ofnumber, errors and unhandled promises, logging, async code and cancellation, text for users and its translations throughIntl, untrusted input and prototype pollution, native addons, public APIs and theexportsfield, doc comments, READMEs and metadata for npm, tests, linting with type information, and dependencies and install scripts. It relies onwriting.mdfor doc comments and error messages, so adopt both. Code that runs in web pages also followsweb-front-end.md. -
PHP
Loads for 22 file patterns
**/*.php**/*.phtml**/*.twig**/composer.json**/composer.lockphpunit.xmlphpunit.xml.distphpstan.neonphpstan.neon.distphpstan-baseline.neonpsalm.xmlpsalm.xml.dist.php-cs-fixer.php.php-cs-fixer.dist.phpphpcs.xmlphpcs.xml.dist.phpcs.xml.phpcs.xml.distrector.phpinfection.json5**/php.ini.php-version
How to write PHP as a senior engineer, covering what each version from 8.0 to 8.6 adds, strict types and type design, traps such as loose comparison and array keys that change type, exceptions and the built-in functions that return
false, files, processes, and timeouts, logging through PSR-3 (the PHP Standards Recommendation for loggers), time and money, text for users and its translations, and untrusted input, from escaping in templates and SQL parameters tounserialize, uploads, and sessions. It also covers state that outlives a request in worker runtimes, database migrations, extensions and the foreign function interface (FFI), public APIs and named arguments, docblocks, READMEs and Composer metadata for Packagist, PHPUnit tests, static analysis and its baseline, and Composer dependencies. It relies onwriting.mdfor docblocks and error messages, so adopt both. The HTML that templates write also followsweb-front-end.md. -
Go
Loads for 13 file patterns
**/*.go**/go.mod**/go.sumgo.workgo.work.sum.golangci.yml.golangci.yaml.golangci.toml.golangci.json**/staticcheck.conf.goreleaser.yml.goreleaser.yaml**/testdata/fuzz/**
How to write Go as a senior engineer, covering what each release from 1.18 to 1.27 adds and how the
goline ingo.modchanges the language, package and type design, traps such as typed nil errors, shared slice arrays, and silent integer wraparound, errors and wrapping, contexts and timeouts, goroutines with owners, channels, and the race detector, files, processes, and HTTP,log/slog, time and money, text for users and its translations, and untrusted input. It also covers cgo andunsafe, profiling, public APIs and module versions, doc comments, examples, and READMEs for pkg.go.dev, table-driven and fuzz tests, lints and their suppressions, modules andgovulncheck, and release builds. It relies onwriting.mdfor doc comments and error messages, so adopt both. -
C#
Loads for 15 file patterns
**/*.cs**/*.csproj**/*.props**/*.targets**/*.sln**/*.slnx**/*.razor**/*.cshtml**/*.resx**/packages.lock.json**/.editorconfig**/.globalconfigglobal.jsonnuget.configNuGet.Config
How to write C# on .NET as a senior engineer, covering what each C# version from 8 to 15 adds and which .NET releases are supported, nullable reference types and type design, traps such as LINQ's deferred execution and record equality with collections, exceptions,
asynccode and cancellation, locks and dependency injection lifetimes, disposal andHttpClient, logging with message templates, time and money, culture and text for users, and untrusted input. It also covers P/Invoke,unsafecode, and Native AOT, performance, public APIs and binary compatibility, XML doc comments, READMEs and metadata for NuGet packages, tests, analyzers and their suppressions, and central package management, lock files, and NuGet's audit. It relies onwriting.mdfor doc comments and error messages, so adopt both. The HTML that Razor and Blazor write also followsweb-front-end.md. -
Ruby
Loads for 17 file patterns
**/*.rb**/*.rake**/*.gemspec**/*.erb**/*.rbs**/*.rbi**/Gemfile**/Gemfile.lock**/Rakefile**/config.ru.ruby-version.rubocop.yml.rubocop_todo.yml.standard.yml.rspec.yardoptsbin/*
How to write Ruby as a senior engineer, covering what each version from 2.7 to 4.0 adds and which are maintained, bundled gems, object design and
Data, traps such as shared default objects, truthiness, and frozen strings, exceptions andrescue, files and commands without a shell, logging, time and money, text for users and its translations through the i18n gem, and untrusted input, from Active Record placeholders and ERB escaping toMarshal, YAML, and regular expressions anchored with\Aand\z. It also covers threads, forked processes, and background jobs, migrations, native extensions, YJIT, public APIs and deprecations, YARD docs, gem READMEs and gemspec metadata, tests, RuboCop and its suppressions, and Bundler's lock file, checksums, and audit. It relies onwriting.mdfor doc comments and error messages, so adopt both. The HTML that templates write also followsweb-front-end.md. -
Perl
Loads for 20 file patterns
**/*.pl**/*.pm**/*.t**/*.pod**/*.psgi**/*.xs**/*.ep**/*.tt**/cpanfile**/cpanfile.snapshot**/Makefile.PL**/Build.PL**/dist.ini**/MANIFEST.SKIP.perlcriticrc.perltidyrc.proverc.perl-versionbin/*script/*
How to write Perl 5 as a senior engineer, covering what each version from 5.10 to 5.44 adds,
use v5.xxand its feature bundles, experimental features, packages and object systems, traps such as context, string and number comparisons,split, and autovivification, exceptions withtry/catchandcroak, three-argumentopenand commands without a shell, logging, time and money, character encodings, text for users and its translations through gettext, and untrusted input, from DBI placeholders and template escaping to stringeval, Storable, and patterns anchored with\Aand\z. It also covers preforking workers and forked processes, migrations, XS modules (C code that perl loads) and the foreign function interface (FFI), public APIs and$VERSION, Plain Old Documentation (POD), distribution READMEs and metadata, tests with Test2, Perl::Critic and its suppressions, and dependencies locked with Carton and checked with CPAN::Audit. It relies onwriting.mdfor POD and error messages, so adopt both. The HTML that templates write also followsweb-front-end.md. -
Roadmap and documentation
Loads for 6 file patterns
docs/**AGENTS.mdCONTRIBUTING.mdREADME.mddiagrams/**diagram/**
How to plan and document a project in the style of Nadir's
docs/folder, covering the numbered core documents, a roadmap of milestones and checkable tasks with a backlog of triggers, append-only decision records, specs for each part of the system, a feature list tied to the roadmap, and where status is reported. It includes a template for each document, and relies onwriting.mdfor the text, so adopt both. -
Teaching materials
Loads for 11 file patterns
**/*.ipynb**/*.tex**/*.bib**/*.sty**/*.cls**/_toc.yml**/myst.yml**/_quarto.ymlcourses/**workbooks/**articles/**
How to write courses, workbooks, and formal articles that educate readers, as a university professor. It covers when to use Markdown, Jupyter notebooks, or LaTeX; objectives-first course design; exercises, answer keys, and rubrics; each format's practices; accessible PDFs; citations; and integrity and student privacy. It relies on
writing.md, so adopt both.
No rules match
Try a shorter word, such as a language or a tool.