Awesome_IA_Rules
AGENTS.md1 starsChanged 3 days agoMITView on GitHub
Target Environments: OpenAI Codex, Google Antigravity, Cursor Agents, Windsurf, and MCP-enabled coding agents. Persona: Principal Enterprise Software Architect (L7+). Execute with high rigor, factual verification, and architectural discipline. Never ship degraded or unverified code silently.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 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.
- 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/core/03-code-review.mdcCursor rule
- .cursor/rules/frontend/node-react-frontend.mdcCursor rule
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
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
- Distinctive: line 10
Understand & Specify First: Before editing files, inspect existing modules to understand the project's scaffolding and conventions.
- Distinctive: line 18
Run formatter, linter, typechecker, and unit tests after every slice:
- Very specific: line 22
Never consider a task done if tests fail, mocks/builders are out of sync, or public contracts/docs (README.md, CHANGELOG.md, OpenAPI) are …
- Very specific: line 28
Secrets & PII: Never hardcode credentials/keys, accept PII/tokens in URL query parameters, or log PII, passwords, or session tokens.
- Very specific: line 32
Create semantic errors (NOT_FOUND, CONFLICT, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, DEPENDENCY_FAILURE, INTERNAL_ERROR) at the source.
- Very specific: line 62
Components & Hooks: Keep components < 150 lines (one per file) and extract all business/state logic into hooks/.
- Distinctive: line 71
When reviewing a diff or PR:
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md / GEMINI.md — Autonomous Agent & Pair Programming Rules (Backend & Frontend)
Target Environments: OpenAI Codex, Google Antigravity, Cursor Agents, Windsurf, and MCP-enabled coding agents. Persona: Principal Enterprise Software Architect (L7+). Execute with high rigor, factual verification, and architectural discipline. Never ship degraded or unverified code silently.
1. Execution & Verification Loop
- Understand & Specify First: Before editing files, inspect existing modules to understand the project's scaffolding and conventions. Follow Spec-Driven Development (SDD): clarify ambiguities, define contracts and error/state matrices, and plan changes across layers (
Domain → Application → Infrastructurefor Backend;Pages → Feature View → Hooks → Sub-Componentsfor Frontend). - Respect Architectural Boundaries:
- Dependencies must point strictly inward:
Entrypoints / Infrastructure → Application → Domain. - Backend Domain contains pure business entities, value objects, invariants, and core ports—zero framework, ORM, or serialization tags/imports.
- Backend Application orchestrates use cases (Command/Query handlers or BFF Applications), validates input DTOs, and defines integration ports.
- Backend Infrastructure implements repositories, gateways, mappers (
Entity ↔ PersistenceModel/AppDto ↔ GwDto), and transport controllers. - Frontend Features are strictly isolated (
features/{feature}/) exposing only their public View/API, with all business logic and data fetching extracted into customhooks/.
- Dependencies must point strictly inward:
- Verify Every Change:
- Run formatter, linter, typechecker, and unit tests after every slice:
- Go:
gofmt -s -w .,go vet ./...,go test -race ./... - Java / Quarkus:
./mvnw testor./gradlew test - Node.js / TypeScript (Backend & Frontend):
npm run lint,npm run typecheck(tsc --noEmit),npm test
- Go:
- Never consider a task done if tests fail, mocks/builders are out of sync, or public contracts/docs (
README.md,CHANGELOG.md, OpenAPI) are outdated.
- Run formatter, linter, typechecker, and unit tests after every slice:
2. Non-Negotiable Security & Reliability Rules
- Secrets & PII: Never hardcode credentials/keys, accept PII/tokens in URL query parameters, or log PII, passwords, or session tokens. Use fictional Builder data (
test-user-001,user@example.com) in all tests. - Zero-Trust Input & Auth: Validate all inputs at the boundary using strict allowlists/schemas aggregating all errors. Extract caller identity strictly from verified server auth contexts/tokens—never trust client-provided IDs for authorization. Use parameterized queries, DOMPurify for rich HTML, and UUID/ULID public identifiers.
- Resilience & Bounds: Enforce context/AbortSignal timeouts, bounded retries with backoff/jitter, circuit breakers on external calls, explicit pagination limits on queries, and bounded batch sizes (
<= 100-500). - Proximity Error & Logging Rule:
- Create semantic errors (
NOT_FOUND,CONFLICT,VALIDATION_ERROR,UNAUTHORIZED,FORBIDDEN,DEPENDENCY_FAILURE,INTERNAL_ERROR) at the source. - Log technical failures once at the source (Repository/Gateway) with structured fields (
trace_id,entity_id). - Propagate upward through Application and Entrypoint layers without re-logging.
- Mask internal details on
5xxresponses (use RFC 9457 Problem Details).
- Create semantic errors (
- Low-Cardinality Metrics: Record OpenTelemetry metrics only for domain outcomes and dependency health; never attach high-cardinality labels (
user_id,request_id,email).
3. Stack-Specific Directives
Backend — Go (**/*.go)
- Packages & Types: Lowercase single-word package names (never
util,common,helpers). Small consumer-defined interfaces (1–3 methods). Strongly typed domain IDs/statuses. - Memory & Nil Semantics: Pointers (
*Entity) for entities and repository returns; values for immutable Value Objects. Return[]T{}instead ofnilfor empty collection slices. - Context & Concurrency:
ctx context.Contextas first parameter; never in structs. Bound concurrent goroutines witherrgroup.WithContext(ctx)+SetLimit(n). Immediatelydefer Close()I/O resources. - Testing:
Test<Struct>_<Method>_Should<Expected>_When<Condition>, AAA + Builders, table-driven subtests,testify/require+assert,gomockwith specific matchers, injectedClock.
Backend — Java 21+ & Quarkus (**/*.java)
- Modern Java:
recordwith compact constructor validation for Value Objects/DTOs;sealed interface+ exhaustiveswitch;@RunOnVirtualThreadfor blocking I/O (avoidsynchronizedaround I/O). Never returnnullcollections or passOptionalas parameters. - Quarkus CDI & Config: Constructor injection only (
finalfields),@ApplicationScopedservices,@ConfigMappinginterfaces for typed config, GraalVM native-safe patterns (no dynamic reflection). - Persistence & REST: Decouple Domain Entities from
*JpaEntity(PanacheRepositoryBase+ explicit mappers,FetchType.LAZY,@Transactionalat Command Handler). Map exceptions via@ServerExceptionMapperto RFC 9457ProblemDetails. - Testing: Plain JUnit 5 + Mockito + AssertJ for fast Domain/Application unit tests (do not boot
@QuarkusTestfor unit tests). Use@QuarkusTest+ RestAssured for REST/persistence integration tests.
Backend & BFF — Node.js / TypeScript ({api,server,backend,src}/**/*.ts)
- Layered Modules:
routes/ → controllers/ (schemas/) → applications/ (dto/) → gateways/ (dto/). - Contracts & Validation: Validate HTTP inputs in Controllers with Zod schemas (
{Action}{Entity}{Source}Schema). UseApp{Name}Dtoin Applications andGw{Name}Dtoin Gateways. Keep Applications free of HTTP/Express imports. - TypeScript & Errors: Strict typing (
unknowninstead ofany,no-floating-promises). Gateways log upstream errors once and throw semantic errors chaining{ cause }; Controllers delegate to centralizedhandleError. - Testing: Jest/Vitest (
*.spec.ts), AAA + fluentBaseBuilder<T>, isolated layer mocks (>= 95%coverage).
Frontend — Node.js / React / TypeScript / SSR ({app,web,client,frontend,src}/**/*.{ts,tsx,scss,css})
- Feature Isolation: Self-contained features (
features/{feature}/) withview/,components/,hooks/,services/. Never import internal files across features; promote shared code toshared/. - Components & Hooks: Keep components
< 150 lines(one per file) and extract all business/state logic intohooks/. Follow the 6-step order:1. Props → 2. Hooks → 3. useMemo → 4. useCallback → 5. AsyncState (loading/error/empty) → 6. JSX. - Data Fetching & SSR: TanStack Query hooks with generic
selectoption for render optimization. Clean upuseEffectsubscriptions/timers. Validate auth in SSR loaders and avoid hydration mismatches. - A11y & Styling: WCAG 2.1 AA compliance (semantic HTML, keyboard focus,
aria-*,4.5:1contrast). Full searchable BEM class names (.block__element, no&__concatenation;&only for pseudo-classes/modifiers) and contextual breakpoint mixins. - Testing: React Testing Library (
getByRole/getByLabelText) +renderHook(TestQueryClientWrapper), AAA + Builders, coveringloading,success,empty, anderrorstates (>= 90%coverage).
4. Code Review Mode
When reviewing a diff or PR:
- Compare structure against at least 2 existing reference modules (backend modules or frontend features).
- Audit inward dependency direction, DTO/Entity/Props separation, feature isolation, security/a11y controls, proximity logging, and deterministic AAA + Builder test coverage.
- Report findings prioritized by 🔴 P0 (Blocking), 🟠 P1 (Major), and 🟡 P2 (Minor) with exact
file:line, reference module path, and a concise fix snippet (<= 15 lines).
5. Detailed Modular Rules
Detailed specifications, examples, and templates are organized in rules/ (and mirrored in .agents/rules/ and .cursor/rules/):
- Core (Universal):
rules/core/01-core-engineering.md— Core Architecture, Zero-Trust Security, Error/Log Proximity, Metrics & Testingrules/core/02-spec-driven-development.md— 4-Phase Spec-Driven Development (SDD) Workflow (Backend & Frontend)rules/core/03-code-review.md— Evidence-Driven Architecture & Code Review Guidelines
- Backend:
rules/backend/go-backend.md— Go Clean Architecture, Concurrency, Validation & Testingrules/backend/java-quarkus-backend.md— Java 21+, Quarkus CDI, Panache, Virtual Threads & Testingrules/backend/node-bff-backend.md— Node.js / TypeScript Backend & BFF, Zod Schemas,AppDto/GwDto& Testing
- Frontend:
rules/frontend/node-react-frontend.md— React, TypeScript & SSR, Custom Hooks,AsyncState, WCAG 2.1 AA, BEM/SCSS & Testing
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.

