personal-finance / rules
Cursor rule1 starsChanged todayMITView on GitHub
TypeScript and JavaScript coding style: strict types, no any, immutability, errors, validation at the boundary, Biome
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 4,243 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 repository84 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/angular-coding-style.mdcCursor rule
- .cursor/rules/angular-patterns.mdcCursor rule
- .cursor/rules/angular-security.mdcCursor rule
- .cursor/rules/angular-testing.mdcCursor rule
- .cursor/rules/common-code-review.mdcCursor rule
- .cursor/rules/common-coding-style.mdcCursor rule
- .cursor/rules/common-development-workflow.mdcCursor rule
- .cursor/rules/common-security.mdcCursor rule
- .cursor/rules/common-testing.mdcCursor rule
- .cursor/rules/csharp-coding-style.mdcCursor rule
- .cursor/rules/csharp-data-access.mdcCursor rule
- .cursor/rules/csharp-patterns.mdcCursor rule
- .cursor/rules/csharp-security.mdcCursor rule
- .cursor/rules/csharp-testing.mdcCursor rule
- .cursor/rules/design-design-system.mdcCursor rule
- .cursor/rules/project-backend.mdcCursor rule
- .cursor/rules/project-security.mdcCursor rule
- .cursor/rules/project-testing.mdcCursor rule
- .cursor/rules/project-web.mdcCursor rule
- .cursor/rules/typescript-patterns.mdcCursor rule
- .cursor/rules/typescript-security.mdcCursor rule
- .cursor/rules/typescript-testing.mdcCursor rule
- angular-guideSkill
- break-uiSkill
- dotnet-create-command-querySkill
- dotnet-create-entitySkill
- dotnet-create-moduleSkill
- dotnet-ef-migrationSkill
- emil-design-engSkill
- frontend-designSkill
- impeccableSkill
- review-animationsSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-specifySkill
- speckit-tasksSkill
- ui-ux-pro-maxSkill
- angular-guideSkill
- break-uiSkill
- dotnet-create-command-querySkill
- dotnet-create-entitySkill
- dotnet-create-moduleSkill
- dotnet-ef-migrationSkill
- emil-design-engSkill
- frontend-designSkill
- impeccableSkill
- review-animationsSkill
- speckit-analyzeSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-implementSkill
- The first 60 shown.
The file
We split this typescript-coding-style.mdc into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 14
Follow the repo's choice when it already uses Prettier/ESLint.
- Very specific: line 17
Use the repo's package manager (lockfile decides: bun.lock, pnpm-lock.yaml, package-lock.json).
- Distinctive: line 57
Never swallow an error: log it with context and rethrow, or turn it into a typed result the caller must handle.
- Very specific: line 58
No floating promises: await them, return them, or mark fire-and-forget explicitly with void and a comment.
≈ “Common” is an estimate: at least 1 in 5 of the 6,809 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 and JavaScript coding style: strict types, no any, immutability, errors, validation at the boundary, Biome"
globs: **/*.ts,**/*.tsx,**/*.mts,**/*.cts,**/*.js,**/*.jsx,**/*.mjs
alwaysApply: false
---
<!-- Generated by armature from stack-typescript/rules/typescript/coding-style.md. Edit the source rule, not this file. -->
# TypeScript coding style
## Compiler and tooling
- `strict: true` in every `tsconfig`, plus `noUncheckedIndexedAccess` and `noImplicitOverride` in new projects. Never
turn a strict flag off to make a build pass.
- One formatter and linter per repo, run by the gate. Default: **Biome** (shared config package in a monorepo).
Follow the repo's choice when it already uses Prettier/ESLint; never add a second one.
- Suppress a lint finding only on the line, with the tool's own syntax and a reason
(`// biome-ignore lint/<group>/<rule>: <reason>`). No file-wide disables.
- Use the repo's package manager (lockfile decides: `bun.lock`, `pnpm-lock.yaml`, `package-lock.json`). Never mix.
## Types
- Exported functions, shared utilities and public methods have explicit parameter and return types. Let TypeScript
infer obvious locals.
- `interface` for object shapes that may be extended; `type` for unions, intersections, tuples, mapped and utility
types. Prefer string literal unions to `enum`.
- No `any` in application code. Use `unknown` for external input and narrow it; use generics when the type depends on
the caller.
- No `as` casts that hide a type error and no non-null `!` without a guard on the line above. `satisfies` is the
way to check a literal against a type without widening it.
- Type-only imports use `import type`.
- In `.js` files that cannot move to TypeScript, use JSDoc types that match runtime behaviour.
```typescript
// WRONG
export function getErrorMessage(error: any) {
return error.message
}
// CORRECT
export function getErrorMessage(error: unknown): string {
return error instanceof Error ? error.message : 'Unexpected error'
}
```
## Immutability
Return new objects instead of mutating arguments; mark inputs `Readonly<T>` when it helps.
```typescript
function rename(user: Readonly<User>, name: string): User {
return { ...user, name }
}
```
## Errors
- `async`/`await` with `try`/`catch`; the caught value is `unknown` and is narrowed before use.
- Never swallow an error: log it with context and rethrow, or turn it into a typed result the caller must handle.
- No floating promises: await them, return them, or mark fire-and-forget explicitly with `void` and a comment.
## Validation at the boundary
Everything that crosses a trust boundary (HTTP bodies, query strings, env vars, `localStorage`, messages from a model
or a tool) is parsed with a schema (Zod or the repo's equivalent) and the type is inferred from the schema.
```typescript
const UserInput = z.object({ email: z.string().email(), age: z.number().int().min(0).max(150) })
type UserInput = z.infer<typeof UserInput>
const input: UserInput = UserInput.parse(body)
```
## Logging
No `console.log` in committed code. Use the repo's logger; never log tokens, secrets or personal data.
## Naming
- Files: kebab-case (`user-card.tsx`) unless the repo's convention differs; one exported component or concept per file.
- Symbols: `PascalCase` types and components, `camelCase` values and functions, `UPPER_SNAKE` for true constants.
- Booleans read as questions: `isLoading`, `hasError`, `canSubmit`.
<!-- Adapted from affaan-m/ECC rules/typescript/coding-style.md and hooks.md (MIT) at d2ef268; merged with the owner's frontend conventions (ordo-frontend CLAUDE.md: strict TS, Biome, bun; personal-finance-sdd typescript-reviewer priorities). -->
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.

