Poultry egg-farm management system. Backend: .NET 10 (C#), layered DDD, Postgres via EF Core. Frontend: React 19 + Vite SPA in web/.
This file is the index and the rules that apply everywhere. Read CONTRIBUTING.md for setup, tests, schema changes, commit messages and dependencies. Read docs/architecture.md before you move middleware or add an aggregate state, and specs/product/GLOSSARY.md before you name or model a domain concept. product-model/ says what each action does today, who may do it and when it is refused. It can lag the code, and the code wins.
A → link points to the rule's decision record in docs/decisions/. Read it before you change or work around the rule.
Before you edit a path below, read its file, whether or not your harness loads it. A rule moves out of this file only when every path that can trigger it is listed with its file.
src/**,tests/**,tools/simulation/**,Dockerfile,deploy/**,.editorconfig,Directory.Build.props→src/AGENTS.md: module boundaries, data and tenancy, auth, boot guards, config callers, the single serving instance.web/**→web/AGENTS.md: SPA text, help prose, styles, lint. Role-gated navigation also needssrc/AGENTS.md.src/Cluckwork.Infrastructure/Persistence/**,docs/schema/**,tools/schema-docs/**→src/Cluckwork.Infrastructure/Persistence/AGENTS.md: migrations, reference data, schema docs..github/**,docs/releasing.md,deploy/**→.github/AGENTS.md: workflows, Action pins, image publishing, releases.
src/Cluckwork.Domain aggregates, value objects (no deps)
src/Cluckwork.Application handlers, repository interfaces, validators
src/Cluckwork.Infrastructure EF Core, Identity, repositories, seeding, jobs
src/Cluckwork.Api minimal-API endpoints, middleware, CLI verbs
src/Cluckwork.AppHost Aspire local orchestration, dev only
src/Cluckwork.Analyzers module-edge analyzer, never shipped
tests/ Domain, Application, Api.IntegrationTests, AppHost
tools/simulation/ sim stack, k6, Playwright E2E (tools/simulation/ui)
dotnet build Cluckwork.slnx. Warnings are errors.- Run only the tests your change touches, with
--filter. CI runs the full suite. - Integration tests use real Postgres through Testcontainers, never SQLite. They need Docker.
- A new test project needs a leg in
ci.yml'stestsmatrix and a row inSolutionTestProjectSplitTests. A missing leg never runs and nothing fails. →775-ci-test-matrix.md
- Read the issue's comments as well as its body. Requirements and amendments land in comments.
- Do not copy issue state (open, closed, remaining) into these files. Use
gh issue view <n> --json state.
A wrong guard is worse than none, because it looks safe. → 407-writing-a-guard.md
- Assert the invariant, not a message. A test that pins error text passes when the behavior breaks.
- Mutation first, claim second. Break the code the guard protects and watch the guard go red before you write "this catches X". Report the mutations in the PR.
- Walk everything and exclude deliberately. Never list the cases you thought of. Two misses of the same shape mean the method is wrong.
- Key a registry or allow-list by what the code declares about itself (attributes, interfaces, symbols, token hashes), never by where it sits (path or
file:line). When a stable key can collide but a positional key could not, make the same guard assert uniqueness; otherwise one identity can excuse two queries. →859-typed-rule-registries.md - A walk that finds nothing must fail. Give it a floor.
- For a pinned or golden value, prove it is portable across machines.
- Prefer the boring guard.
- Run an adversarial pass before the first push: mutations, or a second agent told to refute the guard.
- When you add a registry entry (
CliDispatcher.Commands,ProcessRoles.OneShotVerbs,AuditActions, an enum mirrored inweb/src/i18n/enums.ts), greptests/for the registry's name to find every guard that reads it. Do not rely on memory. - Some guards check call-site syntax, for example
AuditVocabularyCoverageTestsonIAuditWriter.WriteAsync. Read the guard before you write the call. - Some guards walk every tracked file (image pins, tenancy wording). They apply to a doc as soon as you commit it. Run them before you commit docs. If one rejects the content of a copied document, fix the source and copy it again; never edit the committed copy or allow-list it.
Each row states what its check fails on, which can be narrower than the prose rule it backs. Existing hits are frozen where a row says so, so a check stops new cases rather than proving the rule everywhere. When a correction repeats and the rule behind it is only prose, add the check and a row here, or record why no check can hold it.
| Check fails on | Enforced by | Runs in |
|---|---|---|
A React hook rule or floating-promise violation in web/src/**/*.{ts,tsx} outside the frozen suppressions (#1155) |
ESLint, web/lint/eslint.config.js; web/lint/eslint-suppressions.json |
npm run lint, CI web |
An await or .then inside a useEffect in non-test files under web/src/routes or web/src/components, outside the suppressions; use useLatestLoad or usePagedList instead (#1190) |
ESLint no-restricted-syntax, same config |
npm run lint, CI web |
An assignment of false to a .current property inside the function a useEffect returns, in web/src/**/*.{ts,tsx}; clear a flag that async continuations read in a useLayoutEffect cleanup instead (#1395) |
ESLint no-restricted-syntax, same config |
npm run lint, CI web |
A new non-help key in en.ts with no Help or glossary change, or changed GLOSSARY.md term text whose English in-app definition stayed the same; a Docs-impact: none — <reason> body line waives both (#1194, see UI changes) |
.github/scripts/docs-impact.mjs |
Docs impact workflow |
A GLOSSARY.md term with neither an in-app entry nor a SPEC_ONLY row; the existing NOT_YET backlog is pinned (#1193) |
web/src/routes/helpGlossary.test.ts |
Vitest, CI web |
A tracked .cs, .ts, .tsx or .css file under src/ or web/src/ over 500 lines, or a test file there over 1,500, excluding migrations and locale catalogs; a listed legacy file fails over its cap (its listed size plus 10% rounded to the nearest line, halves up, at least 50 lines) and once back within its limit (#1153, #1223) |
FileSizeLimitTests |
Application tests, CI |
A new C# test type that parses syntax and never queries a SemanticModel; legacy types are listed (#1189) |
SpellingScannerRatchetTests |
Application tests, CI |
An unused using in any project's C# source, except the EF migrations tree and generated files (#1187) |
IDE0005 at build time, set in .editorconfig and Directory.Build.props |
dotnet build, CI |
An agent's push to main, force-push, src:dst refspec push or commit on main when the harness hook is enabled or git uses .githooks, and, from the harness hook only, a PR merge through the REST or GraphQL API, a non-GET gh api call on merges, contents, git/refs, rulesets or branches/<b>/protection, git send-pack, git update-ref on a main ref, a git config write of alias.* or core.hooksPath, git push --no-verify, a git command in the shared checkout (a main worktree with linked worktrees) outside its read, fetch, worktree and branch-listing set and git pull --ff-only on a clean main, or git stash or a shallow fetch anywhere; the guard's parser limits apply (#1158, #1172, #1175, #1205, #1221) |
tools/agent-guard/git_guard.py (Claude Code and Codex hooks, Pi extension, Hermes plugin); .githooks/pre-commit and .githooks/pre-push |
the agent harness; git; the guard's own tests in CI |
- A PR that changes what a user sees attaches screenshots: before and after at the same viewport and scenario, after-only for new UI. Capture at 1:1 from a stack rebuilt at the PR head; a long-running sim stack serves the build it started with. Attach with
gh pr comment --attachorgh pr create --attach, never by committing images to a branch. - Use the
verifyskill to launch the sim stack, drive it and capture frames. Never reset a sim stack another agent is using. Run/maintain-verification-skillafter a screen slice lands. - Playwright E2E lives in
tools/simulation/ui/(its README has the suite's rules). Reason aboutinertand the accessibility tree through CDP (src/ax.ts), because Playwright's own APIs do not modelinert. →277-spa-e2e.md - Every user-visible change updates, in the same PR,
specs/product/GLOSSARY.mdwhen a concept appears or changes meaning, and the SPA Help page and in-app glossary. The Docs impact workflow (.github/workflows/docs-impact.yml) checks part of this and names the fix when it fails; run it before you push withnode .github/scripts/docs-impact.mjs --base origin/main --body-file <file>..githooks/pre-pushruns it without a body and warns, never refuses.
Never commit a secret. Real values go in gitignored deploy/.env or dotnet user-secrets. Generate test credentials at runtime; never write a credential literal, even in a test.
The app never names or branches on a hosting provider. Flag a hardcoded provider name in code, configuration or committed docs like a missing test. A provider may appear as a passing prose example only when no portable phrasing works; prefer the neutral term. Provider manifests, IaC and concrete environment values (proxy CIDRs, CA bundles, connection URLs) belong in the separate deployment repo.
- Use
ghfor GitHub PRs. - Never commit to
main. Branch asfeat/…,fix/…,chore/…,docs/…orspec/…. - The agent command guard,
tools/agent-guard/git_guard.py, refuses PR merges through the REST or GraphQL API (gh pr mergeitself runs), force and mirror pushes, refspec pushes, pushes tomain, commits onmain, non-GETgh apicalls onmerges,contents,git/refs,rulesetsorbranches/<b>/protection,git send-pack,git update-refon a main ref,git configwrites ofalias.*orcore.hooksPathin any scope, andgit push --no-verify(#1221). In the shared checkout, a main worktree that has linked worktrees, it allows only reads,fetch,worktree, listing and deleting branches,merge-tree,config,remote, andgit pull --ff-only(optionallyorigin main) whenmainis checked out with no tracked change, and checks each git step of a chain, and it refusesgit stashand shallow fetches in every worktree, because all of them share one.git. Its message gives the allowed form. It runs only where enabled. Claude Code loads it from.claude/settings.json. Codex runs it only after you trust it in/hooks. Pi loads it only for a trusted project. Hermes needsgit-guardinplugins.enabledand must start from the repo root withHERMES_ENABLE_PROJECT_PLUGINS=true. - The git hooks in
.githooks(enabled withgit config core.hooksPath .githooks) are a separate backup. They refuse commits onmainor in the shared checkout, pushes tomainand non-fast-forward pushes, but they cannot seegh pr merge, and--no-verifyskips them. - The PR title is the release note: it becomes the squash commit subject that release-please parses. Use a conventional title (
feat(scope): …). A bad title drops the changelog entry with a green run. - Close an issue with
Closes #Non its own line in the PR body, never in the title. Check what will close withgh api graphqlonclosingIssuesReferences. - Never hand-edit
.release-please-manifest.jsonorversion.txt. - A package add or bump commits the regenerated
packages.lock.jsonfiles in the same commit. NuGet versions live only inDirectory.Packages.props. - If your PR ships work that another open issue claims, amend that issue in the same PR. Leave its body as written, and add an amendment at its top linking to a comment that names what shipped and where, what remains, and which acceptance criteria the shipped code deliberately does not meet. A criterion nobody will implement needs a follow-up issue or a recorded won't-fix.
graphify-out/ holds a knowledge graph of the code. When graphify-out/graph.json exists, run graphify query "<question>" first for codebase questions; graphify path "<A>" "<B>" and graphify explain "<concept>" return a focused subgraph. Dirty graphify-out/ files are not a reason to skip it. Use graphify-out/wiki/index.md, when it exists, for broad navigation. Run graphify update . periodically, but do not commit its output with unrelated changes.