diff options
| author | Adam Malczewski <[email protected]> | 2026-06-27 22:03:59 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-27 22:03:59 +0900 |
| commit | 831747ddb5886364707b696ac38cce8da333f15d (patch) | |
| tree | 1b3c983c2b9964d55adec16e2e3a78190fbedbbe /.dispatch/rules/contracts-are-h.md | |
| parent | b0534c0b53fc116521245c14b05d0120a1cded89 (diff) | |
| download | study-player-V1.tar.gz study-player-V1.zip | |
V1: preserve pre-refactor state (single-file main.c + harness docs)V1
Diffstat (limited to '.dispatch/rules/contracts-are-h.md')
| -rw-r--r-- | .dispatch/rules/contracts-are-h.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.dispatch/rules/contracts-are-h.md b/.dispatch/rules/contracts-are-h.md new file mode 100644 index 0000000..29f9ce3 --- /dev/null +++ b/.dispatch/rules/contracts-are-h.md @@ -0,0 +1,17 @@ +# Contracts are header files + +- The `.h` file IS the contract between modules. Other agents read ONLY your + `.h` — never your `.c`. +- Every `.h` must be **self-contained**: it includes all types it references. + A consumer should be able to `#include "your_module.h"` and nothing else. +- Prefer **forward declarations** over full includes when only a pointer is + needed. Example: `typedef struct PlayerState PlayerState;` avoids including + `types.h`. +- A `.h` file must NOT include any `.c` file. Ever. +- If you expose a function, its full signature (return type, name, parameter + types and names) must be in the `.h`. The documentation of what it DOES + (preconditions, postconditions, side effects) goes in a comment in the `.h` + — that is the contract's behavioral specification, not just its type + signature. +- If an agent NEEDS to read your `.c` to understand what your module does, + your `.h` contract is UNDESPECIFIED. Report this as a contract gap. |
