agentleFS
EvilFreelancerEvilFreelancer/zaezd/.cursor/rules/code-style.mdc

zaezd / rules

Cursor rule1 starsChanged 3 months agoMITView on GitHub

TypeScript style, language policy, hygiene, shared domain vocabulary

  • Reads credentials

The file

We split this code-style.mdc into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Use const objects with as const instead of enum.

    line 24
  2. Very specific:

    Prefer type aliases for data, discriminated unions over optional-field soup, and readonly arrays for anything crossing a module boundary.

    line 30
  3. Distinctive:

    Never substitute a default, a guess or a web-search answer for data a source did not return.

    line 39
  4. Very specific:

    No secrets. .env.example documents every variable.

    line 50
  5. Distinctive:

    No unused dependencies. Add a package in the same change that starts using it.

    line 51
  6. Distinctive:

    Every file ends with a newline.

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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
code-style.mdc
---
description: "TypeScript style, language policy, hygiene, shared domain vocabulary"
alwaysApply: true
---


# Code style

## Language

- **Code, comments, identifiers, docstrings, commit messages: English.**
- **Agent rule files and briefs** (`.cursor/rules/*.mdc`, `.claude/rules/*.md`, `AGENTS.md`,
  `CLAUDE.md`): English, unless the project owner asks otherwise; then switch every tree at
  once so the Rules Sync diff stays reviewable.
- **User-facing product copy** (the trip board, the user guide): Russian, following the
  microcopy rules in `specs/05-interfeys.md`.
- **Chat replies to the user: Russian.**

## TypeScript

- Node >= 22.6, ESM only (`"type": "module"`). Relative imports carry the `.ts` extension;
  the toolchain runs TypeScript through Node's native type stripping, so only erasable
  syntax is allowed: no `enum`, no `namespace`, no parameter properties, no decorators.
  Use `const` objects with `as const` instead of `enum`.
- `strict` is on, together with `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`
  and `verbatimModuleSyntax`. Type-only imports use `import type`.
- **`any` is forbidden** and the linter enforces it. External payloads enter as `unknown`
  and are narrowed by an explicit parser in `src/sources/`. Everything downstream of that
  parser is a domain type.
- Prefer `type` aliases for data, discriminated unions over optional-field soup, and
  readonly arrays for anything crossing a module boundary.
- Named exports only; one clear responsibility per module. A file above roughly 300 lines
  is a signal to split, and a single file holding two thousand lines is an explicit
  reviewer complaint in `specs/08-repozitoriy.md`.

## Errors and absence

- A missing field is `undefined` and stays visible as missing all the way to the UI.
  Never substitute a default, a guess or a web-search answer for data a source did not
  return. This is the product's core promise, not a style preference.
- Throw typed errors carrying the source name and the arguments that failed
  (`class SourceError extends Error`), not bare strings.
- Optional enrichment never throws outward: it resolves to `undefined` after its timeout
  and the caller renders the absence.

## Hygiene

- No `TODO`, no commented-out code, no stub that returns a plausible value. The repository
  is read by an AI reviewer that scores exactly this.
- No secrets. `.env.example` documents every variable; real values live in `.env`, ignored.
- No unused dependencies. Add a package in the same change that starts using it.
- Every file ends with a newline.
- `console.log` is off outside `scripts/`; use `console.warn` and `console.error` for
  operational messages.

## Naming

- Types and classes `PascalCase`; functions, variables and files `camelCase` for modules
  with a single export, `kebab-case` for multi-word file names (`build-trip.ts`).
- Domain vocabulary is fixed and shared with the specs and the documentation:
  `TripRequest`, `TripResult`, `TripPackage`, `EventCard`, `CoverageNote`, `SkippedNote`,
  `Leg`, `HotelOffer`, `CheckoutLink`. Do not invent a synonym in a new module.
- Tool names are identical in code, README, user guide and architecture diagram:
  `find_event_trips`, `get_trip_details`, `create_trip_checkout`. A mismatch between the
  diagram and the code was flagged by both reviewers of the plan; do not reintroduce it.

## Commands

```bash
npm run typecheck   # tsc --noEmit
npm run lint        # eslint .
npm run lint:fix
npm run verify      # the full gate
```

## References

@architecture.mdc
@testing.mdc

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.