claudinho / rules
Cursor rule30 starsChanged 56 days agoMITView on GitHub
CLI, MCP, and share must pass the same format opts (tz, locale, flags)
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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/bundle-bracket-pr.mdcCursor rule
- .cursor/rules/change-discipline.mdcCursor rule
- .cursor/rules/release-discipline.mdcCursor rule
- .cursor/rules/trust-boundary.mdcCursor rule
The file
We split this surface-parity.mdc into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 65
If a core formatter accepts tz, locale, flags, or date, every wrapper passes them from CliConfig / CommonOpts.
- Very specific: line 78
When adding a format option (e.g.
- Distinctive: line 80
Add a core unit test for the option.
- Very specific: line 81
Add an MCP tool test proving tz changes output (e.g.
- Very specific: line 82
Update share tests if formatShareBracket / compact lines are affected.
≈ “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: CLI, MCP, and share must pass the same format opts (tz, locale, flags)
globs: packages/{cli,mcp,core}/**/*
alwaysApply: false
---
# Surface parity (CLI / MCP / share)
Any user-visible formatter change must land on **all three surfaces** before merge:
| Surface | Verify |
|---------|--------|
| CLI | `packages/cli` command + `packages/cli/test/` |
| MCP | `toolGet*` in `packages/mcp/src/tools.ts` + `packages/mcp/test/tools.test.ts` |
| Share | `formatShare*` + `packages/mcp/test/share.test.ts` |
The flair slot of a match line comes from core alike on CLI (`today`, `live`, `next`, `match`) and MCP (`get_today`, `get_live`, `get_match`, `get_next_fixture`): a list through ONE rule, `matchFlairs` (a row whose side carries a rally cry prints the cry and reserves no phrase; the other rows get distinct phrases while the bank allows), one line through `matchFlair` (the list of one). Between two sides that both carry a cry the pin decides, on both surfaces (CLI `cfg.pin`, MCP `choiceOf(args).pin` through `fmtOpts`; matched by core's one pin predicate, `isPinnedSide`), else the home side's; `CLAUDINHO_TEAM` is not the cry's tiebreak (it is the team-taking commands' query, and the statusline's and the hook's preference, below). A postponed or cancelled line carries no cry (nor a phrase); `--flavor subtle` prints goals, full time, draws, and the cries; `fixtures://` prints a phrase, never a cry (it states no team kind). Share cards and the ambient surfaces carry none.
`scripts/release-qa.sh` exercises CLI + share rendering across locales and timezones, the World Cup pass then a club render (the Premier League in a temporary config and cache of its own: `today`, `live`, `next Arsenal`, both tables, the `share next` card, the Portuguese table, a seeded `prompt` that must start no refresher); MCP arg threading is **not** rendered there: guard it with unit tests.
## Every answer names its competition (the mode line and the `competition` key)
The competition is resolved once at each edge (`resolveCompetition` in `packages/cli/src/config.ts` and `choiceOf`/`selectionOf` in `packages/mcp/src/tools.ts`, from `--competition` / the tool's `competition` argument, then `CLAUDINHO_COMPETITION`, then the user's saved choice: the config file `claudinho follow` writes, read once per invocation or request through core's no-follow reader, `readUserConfig`); a value that is neither an alias nor a slug is refused with the aliases before any request (`selectionRefusal`). With NONE of the three nothing is chosen (never a default), and nothing below the edge runs: a CLI command says the one sentence (`selectionRefusal`, exit 1; `--json` prints `{ competition: null, noCompetition: true }` first), the statusline prints `⚽ claudinho follow`, the hook nothing, `vibe` no segment; an MCP tool answers the `noCompetition` verdict (`selectionVerdict`, the first replacing verdict) with its own empty healthy shape plus `competition: null` (`said`, a `refusal` builder beside each answer), before any adapter is built; `list_competitions` answers `current: null`. A saved mode line names no source (`World Cup`, not `World Cup · …`). Every competition-answering TEXT answer prints the mode line from core (`modeLine`: the name, then `from the command line` / `from the request` / `from the environment` when the flag or the environment chose it, then `experimental` for a raw slug): CLI `today`, `live`, `next`, `match`, `table`, `bracket`, `markets` right after the header (first where an answer has none; `table` once, before its tables), every MCP tool's text first except `get_share_snippet`, `get_team` and `list_competitions`, and the `standings://` resource's text first (`fixtures://` names the World Cup first: the bundled schedule, whatever the selection). An adapter injected through a test seam must serve the selection's competition (CLI `adapterFor`, MCP `resolveAdapter` refuse another before any read). Never on `--json` and never on a share card (the card's title names the competition, its run cue selects it: `npx @claudinho/cli --competition <alias> ...`). The structured twin is ONE key, `competition`, from core's `selectionExtras`, spread at every `--json` emit site of those commands and of `share`, and in every competition-answering MCP `data` (declared as `selectionOut`). `team` / `get_team` read the World Cup's roster, name it, and carry no key. A new competition-answering command or tool gets the line and the key; a new emit site spreads `selectionExtras`, never a hand-built key.
## The pinned team, and the ambient pick (a preference, never a filter)
`claudinho follow <alias> --team <name>` saves a team, resolved exactly as `next <name>` would resolve it (the bundle's nations by code, offline; a club through `next`'s own reads, with its provider id). It belongs to its competition, not to the source that chose it: it applies whenever the selected competition is the file's (an alias and its slug are one), whether the file, the flag or the environment chose it, and never under another (core `pinUnder`, asked by CLI `cfg.pin` and MCP `choiceOf(...).pin`). The team-taking surfaces take, in order, the argument, `CLAUDINHO_TEAM`, the pin, on every surface: CLI `next`, `share next`, `markets next` (through `teamAsked`), MCP `get_next_fixture` with `team` omitted (`nextAsked`: the server's `CLAUDINHO_TEAM`, else the pin); the pin answers as a RESOLVED team (`nextFixtureForPin`: by its id, or by code for an id-less pin, believed on the bundled competition alone; never resolved again, no roster read). As a team to answer about, on MCP the pin reaches `get_next_fixture` alone, by design: `get_share_snippet` without a team and `get_market_signal` without one stay a date's answer; as the cry's tiebreak it reaches every tool that prints a match line (`get_today`, `get_live`, `get_match`, `get_next_fixture`) through `fmtOpts`, and `fixtures://` prints a phrase, never a cry. **World Cup exception of `follow --team`:** an unknown 3-letter code is refused (a pin must be a team the roster holds), where `next` passes one through as the escape hatch for other feeds. The ambient surfaces (the statusline's live line, syncing matchup and countdown; the hook's list; `vibe`'s segment) pick through ONE function, `pickAmbientMatch(matches, pick)` (`packages/cli/src/statusline.ts`), the pick being `CLAUDINHO_TEAM`'s code, else the pin when `CLAUDINHO_TEAM` is absent (present but unreadable on the hot path, a name off the bundle, it is still the override: no preference, never the pin): the picked team's matches FIRST, the others kept (the statusline shows the picked live match and counts the rest as `+N`; the hook lists them after it). **Parity exception, stated:** this replaced the statusline's filter-to-one and `vibe`'s filter (0.11 · 2.5b): with the picked team not live, the line shows what is, and with no fixture of the picked team ahead, the countdown is to anyone's. A new ambient surface asks `pickAmbientMatch`, never a filter of its own.
## A verdict is forwarded by core, not by each surface
A result that states a verdict about itself (today: `noCompetition`, nothing is chosen (stated by a selection, `selectionVerdict`, first among the replacements); `unsupported`, "not available for this competition"; `inapplicable`, the competition has no bracket; `unknownTeam`, the roster the competition has holds no team by that name (`rosterEvidence`: the World Cup's nations, or the table read whole and a whole read of the next 14 days); `rosterIncomplete`, the roster could not be read whole and the name could not be answered without it; `betweenEditions`, the edition ended and nothing is current; `incomplete`, "some tables could not be read" on an all-tables standings read; and `partial`, "fixture data may be incomplete" on a read whose window was not whole: `next`, `bracket`, `match <id>`, `today`, `live`, the market surfaces, and their share cards and MCP twins; never the statusline or the hook) reaches text **and** structured output through core (`packages/core/src/verdict.ts`): `verdictExtras` for the keys, `verdictNotice` for the one sentence that REPLACES the body (`noCompetition`, then `unsupported`, then `inapplicable`, `unknownTeam`, `rosterIncomplete`, `betweenEditions`), and `verdictQualifiers` for the sentences that QUALIFY it (`incomplete`, `partial`), printed beside what was read, on a populated body and an empty one, and before the body wherever a text can be cut (MCP text, share cards: their `note`). When a replacement is stated, no qualifier is printed. Where a text can be cut, NOTHING follows the body but the footer: every sentence that qualifies it (after the verdict's qualifiers and the unserved count, a degraded line, a market-incomplete notice, a list's truncation, a roster note, a bracket's note, in the order they used to follow the body) is printed before it, through MCP `qualified(body, result, lang, ...also)` or, for the standings tool and the share formatters, in the same order by themselves; a table's partial line goes before that table. The CLI commands other than `share` are not cut and keep their notes after the body. Pass the RESULT to them; do not name the verdict at an emit site (`packages/core/test/verdict.test.ts` fails when a surface's code spells `unsupported`, `noCompetition:`, `incomplete:`, `partial:`, `inapplicable:`, `unknownTeam:`, `rosterIncomplete:`, `betweenEditions:`, a verdict's sentence or i18n key, the horizon, window, "none read" or unserved sentence, a card's `emptyNote`/`installLine`, or a table's `partial` key). The horizon (`next`) and window (`match <id>`) are NOT verdicts: plain fields of the answer, whose sentences come from `nextHorizonSentence` / `matchWindowSentence` in core. Nor are the empty bodies after a read that was not whole ("none read": `nextNoneReadSentence`, `matchNoneReadSentence`, `liveNoneRead`, `dateNoneRead`, `marketsNoneRead`; and a failed day that merged no bundled schedule, `dateUnreached`: the provider could not be reached, never "no matches scheduled" nor "showing the bundled schedule"), nor a day's attribution on such a read: ONE rule in core (`dayAttribution`), over the fixtures the surface finally displays, names no provider in the text when none of them was served (the structured `source` keeps it) and counts the shown rows the read did not serve. Every day surface (CLI `today` text, MCP `get_today` text, the date card) and the bundled match surfaces (over the one record shown) call it; none re-derives it. On MCP a date's list on a read that was not whole that the text cut shortens keeps the disclaimer and drops the attribution line (`ToolResult.cutFooter`); a live list keeps its line (every row it shows was served). `served` rides in the structured twins as a plain field beside `source`, only beside `partial`, as the SHOWN fixtures whose record the window held (`servedExtras(result, shown)`, the one rule): a whole read keeps its shape. A new verdict is added in that module and declared in the MCP output schema (`verdictOut`, `incompleteOut`, `partialOut` in `packages/mcp/src/server.ts`). A table's structured form, with its `label` and its `partial` verdict, comes from `tableData`, and its unlocalized title from `tableTitle` (`packages/core/src/standings.ts`); a table argument is checked with `tableKeyArg` on every surface (the MCP tools check it through their input schema, which uses core's `TABLE_KEY_ARG`, the grammar `tableKeyArg` applies). Share cards (`claudinho share`, `get_share_snippet`) come from the builders in `packages/core/src/share/cards.ts`; a surface only serializes them.
## Knockout surfaces live-resolve — never read the skeleton (the #1 recurring bug)
The bundled schedule's knockout slots are **resultless placeholders** (codes like `2A`/`2B`, flag `🏳️`). So a team-facing surface that reads the static bundle is **silently** blind to a confirmed knockout tie — no crash, no wrong data, just a stale placeholder. **Knockout live-resolve regressions** shipped repeatedly in different surfaces (root cause: skeleton reads, cache gaps, or both):
- v0.8.2 — R32 pre-draw seeds rendered static, didn't live-resolve.
- v0.8.6 — bracket third-place slots never read the merged live `match.home/away`.
- v0.8.7 — `next` / `share next` / MCP next-fixture resolvers read only the static bundle.
- v0.8.8 — statusline next-match countdown read the static bundle (`🏳️ vs 🏳️` / `⚽ —` in knockouts).
- v0.8.9 — empty fixtures cache stamped the full 15min TTL at phase boundaries; stale-cache `live · syncing…` still read the skeleton.
**Rule:** every team-facing surface must reach the live overlay (`getBracket` / `getNextFixtureForTeam` — on the bundled competition, the same `fetchWindow` the bracket uses; off it `next` reads discovery's schedule ahead and `bracket` makes no request), fail closed on outage, and attribute the provider only when the overlay served the chosen fixture. **Exception — statusline:** hot path cannot fetch; the cold-path refresher calls `getKnockoutFixtures` and caches to `CacheState.fixtures`; `renderPrompt` merges that slice over the bundle (countdown **and** `live · syncing…`), never leaking 🏳️. **Exception — MCP `fixtures://{date}` resource:** deliberately static ("Static fixture list"; a resource URI carries no tz and gets no live overlay) — do not "fix" it to live-resolve without a maintainer decision; agents use `get_today`/`get_bracket` for resolved pairings.
| Surface | Entry point | Must |
|---------|-------------|------|
| CLI `bracket` / `next` | `cmdBracket` / `cmdNext` | call `getBracket` / `getNextFixtureForTeam` (a saved pin: `nextFixtureForPin`, which on the bundle IS `getNextFixtureForTeam` by code) |
| CLI `share bracket` / `share next` | `cmdShare` | same |
| MCP `get_bracket` / `get_next_fixture` | `toolGetBracket` / `toolGetNextFixture` | same (no `team`: the server's `CLAUDINHO_TEAM`, else the pin through `nextFixtureForPin`) |
| MCP `get_share_snippet{bracket,next}` | `toolGetShareSnippet` | same |
| **statusline** | `renderPrompt` + `runRefresh` | hot path, NO network — indirect: refresher caches `getKnockoutFixtures` → `CacheState.fixtures`; `renderPrompt` merges them, **failing closed to `⚽ —`** when the cache lacks the pairing; unresolved placeholders dropped in syncing (never 🏳️). Empty successful fetch uses a **short TTL** (~60s); provider errors keep prior cache. **`cmdPrompt` and `cmdHook`** both spawn fixtures refresh in knockout phase. |
Off the bundled competition the statusline reads the cache's `schedule` slice instead (display records for a countdown, the slice's gate for `live · syncing…`; rules in `packages/cli/src/scheduleSlice.ts`), and the knockout `fixtures` slice is never filled there. `refreshWanted` (`packages/cli/src/refresh.ts`) is the one trigger for the statusline and the hook.
**Executable guard:** `packages/{cli,mcp}/test/knockout-surface-coverage.test.ts` pins one fake resolved tie (Mexico vs Ecuador) and asserts every surface renders the real nations, not `🏳️` (statusline from a seeded cache). Its sibling `packages/{cli,mcp}/test/club-surface-coverage.test.ts` puts a Premier League fixture (live, and scheduled) through every surface: a club renders by its name or code with nothing in a flag's place, no nation rename, no "Friendly" in four locales, the written stage ("League", "Play-offs", the provider's words for an unknown round), no `flag` key in `--json`/`data`. **`statusline.test.ts` / `refresh.test.ts`** cover syncing + empty-cache TTL on the bundled competition; off it, **`statusline-off-bundle.test.ts` / `refresher-discovery.test.ts`** cover the syncing line, the countdown and the cycle that fills the schedule slice. **Adding a team-facing surface? Add it to BOTH coverage tests and this table.**
## A club has no flag; the stage is written, not guessed
A flag is generated from a NATION's name, and the competition says which teams are nations (`TEAM_KIND`, a written fact derived from the supported table, `packages/core/src/supported.ts`; an unlisted competition fields clubs). A club's `flag` key is absent, and every renderer prints a flag only when it is a non-empty string, with its one space (`withFlag` in core): nothing in its place, no double space, no code where the flag was. The statusline's tokens keep their nation layouts; a side with no flag renders its code (`ARS 2–1 CHE 50'`, `ARS vs LEE in 2d4h`). Every reader states the kind: the adapter passes its competition to both parsers, and the cache readers (`liveMatchesFromCache`, `sealFixtures`) take `teamKind(competition)` from their callers (`cmdPrompt`, `cmdHook`, `cmdVibe`, the refresher). A placeholder is the 🏳️ of a nation competition's unknown side (`isPlaceholderSide`); a side with no flag is resolved.
The stage comes from the written grammar over the whole season slug (`stageFromSlug`, with `COMPETITION_KIND` and `SEASON_SLUG`): a league's season is `REGULAR` ("League"), a cup's league phase `LEAGUE` ("League phase"), play-offs `PO` ("Play-offs"), and anything the grammar does not know `OTHER` with the provider's words (`stageLabel`), or nothing at all when the slug is absent or unreadable. CLI `next`/`match` print it localized (`stageLabelI18n(lang, match)`), MCP text and the cards in English (`stageLabel(match)`). Wherever a stage is joined into a line with ` · ` the segments go through `joinSegments`, which drops an empty one with its separator.
## Format opts invariant
If a core formatter accepts `tz`, `locale`, `flags`, or `date`, **every wrapper** passes them from `CliConfig` / `CommonOpts`.
```typescript
// ❌ BAD — locale only; tz silently drops to server local
formatBracketList(view, { footer: false, locale: args.lang });
// ✅ GOOD
formatBracketList(view, { footer: false, locale: args.lang, tz: args.tz });
// or reuse fmtOpts(args) where shapes align
```
## Regression tests
When adding a format option (e.g. `date: true` on `formatKickoff`):
- Add a **core** unit test for the option.
- Add an **MCP tool test** proving `tz` changes output (e.g. UTC vs `America/Mexico_City` on a cross-midnight kickoff).
- Update share tests if `formatShareBracket` / compact lines are affected.
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.

