apoorvrajdev commited on
Commit
7c00779
Β·
1 Parent(s): befac80

docs(contributing): add commit granularity policy to CLAUDE.md

Browse files
Files changed (1) hide show
  1. CLAUDE.md +51 -0
CLAUDE.md CHANGED
@@ -29,6 +29,57 @@ Use Conventional Commits. Examples:
29
 
30
  Keep subject under 72 characters. Body optional but explains *why*, not *what*.
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ## Project Stack
33
 
34
  - **Core ML:** Python 3.10+, TensorFlow / Keras, NumPy, Pillow
 
29
 
30
  Keep subject under 72 characters. Body optional but explains *why*, not *what*.
31
 
32
+ ## Commit Granularity
33
+
34
+ **Prefer many small, focused commits over a few large ones.** Atomic commits are
35
+ a widely defensible engineering practice β€” easier review, cleaner revert paths,
36
+ more legible history β€” and a portfolio project benefits from the richer
37
+ contribution graph as a byproduct. Split a batch of work so each logical change
38
+ lands as its own Conventional Commit.
39
+
40
+ ### Rules
41
+
42
+ - **One reason per commit.** If you'd describe the work as "X *and* Y" with
43
+ separable verbs (e.g. "fix tokenizer *and* add tests *and* update CHANGELOG"),
44
+ that's three commits. If it's a single coherent action ("rename `foo` to `bar`
45
+ across the codebase"), it's one commit β€” even if it touches twenty files.
46
+ Granularity is logical, not per-file.
47
+
48
+ - **Indivisible commits stay indivisible.** Pre-registration blocks (which must
49
+ land before any result), notebook SHA-256 freeze updates, atomic reverts β€”
50
+ these exist as one commit on purpose and are NOT subject to the splitting
51
+ rule. Do not break them apart to inflate the count.
52
+
53
+ - **Conventional Commits format applies to every split commit**, not just the
54
+ combined one. `feat(eval): add rescore script` and `test(eval): cover error
55
+ paths` are two valid commits; rolling them together loses scope clarity.
56
+
57
+ - **Always present the sequence, never execute it.** Per the existing rule that
58
+ Claude does not stage, commit, or push: output the full intended commit
59
+ sequence (each `git add <file>` + `git commit` pair) so the user can run
60
+ them. Order matters β€” within a multi-commit sequence, prefer:
61
+ schemas/types β†’ implementation β†’ tests β†’ docs β†’ CHANGELOG.
62
+
63
+ - **No padding.** Do not split a single indivisible change across artificial
64
+ commits purely to inflate the count. Cohesive granularity, not noise.
65
+
66
+ ### Example
67
+
68
+ For a change that adds a new evaluation script, its tests, and a Makefile target:
69
+
70
+ ```
71
+ # Bad β€” one combined commit:
72
+ feat(eval): add rescore script, tests, and Makefile target
73
+
74
+ # Good β€” three commits, in order:
75
+ feat(eval): add scripts/rescore_nltk_bleu.py
76
+ test(eval): cover rescore script error paths
77
+ build(make): add rescore-5ref target
78
+ ```
79
+
80
+ The "good" sequence is reviewable, revertable, and reads honestly as three
81
+ logical contributions.
82
+
83
  ## Project Stack
84
 
85
  - **Core ML:** Python 3.10+, TensorFlow / Keras, NumPy, Pillow