bigpowers / rules
Cursor rule252 starsChanged 3 months agoMITView on GitHub
Self-review checklist for the coding agent to run before dispatching a reviewer. Checks CONVENTIONS.md compliance, Boy Scout Rule, test coverage, types, and SOLID. Produces a pass/fail checklist. Use before request-review, before committing, or when user asks for a code quality check.
- Reads credentials
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 1,533 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 repository165 other files it gives its agents.
- docs/AGENTS.mdAGENTS.md
- website/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- website/CLAUDE.mdCLAUDE.md
- .cursor/rules/align-grid.mdcCursor rule
- .cursor/rules/assess-impact.mdcCursor rule
- .cursor/rules/audit-plan.mdcCursor rule
- .cursor/rules/build-epic.mdcCursor rule
- .cursor/rules/change-request.mdcCursor rule
- .cursor/rules/commit-message.mdcCursor rule
- .cursor/rules/compose-workflow.mdcCursor rule
- .cursor/rules/context7-mcp.mdcCursor rule
- .cursor/rules/craft-skill.mdcCursor rule
- .cursor/rules/deepen-architecture.mdcCursor rule
- .cursor/rules/define-language.mdcCursor rule
- .cursor/rules/define-success.mdcCursor rule
- .cursor/rules/delegate-task.mdcCursor rule
- .cursor/rules/deploy.mdcCursor rule
- .cursor/rules/design-interface.mdcCursor rule
- .cursor/rules/develop-tdd.mdcCursor rule
- .cursor/rules/diagnose-root.mdcCursor rule
- .cursor/rules/diagnose-stall.mdcCursor rule
- .cursor/rules/dispatch-agents.mdcCursor rule
- .cursor/rules/edit-document.mdcCursor rule
- .cursor/rules/elaborate-spec.mdcCursor rule
- .cursor/rules/enforce-first.mdcCursor rule
- .cursor/rules/evolve-skill.mdcCursor rule
- .cursor/rules/execute-plan.mdcCursor rule
- .cursor/rules/extract-design.mdcCursor rule
- .cursor/rules/find-way.mdcCursor rule
- .cursor/rules/fix-bug.mdcCursor rule
- .cursor/rules/gate-trace.mdcCursor rule
- .cursor/rules/generate-allure-report.mdcCursor rule
- .cursor/rules/grill-me.mdcCursor rule
- .cursor/rules/grill-with-docs.mdcCursor rule
- .cursor/rules/guard-git.mdcCursor rule
- .cursor/rules/harden-vps.mdcCursor rule
- .cursor/rules/hook-commits.mdcCursor rule
- .cursor/rules/inspect-quality.mdcCursor rule
- .cursor/rules/investigate-bug.mdcCursor rule
- .cursor/rules/kickoff-branch.mdcCursor rule
- .cursor/rules/maintain-wiki.mdcCursor rule
- .cursor/rules/map-codebase.mdcCursor rule
- .cursor/rules/migrate-spec.mdcCursor rule
- .cursor/rules/model-domain.mdcCursor rule
- .cursor/rules/orchestrate-project.mdcCursor rule
- .cursor/rules/organize-workspace.mdcCursor rule
- .cursor/rules/plan-refactor.mdcCursor rule
- .cursor/rules/plan-release.mdcCursor rule
- .cursor/rules/plan-tests.mdcCursor rule
- .cursor/rules/plan-work.mdcCursor rule
- .cursor/rules/publish-package.mdcCursor rule
- .cursor/rules/quick-fix.mdcCursor rule
- .cursor/rules/release-branch.mdcCursor rule
- .cursor/rules/request-review.mdcCursor rule
- .cursor/rules/research-first.mdcCursor rule
- .cursor/rules/reset-baseline.mdcCursor rule
- .cursor/rules/respond-review.mdcCursor rule
- .cursor/rules/run-benchmark.mdcCursor rule
- .cursor/rules/run-evals.mdcCursor rule
- The first 60 shown.
The file
Show its rules and text
We split this audit-code.mdc into the rules it gives an agent
15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Run this self-review before asking anyone else to look at the code.
- Distinctive: line 16
Before the checklist, rank changed files by git churn and review high-churn hotspots first — they carry the most latent risk regardless of …
- Distinctive: line 114
Before reporting, name any rationalization you caught yourself making for skipping a checklist item.
- Very specific: line 120
If all items pass: suggest running request-review for an independent second opinion.
- Distinctive: line 121
If any items fail: fix them before proceeding.
- Distinctive: line 147
C2: Obsolete Comment: Update or delete comments that are no longer accurate.
- Very specific: line 148
C3: Redundant Comment: Don't describe code that adequately describes itself (e.g., i++.
- Distinctive: line 149
C4: Poorly Written Comment: If you write a comment, spend time making it the best it can be.
- Distinctive: line 150
C5: Commented-Out Code: Delete it. Git remembers it.
- Distinctive: line 158
F2: Output Arguments: Avoid them. If a function changes state, it should change the state of its owning object.
- Very specific: line 167
G28: Encapsulate Conditionals: Prefer if (shouldBePublished()) over complex boolean logic.
- Very specific: line 168
G29: Avoid Negative Conditionals: Prefer if (buffer.shouldCompact()) over if (!buffer.shouldNotCompact()).
- Distinctive: line 169
G30: Functions Should Do One Thing: If a function can be split into sections, it's doing too much.
- Distinctive: line 170
G31: Hidden Temporal Couplings: If execution order matters, make the dependency explicit via arguments.
- Very specific: line 180
T4: An Ignored Test Is a Question about an Ambiguity: Document the reason for @Ignore.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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: "Self-review checklist for the coding agent to run before dispatching a reviewer. Checks CONVENTIONS.md compliance, Boy Scout Rule, test coverage, types, and SOLID. Produces a pass/fail checklist. Use before request-review, before committing, or when user asks for a code quality check." alwaysApply: false --- # Audit Code > **HARD GATE** — **HARD GATE** — Audit must check for: bugs (correctness), security, performance, and clarity. Do NOT skip security review if the code touches user data, auth, or external APIs. Run this self-review before asking anyone else to look at the code. The goal is to catch everything that is clearly wrong or missing — so the reviewer can focus on design and architecture, not hygiene. **Distinct from `request-review`:** This is the coding agent checking its own work. No second agent is involved. Run this first; run `request-review` after this passes. ## Look-here-first (churn heuristic) Before the checklist, rank changed files by git churn and review **high-churn hotspots first** — they carry the most latent risk regardless of diff size. ```bash bash scripts/bp-churn-rank.sh --since 90.days --limit 15 ``` Apply the full checklist to churn-ranked files in descending order. Files with zero recent commits but large diffs still get reviewed; churn only sets priority, not scope. ## Modes - Default: full checklist - --quick: Run only Supply Chain and Test Coverage. Use for changes under 50 LOC. - --gate: Non-interactive mode for automated CI gating (used by build-epic step 6). Exit with non-zero status code (`exit 1`) on ANY checklist failure; `exit 0` only if ALL items pass. Produces a compact pass/fail summary to stderr. On failure, list every ✗ item with reason. - --parallel: Run checklist sections in **isolated git worktrees** (e45s18) so concurrent checks cannot corrupt each other's working tree: ```bash bash scripts/lib/parallel-review-worktrees.sh audit-code ``` ## Checklist ### Supply Chain & Security - [ ] slopcheck run for new dependencies; packages tagged in plan-work: `[OK]`, `[SUS]`, or `[SLOP]` - [ ] No `[SLOP]` packages without documented human approval - [ ] No secrets in diff (`sk-`, `ghp_`, `AKIA`, `.env` values) — see `guard-git` patterns - [ ] OWASP Top 10 spot-check: injection, broken auth, sensitive data exposure, misconfiguration (see `docs/references/security-threats.md`) - [ ] Security: diff scanned — no unaddressed HIGH findings (or deviations documented in `specs/security/EXCEPTIONS.md`) ### Provenance & Metadata - [ ] New plan artefacts include `type:` and `context:` metadata - [ ] Implementation steps reference ADR or commit SHA where decisions were made ### Law of Demeter - [ ] No method chains through unrelated objects (e.g. `a.getB().getC().doX()`) - [ ] Collaborators talk to immediate neighbors only; law violations need explicit justification ### CONVENTIONS.md Compliance - [ ] All output files are in `specs/` (no docs written to project root) - [ ] No `gh issue create` calls anywhere in new/modified skills or scripts - [ ] `gh` used only for PRs and repo clone operations - [ ] No GitHub REST API called directly (no curl/fetch to api.github.com) ### Scope - [ ] Changes are limited to what was asked — nothing extra refactored or reorganized - [ ] No speculative features added - [ ] No files touched outside the stated scope - [ ] **Discovered defects:** Reproducible gate failures (Preflight, CI, golden suite) require fix-or-log — `quick-fix` or `fix-bug` — even when "outside" the story scope. Scope-minimization does not waive Always Green. - [ ] Boy Scout Rule applies to files opened to fix a gate failure; it does not excuse skipping red Preflight ### Boy Scout Rule - [ ] Every file I touched is cleaner than when I found it - [ ] No dead code left behind - [ ] No commented-out code blocks ### Types and Safety - [ ] No `any` types introduced (TypeScript) or untyped public functions (Python/Go/etc.) - [ ] No `@ts-ignore` or `// eslint-disable` added - [ ] No `as unknown as X` casts that bypass type safety ### Test Coverage - [ ] Every new function has at least one test - [ ] Every bug fix has a regression test - [ ] Tests verify behavior through public interfaces (not implementation details) - [ ] Tests are F.I.R.S.T compliant (per CONVENTIONS.md §Tests; use `enforce-first` if unsure) ### SOLID and Heuristics - [ ] Single Responsibility: no function or module doing two unrelated things - [ ] Open/Closed: extended through interfaces, not by modifying stable code - [ ] Dependency Inversion: dependencies injected, not imported globally where avoidable - [ ] **Chapter 17 Heuristics**: Code is free of smells documented in `audit-code/HEURISTICS.md` (G, N, C, T) ### Refactoring Smells (Fowler) Explicitly name any detected smells: Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Message Chains, Middle Man. ### Code Style (CONVENTIONS.md) - [ ] Functions: 4–20 lines; split if longer - [ ] Functions: descend exactly one level of abstraction (The Stepdown Rule / G34) - [ ] Files: under 300 lines (ideally 200–300) - [ ] Names: specific and unique (grep returns < 5 hits for each name) - [ ] No duplication — shared logic extracted (DRY / G5) - [ ] Early returns over nested ifs; max 2 levels of indentation - [ ] Conditionals: expressed as positives (G29) - [ ] Comments explain WHY, not WHAT ### Red Flags Before reporting, name any rationalization you caught yourself making for skipping a checklist item. Silence is not acceptable — if you skipped an item, state the reason explicitly. ## Output Report the checklist with ✓ / ✗ per item. For each ✗, describe what needs to be fixed. If all items pass: suggest running `request-review` for an independent second opinion. If any items fail: fix them before proceeding. In `--gate` mode, print one summary line per checklist section (`PASS Supply Chain` / `FAIL Provenance (2 items)`). Exit `0` only if all PASS. Write full report to `specs/verifications/AUDIT-<epic>-<story>.md`. ## Verify → verify: `test -f CONVENTIONS.md && test -d skills/enforce-first && test -d skills/request-review` ## Handoff Gate: READY -> next: commit-message Writes: state.yaml handoff.next_skill = commit-message <!-- story: e01s02 --> <!-- story: e06s03 --> <!-- story: e07s01 --> --- # Clean Code Heuristics (Chapter 17) A summary of Robert C. Martin's catalogue of code smells and heuristics, used as the technical benchmark for `audit-code`. ## Comments (C) - **C1: Inappropriate Information**: Comments should only hold technical notes. Metadata (author, change history) belongs in Git. - **C2: Obsolete Comment**: Update or delete comments that are no longer accurate. - **C3: Redundant Comment**: Don't describe code that adequately describes itself (e.g., `i++; // increment i`). - **C4: Poorly Written Comment**: If you write a comment, spend time making it the best it can be. - **C5: Commented-Out Code**: Delete it. Git remembers it. ## Environment (E) - **E1: Build Requires More Than One Step**: Building should be a single trivial operation (e.g., `bash install.sh`). - **E2: Tests Require More Than One Step**: Running all tests should be one simple command (e.g., `npm test`). ## Functions (F) - **F1: Too Many Arguments**: 0 is ideal, 1-2 is fine, 3 requires special justification. Never > 3. - **F2: Output Arguments**: Avoid them. If a function changes state, it should change the state of its owning object. - **F3: Flag Arguments**: Boolean arguments are a smell that the function does > 1 thing. - **F4: Dead Function**: Discard methods that are never called. ## General (G) - **G1: Multiple Languages in One Source File**: Try to minimize the mixing of languages (e.g., HTML inside Java). - **G5: Duplication (DRY)**: **The root of all evil.** Every time you see duplication, it's a missed opportunity for abstraction. - **G6: Code at Wrong Level of Abstraction**: High-level concepts in base classes; low-level details in derivatives. - **G25: Replace Magic Numbers with Named Constants**: No "naked" numbers or strings. - **G28: Encapsulate Conditionals**: Prefer `if (shouldBePublished())` over complex boolean logic. - **G29: Avoid Negative Conditionals**: Prefer `if (buffer.shouldCompact())` over `if (!buffer.shouldNotCompact())`. - **G30: Functions Should Do One Thing**: If a function can be split into sections, it's doing too much. - **G31: Hidden Temporal Couplings**: If execution order matters, make the dependency explicit via arguments. - **G34: Functions Should Descend Only One Level of Abstraction**: The Stepdown Rule. ## Naming (N) - **N1: Choose Descriptive Names**: Names should reveal intent and be updated as code evolves. - **N4: Unambiguous Names**: Names should make the working of a function/variable clear. - **N7: Names Should Describe Side-Effects**: Describe everything the function is or does. ## Tests (T) - **T1: Insufficient Tests**: A test suite should test everything that could possibly break. - **T4: An Ignored Test Is a Question about an Ambiguity**: Document the reason for `@Ignore`. - **T5: Test Boundary Conditions**: Most bugs happen at the boundaries; test them exhaustively. - **T8: Test Coverage Patterns Can Be Revealing**: Analyze what code is *not* executed to find gaps. - **T9: Tests Should Be Fast**: Slow tests don't get run.
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.

