|
| 1 | +--- |
| 2 | +trigger: always_on |
| 3 | +--- |
| 4 | + |
| 5 | +# Project Rules & Engineering Standards |
| 6 | + |
| 7 | +This document establishes the non-negotiable engineering standards for this project. These rules are designed to maintain codebase health, ensure velocity, and prevent technical debt accumulation. |
| 8 | + |
| 9 | +**All contributors (human and AI) must adhere to these guidelines.** |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## 1. The Golden Rule: Green Build Policy |
| 14 | +> *The main branch must always be in a deployable state.* |
| 15 | +
|
| 16 | +* **Passing Tests**: No code may be merged unless **100%** of the project's automated tests (Unit, Integration, E2E) pass. |
| 17 | +* **No Broken Windows**: If a build fails, fixing it is the highest priority. No new features can be merged until the build is green. |
| 18 | +* **Local Verification**: Before pushing/submitting a PR, you must run the test suite locally. "It works on my machine" is not a valid excuse for CI failures. |
| 19 | + |
| 20 | +## 2. Testing Protocols |
| 21 | +> *If it's not tested, it's broken.* |
| 22 | +
|
| 23 | +* **Regression Tests**: Every bug fix **MUST** be accompanied by a new test case that reproduces the bug and verifies the fix. |
| 24 | +* **New Features**: All new functionality requires corresponding unit tests. |
| 25 | +* **Test Quality**: |
| 26 | + * Tests must be deterministic (no flaky tests). |
| 27 | + * Tests must be readable and test behavior, not implementation details. |
| 28 | + |
| 29 | +## 3. Documentation Hygiene |
| 30 | +> *Code is the truth, but documentation is the map.* |
| 31 | +
|
| 32 | +* **Atomic Updates**: Documentation updates (README, API docs, inline comments) **MUST** be included in the same Pull Request/Commit as the code change. |
| 33 | + * *Example*: If you add a new flag or environment variable, update the configuration guide immediately. |
| 34 | +* **Why, Not What**: Comments should explain *why* a decision was made or *why* the logic is complex. Do not write comments that simply repeat what the code does. |
| 35 | +* **Obsolescence**: Stale documentation is worse than no documentation. Delete docs that no longer reflect the codebase. |
| 36 | + |
| 37 | +## 4. Code Review & Workflow |
| 38 | +* **Small, Atomic Commits**: |
| 39 | + * A Change List (CL) or Pull Request (PR) should focus on **one** thing. |
| 40 | + * Avoid mixing formatting changes, refactoring, and feature work in the same commit. |
| 41 | +* **Conventional Commits**: |
| 42 | + * Use semantic commit messages: `feat: ...`, `fix: ...`, `docs: ...`, `refactor: ...`. |
| 43 | +* **Linting & Formatting**: |
| 44 | + * Code must be formatted automatically (e.g., Prettier, gofmt, Black). |
| 45 | + * Zero linting warnings allowed in the final merge. |
| 46 | + |
| 47 | +## 5. Dependency Management |
| 48 | +* **Explicit Versions**: All dependencies must be pinned to specific versions (via `package-lock.json`, `go.sum`, `requirements.txt`, etc.). |
| 49 | +* **Minimalism**: Do not introduce a heavy library for a trivial utility function that can be written in 5 lines of code. |
| 50 | + |
| 51 | +## 6. AI & Copilot Usage |
| 52 | +* **Verification**: Code generated by AI (Cursor, Copilot, ChatGPT) must be reviewed line-by-line. |
| 53 | +* **No Hallucinations**: Verify that imported libraries actually exist and APIs are correct. |
| 54 | +* **Context**: AI-generated code must match the existing style and patterns of the project. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +*Modification of these rules requires a consensus from the core engineering team.* |
0 commit comments