Plain-language patterns for common diff hunk types.
What: New import line at top of file.
Why: Pulls in code defined elsewhere so we can call it here.
How: file.ts:1 — import { X } from 'y'.
Term: import — borrows code from another file/module.
What: New function that runs when something happens.
Why: Keeps event reaction in one named place instead of inline spaghetti.
How: app.js:15 — function handleSave() { ... }.
Term: handler — function that runs in response to an event.
What: Code finds an element and changes it.
Why: HTML is static; JS updates the page without reload.
How: app.js:8 — document.getElementById('list').
Terms: DOM — tree of page elements; query — find an element.
What: Browser asks a server for data.
Why: Server holds data users share or that outlives one browser.
How: api.js:22 — fetch('/api/todos').
Terms: request, endpoint, JSON.
What: Config reads process.env.API_URL or similar.
Why: Secrets and URLs differ per machine; don't hardcode in git.
How: .env.example:1 — documents key name without secret value.
Term: environment variable — config from outside the code file.
What: New entry under dependencies.
Why: Reuse battle-tested library instead of reinventing.
How: package.json:12 — package name and semver range.
Term: dependency — external code your project installs.
What: Flex/grid/display rules changed.
Why: Controls where elements sit on screen.
How: styles.css:40 — display: flex.
Term: flexbox — one-dimensional layout for rows/columns.
What: New test file or it('...') block.
Why: Locks expected behavior so future edits don't break silently.
How: app.test.js:5 — assertion on save behavior.
Term: assertion — check that output matches expectation.
What: YAML or platform config for build/deploy.
Why: Automates "push code → live site" without manual steps.
How: .github/workflows/deploy.yml:1.
Term: CI — automated checks/build on each push.
If diff is only .gitignore, README, or license — say it's project hygiene, not user-facing behavior. Still one sentence of why.
| If hunks share | Group as |
|---|---|
| Same feature flag or route | One feature group |
| Same bug symptom in commit message | One fix group |
| rename + import updates | Refactor (mechanical) |
| test + implementation | Feature (note test proves behavior) |
Deep mode add per group:
- Before/after behavior — what user could do before vs after
- Failure mode — what breaks if this hunk is reverted
- Alternative — what you didn't do and why