R packages
Git
Best practices
Foundations series · part 13

Repo hygiene files

The small files that answer questions before anyone has to ask

Use standard repository hygiene files like README, LICENSE, and CONTRIBUTING to answer questions before they are asked.
Published

2026-09-26

Modified

2026-09-27

What each file is for

GitHub recognises several files by name and surfaces them in the UI: on the repo home page, the New issue page, the Security tab, and next to the PR form. Each one answers a question that would otherwise become a message to you.

File Answers GitHub surfaces it R helper
README What is this, how do I install and use it? Repo home usethis::use_readme_rmd() / use_readme_md()
LICENSE May I use this? License badge / sidebar use_mit_license(), use_proprietary_license(copyright_holder)
CONTRIBUTING.md How do I set up, branch, commit and get a PR merged? Link on new issue/PR use_tidy_contributing()
SECURITY.md How do I report a vulnerability privately? Security tab — (write it)
CODE_OF_CONDUCT.md How do we treat each other? Community profile use_code_of_conduct(contact)
SUPPORT.md Where do I ask questions? Link on new issue use_tidy_support()
.editorconfig Indentation, line endings, final newline Editors that support EditorConfig —
.gitignore / .Rbuildignore What never goes into git / the tarball — use_git_ignore(), use_build_ignore()

GitHub looks for the community files in the repo root, .github/ or docs/. In R packages, prefer .github/, which stays out of the build with use_build_ignore(".github").

What we wrote for the website

  • CONTRIBUTING.md: setup (npm install also installs hooks); the branch → Conventional Commit → PR → squash workflow; a table of every check, what it does and where it runs; how releases happen; and the ground rules (no client names or data, no secrets, ADRs for decisions).
  • SECURITY.md: “don’t open a public issue”, how to reach the maintainers, a response target, and a link to the secrets standard.
  • LICENSE: proprietary, all rights reserved (the repo is private company code).
  • .editorconfig: UTF-8, LF line endings, 2-space indent, final newline, and trailing whitespace trimmed (except in Markdown, where two trailing spaces can mean a line break).
  • .env.example: every environment variable name, with no values (secrets management).

The R version

usethis::use_readme_rmd()                          # README.Rmd -> README.md (knit to update)
usethis::use_proprietary_license("Acme Analytics") # or use_mit_license() for open source
usethis::use_tidy_github()                         # CONTRIBUTING, issue template, SUPPORT, CoC in .github/
usethis::use_build_ignore(c(".github", ".editorconfig"))

A CONTRIBUTING.md for an internal R package should at least say:

  • how to get a working environment (renv::restore(), the R version, precommit::use_precommit());
  • the branch/PR workflow and the PR-title convention;
  • what CI checks and how to reproduce it locally (devtools::check(), lintr::lint_package());
  • when to add a NEWS.md bullet (releases & changelogs);
  • the data rule: synthetic or public data only in code, tests and issues.

Pitfalls

  • README.Rmd drift. Edit the .Rmd, knit, and commit both. The readme-rmd-rendered pre-commit hook (pre-commit hooks, formatting & linting) catches it if you forget.
  • Copy-pasted CONTRIBUTING from an open-source template that tells internal colleagues to fork. Tailor it.
  • A SECURITY.md with no working contact is worse than none. Keep it current.
  • Licence ambiguity on internal code. Say “proprietary” explicitly. No LICENSE file isn’t the same as a clear statement.

Sources

GitHub

Other

R package documentation

  • usethis (use_readme_rmd(), use_mit_license(), use_proprietary_license(), use_tidy_github(), use_code_of_conduct(), use_tidy_support(), use_git_ignore(), use_build_ignore()): usethis.r-lib.org
NoteUpdates
  • 2026-09-26: Removed the end-of-post checklist. Marked package-dependent usethis block as .norun.
  • 2026-09-27: Added a Sources section.