---
description: "Master index of all available rules - consult when planning multi-step tasks, working with unfamiliar parts of the codebase, or when no language-specific file is open. Lists per-stack router files and pattern rules."
tags: ["discovery", "routing", "catalog"]
relatedRules: ["QUICK_START.mdc", "README.md"]
---

# Rule Index

Use this index when you need to discover which rules exist for a given stack or topic. Each **router** file is the table of contents for that stack; read the router first, then the specific rule files it points to.

## Quick Decision Tree

- Need first-run guidance or fast navigation? -> `QUICK_START.mdc`
- Need stack-specific implementation guidance? -> open the matching stack router below
- Need cross-cutting concepts (testing/security/architecture)? -> use `patterns/*`
- Need workflow/process guidance (TDD/review/onboarding)? -> use `development/*`

## Always-Applied Rules (in every context)

| File | Purpose |
|------|---------|
| `agent-behavior.mdc` | Persona, Never Assume, Rule Flagging; links to workflow/TDD/docs |
| `project-context.mdc` | Project-specific routing: active stacks, directory→router mapping, key deps; generated by onboarding |

**Agent-requestable (request when needed):** `retrospective.mdc` (end-of-task review, rule gaps, IMPROVEMENTS.md). See agent-behavior.mdc "See also".

## Per-Stack Routers (glob-activated; read when working in that stack)

Each stack has **one router** that loads when matching files are open. All other rules in that stack are agent-requestable — the router lists them by task; load the 2–3 relevant to the current sub-task.

| Stack | Router File | When to Use |
|-------|-------------|-------------|
| **AWS Lambda / Node.js** | `languages/aws-lambda/nodejs-lambda.mdc` | Lambda functions, CDK, DynamoDB, SQS, SNS, API Gateway |
| **Node.js / TypeScript (base)** | `languages/nodejs/nodejs-base.mdc` | Express, Fastify, NestJS, Hono; non-Lambda TS backends |
| **Java / Spring Boot** | `languages/java/java-spring.mdc` | Spring Boot 3, JPA, Spring Security, Resilience4j |
| **C# / .NET** | `languages/csharp/csharp-dotnet.mdc` | ASP.NET Core, EF Core, FluentValidation, Polly, Rebus |
| **React / TypeScript** | `languages/react/react-frontend.mdc` | React 18+, TanStack Query, React Router v7, Tailwind |

## Agent-Requestable Pattern & Workflow Rules

| File | Topic |
|------|--------|
| `patterns/architecture.mdc` | Clean Architecture, Vertical Slice, CQRS, DDD, SOLID |
| `patterns/clean-code.mdc` | Index to clean-code sub-rules (naming, functions, design, hygiene) |
| `patterns/clean-code-naming.mdc` | Naming, vocabulary, abbreviations, negated booleans |
| `patterns/clean-code-functions.mdc` | Method params, guard clauses, abstraction levels, cognitive load |
| `patterns/clean-code-design.mdc` | Side effects, immutability, Law of Demeter, composition, dependencies |
| `patterns/clean-code-hygiene.mdc` | Dead code, magic numbers, comments, fail fast, Rule of Three |
| `patterns/error-handling.mdc` | Result pattern, RFC 7807 ProblemDetails |
| `patterns/testing.mdc` | TDD, AAA, test categories, mocking |
| `patterns/security.mdc` | Secrets, HTTPS, CORS, headers, RBAC |
| `patterns/api-design.mdc` | REST, HTTP methods, status codes, versioning |
| `patterns/input-sanitization.mdc` | Validation vs sanitization, SQL/XSS/path traversal |
| `patterns/cqrs.mdc` | Command/Query separation, pipeline behaviors |
| `development/tdd-workflow.mdc` | TDD Red/Green/Refactor mandate, escape clause |
| `development/tdd-planning.mdc` | Test scenario specification, Method_WhenCondition_ShouldResult |
| `development/code-implementation.mdc` | Pre-work, TDD cycle, Definition of Done, summary format |
| `development/code-review.mdc` | Code review loop, DoD table, checklist |
| `development/project-onboarding.mdc` | Analyze repo, detect stacks, map dirs→routers, generate project-context.mdc |
| `development/context7-docs.mdc` | Context7 MCP — resolve-library-id, get-library-docs |
| `retrospective.mdc` | End-of-task review, rule gaps, IMPROVEMENTS.md |

## How to Use

1. **Before implementation:** Always consult the **stack router** for the stack you are working in (see table above). The router is the only glob-loaded rule for that stack; it lists every language-specific rule by task type. Load the 2–3 rules relevant to your current sub-task.
2. **Planning or unfamiliar codebase:** Read this index, then the router for that stack; request the rule files the router points to for your task.
3. **Cross-cutting concept:** Use the pattern or development rules above; request by name when needed.

## Most Common Workflows

- API endpoint work: router -> `languages/*/controllers.mdc`, `languages/*/validation.mdc`, `languages/*/error-handling.mdc`
- Testing work: router `languages/*/testing.mdc` + `patterns/testing.mdc` + `development/tdd-workflow.mdc`
- Security work: router `languages/*/security.mdc` + `languages/*/input-sanitization.mdc` (+ `languages/*/auth.mdc` if applicable)
- Large unfamiliar project: `development/project-onboarding.mdc` -> refresh `project-context.mdc` -> router

**Activation model:** Always-applied: `agent-behavior.mdc`, `project-context.mdc`. Only the five stack routers are glob-activated. All other language-specific rules and all pattern/development rules are agent-requestable — load them on demand via the router or by name to keep context under ~15k–20k tokens per task.

**See also:** `QUICK_START.mdc`, `README.md` in this folder for full activation model and token budget.
