zaezd / rules
Cursor rule1 starsChanged 3 months agoMITView on GitHub
Layer by layer build order, inner layers first
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 1,533 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 repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/bdd-specs.mdcCursor rule
- .cursor/rules/code-style.mdcCursor rule
- .cursor/rules/composer-core.mdcCursor rule
- .cursor/rules/data-sources.mdcCursor rule
- .cursor/rules/mcp-layer.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/web-ui.mdcCursor rule
- .cursor/rules/workflow.mdcCursor rule
The file
We split this implementation-order.mdc into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
L0. Pure domain core,
src/composer/: No imports outside the file's own layer, no I/O, no clock, no network. - Distinctive: line 66
Never reach upward. If an L0 function needs a city name resolved by an L1 client, the resolution happens in L3 and the resolved value is …
- Distinctive: line 68
Never widen a lower layer to make a higher one convenient.
≈ “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.
Files
---
description: "Layer by layer build order, inner layers first"
globs: src/**/*.ts
alwaysApply: false
---
# Implementation order: inner layers first
Build the cake from the inside out. A unit may be written only when everything it depends
on already exists and is green. This keeps every layer testable without mocks and stops
the classic hackathon failure where a beautiful screen sits on top of arithmetic nobody
verified.
## The order
**L0. Pure domain core, `src/composer/`.** No imports outside the file's own layer, no I/O,
no clock, no network.
1. `types.ts` - `TripRequest`, `TripResult`, `TripPackage`, `EventCard`, `Leg`,
`HotelOffer`, `CheckoutLink`, `CoverageNote`, `SkippedNote`. The file grows feature by
feature; it is never published whole in the first commit.
2. `dates.ts` - check-in day, check-out day, night count.
3. `selection.ts` - candidate events, with the reference date passed in as an argument.
4. `feasibility.ts` - arrival buffer, departure after the event, unknown start time.
5. `pricing.ts` - total participation price and budget breakdown. It receives an already
marked set of working days; reading isDayOff is L2, not L0.
6. `hotels.ts` - hotel ranking: by distance when the venue was geocoded precisely,
otherwise by price and rating with the distance block suppressed.
7. `packages.ts` - the three selection rules and their collapse to fewer cards. It chooses
among combinations that L3 already assembled; building the cartesian product is L3.
8. `checkout-labels.ts` - the pure `kind` to button-label table.
**L1. Sources, `src/sources/`.** Protocol and normalization, one module per concern.
6. `types.ts` - normalized shapes the rest of the code sees.
7. `normalize.ts` - raw payload (`unknown`) to domain types, plus forgiving input coercion.
8. `cache.ts` - keyed in-memory cache with per-source TTL, replay from `fixtures/`.
9. `confcal.ts` - session handling, one concurrent call, automatic re-initialize.
10. `tutu.ts` - sessionless client over the four tools actually used.
**L2. Enrichment, `src/enrich/`.** Each one a function with a timeout and a fallback,
independent of the others.
11. `calendar.ts`, then `geo.ts`, then `weather.ts`.
**L3. Orchestration, `src/composer/`.** Written only when L0 to L2 are green.
12. `build-trip.ts` - candidate selection, parallel fan-out, concurrency limits, the
cartesian product of legs and hotels, assembly of the result.
13. `build-checkout.ts` - the live checkout calls: `get_offer_details` for a room rate's
`offerpack_hash`, then `create_checkout_link`, with the fallback to
`search_results_url`. Pure label lookup stays in L0.
14. `trip-id.ts` - the `v1.<base64url>` encoding of a request, its canonical JSON, its
length ceiling and its rejection paths.
**L4. Delivery, `src/web/` then `src/mcp/`.** The web screen comes first because the public
link is what gets graded. Both channels share one client-side renderer, not one finished
document: the web page receives the `TripResult` from the server, the `ui://` resource
receives it from the host through `ui/notifications/tool-result`.
## Rules
- One unit at a time, and it is specified in Gherkin and unit tested before it is written
(@workflow.mdc).
- Never reach upward. If an L0 function needs a city name resolved by an L1 client, the
resolution happens in L3 and the resolved value is passed in as an argument.
- Never widen a lower layer to make a higher one convenient. Add a mapping in the higher
layer instead.
- A layer is finished when its unit tests pass without a single mock of a sibling module.
- Cutting scope cuts from the outside in: the reserve list in `specs/09-plan-po-chasam.md`
drops the `ui://` resource, then the map, then walking time, then weather, then the
second and third packages. The date algorithm, the return leg and honest link labels are
never cut.
## Forbidden
- Writing `src/web/` or `src/mcp/` logic that computes prices, dates or feasibility.
- Starting the orchestrator before `dates.ts`, `feasibility.ts` and `pricing.ts` are green.
- Adding a sixth enrichment source. Three optional ones are the agreed ceiling.
## References
@architecture.mdc
@workflow.mdc
@composer-core.mdc
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.

