This file is the operating contract for any agent or engineer making changes in this repo.
The goal is simple: ship fast, prove correctness, protect production, and save developer time.
If a rule here conflicts with common sense, surface the conflict in the PR instead of pretending not to notice it.
Optimize for:
- speed of safe delivery
- saving developer time
- high confidence changes
- fast recovery when something breaks
The human developer's time is scarce and expensive.
Agents and contributors must catch preventable failures before human review:
- missing checklist items
- missing required PR sections
- missing evidence
- missing required environment variables
- unrun tests
- obvious CI failures
- avoidable lint, typecheck, or build failures
- broken preview validation when applicable
The human review should be reserved for judgment, not mechanics.
The human should spend review time on:
- product correctness
- architectural tradeoffs
- edge cases
- operational risk
- code quality
not on mechanical enforcement failures.
These apply to every PR unless the PR is documentation only or explicitly marked as low risk.
-
Never push directly to main. Every change goes through a PR.
-
Behavior first PR summary is required. Describe what changed in terms of user visible behavior and system contracts. Cover UI, API, data shape, permissions, configuration, and operational behavior.
-
Document affected user flows. For each changed feature or path, include:
- happy path
- expected failure paths
- empty states
- permission and auth cases if relevant
- timeout, network, and dependency failure cases if relevant
-
Include evidence. UI changes require a screenshot or short recording. API or backend changes require CLI output, test output, logs, or equivalent proof. Infra or runtime changes require deployment evidence, health checks, or validation output.
-
Review for weakness, not just correctness. Identify the top architectural, operational, and testing risks introduced by the change. Be explicit and prioritize them.
-
Observability is mandatory for runtime changes. If runtime behavior changes, update logging, metrics, and error visibility accordingly.
-
CI must be green before handoff. Do not hand off a PR as ready until required checks pass.
-
Address meaningful review feedback. Consider feedback from humans and bots. Resolve high signal feedback or explain why it was not adopted.
Every PR must declare a risk tier.
Examples:
- docs
- comments
- copy only
- formatting
- non executed config
Requirements:
- behavior summary if applicable
- evidence if useful
- no runtime validation required
Examples:
- isolated UI fixes
- non critical refactors
- small backend logic changes without schema or auth impact
Requirements:
- unit or integration tests as appropriate
- evidence
- observability review if runtime is affected
Examples:
- user facing workflow changes
- API contract changes
- database query or path changes
- feature flags
- caching
- background jobs
- third party integrations
Requirements:
- integration tests required
- critical path failure modes documented
- evidence required
- observability updates required
- preview or staged validation if applicable
Examples:
- auth
- billing
- schema migrations
- permissions
- destructive data operations
- infrastructure changes
- production critical workflow rewrites
Requirements:
- integration tests required
- end to end coverage required for affected critical flows
- rollback or mitigation plan required
- observability updates required
- preview or staging validation required
- explicit architectural risk review required
If unsure, choose the higher tier.
The repo should favor tests that give high confidence in real behavior.
-
Unit tests Minimize these! Use for pure logic, edge conditions, parsing, validation, and transformations. Fast and focused. Mocking is allowed here.
-
Integration tests Preferred for most business logic. Should use real databases and real services. Avoid mocking internal boundaries unless there is a strong reason. Delete any test data that's created.
-
Contract tests Required when integrating with external services whose behavior or schemas matter. Prefer provider schemas, sandbox environments, or stable replay fixtures.
-
End to end tests Required for critical user journeys.
- Do not silently skip important tests because configuration is missing.
- If a required environment variable is missing, fail with a clear message naming the variable and how to set it.
- For third party systems, use the most realistic and stable validation available:
- local containers
- internal test environments
- provider sandboxes
- controlled live tests only when justified
- Delete test data generated by tests
- Tier 0: none unless useful
- Tier 1: unit or integration coverage for changed behavior
- Tier 2: integration coverage for affected paths
- Tier 3: integration plus end to end coverage for affected critical flows
- Coverage must be measured and reported.
- Coverage numbers alone are not sufficient.
- Prioritize coverage of changed lines, critical paths, failure handling, and regression prone logic.
A core Playwright suite must exist for the most important user journeys.
Rules:
- No mocking allowed.
- Playwright tests must run in CI against a local or PR built application, and in production.
- Critical flows must remain covered.
- Add or update Playwright tests when a PR changes a critical flow, rendering path, or client side behavior that could fail in browser.
- Prefer a smaller stable suite with high signal over a larger flaky suite.
At minimum, protect the flows that would materially harm users or revenue if broken.
CI must validate required configuration for required jobs.
Rules:
- A dedicated CI step must verify required environment variables and secrets for test and deployment jobs.
- If required configuration is missing, fail clearly and list the missing variables.
- Do not allow tests to pass because they downgraded to mocks or no ops due to missing configuration.
Any runtime change must be observable.
Minimum expectations:
-
Structured logs Include enough context to debug failures. Never log secrets or sensitive tokens.
-
Error visibility Errors must surface to the repo's error tracking or equivalent mechanism.
-
Metrics Add or confirm metrics for the changed critical path where relevant:
- success and failure count
- latency
- retries and timeouts
- queue or job outcomes
- business event completion if applicable
-
Correlation Use request IDs, job IDs, or trace IDs where supported.
-
Dashboards and alerts For Tier 3 changes, confirm how the team would detect failure in production.
Before requesting human review, the agent or contributor must complete a local preflight.
The preflight must verify:
- required PR sections are present
- required checklist items are completed honestly
- required tests for the risk tier have run
- lint, typecheck, and build steps pass
- required environment variables are present for the selected test suite
- preview or staging validation is complete when applicable
- evidence artifacts are attached or referenced
- changed flows are documented
- rollback or mitigation is included when required
Do not ask the human to discover preventable failures in CI or the PR template. If a failure can be detected before review, it must be detected before review.
Human review is the final quality pass, not the first validation pass.
Do not hand a PR to a human reviewer if it still has:
- missing checklist items
- missing evidence
- missing required tests
- known CI failures
- known formatting or template failures
- missing environment configuration
- unresolved mechanical issues that the agent or contributor could have detected
The reviewer should not be used as a substitute for preflight validation.
Where possible, the repo should automate mechanical enforcement before human review.
Prefer automated checks for:
- PR template completeness
- checklist presence
- required environment variable validation
- lint, typecheck, and build
- test selection by risk tier
- coverage reporting
- preview health checks
Humans should judge substance. Automation should catch mechanics.
Every PR description must include:
A short behavior first summary.
For affected flows:
- happy path
- main failure paths
- edge cases worth noting
One or more of:
- screenshots
- short video
- CLI output
- test output
- preview link
- logs or metrics evidence
List:
- tests added or updated
- exact commands run
- result summary
List:
- top weaknesses or risks introduced
- what was done to mitigate them
- what remains unresolved
State:
- what logs, metrics, or error reporting were added or verified
- how failures would be detected after deploy
Required for Tier 3 and any irreversible change.
For any non trivial PR, answer these:
- What contract changed?
- What can fail now that could not fail before?
- What happens on retry, timeout, duplicate submission, partial success, or stale state?
- What assumptions does this change make about data, ordering, auth, or infra?
- How would this be rolled back or disabled?
- What production signal would prove this is healthy?
Do not write generic filler. Be specific.
For web applications and user facing runtime changes:
- Validate the PR build in a preview or equivalent environment when available.
- Run smoke tests or end to end checks appropriate to the change.
- Confirm the deployed artifact matches the intended behavior.
- Do not merge if the preview or staged validation reveals a real regression.
For backend only or library only changes, use the closest relevant validation instead of forcing meaningless preview checks.
- Use bot review as a signal amplifier, not as a substitute for judgment.
- Fix high value feedback.
- If rejecting substantial feedback, explain why in the PR.
- Human review still governs merge readiness.
A PR is ready for human review only when:
- local preflight is complete
- required checks are green or already known to be non blocked with explanation
- required tests have run
- evidence is attached
- the PR template is fully completed
- major known issues are already surfaced
- the PR is genuinely ready for judgment, not mechanical cleanup
The human reviewer is the final decision maker. The agent or contributor is responsible for eliminating preventable review friction before handoff.
Escalate earlier only if:
- there is a product tradeoff
- there is an architectural conflict
- CI is blocked by infrastructure outside the PR
- a risky unresolved issue needs a decision
- Risk tier declared
- Behavior first summary included
- Affected user flows documented
- Evidence attached
- Tests added or updated appropriately
- Exact validation commands included
- Architectural risks identified
- Edge cases reviewed
- Observability addressed
- Preview or staging validation completed if applicable
- Rollback or mitigation included if required
- CI green
Write clearly and directly. Do not use the hyphen character in normal prose unless it is required for technical correctness. Keep wording simple so the final reviewer can scan the PR quickly with minimal effort.
Avoid the hyphen character in normal prose.
Prefer plain wording without hyphenated compounds. Examples:
- Use "behavior first" instead of "behavior-first"
- Use "user facing" instead of "user-facing"
- Use "end to end" instead of "end-to-end"
- Use "high risk" instead of "high-risk"
Exception: Use the character when required for correctness in code, file names, URLs, environment variables, commands, identifiers, markdown checkboxes, or external system names.
- Do not optimize for passing the checklist. Optimize for protecting real behavior.
- Do not hide uncertainty. Surface it.
- Do not replace production confidence with mock heavy theater.
- Do not merge red builds.
- Do not confuse coverage with safety.
- When a rule here seems wrong for the specific change, raise the exception explicitly in the PR with reasoning.
The standard is not perfection. The standard is clear behavior, real validation, production visibility, disciplined delivery, and minimal wasted developer time.