|
| 1 | +# Repository rules for Claude |
| 2 | + |
| 3 | +Read this before making any change to this repo. |
| 4 | + |
| 5 | +## Pre-push checklist |
| 6 | + |
| 7 | +Before you push a branch (any branch), run these and make sure they all pass: |
| 8 | + |
| 9 | +1. `npm run typecheck` — must exit 0. |
| 10 | +2. `npm run build` — must succeed and produce `dist/index.mjs`, `dist/index.d.ts`, `dist/styles.css`. |
| 11 | + |
| 12 | +Do not push if either fails. Fix the root cause; do not silence errors. |
| 13 | + |
| 14 | +## Changeset rule |
| 15 | + |
| 16 | +If the change modifies anything under `src/` that affects users of the published package (new/removed/changed prop, behavior change, bug fix that reaches runtime, CSS that changes visuals), you MUST add a changeset before opening the PR: |
| 17 | + |
| 18 | +``` |
| 19 | +npx changeset |
| 20 | +``` |
| 21 | + |
| 22 | +- Bump type: `patch` for bug fixes, `minor` for additive features, `major` for breaking changes to the public API (`SnakeLoader`, `SnakeLoaderProps`, `Theme`, `Colors`, `Effects`). |
| 23 | +- Summary: one line, written from the consumer's perspective (what changed for them, not what you did internally). |
| 24 | + |
| 25 | +Skip the changeset for: docs-only edits, CI/workflow changes, `.gitignore`, `CLAUDE.md`, internal refactors with zero observable effect, tooling config that doesn't change the tarball. |
| 26 | + |
| 27 | +When in doubt, add one. An extra changeset is cheap; a missing one means a fix ships unversioned. |
| 28 | + |
| 29 | +## Branch + PR flow |
| 30 | + |
| 31 | +- `main` is protected. Never push to it directly — the ruleset will reject it. |
| 32 | +- Work in a short-named branch (`fix/...`, `feat/...`, `chore/...`, `docs/...`). |
| 33 | +- Open a PR with `gh pr create`. The user merges. |
| 34 | +- After merge, the Release workflow either opens a "Version Packages" PR (if changesets are pending) or no-ops. |
| 35 | + |
| 36 | +## Public API — do not change without the user's explicit approval |
| 37 | + |
| 38 | +These are part of the package's public contract. Changing any of them is a major bump and needs a conversation first: |
| 39 | + |
| 40 | +- Props: `theme`, `cellSize`, `speed`, `colors`, `effects`, `paused`, `className`, `style`, `aria-label`. |
| 41 | +- Exports: `SnakeLoader`, `SnakeLoaderProps`, `Theme`, `Colors`, `Effects`. |
| 42 | +- Observable behavior: 8×8 grid (`GRID_SIZE`), initial snake length of 2 (`INITIAL_LENGTH`), death flicker duration of 12 ticks (`DYING_TICKS`), weighted-random pathing with 60% straight persistence, default `cellSize: 3`, default `speed: 10`. |
| 43 | + |
| 44 | +## Things to never do |
| 45 | + |
| 46 | +- Do not commit `dist/` or `node_modules/`. |
| 47 | +- Do not run `npm publish`, `npm version`, or create release tags by hand — the Release workflow owns these. |
| 48 | +- Do not edit `.changeset/*.md` files that the "Version Packages" PR generated. They're produced by `changeset version` and deleted on release. |
| 49 | +- Do not add runtime dependencies. This package advertises zero deps. |
| 50 | +- Do not use `git push --force`, `git reset --hard`, or `git commit --amend` on pushed commits. |
0 commit comments