wizard-workbench / rules
Cursor rule5 starsChanged 6 months agoMITView on GitHub
When writing JavaScript or TypeScript code, use this guide for JavaScript best practices and guidance
We split this js-and-ts.mdc into the rules it gives an agent
19 rules. About 0 are common, 10 are distinctive, and 9 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.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Read the lint and formatting rules.
- Distinctive: line 33
Prefer immutability; use const, spread, and rest operators instead of mutation.
- Very specific: line 38
Avoid loose procedural sequences.
- Very specific: line 39
Avoid class and extends as much as possible.
- Distinctive: line 40
Keep related code together.
- Distinctive: line 41
Put statements and expressions in positive form.
- Distinctive: line 42
Use parallel code for parallel concepts.
- Distinctive: line 43
Avoid null/undefined arguments.
- Very specific: line 44
Use concise syntax: arrow functions, object destructuring, array destructuring, template literals.
- Very specific: line 45
Avoid verbose property assignments.
- Distinctive: line 53
Avoid IIFEs. Use block scopes, modules, or normal arrow functions instead.
- Distinctive: line 54
Avoid using || for defaults.
- Distinctive: line 55
Prefer async/await or asyncPipe over raw promise chains.
- Very specific: line 62
Use clear, consistent naming.
- Very specific: line 65
Prefer standalone verbs over noun.method.
- Very specific: line 66
Avoid noun-heavy and redundant names.
- Very specific: line 67
Avoid "doSomething" style.
- Very specific: line 69
Use strong negatives over weak ones: isEmpty(thing) not !isDefined(thing).
- Distinctive: line 75
Ensure that any comments are necessary and add value.
≈ “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: When writing JavaScript or TypeScript code, use this guide for JavaScript best practices and guidance
globs: **/*.js,**/*.jsx,**/*.ts,**/*.tsx
alwaysApply: false
---
# JavaScript/TypeScript guide
Act as a top-tier software engineer with serious JavaScript/TypeScript discipline to carefully implement high quality software.
## Before Writing Code
- Read the lint and formatting rules.
- Observe the project's relevant existing code.
- Conform to existing code style, patterns, and conventions unless directed otherwise. Note: these instructions count as "directed otherwise" unless the user explicitly overrides them.
## Principles
- DOT
- YAGNI
- KISS
- DRY
- SDA - Self Describing APIs
- Simplicity - "Simplicity is removing the obvious, and adding the meaningful."
- Obvious stuff gets hidden in the abstraction.
- Meaningful stuff is what needs to be customized and passed in as parameters.
- Functions should have default parameters whenever it makes sense so that callers can supply only what is different from the default.
Constraints {
Be concise.
Favor functional programming; keep functions short, pure, and composable.
Favor map, filter, reduce over manual loops.
Prefer immutability; use const, spread, and rest operators instead of mutation.
One job per function; separate mapping from IO.
Obey the projects lint and formatting rules.
Omit needless code and variables; prefer composition with partial application and point-free style.
Chain operations rather than introducing intermediate variables, e.g. `[x].filter(p).map(f)`
Avoid loose procedural sequences; compose clear pipelines instead.
Avoid `class` and `extends` as much as possible. Prefer composition of functions and data structures over inheritance.
Keep related code together; group by feature, not by technical type.
Put statements and expressions in positive form.
Use parallel code for parallel concepts.
Avoid null/undefined arguments; use options objects instead.
Use concise syntax: arrow functions, object destructuring, array destructuring, template literals.
Avoid verbose property assignments. bad: `const a = obj.a;` good: `const { a } = obj;`
Assign reasonable defaults directly in function signatures.
`const createExpectedUser = ({ id = createId(), name = '', description = '' } = {}) => ({ id, name, description });`
Principle: SDA. This means:
Parameter values should be explicitly named and expressed in function signatures:
Bad: `const createUser = (payload = {}) => ({`
Good: `const createUser = ({ id = createId(), name = '', description = ''} = {}) =>`
Notice how default values also provide hints for type inference.
Avoid IIFEs. Use block scopes, modules, or normal arrow functions instead. Principle: KISS
Avoid using || for defaults. Use parameter defaults instead. See above.
Prefer async/await or asyncPipe over raw promise chains.
Use strict equality (===).
Modularize by feature; one concern per file or function; prefer named exports.
}
NamingConstraints {
Use active voice.
Use clear, consistent naming.
Functions should be verbs. e.g. `increment()`, `filter()`.
Predicates and booleans should read like yes/no questions. e.g. `isActive`, `hasPermission`.
Prefer standalone verbs over noun.method. e.g. `createUser()` not `User.create()`.
Avoid noun-heavy and redundant names. e.g. `filter(fn, array)` not `matchingItemsFromArray(fn, array)`.
Avoid "doSomething" style. e.g. `notify()` not `Notifier.doNotification()`.
Lifecycle methods: prefer `beforeX` / `afterX` over `willX` / `didX`. e.g. `beforeUpdate()`.
Use strong negatives over weak ones: `isEmpty(thing)` not `!isDefined(thing)`.
Mixins and function decorators use `with${Thing}`. e.g. `withUser`, `withFeatures`, `withAuth`.
}
Comments {
Favor docblocks for public APIs - but keep them minimal.
Ensure that any comments are necessary and add value. Never reiterate the style guides. Avoid obvious redundancy with the code, but short one-line comments that aid scannability are okay.
Comments should stand-alone months or years later. Assume that the reader is not familiar with the task plan or epic.
}
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 repository5 other files it gives its agents.
- apps/basic-integration/rails/fizzy/AGENTS.mdAGENTS.md
- apps/basic-integration/swift/hackers-ios/AGENTS.mdAGENTS.md
- apps/basic-integration/rails/fizzy/.claude/CLAUDE.mdCLAUDE.md
- apps/basic-integration/react-router/saas-template/.cursor/rules/facades.mdcCursor rule
- apps/basic-integration/react-router/saas-template/.cursor/rules/jsx-and-tsx.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.

