|
| 1 | +# Cursor Rules Overview |
| 2 | + |
| 3 | +This directory defines **enforceable coding and workflow rules** for agents and humans working in this repository. |
| 4 | +The rules are modular, following [Cursor Context Rules](https://docs.cursor.com/en/context/rules) best practices. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 📜 Rule Files |
| 9 | + |
| 10 | +### 1. `tdd_enforcement.mdc` |
| 11 | +**Purpose:** Enforces **Strict TDD (Red → Green → Refactor)** for all code changes. |
| 12 | + |
| 13 | +Key points: |
| 14 | +- **RED:** Write failing tests first. |
| 15 | +- **GREEN:** Implement minimum code to pass tests. |
| 16 | +- **REFACTOR:** Clean up while all tests pass. |
| 17 | +- No marking GREEN complete with failing relevant tests. |
| 18 | +- Must resolve root causes, no shortcuts. |
| 19 | +- TDD is **iterative** — multiple cycles may occur in the same branch. |
| 20 | +- Logs phase, cycle number, and violations in the **State Log**. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +### 2. `branch_commit_pr.mdc` |
| 25 | +**Purpose:** Enforces branching, commit, and PR hygiene. |
| 26 | + |
| 27 | +Key points: |
| 28 | +- Create a new branch **before starting on a new issue**. |
| 29 | +- One branch and one PR per issue. |
| 30 | +- PR must list TDD cycles performed and link to the **State Log**. |
| 31 | +- Commit frequently, use **Conventional Commits** format. |
| 32 | +- Keep commits single-line and changes simple. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +### 3. `state_tracking.mdc` |
| 37 | +**Purpose:** Defines a **unified logging format** for all workflow tracking. |
| 38 | + |
| 39 | +Key points: |
| 40 | +- **State Log** includes: |
| 41 | + - Cycle number |
| 42 | + - Current phase (RED, GREEN, or REFACTOR) |
| 43 | + - Timestamps |
| 44 | + - Commit history |
| 45 | + - Relevant test results |
| 46 | + - Violations + corrective actions |
| 47 | +- Update log at **end of every phase** and on **violations**. |
| 48 | +- Log must be accessible to reviewers (e.g., linked in PR). |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 🛠 How They Work Together |
| 53 | +1. **`tdd_enforcement.mdc`** ensures the *process* is followed. |
| 54 | +2. **`branch_commit_pr.mdc`** enforces *version control hygiene*. |
| 55 | +3. **`state_tracking.mdc`** standardizes *logging and visibility*. |
| 56 | + |
| 57 | +Together, they guarantee: |
| 58 | +- Every change is **test-driven**. |
| 59 | +- Every workflow step is **documented**. |
| 60 | +- Every PR is **traceable and reviewable**. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## ✅ Compliance Checklist |
| 65 | +- [ ] New branch created before starting work. |
| 66 | +- [ ] Failing test written before implementation. |
| 67 | +- [ ] GREEN phase only marked complete with all relevant tests passing. |
| 68 | +- [ ] REFACTOR phase keeps all tests passing. |
| 69 | +- [ ] Commits are small, frequent, and follow Conventional Commits. |
| 70 | +- [ ] State Log updated at every phase and linked in PR. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +*These rules are enforced automatically by Cursor agents but are also expected to be followed by human contributors.* |
0 commit comments