apps / rules
Cursor rule621 starsChanged 13 months agoApache-2.0View on GitHub
TypeScript/React coding standards - prefer null coalescing, optional chaining, ternaries for rendering, optional types, and organized string constants
We split this audius-style-guide.mdc into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use ?? and ?. instead of &&/|| for null checks.
- Very specific: line 26
Use ternaries instead of && for JSX conditional rendering.
≈ “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: TypeScript/React coding standards - prefer null coalescing, optional chaining, ternaries for rendering, optional types, and organized string constants
globs:
alwaysApply: true
---
# TypeScript Best Practices
## Null Coalescing & Optional Chaining
Use `??` and `?.` instead of `&&`/`||` for null checks.
```typescript
// ✅ Good
const value = user?.name ?? 'Anonymous'
const displayName = user?.profile?.displayName ?? 'Unknown'
// ❌ Bad
const value = (user && user.name) || 'Anonymous'
const displayName =
(user && user.profile && user.profile.displayName) || 'Unknown'
```
## Conditional Rendering
Use ternaries instead of `&&` for JSX conditional rendering.
```tsx
// ✅ Good
return !user ? null : <UserProfile user={user} />
return list.length === 0 ? null : <List items={list} />
// ❌ Bad
return user && <UserProfile user={user} />
return list.length && <List items={list} />
```
## String Constants
Organize user-facing strings in a `messages` object at the top of components.
```tsx
// ✅ Good
const messages = {
title: 'Welcome',
error: 'Something went wrong'
}
return <h1>{messages.title}</h1>
// ❌ Bad
return <h1>Welcome</h1>
```
## Flex Component Direction
Flex components default to column direction on mobile and row direction on web. Use the `column` prop directly instead of `direction='column'`, or omit the prop entirely for the default responsive behavior.
```tsx
// ✅ Good
<Flex>...</Flex> // Default: Mobile column, Web row
<Flex column>...</Flex> // Explicit column on both platforms
// ❌ Bad
<Flex direction='column'>...</Flex>
```
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 repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/challenges.mdcCursor rule
- .cursor/rules/run-always.mdcCursor rule
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.

