narrative-modeling-app
CLAUDE.md6 starsChanged 2 months agoApache-2.0View on GitHub
One product name, SheetPredict (#765). Pages show COMPANY.serviceName (apps/frontend/lib/legal/company.ts); COMPANY.valueLine equals docs/product/positioning.md (sign-up page test). API vendor media type: application/vnd.sheetpredict.v1+json. apps/backend/tests/test_security/test_product_name.py fails on a retired name in any tracked text file, comments and guides included — describe an old name without writing it. Identifiers keep theirs (repo, packages, databases, buckets, test-user address). The only exempt file is positioning.md. This file holds durable conventions: the rule, where it lives, and the guard that enforces it. #NNN points at the PR with…
- Reads credentials
- Commits and pushes
In this repositoryOne other file it gives its agents.
- staging-opsSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is 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.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 32
E2E uses real auth (#493): never SKIP_AUTH in test-e2e.sh.
≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.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
CLAUDE.md - Project Conventions and Guidelines
Project Overview
SheetPredict — an AI-guided platform that helps non-expert analysts build, explore, and deploy ML models without writing code.
One product name, SheetPredict (#765). Pages show COMPANY.serviceName (apps/frontend/lib/legal/company.ts); COMPANY.valueLine equals docs/product/positioning.md (sign-up page test). API vendor media type: application/vnd.sheetpredict.v1+json. apps/backend/tests/test_security/test_product_name.py fails on a retired name in any tracked text file, comments and guides included — describe an old name without writing it. Identifiers keep theirs (repo, packages, databases, buckets, test-user address). The only exempt file is positioning.md.
This file holds durable conventions: the rule, where it lives, and the guard that enforces it.
#NNNpoints at the PR with the story; per-issue history lives in git, not here.
Where the rest lives
Per-app conventions load when you work in that app: apps/backend/CLAUDE.md (FastAPI: routes, auth, models, datasets/S3, transformations, training, billing, jobs), apps/frontend/CLAUDE.md (Next.js: auth, Tailwind, middleware, pages, errors). Read the relevant one before changing code there.
Git hooks
./scripts/install-git-hooks.shruns at session start (SessionStarthook) and symlinks.githooks/pre-push, which refuses a push updating the default branch (enforce_adminsis false, so a direct push would succeed). Override:git push --no-verify..claude/hooks/no-push-to-main.shis the early-feedback layer for agents (parses command text; only checks the current branch). Override:ALLOW_MAIN_PUSH=1 git push ....- The installer never clobbers a real file in
.git/hooks(the untracked secret-scanningpre-commitlives there);core.hooksPathstays unchanged. Both hooks have--self-checktables that CI runs.
Testing Commands
- Backend (full):
cd apps/backend && uv run pytest— needs MongoDB on :27017; optional Redis (:6380) + LocalStack (:4566) viadocker compose -f docker-compose.test.yml up -d. - Backend (PR gate):
cd apps/backend && PYTHONPATH=. uv run pytest tests/ -m "not integration and not performance" -v. Selection is by marker, never by path. tests/test_security/test_images_built_once.pyrenders the deploy compose file with the realdocker composeCLI and has no skip: without it, those tests fail.- Frontend:
cd apps/frontend && npm test|npm run type-check|npm run lint
Test footguns
- Route tests use real documents (#267, #683):
mock_async_clientmounts only health + secure_upload (other routes 404 vacuously). Useasync_authorized_clientwith real Mongo docs and exact statuses. Seed datasets withUserData(...).insert()and processed state from captureddataProcessResponse.json; never aMagicMockdataset or a patchedsave. For X-API-Key routes insert a realAPIKeyand send the rawsk_live_…. - Captured fixtures (#808):
apps/frontend/__tests__/fixtures/bodies are captured, never hand-written — regenerate withUPDATE_FIXTURES=1 PYTHONPATH=. uv run pytest <capturing test>(e.g.tests/test_api/test_user_data_response_fixture.py) and build page fixtures on them. - Frontend lint is warning-capped (#333):
eslint . --max-warnings 64over the whole project (incl.e2e/,__tests__/). The cap only ratchets down; never widenglobalIgnores. - React Compiler rules (#393):
immutability,static-components,refs,preserve-manual-memoizationareerror;set-state-in-effectis stillwarn(keepsreactCompileroff). Counts are lower bounds — re-measure after each batch. apps/frontend/__mocks__/auto-applies to every suite (#390): when bumping a mocked dependency's major, update the mock in the same PR, make it throw on the old prop shape, and mutation-check.- Charts run against real recharts (#346): mock only
ResponsiveContainerviajest.requireActual('@/__tests__/utils/sizedRecharts').sizedRecharts(); assert on drawn output (axisTicks,.recharts-bar-rectangle,.recharts-line-curve[d]).Tooltipstays a stub. Recharts majors break at the type level — runtsc. - jest.setup (#268): global
fetchrejects by default — stub it;useRouter()spies live atglobal.__NEXT_ROUTER_MOCKS__; Radix tabs needmouseDown+mouseUp+click. Contract:__tests__/setup/jestSetupContract.test.tsx. - E2E uses real auth (#493): never
SKIP_AUTHintest-e2e.sh. Direct backend calls get headers frome2e/helpers/apiAuth.ts::apiAuthHeaders(request); a second tenant viasignInAs.e2e/workflows/tenant-isolation.spec.ts(@smoke) is the isolation guard — a new owned surface joins itsownedlist. - Account-scoped specs run as their own user (#743): names in
e2e/isolatedUsers.ts, opted into withtest.use({ storageState: isolatedState('<name>') })(TEST_ISOLATED_USERS=1). Never reset, erase or re-plan the shared user. - E2E assertions must be able to fail (#921, #999, #810): drive pages navigation reaches; no assertions inside
try/catchorif (await x.isVisible()); no barereturn;(__tests__/e2e/noEarlyReturns.test.ts) — seed preconditions (seedEvaluationWorkflow,trainModel). Assert stage landings withe2e/helpers/landing.ts::expectLandedOnStage(page, url, '<Stage>'), never the address alone. Break the thing a new spec tests once before trusting it.e2e/fixtures/auth.ts'sauthenticatedPageis deprecated. - Red smoke (#578, #1233, #1245): read
error-context.md,trace.zipand thesmoke-server-logsartifact (backend, frontend, LocalStack output; public, so the E2E jobs read no secret:test_e2e_server_logs_wiring.py) before retrying. A backend alive but not answering is stopped with SIGABRT and its log ends with aBackend stack dumpof every thread (e2e/dump-hung-backend.sh,PYTHONFAULTHANDLER=1;test_hung_backend_stack_dump.py).authenticatedPage(e2e/fixtures/index.ts) fails naming the actual landing URL; a failure across in-run retries is a real signal, not flake.
CI & Test Suite Status
- pytest always uses the test database (
tests/conftest.py::_app_uses_the_test_database) and pins its own S3 settings (blank credentials, localAWS_ENDPOINT_URL;test_suite_never_reaches_aws.py) — read a credential in a fixture withos.getenv(NAME) or "test". ci.ymlis the PR gate: backend (ruffE/F/I/UP, mypy, pytest by marker against Mongo), frontend (eslint,tsc --noEmit,next build, jest),docker-images(both production images built byscripts/ci/build_images.sh, and one frontend image booted as two hosts), backend integration (CI_REQUIRE_SERVICES=true),e2e-smoke.CI Successis the only required check. Advisory:backend-typecheck,perf-tests.yml,security-audit, review bots.e2e-tests.ymlruns the full suite nightly and opens/closes a[P2] [testing] The nightly full e2e suite is failingissue.- Review bots — absent ≠ clean (#571, #626, #955): a red
claude-review, a GLM run that failed to start, or a "Reviewer failover" comment saying no reviewer produced a review (the GLM caller fails over Codex → Kimi → Z.ai and stays green) means no verdict.review-bots-health.yml(scripts/ci/review_bots_health.sh; add new reviewers toWORKFLOWS) opens/closes a[P2] [infra] Review bot is failing at startup: <workflow>issue, deduped on that phrase; a green run that posted the callee's "No reviewer produced a review" comment counts asno_review, and three in a row alert (#1149). A reviewer whose last three failover comments say it failed for a reason other than quota gets its own[P2] [infra] A reviewer keeps failing over: <name>alert, even though a later reviewer covered it (#1194). Keep the GLM caller'spermissions:in step with the pinned callee and never add a caller-levelconcurrency:group matching the callee's (test_review_bots_health_wiring.py).claude-reviewkeeps its steptimeout-minutes: 9below the job's 10 so the "did not complete" comment can post, and runs only for human PRs (Dependabot skips are by design). - Staging access:
ssh staging-ts '<cmd>'only, with inlinepython -c "…"(opaque piped scripts are refused;scripts/isn't in the image). If refused or the alias is missing, don't retry variants —gh workflow run staging-health.yml --ref <branch>(exit 137 = boot loop). Split secret-needing verification into a code PR + an operator issue with exact commands. - Wait for CI with
scripts/ci/wait_for_checks.sh <pr|sha>in the foreground with a bounded timeout (0 =CI Success, 1 = failure, 2 = timeout). - Deploys, staging health, staging env vars and the nginx edge config: the
staging-opsskill (.claude/skills/staging-ops/SKILL.md). - Guides:
docs/dev/TEST_INFRASTRUCTURE.md,docs/dev/E2E_TESTING_GUIDE.md,docs/dev/LOCAL_DEVELOPMENT.md.
Docs and licence
docs/holds only what is current and used:adr/(decision records — supersede, never rewrite),ops/(runbooks that workflows, scripts and the legal pages point at),product/,dev/. Session notes, sprint/story reports and per-issue demos are not committed (/tasks/is gitignored); history lives in git and the PRs.- Licence is Apache-2.0:
LICENSEis the verbatim text, attribution is inNOTICE;pyproject.toml/package.json,GET /and the OpenAPIinfo.licensestate the same SPDX id (tests/test_security/test_license.py). - Env templates: repo-root
.env.staging.exampleand.env.production.examplehold exactly the variablesdocker-compose.deploy.ymlreads from an env file (plusNGINX_SERVER_NAME; not the fourscripts/deploy/compose.shsupplies:ENVIRONMENT, the two image digests,APP_VERSION), in the same order — only values and environment-specific comments (header, Stripe key mode) differ.apps/backend/.env.exampleandapps/frontend/.env.local.exampleare local-dev; the variables both services read carry identical values and text. Change a pair together (tests/test_security/test_env_templates.py).
Environment Variables
- Public frontend settings are runtime values (#831): the frontend image is built once and promoted by digest, so no
NEXT_PUBLIC_*is a build arg; code reads them throughlib/runtimeEnv.ts::publicEnv(seeapps/frontend/CLAUDE.md). Guards:__tests__/lib/noBuildTimePublicEnv.test.ts,test_images_built_once.py. NEXT_PUBLIC_API_URLincludes/api/v1(#406, #470): append only the resource path; never re-add/apior "normalise" with.replace(...). Never call a bare relative/api/v1fromapp/,components/,lib/(Next route handlers underapp/api/**are the only relative target). Guard:__tests__/lib/apiUrlConstruction.test.ts.MONGODB_URIis bare; the database isMONGODB_DB(#545, #551, #694), passed to both halves with the same value (the backend selectsclient[db_name]; the NextAuth adapter getsdatabaseName). Omitting it silently lands on a database namedtest. The frontend'sassertDatabaseConfig(lib/auth-config.ts, production only) and the backend'sresolve_database_namerefuse a missing or disagreeing name. Guard:__tests__/lib/authAdapterDatabase.test.ts.- Local development uses LocalStack, never a deployed bucket (#878):
AWS_ENDPOINT_URL=http://localhost:4566(bucket viaawslocal s3 mb).development_uses_a_real_bucket()warns once per process otherwise. SKIP_AUTH=truemaps all requests todev-user-defaultand is honoured only whenENVIRONMENTisdevelopment/test(startup fails otherwise, #149).
Documentation Requirements
Keep docs in sync with code: OpenAPI when endpoints change; docstrings/JSDoc on public or complex surfaces; remove outdated comments immediately; update the relevant section of the matching CLAUDE.md (root, apps/*/CLAUDE.md, or the staging-ops skill) when a convention changes — the rule and its guard, not the story.
Automated Workflow Configuration
- Quality gates before PR: tests pass, coverage >85%, ruff/eslint clean, mypy/tsc clean, no TODO/FIXME/NotImplemented markers, OWASP scan, and
scripts/quality/crap.shpasses: every added or modified function scores CRAP < 6 — split or cover it, never skip (exit 2 = a measurement is missing: follow the hint; backend coverage needs MongoDB). No standing exemptions. - CRAP gate engine (#1153):
crap.shruns the newestquality-gateplugin in the plugin cache with.claude/quality-gate/crap.json; it parses TS/TSX with the TypeScript AST and Python with the stdlib AST, so write code naturally (the old lizard workarounds are gone). The backend LCOV comes fromscripts/quality/python_lcov.py(coverage's raw measured lines, a record for every executable line), because coverage.py's own LCOV folds a multi-line statement onto its first line and the gate cannot verify such a body (#1160;test_python_lcov.py). Receipts land in the gitignored.claude/quality-gate/receipts/. JSX: Jest's coverage never records a component'sreturn (…)line, so a JSX-returning body is measurable only through its other statements; the gate passes an unmeasured body only at complexity 1. Keep branches out of JSX-returning components (aconst X = { true: …, false: … }lookup or a one-line non-JSX helper). - CodeRabbit: max 3 iterations; auto-fix style/types/simple bugs/docs. Escalate on iteration-3 failures, architecture changes, or security decisions.
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.

