|
| 1 | +# CLAUDE.md — Git Tutorial (Code with Branko) |
| 2 | + |
| 3 | +Instructions for Claude Code working in this repository. |
| 4 | + |
| 5 | +Quality conventions (git, docs, quality, scope) are defined in |
| 6 | +`docs/solid-ai-templates/` — a git submodule from |
| 7 | +[Imbra-Ltd/solid-ai-templates](https://github.com/Imbra-Ltd/solid-ai-templates). |
| 8 | +Key references: |
| 9 | +- `docs/solid-ai-templates/base/git.md` — git workflow, branching, PRs |
| 10 | +- `docs/solid-ai-templates/base/docs.md` — documentation rules, ADRs, writing style |
| 11 | +- `docs/solid-ai-templates/base/quality.md` — SOLID, readability, code style |
| 12 | +- `docs/solid-ai-templates/base/scope.md` — scope guard, session protocol |
| 13 | +- `docs/solid-ai-templates/frontend/static-site.md` — static site architecture |
| 14 | +- `docs/solid-ai-templates/stack/static-site-astro.md` — Astro-specific rules |
| 15 | + |
| 16 | +Project-specific overrides and additions follow below. |
| 17 | + |
| 18 | + |
| 19 | +## Project identity |
| 20 | + |
| 21 | +- **Name**: tutorial-git (Git Tutorial — Code with Branko) |
| 22 | +- **Owner**: Branimir Georgiev — braboj |
| 23 | +- **Repo**: github.com/braboj/tutorial-git |
| 24 | +- **Stack**: Astro static site, Markdown content, draw.io diagrams |
| 25 | +- **Hosting**: GitHub Pages via GitHub Actions |
| 26 | +- **Domain**: braboj.github.io/tutorial-git (codewithbranko.com pending) |
| 27 | + |
| 28 | + |
| 29 | +## Project structure |
| 30 | + |
| 31 | +``` |
| 32 | +chapters/ # SSG-agnostic tutorial content (canonical) |
| 33 | + 01-introduction.md |
| 34 | + 02-building-blocks.md |
| 35 | + 03-branching-and-merging.md |
| 36 | + 04-remote-repositories.md |
| 37 | + 05-subprojects.md |
| 38 | + 06-expert-topics.md |
| 39 | + 07-playbook.md |
| 40 | + 08-appendix.md |
| 41 | + 09-glossary.md |
| 42 | +assets/ |
| 43 | + images/ # PNG exports used in chapters |
| 44 | + drawio/ # draw.io source files (editable) |
| 45 | + archive/ # Superseded images (kept for ebook) |
| 46 | + banners/ |
| 47 | + doc/ |
| 48 | + uml/ |
| 49 | +astro-site/ # Astro build (imports from chapters/ and assets/) |
| 50 | +docs/ # Legacy MkDocs content (reference, not active) |
| 51 | + solid-ai-templates/ # Submodule — Imbra-Ltd/solid-ai-templates |
| 52 | +``` |
| 53 | + |
| 54 | + |
| 55 | +## Scope guard override |
| 56 | + |
| 57 | +Extends `base/scope.md` with tutorial-specific boundaries: |
| 58 | +- One chapter per session is the default scope for content work |
| 59 | +- Diagram, exercise, and quiz changes within that chapter are in scope |
| 60 | +- Restructuring other chapters, creating new projects, or adding |
| 61 | + infrastructure is out of scope unless explicitly requested |
| 62 | + |
| 63 | +## End-of-session checklist |
| 64 | + |
| 65 | +Before ending a session, verify all of the following: |
| 66 | + |
| 67 | +1. **Dev journal** — update `docs/dev-journal.md` with a session entry |
| 68 | + (date, tool, key changes, decisions, open issues) |
| 69 | +2. **ONBOARDING.md** — update `docs/ONBOARDING.md` if prerequisites, |
| 70 | + setup steps, or project structure changed |
| 71 | +3. **PLAYBOOK.md** — update `docs/PLAYBOOK.md` if operational |
| 72 | + workflows changed (diagram export, chapter review process, etc.) |
| 73 | +4. **solid-ai-templates** — check if upstream submodule needs updates |
| 74 | + based on new patterns or conventions discovered during the session |
| 75 | + (e.g. new scope rules, documentation rules, quality conventions) |
| 76 | +5. **Open issues** — close resolved GitHub issues, update or create |
| 77 | + issues for remaining work |
| 78 | + |
| 79 | + |
| 80 | +## Content conventions |
| 81 | + |
| 82 | +### Chapter structure |
| 83 | + |
| 84 | +Every chapter follows this structure: |
| 85 | + |
| 86 | +1. Frontmatter (`title`, `section`, `order`) |
| 87 | +2. `## Overview` — what the chapter covers and why |
| 88 | +3. Content sections with `##` and `###` headings |
| 89 | +4. `## Exercises` — hands-on tasks with verification steps |
| 90 | +5. `## Quiz` — multiple-choice questions with answers at the bottom |
| 91 | + |
| 92 | +### Writing style |
| 93 | + |
| 94 | +- **American English** spelling (analyze, not analyse) |
| 95 | +- **Git** capitalised in prose, `git` lowercase in commands and code blocks |
| 96 | +- Concise, direct sentences — no filler, no preamble |
| 97 | +- Explain technical terms inline for beginners (e.g. "a hash — a unique identifier") |
| 98 | +- No `---` separators between subsections — headings provide separation |
| 99 | +- No inline Practice sections — all practice goes in Exercises |
| 100 | +- No emojis unless explicitly requested |
| 101 | + |
| 102 | +### Quiz formatting |
| 103 | + |
| 104 | +- Each option on a bullet line: `- A) ...`, `- B) ...` |
| 105 | +- Vary the correct answer positions — never all the same letter |
| 106 | +- Answers section at the bottom: `1. C — explanation` |
| 107 | + |
| 108 | +### Cross-references |
| 109 | + |
| 110 | +- Reference other chapters by file: `[Building Blocks](02-building-blocks.md)` |
| 111 | +- Reference sections within a chapter by heading anchor: `[Tag Object](#tag-object-labels)` |
| 112 | + |
| 113 | +### Images |
| 114 | + |
| 115 | +- Source files: `assets/drawio/` (`.drawio` format) |
| 116 | +- Exported PNGs: `assets/images/` |
| 117 | +- Reference from chapters: `` |
| 118 | +- Superseded images move to `assets/archive/` — not deleted |
| 119 | +- ASCII diagrams in markdown serve as fallback and source of truth |
| 120 | + |
| 121 | + |
| 122 | +## Figure style rules |
| 123 | + |
| 124 | +Every figure follows these rules. Applies to draw.io XML, PlantUML, and SVG. |
| 125 | + |
| 126 | +### Core principles |
| 127 | + |
| 128 | +- Flat only: no gradients, shadows, glows, or 3D effects |
| 129 | +- Sentence case for prose labels — filenames and acronyms keep their casing |
| 130 | +- Two fonts: **Helvetica** for labels, **Courier New** for commands/hashes/filenames |
| 131 | +- 0.5 px borders — quiet chrome |
| 132 | +- One visual grammar per figure — if it needs two, split into two figures |
| 133 | +- Shapes (circle vs pill vs card) distinguish elements in grayscale |
| 134 | + |
| 135 | +### Palettes |
| 136 | + |
| 137 | +**A — Difficulty** (tier cards): |
| 138 | +- Beginner: fill `#EAF3DE`, border `#3B6D11`, text `#27500A` |
| 139 | +- Advanced: fill `#FAEEDA`, border `#854F0B`, text `#633806` |
| 140 | +- Expert: fill `#FCEBEB`, border `#A32D2D`, text `#791F1F` |
| 141 | + |
| 142 | +**B — Scoring** (comparison cells): same hex as A. Good / Neutral / Bad. |
| 143 | + |
| 144 | +**C — Categorical** (convention-based, matches common Git tool colours): |
| 145 | +- Gray `#F1F1F1` / `#888888` / `#2C2C2A` — **commit** (regular) / neutral |
| 146 | +- Blue `#DBEAFE` / `#2563EB` / `#1E40AF` — **main branch** / stable refs |
| 147 | +- Green `#DCFCE7` / `#16A34A` / `#15803D` — **feature branch** / active work |
| 148 | +- Purple `#EDE9FE` / `#7C3AED` / `#5B21B6` — **merge commit** |
| 149 | +- Yellow `#FEF9C3` / `#CA8A04` / `#854D0E` — **tag** |
| 150 | +- Coral `#FAECE7` / `#993C1D` / `#712B13` — **tree** (object model diagrams) |
| 151 | +- Gray `#F1EFE8` / `#5F5E5A` / `#2C2C2A` — **blob** / `.git` chrome (object model) |
| 152 | + |
| 153 | +Canonical assignment — never swap these across figures in the series. |
| 154 | +Convention rationale: blue = stable (GitHub, VS Code), green = active work |
| 155 | +(GitKraken), purple = merge (common in Git GUIs). Reduces cognitive load |
| 156 | +for readers who use Git tools. |
| 157 | + |
| 158 | +**D — Zone** (sequence-diagram backgrounds): |
| 159 | +- Local machine: `#FAF4E8` |
| 160 | +- Remote server: `#EAF1F5` |
| 161 | + |
| 162 | +**Neutral chrome** (all palettes): |
| 163 | +- Border `#D3D1C7`, primary text `#2C2C2A`, secondary text `#5F5E5A`, |
| 164 | + arrow stroke `#444441`, white card `#FFFFFF`. |
| 165 | + |
| 166 | +### Typography |
| 167 | + |
| 168 | +| Use | Font | Size | Weight | Style | |
| 169 | +|---|---|---|---|---| |
| 170 | +| Card titles, headers | Helvetica | 14 px | Bold | — | |
| 171 | +| Body labels, row names | Helvetica | 12 px | Regular | — | |
| 172 | +| Commands, hashes, filenames | Courier New | 11–12 px | Regular | — | |
| 173 | +| Captions, footnotes | Helvetica | 11–12 px | Regular | — | |
| 174 | +| Descriptive notes, placeholders | Helvetica | 11 px | Regular | Italic | |
| 175 | + |
| 176 | +### Arrow conventions |
| 177 | + |
| 178 | +- Solid 1 px `#444441`, 6 × 6 px chevron head. Labels in clear space, never |
| 179 | + on the line. |
| 180 | +- **Parent direction**: commit arrows point from child to parent |
| 181 | + (right-to-left in horizontal layouts). Matches Git's internal pointer |
| 182 | + direction and the ASCII diagrams in the tutorial (`A ← B ← C`). |
| 183 | +- **Reference arrows** (branch/tag to commit): **dashed** (pattern `4 3`). |
| 184 | +- **Unlabeled** if meaning is obvious from endpoints. |
| 185 | +- **Italic `#5F5E5A` label** for named relationships (`attached`, `parent`). |
| 186 | +- **Self-loop** (small arc above box corner) for recursive references. |
| 187 | + |
| 188 | +### Component vocabulary |
| 189 | + |
| 190 | +- **Card**: rounded rect, rx=5–8, 0.5 px border, 10–12 px inner padding. |
| 191 | +- **Pill**: rounded rect with rx = height/2. For branches, tags, short labels. |
| 192 | +- **Badge**: filled circle, 20–22 px diameter, bold numeral inside. |
| 193 | +- **Divider**: 0.5 px horizontal line at 30% opacity in parent's border color. |
| 194 | +- **Background card**: white (`#FFFFFF`) rounded rect with neutral border |
| 195 | + (`#D3D1C7`, 0.5 px, rx=5) placed behind all diagram content. Ensures |
| 196 | + readability on both light and dark page backgrounds. Export PNGs with |
| 197 | + transparent background — the card provides the contrast. |
| 198 | + |
| 199 | +### Commit-chain panel variant |
| 200 | + |
| 201 | +Gray commit circles (diameter 28), branch pills to the right of the |
| 202 | +commit they point to, italic "HEAD" label above the active branch pill. |
| 203 | +`*main` means HEAD is attached to main. Dashed arrow from pill to commit |
| 204 | +shows the reference relationship. Uses Palette C. |
| 205 | + |
| 206 | +### draw.io file conventions |
| 207 | + |
| 208 | +- Source files: `assets/drawio/<name>.drawio` |
| 209 | +- Naming: `git-<topic>-<variant>.drawio` (e.g. `git-branch-merge.drawio`) |
| 210 | +- Readable IDs: `card-commit-1`, `pill-main`, `arrow-3-2` |
| 211 | +- All cells `parent="1"` |
| 212 | +- XML-escape values: `&` → `&`, `<` → `<`, `>` → `>` |
| 213 | + |
| 214 | +### draw.io style string templates |
| 215 | + |
| 216 | +``` |
| 217 | +# Commit circle (gray): |
| 218 | +ellipse;whiteSpace=wrap;html=1;fillColor=#F1F1F1;strokeColor=#888888;strokeWidth=0.5;shadow=0;fontSize=14;fontStyle=1;fontColor=#2C2C2A;fontFamily=Helvetica;aspect=fixed; |
| 219 | +
|
| 220 | +# Merge commit circle (purple): |
| 221 | +ellipse;whiteSpace=wrap;html=1;fillColor=#EDE9FE;strokeColor=#7C3AED;strokeWidth=0.5;shadow=0;fontSize=14;fontStyle=1;fontColor=#5B21B6;fontFamily=Helvetica;aspect=fixed; |
| 222 | +
|
| 223 | +# Main branch pill (blue): |
| 224 | +rounded=1;whiteSpace=wrap;html=1;fillColor=#DBEAFE;strokeColor=#2563EB;strokeWidth=0.5;arcSize=20;shadow=0;fontSize=14;fontStyle=1;fontColor=#1E40AF;fontFamily=Helvetica;verticalAlign=middle;align=center; |
| 225 | +
|
| 226 | +# Feature branch pill (green): |
| 227 | +rounded=1;whiteSpace=wrap;html=1;fillColor=#DCFCE7;strokeColor=#16A34A;strokeWidth=0.5;arcSize=20;shadow=0;fontSize=14;fontStyle=1;fontColor=#15803D;fontFamily=Helvetica;verticalAlign=middle;align=center; |
| 228 | +
|
| 229 | +# HEAD label: |
| 230 | +text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;fontSize=11;fontStyle=2;fontColor=<branch-border>;fontFamily=Helvetica; |
| 231 | +
|
| 232 | +# Solid arrow (parent pointer): |
| 233 | +endArrow=classic;html=1;strokeColor=#444441;strokeWidth=1;endFill=1;endSize=6; |
| 234 | +
|
| 235 | +# Dashed arrow (reference): |
| 236 | +endArrow=classic;html=1;strokeColor=#444441;strokeWidth=1;endFill=1;endSize=6;dashed=1;dashPattern=4 3; |
| 237 | +
|
| 238 | +# Background card: |
| 239 | +rounded=1;whiteSpace=wrap;html=1;fillColor=#FFFFFF;strokeColor=#D3D1C7;strokeWidth=0.5;shadow=0;arcSize=5; |
| 240 | +``` |
| 241 | + |
| 242 | +### XML boilerplate |
| 243 | + |
| 244 | +```xml |
| 245 | +<mxfile host="app.diagrams.net"> |
| 246 | + <diagram id="..." name="..."> |
| 247 | + <mxGraphModel dx="1200" dy="700" grid="1" gridSize="10" page="1" |
| 248 | + pageWidth="..." pageHeight="..." math="0" shadow="0"> |
| 249 | + <root> |
| 250 | + <mxCell id="0" /> |
| 251 | + <mxCell id="1" parent="0" /> |
| 252 | + <!-- cells go here --> |
| 253 | + </root> |
| 254 | + </mxGraphModel> |
| 255 | + </diagram> |
| 256 | +</mxfile> |
| 257 | +``` |
| 258 | + |
| 259 | + |
| 260 | +## Commands |
| 261 | + |
| 262 | +```bash |
| 263 | +# Astro site (from astro-site/) |
| 264 | +npm run dev # develop — hot reload at localhost:4321 |
| 265 | +npm run build # production build to dist/ |
| 266 | +npm run preview # preview production build locally |
| 267 | +``` |
0 commit comments