agentleFS
quests-orgquests-org/quests/.cursor/rules/typescript.mdc

quests / rules

Cursor rule464 starsChanged 10 months agoApache-2.0View on GitHub

The file

Show its rules and text

We split this typescript.mdc into the rules it gives an agent

15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

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

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

    NEVER use non-null assertions (!).

    line 6
  2. Distinctive:

    Avoid casting types unless necessary.

    line 7
  3. Very specific:

    Avoid any and NEVER use as any.

    line 8
  4. Distinctive:

    Avoid redefining types and interfaces in every file, if possible, use an existing type or interface.

    line 9
  5. Distinctive:

    Avoid making component props and object properties optional unless necessary.

    line 10
  6. Very specific:

    NEVER add comments for sections of JSX like {/* Header */}<Header />

    line 13
  7. Distinctive:

    Do not fix "Expected {thing} to come before {thing}" errors from perfectionist, they will be fixed automatically after your work is done.

    line 15
  8. Distinctive:

    Prefer objects for functions with many parameters.

    line 16
  9. Very specific:

    Don't run tsc to check for type errors, use your built-in diagnostics tool.

    line 17
  10. Distinctive:

    Prefer inline type declarations when they are short and not exported.

    line 20
  11. Very specific:

    Prefer object types for functions with identical parameters, e.g.

    line 21
  12. Distinctive:

    Don't define return types unless necessary.

    line 23
  13. Very specific:

    Use size- over w- and h- when width and height are the same.

    line 27
  14. Very specific:

    Use gap-x- or gap-y- over space-x or space-y for gap.

    line 28
  15. Very specific:

    Prefer z.output over z.infer for type inference.

    line 32

≈ “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
typescript.mdc
---
globs: *.ts,*.tsx
alwaysApply: true
---

- NEVER use non-null assertions (`!`). This is forbidden. Always use proper type guards or optional chaining instead.
- Avoid casting types unless necessary. If you do cast, you must add a comment explaining why.
- Avoid `any` and NEVER use `as any`.
- Avoid redefining types and interfaces in every file, if possible, use an existing type or interface.
- Avoid making component props and object properties optional unless necessary.
- We use kebab case for filenames.
- We use non-default exports whenever possible.
- NEVER add comments for sections of JSX like `{/* Header */}<Header />`
- Objects, interfaces, types, and other sortable structures are automatically sorted by the perfectionist ESLint plugin
- Do not fix "Expected {thing} to come before {thing}" errors from perfectionist, they will be fixed automatically after your work is done.
- Prefer objects for functions with many parameters.
- Don't run `tsc` to check for type errors, use your built-in diagnostics tool.
- `"lib": ["es2023", "DOM", "DOM.Iterable"]` is set, so you can use modern features.
- The `radashi` import is installed. Use it for common lodash-style functions.
- Prefer inline type declarations when they are short and not exported.
- Prefer object types for functions with identical parameters, e.g. `({ a, b }: { a: number, b: number }) => number` instead of `(a: number, b: number) => number`.
- Array#reduce() usually results in hard-to-read and less performant code. Instead, prefer .map, .filter, or a for-of loop.
- Don't define return types unless necessary.

## Tailwind Rules

- Use `size-` over `w-` and `h-` when width and height are the same.
- Use `gap-x-` or `gap-y-` over `space-x` or `space-y` for gap.

## Zod Rules

- Prefer `z.output` over `z.infer` for type inference.

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.