Team conventions
Intermediate
Why this matters
Every team has rules, most of them written down somewhere in the repository, and almost nobody tells a new person where. Reading four files on your first day makes the difference between a first merge request that sails through and one that comes back with six comments about formatting.
The files, and what each governs
| File | Governs | Where |
|---|---|---|
README.md |
What the project is and how to run it | Repository root |
CONTRIBUTING.md |
Branch naming, commit style, how to propose a change, the review process | Root or .github/ / .gitlab/ |
CODEOWNERS |
Who must review which paths | .github/, .gitlab/, or root |
| Merge request template | What every description must contain | .gitlab/merge_request_templates/ |
| Pull request template | The same on GitHub | .github/pull_request_template.md |
| Issue templates | What a bug report or feature request must include | .github/ISSUE_TEMPLATE/, .gitlab/issue_templates/ |
.editorconfig |
Indentation, line endings, trailing whitespace | Root |
| Linter configs | Formatting rules the pipeline enforces | Root, various names |
CODE_OF_CONDUCT.md |
Behaviour, and who to contact | Root |
Read the first four before your first change. It takes ten minutes and it is the single highest-value thing a new contributor can do.
CONTRIBUTING.md
The one file worth reading in full. A good one answers:
- Which branch to start from, and how branches are named.
- How commit messages should look.
- What a merge request must contain, and how many approvals it needs.
- How to run the tests and the linters locally.
- Who to ask when stuck.
If it does not exist, the conventions still do; they are just unwritten, and you will find them in review. Writing the file afterwards, from what you learned, is a genuinely welcome first contribution.
Commit message conventions
Many teams use conventional commits, which is a prefix on the subject line:
docs: add Windows steps to installation guide (#12)
fix: handle trails with no distance (#15)
feat: add a difficulty filter (#21)
chore: update the CI image to python 3.12
refactor: split the parser into two functions
test: cover the empty-distance case| Prefix | Means |
|---|---|
feat |
New behaviour |
fix |
A bug fix |
docs |
Documentation only |
chore |
Maintenance, dependencies, configuration |
refactor |
Restructuring without behaviour change |
test |
Tests only |
The prefixes are not decoration: tooling reads them to generate changelogs and to decide version bumps, and feat!: or a BREAKING CHANGE: footer signals a major version. Even without tooling, they make git log --oneline scannable.
The rest of the message follows the ordinary rules (lesson 5.4): imperative mood, under about fifty characters for the subject, a blank line, then the why.
CODEOWNERS
A file mapping paths to people or teams, which the platform uses to request reviews automatically:
* @northwind-trails/engineering
/docs/ @northwind-trails/docs
*.md @northwind-trails/docs
/CHANGELOG.md @northwind-trails/docs @devThe last matching rule wins, which is the opposite of what most people expect. If you are the person who should see documentation changes, ask to be added: it turns "remember to ask Ana" into an automatic review request (lesson 9.5).
Definition of done
Many teams have one, and it is worth asking for explicitly, because "done" is where most disagreements about scope actually live. A typical one:
- The change works and is covered by a test, where a test makes sense.
- The documentation is updated in the same merge request.
- The changelog has an entry.
- The pipeline is green.
- It has been reviewed and approved.
- The issue is linked and closes on merge.
Notice how much of that list is documentation and process rather than code. On many teams the person who notices items 2, 3 and 6 are missing is exactly the sort of contributor this course is for.
The unwritten rules
Some conventions are never written down. Three ways to find them without asking twice:
- Read the last ten merged merge requests. Their titles, descriptions and review comments show the real standard, including how much detail is expected.
- Read
git log --oneline -30. The commit message style is visible immediately, and it is more reliable than the documented one. - Ask once, in the issue or the merge request, so the answer is recorded where the next person will find it.
How to do it
The first commands in a repository you have just cloned:
$ ls -a
$ cat CONTRIBUTING.md
$ git log --oneline -20
$ git branch -rFour commands, two minutes, and you know the branch naming, the commit style, the long-lived branches and the review expectations.
.editorconfig is honoured automatically, so indentation and line endings match the project without you configuring anything. Install the linters the project uses so you see the same warnings the pipeline will produce.
IntelliJ reads .editorconfig too, and Settings → Editor → Code Style can be set from it. The Commit window can enforce a commit message template.
Templates live in .gitlab/merge_request_templates/ and .gitlab/issue_templates/; approval rules and CODEOWNERS enforcement are in Settings → Merge requests and Settings → Repository → Protected branches. Push rules can enforce commit message patterns.
.github/pull_request_template.md and .github/ISSUE_TEMPLATE/; rulesets carry required reviews and can require the CODEOWNERS review (lesson 10.5).
Common mistakes
- Not reading
CONTRIBUTING.md. It is written for exactly this moment. - Following the documented convention when the repository does something else. The repository is the truth; the document may be stale, and fixing it is a good first contribution.
- Deleting a template's headings instead of filling them in.
- Inventing your own commit prefix. Use the project's list.
- Asking in chat, where the answer helps one person once.
- Assuming "done" means the code works. Ask for the definition of done.
Try it yourself
Goal: read a project's conventions off the repository in five minutes.
- Pick a repository you contribute to, or a public one you use.
- List the convention files it has:
CONTRIBUTING.md,CODEOWNERS, templates,.editorconfig, linter configs. - Run
git log --oneline -20and write down the commit message convention you observe. - Compare what you observed with what
CONTRIBUTING.mdsays, if it exists. - Open the last three merged merge requests and note what their descriptions contain.
Expected result: a short written summary of how to contribute to that project, produced without asking anyone.
Show solution
Step 4 is the interesting one. Where the document and the practice disagree, practice wins, and the gap is a small, welcome contribution: updating the document to describe what the team actually does now.