* feat(rules): add Rust coding style, hooks, and patterns rules Add language-specific rules for Rust extending the common rule set: - coding-style.md: rustfmt, clippy, ownership idioms, error handling, iterator patterns, module organization, visibility - hooks.md: PostToolUse hooks for rustfmt, clippy, cargo check - patterns.md: trait-based repository, newtype, enum state machines, builder, sealed traits, API response envelope Rules reference existing rust-patterns skill for deep content. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> * feat(rules): add Rust testing and security rules Add remaining Rust language-specific rules: - testing.md: cargo test, rstest parameterized tests, mockall mocking with mock! macro, tokio async tests, cargo-llvm-cov coverage - security.md: secrets via env vars, parameterized SQL with sqlx, parse-don't-validate input validation, unsafe code audit requirements, cargo-audit dependency scanning, proper HTTP error status codes Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> * fix(rules): address review feedback on Rust rules Fixes from Copilot, Greptile, Cubic, and CodeRabbit reviews: - Add missing imports: use std::borrow::Cow, use anyhow::Context - Use anyhow::Result<T> consistently (patterns.md, security.md) - Change sqlx placeholder from ? to $1 (Postgres is most common) - Remove Cargo.lock from hooks.md paths (auto-generated file) - Fix tokio::test to show attribute form #[tokio::test] - Fix mockall mock! name collision, wrap in #[cfg(test)] mod tests - Fix --test target to match file layout (api_test, not integration) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> * fix: update catalog counts in README.md and AGENTS.md Update documented counts to match actual repository state after rebase: - Skills: 109 → 113 (new skills merged to main) - Commands: 57 → 58 (new command merged to main) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> --------- Co-authored-by: Chris Yau <chris@diveanddev.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Happy <yesreply@happy.engineering>
Rules
Structure
Rules are organized into a common layer plus language-specific directories:
rules/
├── common/ # Language-agnostic principles (always install)
│ ├── coding-style.md
│ ├── git-workflow.md
│ ├── testing.md
│ ├── performance.md
│ ├── patterns.md
│ ├── hooks.md
│ ├── agents.md
│ └── security.md
├── typescript/ # TypeScript/JavaScript specific
├── python/ # Python specific
├── golang/ # Go specific
├── swift/ # Swift specific
└── php/ # PHP specific
- common/ contains universal principles — no language-specific code examples.
- Language directories extend the common rules with framework-specific patterns, tools, and code examples. Each file references its common counterpart.
Installation
Option 1: Install Script (Recommended)
# Install common + one or more language-specific rule sets
./install.sh typescript
./install.sh python
./install.sh golang
./install.sh swift
./install.sh php
# Install multiple languages at once
./install.sh typescript python
Option 2: Manual Installation
Important: Copy entire directories — do NOT flatten with
/*. Common and language-specific directories contain files with the same names. Flattening them into one directory causes language-specific files to overwrite common rules, and breaks the relative../common/references used by language-specific files.
# Install common rules (required for all projects)
cp -r rules/common ~/.claude/rules/common
# Install language-specific rules based on your project's tech stack
cp -r rules/typescript ~/.claude/rules/typescript
cp -r rules/python ~/.claude/rules/python
cp -r rules/golang ~/.claude/rules/golang
cp -r rules/swift ~/.claude/rules/swift
cp -r rules/php ~/.claude/rules/php
# Attention ! ! ! Configure according to your actual project requirements; the configuration here is for reference only.
Rules vs Skills
- Rules define standards, conventions, and checklists that apply broadly (e.g., "80% test coverage", "no hardcoded secrets").
- Skills (
skills/directory) provide deep, actionable reference material for specific tasks (e.g.,python-patterns,golang-testing).
Language-specific rule files reference relevant skills where appropriate. Rules tell you what to do; skills tell you how to do it.
Adding a New Language
To add support for a new language (e.g., rust/):
- Create a
rules/rust/directory - Add files that extend the common rules:
coding-style.md— formatting tools, idioms, error handling patternstesting.md— test framework, coverage tools, test organizationpatterns.md— language-specific design patternshooks.md— PostToolUse hooks for formatters, linters, type checkerssecurity.md— secret management, security scanning tools
- Each file should start with:
> This file extends [common/xxx.md](../common/xxx.md) with <Language> specific content. - Reference existing skills if available, or create new ones under
skills/.
Rule Priority
When language-specific rules and common rules conflict, language-specific rules take precedence (specific overrides general). This follows the standard layered configuration pattern (similar to CSS specificity or .gitignore precedence).
rules/common/defines universal defaults applicable to all projects.rules/golang/,rules/python/,rules/swift/,rules/php/,rules/typescript/, etc. override those defaults where language idioms differ.
Example
common/coding-style.md recommends immutability as a default principle. A language-specific golang/coding-style.md can override this:
Idiomatic Go uses pointer receivers for struct mutation — see common/coding-style.md for the general principle, but Go-idiomatic mutation is preferred here.
Common rules with override notes
Rules in rules/common/ that may be overridden by language-specific files are marked with:
Language note: This rule may be overridden by language-specific rules for languages where this pattern is not idiomatic.