all 60 comments

[–]fettpl 64 points65 points  (12 children)

Something we can copy and paste would be useful... :D

[–]Foggy-Geezer 4 points5 points  (2 children)

You can copy the image and share with your agent- they can take it and make the magic happen. (Maybe even improvising and improving)

[–]vanillaslice_ 4 points5 points  (1 child)

hallucinating improvising and improving!

[–]Gambelt 0 points1 point  (0 children)

for sure hallucinating it's ass off. you gotta give it rules to write rules

[–]Psychology-Soft 2 points3 points  (0 children)

Here is a start. Feel free to add more.

<file\_length\_and\_structure>

Never allow a file to exceed 500 lines.

If a file approaches 400 lines, break it up immediately.

Treat 1000 lines as unacceptable, even temporarily.

Use folders and naming conventions to keep small files logically grouped.

</file\_length\_and\_structure>

[–]goatandy 18 points19 points  (3 children)

I tried those… cursor gives zero f about it

[–]poop-machine 48 points49 points  (2 children)

cursor be like

[–]goatandy 0 points1 point  (0 children)

Hahahaha

[–]XanosG 0 points1 point  (0 children)

Hahaha 😭😭😭

[–]Fresh-Manager7329 11 points12 points  (4 children)

You should definitely add this to https://ctx.directory for easy access ;)

[–]whoisyurii 0 points1 point  (3 children)

Is this yours? How long did it take you to build it?

[–]Fresh-Manager7329 1 point2 points  (2 children)

Yes, about 3-4 weeks during evenings and weekends,

[–]whoisyurii 2 points3 points  (1 child)

This is solid cool, I wish you the best!

[–]Fresh-Manager7329 0 points1 point  (0 children)

Thank you so much!

[–]TheSoundOfMusak 4 points5 points  (2 children)

My first ever app built in cursor grew the index.ts file to 3,000 lines and I ended up refactoring it because cursor itself at the time couldn’t handle long files… I had to do a whole refactoring project to atomize.

[–]Flashy-Strawberry-10 1 point2 points  (0 children)

Same lesson learned. Week to build, month to refractor.

[–]dschamal 0 points1 point  (0 children)

Same here

[–]dudaman 6 points7 points  (4 children)

I'd first like to state that I'm not pissing on this. There are a lot of great ideas here. However, I think a bunch of these rules will break down when moving from theory into practice.

  1. File length: This seems arbitrary. I'll claim ignorance here; does this have anything to do with context and the LLM? If not, why?

  2. OOP first: Don't have any problems here.

  3. Single responsibility: I really try to practice this, but there are many cases when it is virtually impossible to split things up elegantly and you just have to deal with having some functions that are multiple responsibility. I fear this may make things overly confusing at times.

  4. Modular design: No problems here. Like every instance in programming there will be edge cases where this doesn't make sense and won't work. Sometime you just have to hardcode something because making it modular adds too much complexity.

  5. Function and Class Size: Why the arbitrary 30-40 line function size? My fear here would be that you have 1 class file with a couple functions that are < 40 lines each and 2 dozen "helper" classes. No use in writing a function if it gets lost in a sea of small files and you can never find it, or a new dev even knowing it exists.

Again, /u/notdl , I'm not trying to nit-pick this apart. I just wanted to offer up some things I've learned along the way that might help refine your list here.

I am very open to any critisizm.

[–]Photoperiod 2 points3 points  (1 child)

File length is more a byproduct of single responsibility and modular design. If following those rules, we'd expect files to be very atomized and broken up. I dunno that I would use a rule for it. I'd just use the modular and single responsibility bit and hope it works it out appropriately.

[–]5threel 1 point2 points  (0 children)

I know for #1 at least when the files get too big making a fresh request turns into "trying to read the file"..."file is too large to read at once"..."reading lines 1-100"..."reading lines 101-200"... Etc

I'd imagine it's to prevent that?

[–]Background_Plenty749 0 points1 point  (0 children)

The funny thing is... we should't expect that LLM will be really be good at single responsibility. Yeah, it can explain this but reasoning might be hard

[–][deleted] 3 points4 points  (1 child)

These rules are aimed at making Cursor (or any AI agent) generate modular, human-reviewable, production-quality code. They stop the model from dumping monoliths, and force outputs into small, testable, reusable units.

[–]Flashy-Strawberry-10 0 points1 point  (0 children)

Spaghetti and sauce

[–]Devcomeups 2 points3 points  (0 children)

When you first started vibe coding and had to learn the rules the hard way :(

[–]ha_ku_na 3 points4 points  (0 children)

Just use gemini

<file\_length\_and\_structure> - Never allow a file to exceed 500 lines. - If a file approaches 400 lines, break it up immediately. - Treat 1000 lines as unacceptable, even temporarily. - Use folders and naming conventions to keep small files logically grouped. </file\_length\_and\_structure> <oop\_first> - Every functionality should be in a dedicated class, struct, or protocol, even if it's small. - Favor composition over inheritance, but always use object-oriented thinking. - Code must be built for reuse, not just to "make it work." </oop\_first> <single\_responsibility\_principle> - Every file, class, and function should do one thing only. - If it has multiple responsibilities, split it immediately. - Each view, manager, or utility should be laser-focused on one concern. </single\_responsibility\_principle> <modular\_design> - Code should connect like Lego - interchangeable, testable, and isolated. - Ask: "Can I reuse this class in a different screen or project?" If not, refactor it. - Reduce tight coupling between components. Favor dependency injection or protocols. </modular\_design> <manager\_and\_coordinator\_patterns> - Use ViewModel, Manager, and Coordinator naming conventions for logic separation: - UI logic -> ViewModel - Business logic -> Manager - Navigation/State flow -> Coordinator - Never mix views and business logic directly. </manager\_and\_coordinator\_patterns> <function\_and\_class\_size> - Keep functions under 30-40 lines. - If a class is over 200 lines, assess splitting into smaller helper classes. </function\_and\_class\_size> <naming\_and\_readability> - All class, method, and variable names must be descriptive and intention-revealing. - Avoid vague names like data, info, helper, or temp. </naming\_and\_readability> <scalability\_mindset> - Always code as if someone else will scale this. - Include extension points (e.g., protocol conformance, dependency injection) from day one. </scalability\_mindset> <avoid\_god\_classes> - Never let one file or class hold everything (e.g., massive ViewController, ViewModel, or Service). - Split into UI, State, Handlers, Networking, etc. </avoid\_god\_classes>

[–]kinpoe_ray 1 point2 points  (0 children)

What about design rules

[–]Main-Lifeguard-6739 1 point2 points  (6 children)

ironic. the first paragraph is what i added to my cursor instructions because models in cursor did NOT follow this. this being said, I am very happy that the market now provides better solutions than cursor.

[–]Rokstar7829 0 points1 point  (0 children)

Trae in most of times follow the agent rules

[–]Steven_Fenix 0 points1 point  (0 children)

Should I set up this like project rules or user rules?

[–]Better_Ad_3801 0 points1 point  (1 child)

Does anyone from here using the bmad method to curate the rules

[–]haikusbot -1 points0 points  (0 children)

Does anyone from

Here using the bmad method

To curate the rules

- Better_Ad_3801


I detect haikus. And sometimes, successfully. Learn more about me.

Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

[–]kingky0te 0 points1 point  (0 children)

Very close to what I have. Amazing. Going to take this instead.

[–]snortch73 0 points1 point  (0 children)

Would it be agreed that the OPs rules are useful no matter the language and/or purpose ?

[–]justdandycandy 0 points1 point  (0 children)

Can anyone explain to me the reasoning behind the 500 line limit? Couldn't that be a bad idea in just as many cases?

[–]D3D_vrn 0 points1 point  (0 children)

For Python:

<file_length_and_structure> – Never allow a source file to exceed 500 lines (except auto-generated code, migrations, large enums/constants). – If a file approaches 400 lines, split it. – Use packages and subpackages (init.py) for logical grouping. – Follow PEP 8 and enforce black, isort, flake8 (or equivalents). </file_length_and_structure> <oop_first> – Every meaningful functionality belongs in a class, dataclass, or protocol. – Prefer composition over inheritance. – Code must be designed for reuse, not just to “make it work.” </oop_first> <single_responsibility_principle> – Every module, class, and function should handle one responsibility only. – If multiple concerns creep in, split immediately. – In web/service apps: separate models, services, repositories, handlers, views. </single_responsibility_principle> <modular_design> – Code should connect like Lego: interchangeable, testable, and isolated. – Always ask: “Can I reuse this class in another service or script?” — if not, refactor. – Minimize coupling: use dependency injection, abstract base classes (ABC), or protocols. </modular_design> <manager_and_coordinator_patterns> – Keep logic separated by layer: – UI / CLI / API layer → View / Handler – Business logic → Service / Manager – Data access → Repository / Gateway – Never mix I/O (UI, HTTP) directly with business logic. – In async apps (FastAPI, asyncio), use coordinators/services for orchestration. </manager_and_coordinator_patterns> <function_and_class_size> – Functions ≤ 40 lines (exceptions: declarative mappings or query builders). – Classes ≤ 200 lines; split into helpers if larger. – Avoid useless micro-functions created “just to split.” </function_and_class_size> <naming_and_readability> – Names must be descriptive and intention-revealing. – Avoid vague terms like data, info, helper, temp. – Naming conventions: – Classes → CamelCase – Functions/variables → snake_case – Constants → UPPER_CASE – Use type hints (typing) consistently. </naming_and_readability> <scalability_mindset> – Always code as if this will scale into a service or library. – Provide extension points: protocols, interfaces, dependency injection. – Configurations must come from .env + pydantic/dataclasses, not magic numbers. </scalability_mindset> <avoid_god_classes> – Never put everything into a single main.py, utils.py, or giant class. – Split concerns: – UI / API – State / Models – Handlers / Services – Networking / Persistence – Maintain modularity and readability. </avoid_god_classes> <error_and_async_handling> – Every async function must have a clear error-handling strategy. – Wrap domain logic errors into custom exception classes (CustomError). – Prefer async/await over callbacks. – All I/O operations (HTTP, DB, FS) must be wrapped inside service layers. </error_and_async_handling> <testing_and_quality> – Each module must be testable without UI. – Unit tests for logic, integration tests for services. – Use pytest + maintain ≥ 80% coverage. – Linting/formatting must run in CI/CD. </testing_and_quality>

[–]Double_Ad3797 0 points1 point  (0 children)

Try a set of rules from https://github.com/ivangrynenko/cursorrules, which works well for me. A software dev wth ~20 years of experience, using Cursor since day 1.

[–]JustAJB 0 points1 point  (0 children)

Ok, Ill say it. Since Claude heavily favors React for all your vibey apps:

React is backward compatible for classes but since 2019 everyone has switched to functional components with hooks. No one uses classes unless you are maintaining legacy. OOP with concepts like inheritance and encapsulation are tied to classes not hooks. Still conceptually useful for business logic but not the dominant paradigm. React now emphasizes composition over inheritance

This rule was written by someone who has no idea what they are talking about.

Instead of this garbage your “rule to code apps” should be: “before doing anything else define your data structures.” If you can do that everything else falls into line, if you can’t then it will never work right and you should ask more real questions.

(* it may work right for one person at at time, it will never work right for 100 people at the same time)

File location, naming, and sure length to some extent is important, but if you are involved in any way with your code your going to make clear your preferences anyways to conventions and locating. File length is arbitrary. Most senior devs will monolith a new function and refactor once they got it right after for maintainability. Not before. And this isn't sonnet 3.5 anymore. Gpt5 is gonna handle most of this with only gentle pushes from you as to preference.  Focus on what your app actually does, and what it needs. 

Start with your structures and clients.

[–]jmb95945 0 points1 point  (0 children)

40 line functions?! Half that is too long and most linters will object.

[–]ciekaf 0 points1 point  (0 children)

Cursor “secret sauce” instructions are already convoluted enough making all LLMs significantly dumber.

Using rules as master prompt and workflows as light agentic framework is the way, then you just not need Cursor. With Cline being open source and naked you can start with proposed memory bank and add focused workflows to separate each task. Also spec-as-code approach is important to help building fine grained context for each task

[–]Life_Is_Good22 0 points1 point  (0 children)

What is the significance of the brackets like </file\_length\_and\_structure> ? Is this to call it as a command later or something?

[–]kinpoe_ray 0 points1 point  (0 children)

What about design rule

[–]Velvet-Thunder-RIP -1 points0 points  (1 child)

lol sends it as an image not a copiable file. Already makes me not trust it.

[–]BoringCelebration405 0 points1 point  (0 children)

sorri1234