agentleFS
aniketshukla1aniketshukla1/sdlc-kit/.cursor/rules/10-general-standards.mdc

sdlc-kit / rules

Cursor rule1 starsChanged 10 days agoMITView on GitHub

General coding standards for all code in this repository (size limits, naming, structure).

The file

We split this 10-general-standards.mdc into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 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.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before editing a file: wc -l <file>.

    line 16
  2. Very specific:

    Keep the public import path working if other code imports it (re-export in __init__.py / index.ts).

    line 18
  3. Very specific:

    Search before writing a helper: rg -n "def <name>|function <name>|const <name>".

    line 23
  4. Distinctive:

    Follow the existing pattern in the closest similar feature.

    line 24
  5. Very specific:

    No unclear abbreviations. Allowed: id, url, api, db, ui.

    line 30
  6. Distinctive:

    No magic numbers/strings: use named constants or enums.

    line 33
  7. Very specific:

    No commented-out code, no print, no console.log, no debugger.

    line 34
  8. Very specific:

    Never swallow errors. No bare except:.

    line 36
  9. Distinctive:

    No new dependency unless PLAN.md lists it and the human approved the plan.

    line 39

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
10-general-standards.mdc
---
description: General coding standards for all code in this repository (size limits, naming, structure).
alwaysApply: true
---
# General coding standards

## Size limits (hard, checked by scripts)
| Unit                  | Limit                         |
|-----------------------|-------------------------------|
| Any source/test file  | ≤ 200 lines (aim for ≤ 150)   |
| Function / method     | ≤ 40 lines                    |
| React component file  | ≤ 150 lines                   |
| Parameters            | ≤ 4 (else pass an object/model) |
| Nesting depth         | ≤ 3 (use early returns)       |

Before editing a file: `wc -l <file>`. If your change would exceed the limit, split first:
- Split by responsibility, not by line number (e.g. `orders_service.py` → `services/orders/create.py`, `cancel.py`).
- Keep the public import path working if other code imports it (re-export in `__init__.py` / `index.ts`).
- Exempt: `frontend/src/components/ui/*` (shadcn generated), lock files, files in `.agent/size-allowlist.txt`.

## Structure
- One responsibility per file. The file name says what it does.
- Search before writing a helper: `rg -n "def <name>|function <name>|const <name>"`. Reuse, don't duplicate.
- Follow the existing pattern in the closest similar feature. Consistency beats your preference.

## Naming
- Python: `snake_case` files/functions/vars, `PascalCase` classes, `UPPER_SNAKE` constants.
- TypeScript: `PascalCase.tsx` for components, `useThing.ts` for hooks, `camelCase.ts` for other modules.
- Booleans start with `is/has/can/should`. Functions start with a verb (`get_order`, `cancelOrder`).
- No unclear abbreviations. Allowed: `id`, `url`, `api`, `db`, `ui`.

## Code hygiene
- No magic numbers/strings: use named constants or enums.
- No commented-out code, no `print`, no `console.log`, no `debugger`.
- `TODO` only with a ticket key: `# TODO(PROJ-123): ...`.
- Never swallow errors. No bare `except:`; catch specific exceptions; no empty `catch {}`.
- Config and secrets come from settings/env. Never hardcode URLs, credentials, tokens.
- Comments explain WHY, not WHAT. Public functions get a one-line docstring/JSDoc.
- No new dependency unless PLAN.md lists it and the human approved the plan.
- Imports: absolute, no wildcard (`*`), no circular imports.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.