physicshub.github.io
AGENTS.md68 starsChanged 50 days agoMITView on GitHub
PhysicsHub — free, open-source interactive physics simulations + written theory. Next.js 15 App Router, React 19, p5.js rendering, Tailwind v4. CLAUDE.md is the canonical architecture doc — read it before building anything, and update it when you change the project structure. There is no test suite. CI (.github/workflows/prchecks.yml) runs only prettier --check . and eslint . — run both before proposing a PR. Husky pre-commit runs scripts/check-package-lock.js and lint-staged. Node >= 24 (see .nvmrc). - Never edit version in package.json…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 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 repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- public/llms-full.txtllms.txt
- public/llms.txtllms.txt
- new-articleSkill
- new-simulationSkill
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 35
If a static build crashes mid-way, app/api shows as deleted in git status — it's a rename away.
- Very specific: line 70
Every formula shown on the site is a card in app/(core)/data/formulas/ (one file per domain.
- Very specific: line 82
Every numeric option accepts a getter: Gravity({ g: () => inputs.gravity }) — never hand-re-sync params or rebuild the world on slider …
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
AGENTS.md
PhysicsHub — free, open-source interactive physics simulations + written theory.
Next.js 15 App Router, React 19, p5.js rendering, Tailwind v4. CLAUDE.md is the
canonical architecture doc — read it before building anything, and update it when
you change the project structure.
Commands & verification
npm run dev # next dev + sitemap regen on routes.js changes
npm run build # generate:sitemap + generate:feeds, then next build (server mode, API live)
npm run build:static # Pages export: strips app/api, exports to out/, restores
npm run lint # eslint (lint:fix to autofix)
npm run format:check # prettier --check . — CI parity
npm run format # prettier --write .There is no test suite. CI (.github/workflows/prchecks.yml) runs only
prettier --check . and eslint . — run both before proposing a PR. Husky
pre-commit runs scripts/check-package-lock.js and lint-staged. Node >= 24 (see .nvmrc).
Gotchas
- Never edit
versionin package.json — semantic-release owns it. PR titles must be conventional commits (feat:,fix:,ci:…); the squashed title is the changelog. routes.jsat the repo root is generated —scripts/sitemap-generator.jsrewrites it in place (lastmod churn) and writespublic/sitemap.xml+public/robots.txt.scripts/generate-feeds.jswritespublic/feed.xml(Atom),public/llms.txt, andpublic/llms-full.txt. All five run before everynext build; all are build output — don't hand-edit them.- Two build modes, switched by
app/apipresence (seenext.config.js):npm run build— API present → normal Next.js app (Vercel, local dev).npm run build:static— stripsapp/apiviascripts/strip-api-for-static-export.js, exports toout/.- If a static build crashes mid-way,
app/apishows as deleted ingit status— it's a rename away; the nextbuild:static(orgit checkout app/api) restores it. - Anything under
app/api(OAuth, blog publishing) does not exist onphysicshub.github.io; publishing only works on Vercel or innext dev.
- Node/Next env: OAuth and publishing need
GITHUB_CLIENT_ID/GITHUB_CLIENT_SECRETin.env.local(gitignored); the committed.envonly holds a webhook URL and contributors-token placeholder.
Architecture
- Import alias
@/*→ repo root. Simulations undersimulations/use relative paths instead. app/(core)/— shared code (engine, components, data, hooks, lib, utils, locales), not a route segment.app/(pages)/— actual pages (about,blog,contribute,simulations).
Simulations
Adding or porting a simulation: load the new-simulation skill first
(.claude/skills/new-simulation/SKILL.md) — step-by-step for the four files that
must agree on one <Name>:
simulations/<Name>.jsx("use client", loaded dynamically,ssr: false)app/(core)/data/configs/<Name>.js— form schema + readout only, never forcesapp/(core)/data/chapters.js— catalog entry; a simulation missing here 404s in the static export (dynamicParams = false)- optionally
app/(core)/data/articles/<slug>.js
Articles / blog
Writing or restructuring an article: load the new-article skill first
(.claude/skills/new-article/SKILL.md). Answer-first house style — a
question-shaped name, the answer in the first two sentences, a key callout +
takeaways box + a faq block, then depth. code blocks only in articles
tagged TAGS.PROGRAMMING. Articles are JS modules in app/(core)/data/articles/,
registered in articles/index.js (position = listing + prev/next order). Theory
blocks render via components/theory/; the faq block also emits FAQPage
JSON-LD server-side through app/(core)/utils/blogSchema.ts. Author bylines:
app/(core)/data/authors.js.
Formulary (/formulas)
Every formula shown on the site is a card in app/(core)/data/formulas/
(one file per domain; name, LaTeX, variables with units, when it holds, an
optional calculator via solve, related formulas). Simulations reference cards
by id from simulationOverviews.js. Articles reference them with
{ type: "formula", ref } blocks and inline [[id]]. Where each card is used is
derived by utils/formulaUsage.js, never written by hand, and an unknown id
fails the build. See CLAUDE.md → "Formulary".
Engine (app/(core)/engine/) — the only physics core
Bodies hold state; everything else is an element (plain object with hooks), composed by addition. Rules that keep it composable:
- Every numeric option accepts a getter:
Gravity({ g: () => inputs.gravity })— never hand-re-sync params or rebuild the world on slider change. - Forces only call
body.applyForce(f, label); the integrator converts to motion. Never recompute a force for rendering —ForceVectorsdraws the recordedappliedForces. - Coordinates are meters, Y-up, origin bottom-left; conversion to pixels happens only at render time (
constants/Utils.js,engine/render/Shapes.js). - Time is owned by
constants/Time.js(FIXED_DT = 1/120,computeSteps(p)); a simulation never touches time directly.
See CLAUDE.md → “How a simulation is wired” for the full createSimulation(spec) contract and which simulations bypass the pipeline (and why the reasons are physical, not convenience).
Conventions
- Mixed JS/TS by design: new shared code →
.tsx/.ts, simulations stay.jsx, the engine stays.jswith JSDoc types. - Some comments are in Italian — fine to keep; write new ones in English.
- i18n is custom, not a library:
hooks/useTranslation.tsreads thegoogtranscookie, loadsapp/(core)/locales/<lang>.json;locales/meta.jsonmarks completed languages. Extract new keys withnpm run i18n:extract— don't introduce next-intl/i18next. - Changing the engine or how simulations are written: update
CLAUDE.mdand.claude/skills/new-simulation/SKILL.mdin the same change. - Changing the theory block types, the article object shape, or the blog schema pipeline: update
CLAUDE.mdand.claude/skills/new-article/SKILL.mdin the same change.
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.

