Skip to content
Sniptide

CODEOWNERS file example

A CODEOWNERS file maps paths to the people or teams who must review changes to them, and GitHub requests their review on every pull request that touches those paths. Save the example below as .github/CODEOWNERS, replace the teams and paths with yours, and turn on code owner reviews in your branch rules.

Updated

Files

.github/CODEOWNERSRaw
# Each line is a file pattern followed by one or more owners.
# The last matching pattern takes precedence, so general rules go first.

# Default owners for everything in the repository.
*                       @acme/maintainers

# Application code
/apps/web/              @acme/frontend
/apps/api/              @acme/backend
/packages/ui/           @acme/design-system

# Database migrations need a backend review on top of the default.
/apps/api/migrations/   @acme/backend @acme/database

# Infrastructure and CI
/infra/                 @acme/platform
/.github/workflows/     @acme/platform
Dockerfile              @acme/platform

# Documentation
/docs/                  @acme/docs
*.md                    @acme/docs

# Ownership rules change only with a maintainer's review.
/.github/CODEOWNERS     @acme/maintainers

Save with your agent

Run this command to add Sniptide to Claude Code in the current project. Open /mcp in Claude Code and sign in to Sniptide. Once the server shows as connected, use the prompt below to save a private copy in your library.

Terminal
claude mcp add --scope local --transport http sniptide https://app.sniptide.com/api/mcp
Prompt
Read https://sniptide.com/templates/codeowners.json and use create_snippet to save its files as a private Sniptide snippet titled "CODEOWNERS file example". Keep the file names and contents from the JSON.

How GitHub reads it

GitHub uses the first CODEOWNERS file it finds in .github/, the repository root or docs/, on the pull request's base branch. Each line is a pattern and its owners. When several patterns match a file, the last match wins. That is why the catch-all * comes first and specific folders follow. About code owners

Owners are @username, @org/team-name or an email address linked to a GitHub account. Each owner needs write access to the repository, and a team needs to be visible with write access. Open the file on GitHub after you commit it: GitHub marks lines with unknown owners or invalid patterns.

Pattern syntax

Pattern
Matches
*
Every file.
/apps/web/
The apps/web folder at the root and everything inside it.
docs/
Any folder named docs, at any depth.
*.md
Markdown files anywhere.
Dockerfile
Files named Dockerfile anywhere.
/apps/api/migrations/
The migrations folder. With two owners on the line, either one can approve.

CODEOWNERS uses most .gitignore rules, but ! negation and [ ] character ranges don't work.

Require their review

The file alone only requests reviews. To make them required, open Settings → Rules → Rulesets, add a branch ruleset for your default branch, enable Require a pull request before merging and check Require review from Code Owners. A change to the migrations folder then needs approval from one of its owners before it can merge.

Variant: a small team

For a few people without GitHub teams, name users directly and keep the file short:

.github/CODEOWNERS
*            @alice @bob
/infra/      @carol

Two default owners mean either can approve, so one person's holiday doesn't block every merge.

All templates
  • Project setupPull request template for GitHub

    A GitHub pull request template with what changed, how to test, screenshots and a checklist, plus multiple templates and a variant for agent-written PRs.

  • Dependabot
    Project setupdependabot.yml example

    A dependabot.yml example that groups npm minor and patch updates, keeps GitHub Actions and Docker base images current, and sets labels and commit prefixes.

  • SECURITY.md
    Project setupSECURITY.md template

    A SECURITY.md template with supported versions, private vulnerability reporting, response times, scope and safe harbor for a GitHub repository.

Pick where your library lives.

Use sniptide.com

Save your first pattern in the app, then connect Claude Code, Cursor or Codex with one sign-in in the browser.

Run it on your own server

One image and a database give you the app, the API and the MCP endpoint. Sniptide is open source under AGPL-3.0.

$docker compose up -d