antistrefo / rules
Cursor rule4 starsChanged 9 days agoMITView on GitHub
Pre-commit gate rules 0-10 and the narrow exceptions
We split this gate.mdc into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Run this before claiming anything works.
- Very specific: line 32
Every new header under src/utils/ must appear in both docs/util-catalog.md and src/utils/re_util.h, except those two private headers.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 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: Pre-commit gate rules 0-10 and the narrow exceptions alwaysApply: true --- # Gate Run this before claiming anything works. The style test fails the build. powershell -NoProfile -ExecutionPolicy Bypass -File scripts\format.ps1 # Linux: clang-format -n --Werror --style=file $(git ls-files 'src/**/*.[ch]' 'src/**/*.cpp') python scripts\check.py . cmake --build --preset clang-release ctest --preset clang-release | Rule | Requirement | |---|---| | 0 | Read the util catalog first. No `realloc` (use `re_strbuf` / `re_vec`). No `x &= x - 1` (use `re_bits`) | | 1 | 500 lines per file. 60-line function bodies. Nesting <= 4 | | 2 | 4-line banner. Folder <= 15 files under `src/` | | 3 | Exactly one `#pragma once` per header | | 4 | ASCII-only source bytes. `.md` is exempt | | 5 | LF, one final newline, no trailing whitespace, no tabs | | 6 | No `malloc` / `calloc` / `realloc` / `free` / `strdup` outside `src/utils`. Use `re_arena` | | 7 | No `printf` / `puts` / `fprintf(stdout)` outside `re_jw*` / `re_text*` | | 8 | No `strlen` / `strcmp` / `strcpy` / `strcat` / `sprintf` / `strtok` and kin. Use `re_str` / `re_strbuf`. `memcpy` / `memset` / `memcmp` on sized spans are fine | | 9 | `re_` prefix (clang-tidy, advisory) | | 10 | clang-format clean | `tests/` is exempt from rules 7 and 8 only. `re_regex_priv.h` and `re_util.h` stay out of the aggregator and must still appear in the util catalog. `RE_VEC_PUSH` needs an lvalue; assign `f(x)` to a local first. Every new header under `src/utils/` must appear in both `docs/util-catalog.md` and `src/utils/re_util.h`, except those two private headers.
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 3,978 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 repository9 other files it gives its agents.
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/banner.mdcCursor rule
- .cursor/rules/build.mdcCursor rule
- .cursor/rules/layout.mdcCursor rule
- .cursor/rules/no-personal-emails.mdcCursor rule
- .cursor/rules/output.mdcCursor rule
- .cursor/rules/project.mdcCursor rule
- .cursor/rules/reuse.mdcCursor rule
- .cursor/rules/scope.mdcCursor rule
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
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.

