balakit / rules
Cursor rule1 starsChanged 2 months agoMITView on GitHub
Testing philosophy, conventions, and tooling — write tests that earn their place
- 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 repository103 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/base.mdcCursor rule
- .cursor/rules/changelog.mdcCursor rule
- .cursor/rules/comments.mdcCursor rule
- .cursor/rules/release.mdcCursor rule
- .cursor/rules/seo-ai-search.mdcCursor rule
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- design-rationaleSkill
- dissectSkill
- documentation-writerSkill
- everything-seoSkill
- executeSkill
- generating-app-verifySkill
- inceptionSkill
- kit-workflowsSkill
- marketing-psychologySkill
- media-genSkill
- nlm-skillSkill
- opinionSkill
- proving-change-safetySkill
- refreshing-app-verifySkill
- release-deploySkill
- seo-auditSkill
- startup-marketing-brainSkill
- subsystem-walkthroughSkill
- unmatched-workflowSkill
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- design-rationaleSkill
- dissectSkill
- documentation-writerSkill
- everything-seoSkill
- executeSkill
- generating-app-verifySkill
- inceptionSkill
- kit-workflowsSkill
- marketing-psychologySkill
- media-genSkill
- nlm-skillSkill
- opinionSkill
- proving-change-safetySkill
- refreshing-app-verifySkill
- release-deploySkill
- seo-auditSkill
- startup-marketing-brainSkill
- subsystem-walkthroughSkill
- unmatched-workflowSkill
- agent-readySkill
- authoring-skills-and-rulesSkill
- blinded-evalSkill
- cloakbrowser-fallbackSkill
- deep-deliberationSkill
- The first 60 shown.
The file
We split this testing.mdc into the rules it gives an agent
10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 10
Every test must earn its place by preventing a bug that would affect users.
- Distinctive: line 22
Follow whatever layout the project already uses.
- Distinctive: line 26
Use the test runner the project already adopts.
- Distinctive: line 28
Keep end-to-end tests pointed at a deployed/staging-like environment rather than hard-coded local URLs when the project's flow expects that.
- Distinctive: line 42
Do not write E2E tests speculatively.
- Very specific: line 47
Never commit API keys, tokens, passwords, or database URLs in any file — including config, .env, source code, or test fixtures.
- Very specific: line 48
Use local-only secret files (e.g.
- Distinctive: line 49
Use the platform's secret manager for deployed environments.
- Very specific: line 50
Prefer an automated secret scanner (e.g.
- Distinctive: line 54
If you skip tests, say so in chat with the reason — never in a code comment.
≈ “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: Testing philosophy, conventions, and tooling — write tests that earn their place alwaysApply: true --- # Testing ## Philosophy Every test must earn its place by preventing a bug that would affect users. Do not write tests to hit a coverage number. If you cannot explain what bug a test would catch, do not write it. Favor integration tests over unit tests. Test real code paths — input validated, work performed, result returned. Reserve unit tests for complex business logic: pricing calculations, date handling, permission resolution. Do not write unit tests for glue code or tests that mock everything away. If a test would still pass when every imported function returns `undefined`, rewrite the assertion or delete the test. ## Folder Convention Mirror the source structure under a single top-level tests location (or your framework's convention), separating tiers clearly: - Unit tests — complex business logic only. - Integration tests — the default tier for most behavior. - End-to-end tests — full-stack flows. Follow whatever layout the project already uses; do not impose a new one mid-project. ## Tooling - Use the test runner the project already adopts. Do not introduce an additional test framework without team agreement. - Match the existing assertion style, fixtures, and mocking approach. - Keep end-to-end tests pointed at a deployed/staging-like environment rather than hard-coded local URLs when the project's flow expects that. ## When to Write Tests A behavior change in a PR requires a test that exercises that behavior. "Behavior change" means: what the user sees or what the API returns is different. Refactors that preserve behavior do not require new tests — existing tests should still pass. **Bug fixes:** Write the failing test first. The test is the proof the bug existed and that the fix works. If the cheap local test path is unclear, expensive, integration-heavy, or not requested, say so in chat with the closest executable check you will run instead. Prefer no test over a mock-only "regression" that would still pass if every imported function returned `undefined`. Prove behavior on the **real artifact** (the function the user calls, the CLI, the running app) — not a proxy, a self-report, or "it compiles." ## End-to-End Tests E2E tests are often slow and run against a deployed environment rather than locally. Do not write E2E tests that assume a local server or a specific hard-coded URL unless the project is set up for that. Do not write E2E tests speculatively. Only write them after the user confirms the feature is done. When a feature implementation appears complete, proactively ask the user (Caveman format): - *"Feature done? Write E2E?"* ## Secrets [CRITICAL] Never commit API keys, tokens, passwords, or database URLs in any file — including config, `.env`, source code, or test fixtures. - Use local-only secret files (e.g. `.env.local`, `.dev.vars`) that are gitignored. - Use the platform's secret manager for deployed environments. - Prefer an automated secret scanner (e.g. `gitleaks`) in pre-commit hooks and CI to enforce this. ## Skipping Tests If you skip tests, say so in chat with the reason — never in a code comment. **Acceptable reasons:** 1. The path is provably unreachable. 2. An existing test already covers the exact behavior. 3. The human explicitly overrode the test requirement.
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.

