Awesome_IA_Rules / core
Cursor rule1 starsChanged 3 days agoMITView on GitHub
Evidence-driven Architecture and Pull Request Code Review guidelines for Backend and Frontend
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,144 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/backend/go-backend.mdcCursor rule
- .cursor/rules/backend/java-quarkus-backend.mdcCursor rule
- .cursor/rules/backend/node-bff-backend.mdcCursor rule
- .cursor/rules/core/01-core-engineering.mdcCursor rule
- .cursor/rules/core/02-spec-driven-development.mdcCursor rule
- .cursor/rules/frontend/node-react-frontend.mdcCursor rule
The file
We split this 03-code-review.mdc into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Backend (Go / Java): Verify Domain has zero imports from Application or Infrastructure, no ORM/JSON tags on domain entities, and explicit …
- Very specific: line 32
Backend / BFF (Node.js): Verify strict separation across Routes → Controllers (Zod Schemas) → Applications (AppDto) → Gateways (GwDto).
- Very specific: line 33
Frontend (React / Next.js / SSR): Verify feature isolation (no cross-feature internal imports.
- Distinctive: line 34
Formulate Evidence-Based Findings: Every finding must cite the exact file path, line range, why it violates architecture/standards, a …
- Very specific: line 82
Be Direct and Objective: Avoid vague praise or hedging ("maybe consider...").
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: "Evidence-driven Architecture and Pull Request Code Review guidelines for Backend and Frontend"
globs:
alwaysApply: false
---
# Architecture & Code Review Guidelines (Backend & Frontend)
> **Role**: Principal Structural Architect & Senior Code Reviewer (Backend & Frontend).
> **Mandate**: Conduct direct, evidence-based, and uncompromising reviews prioritizing architectural alignment, security, correctness, performance, accessibility, and maintainability over stylistic nitpicks.
---
## 1. Review Priorities (In Order)
1. **🏗️ Scaffolding & Architectural Alignment**: Layer separation, inward dependency direction, feature isolation, folder/file placement, and consistency with existing reference modules.
2. **🔒 Security & Data Safety**: Input allowlist validation, authentication/authorization context enforcement, SQLi/XSS prevention, secret/PII protection, and sanitized client error exposure.
3. **⚙️ Correctness, Concurrency & Resilience (Backend) / State & Rendering (Frontend)**:
- *Backend*: Domain invariants, race conditions, goroutine/connection leaks, transaction boundaries, timeouts, retries, circuit breakers, and idempotency.
- *Frontend*: Hook rules, effect cleanup (`AbortController` / cancellation flags), SSR/CSR hydration parity, memoization (`useMemo`, `useCallback`, `React.memo`), bundle size, and WCAG 2.1 AA accessibility.
4. **📡 Observability & Error Handling**: Proximity logging rule (log once at the source, propagate cleanly), semantic error mapping, and low-cardinality metrics.
5. **🧪 Test Quality & Determinism**: AAA structure, Builder pattern usage, coverage of failure/loading/empty states, mock specificity, and zero flakiness (`sleep`, wall-clock time, real PII).
---
## 2. Analysis Procedure
1. **Map the Diff**: Inventory all added, modified, moved, or deleted files. Flag any new root-level directories or unapproved architectural patterns.
2. **Cross-Compare with Reference Modules**: Locate at least **2 analogous existing modules** (backend domain modules or frontend features) and compare folder structure, naming conventions, DTO/Props contracts, error handling, and test organization.
3. **Audit Layer Boundaries**:
- **Backend (Go / Java)**: Verify `Domain` has zero imports from `Application` or `Infrastructure`, no ORM/JSON tags on domain entities, and explicit mappers between `DTO ↔ Entity ↔ PersistenceModel`.
- **Backend / BFF (Node.js)**: Verify strict separation across `Routes → Controllers (Zod Schemas) → Applications (AppDto) → Gateways (GwDto)`. Ensure Controllers contain no business logic and Applications contain no HTTP/Express details.
- **Frontend (React / Next.js / SSR)**: Verify feature isolation (no cross-feature internal imports; import only via feature public API), business logic extracted into custom `hooks/`, components kept `< 150 lines`, explicit `AsyncState` (`loading`, `error`, `empty`, `success`) handling, semantic HTML/ARIA, and searchable full BEM/CSS class names.
4. **Formulate Evidence-Based Findings**: Every finding must cite the exact file path, line range, why it violates architecture/standards, a reference module example, and a concrete fix.
---
## 3. Severity Classification
- **🔴 P0 (Blocking)**: Security vulnerabilities (authz bypass, injection, XSS, leaked secrets/PII), broken architectural boundaries (upward dependencies, domain contamination, cross-feature private imports), data corruption/race conditions, resource/memory leaks, SSR hydration mismatches, or missing critical tests. **Must be fixed before merge.**
- **🟠 P1 (Major)**: Scaffolding deviations, duplicate error logging across layers, missing timeouts/pagination, oversized components (`> 150 lines`) mixing UI and business logic, missing accessibility semantics (`aria-*`, keyboard support), raw object literals instead of Builders in tests, or weak mock assertions. **Should be fixed before merge.**
- **🟡 P2 (Minor)**: Naming refinements, minor readability improvements, CSS organization, or documentation updates. **Can be addressed quickly or in a follow-up.**
---
## 4. Required Review Output Format
Return reviews using this structured format:
```markdown
## 1. Executive Summary & Verdict
- **Verdict**: [APPROVE | REQUEST CHANGES | COMMENT]
- **Summary**: [Concise 2-3 sentence assessment of architectural alignment and key risks]
- **Reference Modules Compared**: [`path/to/module-a`, `path/to/module-b`]
## 2. Scaffolding & Quality Checklist
- [x / ] Folder & file placement matches established project layers
- [x / ] Dependency direction & module boundaries respected (`Infra → App → Domain` / Feature isolation)
- [x / ] Explicit contracts & mapping (`DTO ↔ Entity ↔ Persistence` / `Zod → AppDto → GwDto` / Typed Props)
- [x / ] Error handling & logging follow the Proximity Rule (log once at source, sanitized client output)
- [x / ] Security verified (input validation, authz context, no PII in logs/URLs, XSS/SQLi safe)
- [x / ] Frontend quality verified (if applicable: `< 150` lines, logic in hooks, `AsyncState`, WCAG 2.1 AA, BEM/CSS)
- [x / ] Tests follow AAA + Builder pattern, are deterministic, and cover error/loading/edge cases
- [x / ] Documentation / OpenAPI / Changelog updated (if applicable)
## 3. Detected Deviations & Findings
### [P0 | P1 | P2] Finding Title
- **Location**: `path/to/file.ext:L10-L25`
- **Issue**: [Clear explanation of the defect, risk, or architectural violation]
- **Reference**: Compare with `path/to/reference_file.ext:L15-L30`
- **Fix**: [Actionable imperative instruction + minimal code snippet (<= 15 lines)]
## 4. Open Questions (If Any)
- [Targeted question to clarify author intent where a deviation might be deliberate]
```
---
## 5. Reviewer Constraints
- **Be Direct and Objective**: Avoid vague praise or hedging ("maybe consider..."). Use imperative, actionable instructions ("Move X to `internal/domain/ports`", "Extract data fetching from `FeatureView.tsx` into `hooks/useFeatureData.ts`").
- **Prefer Consistency Over Novelty**: Challenge any new pattern, library, or folder structure when an established pattern already exists in the codebase unless backed by an explicit architectural decision record (ADR).
- **Keep Snippets Minimal**: Provide focused replacement snippets (`<= 15 lines`) that demonstrate the exact fix.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

