
codeowners
Author, validate, and enforce a CODEOWNERS file: detect an existing file, gather ownership evidence from directory structure and git history, write or update rules with correct CODEOWNERS syntax, validate the file against the GitHub API, and wire the ruleset rule that requires code owner review on pull requests. Use when the user says "add CODEOWNERS", "who owns this path", "require owner review", "validate CODEOWNERS", or invokes /codeowners. Idempotent — safe to re-run; diffs before overwriting and never auto-assigns an owner without confirmation. Do NOT use for branch rulesets in general (use /gh-bootstrap) or community health files such as README, LICENSE, CODEOFCONDUCT, and SECURITY (use /oss-hygiene) — this skill only covers the CODEOWNERS file and the review rule it feeds.
- Installs
- 53
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/paulnsorensen/git-gouda --skill codeowners- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads codeowners automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
codeowners
Author and maintain a CODEOWNERS file, then wire the ruleset rule that
turns it into an enforced review requirement.
This skill covers one file and the rule it feeds. It does not configure
branch rulesets in general (/gh-bootstrap) or community health files
(/oss-hygiene).
When to use
- The user asks to add or update a
CODEOWNERSfile. - The user asks who owns a path, or wants ownership suggestions from git history.
- The user asks to require owner review on pull requests.
- The user asks to validate an existing
CODEOWNERSfile.
Protocol
1. Detect the existing file and the default branch
GitHub reads CODEOWNERS from one of three locations, checked in this
order: .github/, the repository root, then docs/. Only the first file
found takes effect.
for path in .github/CODEOWNERS CODEOWNERS docs/CODEOWNERS; do
test -f "$path" && echo "Found: $path"
done
REPO="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')"
DEFAULT_BRANCH="$(gh repo view "$REPO" --json defaultBranchRef --jq '.defaultBranchRef.name')"
If more than one location has a file, tell the user only the first match
(.github/, then root, then docs/) is active and ask which one to keep.
If none exists, ask which location to create — .github/CODEOWNERS is the
conventional choice because it keeps repository policy files together.
2. Gather ownership evidence
Offer two approaches. Present results as suggestions and confirm them with the user before writing any rule — never auto-assign an owner.
Static, by directory structure. List top-level and second-level directories as candidate ownership boundaries:
git ls-files | awk -F/ 'NF>1 {print $1"/"$2"/"} NF==1 {print $1}' | sort -u
History-derived, by committer. For a given path, rank contributors by commit count and list unique authors:
git shortlog -sn -- <path>
git log --format=%an -- <path> | sort -u
A top committer is a candidate, not a decision. Match each candidate name or email to a GitHub handle or team before it goes in the file — a CODEOWNERS entry that does not resolve to a valid GitHub user, or a team with write access, is silently ignored by GitHub, not an error.
3. Author the rules
Write rules in the order the user confirmed, respecting CODEOWNERS syntax:
- Last matching pattern wins. Order general rules first, specific overrides last. A file matches its last matching line, not its first.
@org/teamneeds write access. A team reference only takes effect if the team has been explicitly granted write access to the repository, not merely membership in the org. Before you write the line, confirm that the team exists and then confirm its write access (see Guardrails).- A trailing
*fallback rule (* @org/default-owners) catches paths no other rule matches. Put it first so more specific rules below it can override it. - Path patterns follow
.gitignoresyntax:/dir/anchors to the repo root,dir/without a leading slash matches anywhere, and*.extmatches by extension. Directories match recursively unless narrowed. - Comments start with
#and section headers such as# Frontendgroup related rules for readability; GitHub also renders sections as named groups in file review UI when written as#SECTION_NAMEblocks.
See references/syntax.md for the full syntax and precedence reference,
and assets/CODEOWNERS.example for a starting template.
Before writing, diff any existing file against the proposed content and show the user the diff. Do not overwrite silently.
4. Validate
After the file is pushed to the default branch, GitHub can check it for syntax and ownership errors:
gh api "repos/$REPO/codeowners/errors"
A 404 here means no CODEOWNERS file was found at any of the three
valid locations on the default branch — push first, then re-check. A 200
with an empty errors array means the file is valid. Non-empty entries
name the line and the problem (unknown user, team without write access,
bad pattern).
As a local sanity check before push, confirm the paths a rule targets actually exist in the tree:
git ls-files -- '<path pattern from the rule>'
An empty result means the rule's pattern does not match anything tracked, which is often a typo.
5. Enforce with the ruleset rule
CODEOWNERS by itself only requests reviews; it does not block a merge.
To require an approving review from a code owner, the default-branch
ruleset's pull_request rule needs require_code_owner_review: true:
gh api "repos/$REPO/rulesets" --jq '.[] | select(.target=="branch") | {id, name}'
gh api "repos/$REPO/rulesets/<id>" --jq '.rules[] | select(.type=="pull_request")'
Show the user the current pull_request rule parameters and the proposed
change (require_code_owner_review: true), and get explicit authorization
before any write:
gh api -X PUT "repos/$REPO/rulesets/<id>" --input "$TMPDIR/ruleset.json"
See references/enforcement.md for the full parameter set and for the
complementary required-reviewer ruleset rule (GA 2026-02-17), which
requires approvals from specific teams scoped to path patterns,
independent of CODEOWNERS. GitHub documents this rule as augmenting
CODEOWNERS, not replacing it: CODEOWNERS still drives auto-requested
reviewers, while the required-reviewer rule enforces the policy at the
ruleset level. Mention it as an option; do not enable it without the user
asking for it.
6. Verify and report
CODEOWNERSfile location and content match what the user confirmed.gh api repos/$REPO/codeowners/errorsreturns an emptyerrorsarray (or explain the 404 if the file has not been pushed yet).- Every
@org/teamreference was confirmed to have write access. - The ruleset's
pull_request.require_code_owner_reviewvalue matches what was authorized (report skip if the user declined enforcement).
Guardrails
- Diff any existing
CODEOWNERSfile before overwriting it; ask before replacing content the user did not confirm. - Never invent a GitHub handle or team slug. Before adding
@org/teamto a rule, rungh api -H 'Accept: application/vnd.github.v3.repository+json' orgs/{org}/teams/{slug}/repos/$REPO. Require.permissions.pushto betrue. A 404 means the team does not exist, has no access, or is not visible to your token. Confirm the slug withgh api orgs/{org}/teams/{slug}before you ask for an access grant. - Never mutate the ruleset (
require_code_owner_reviewor the required-reviewer rule) without explicit user authorization for that specific write. - Re-running this skill on an already-configured repo must be a no-op except where the user asks for a change — re-read the current file and ruleset state before proposing edits.
What this skill is NOT for
- Branch rulesets in general (merge queue, required status checks, PR
review counts) — use
/gh-bootstrap. - Community health files (README, LICENSE, CODE_OF_CONDUCT, CONTRIBUTING,
SECURITY, issue and PR templates) — use
/oss-hygiene. - Local git operations unrelated to ownership evidence gathering.
FAQ
What does the codeowners skill do?
Author, validate, and enforce a CODEOWNERS file: detect an existing file, gather ownership evidence from directory structure and git history, write or update rules with correct CODEOWNERS syntax, validate the file against the GitHub API, and wire the ruleset rule that requires code owner review on pull requests. Use when the user says "add CODEOWNERS", "who owns this path", "require owner review", "validate CODEOWNERS", or invokes /codeowners. Idempotent — safe to re-run; diffs before overwriting and never auto-assigns an owner without confirmation. Do NOT use for branch rulesets in general (use /gh-bootstrap) or community health files such as README, LICENSE, CODEOFCONDUCT, and SECURITY (use /oss-hygiene) — this skill only covers the CODEOWNERS file and the review rule it feeds.
How do I install codeowners?
Run npx skills add https://github.com/paulnsorensen/git-gouda --skill codeowners in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/codeowners/ (personal) or .claude/skills/codeowners/ (project).
Which AI agents can use codeowners?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is codeowners safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains codeowners?
It is published by paulnsorensen in paulnsorensen/git-gouda. It has 53 recorded installs.
More from paulnsorensen/git-gouda
config-review-bot
paulnsorensen/git-gouda
Audit or configure CodeRabbit repository review policy from effective sources. Use for CodeRabbit setup, configuration review, path coverage, or a specific pull-request review audit. Trigger on "configure CodeRabbit", "review .coderabbit.yaml", "set up CodeRabbit", "audit CodeRabbit settings", or "is CodeRabbit covering X". Keep audits read-only by default and separate schema validity, rule quality, and completed-review evidence. Do not use it to run a CodeRabbit CLI review or autofix, or to fix review comments on a pull request.
safe-settings
paulnsorensen/git-gouda
Set up GitHub's safe-settings (a Probot-based GitHub App from the github org) for declarative, org-wide repository policy as code. Use when the user says "settings as code", "safe-settings", "manage repos declaratively", "centralize repo settings", "org-level branch protection", "scaffold an admin repo", "github settings app", or invokes /safe-settings on an org that wants to manage repo settings, branch protection, rulesets, labels, teams, environments, and collaborators from one admin repo. Scaffolds the admin-repo layout (settings.yml + suborgs/ + repos/), the GitHub App installation steps, and a scheduled full-sync GitHub Actions workflow. Distinct from /gh-bootstrap (one-shot gh api config of a single repo) — this skill is for org-scale settings as code that reconciles continuously. Not for per-task GitHub ops (PRs, issues, CI status) or local git work — those are out of this catalog's scope.
gh-bootstrap
paulnsorensen/git-gouda
One-time GitHub repository configuration via the gh CLI: lock the default branch with PR and CI rules, optionally enable a supported merge queue, lock merging to squash-only with PR-title commit messages, scaffold automatically-generated release notes (.github/release.yml), and optionally add a tag-driven release workflow. Use when the user says "set up the repo", "configure the merge queue", "enable squash merging", "lock down main", "set up branch protection", "configure release notes", "scaffold releases", "set up release tagging", or invokes /gh-bootstrap on a fresh or loosely-configured GitHub repository. Idempotent — safe to re-run on already-configured repos to bring missing pieces in line. This skill covers one-time repo policy, not per-task GitHub operations, local git commands, or project task running.
prek
paulnsorensen/git-gouda
Onboard prek (Rust-powered pre-commit) into any project and suggest hooks tailored to the language/framework. Use when the user says "add prek", "set up pre-commit hooks", "configure prek", "what hooks should I use", or when you notice a project without a prek.toml that would benefit from pre-commit checks. Also trigger when the user wants to add new hooks to an existing prek.toml, audit their hook config, or migrate from pre-commit to prek. Covers Rust, Python, TypeScript/JavaScript, Go, Ruby, and Shell projects. Do NOT use for husky, lint-staged, or CI pipeline hook configuration — this skill is specifically for prek.
oss-hygiene
paulnsorensen/git-gouda
Bring an open-source GitHub repository up to community-standards and supply-chain hygiene baseline: scaffold the GitHub Community Standards files (README check, LICENSE, CODEOFCONDUCT, CONTRIBUTING, SECURITY, issue + PR templates), wire Dependabot version updates, the Dependency Review action, OpenSSF Scorecard, and CodeQL (when applicable), check Dependabot alerts and secret scanning, and add the OpenSSF Best Practices Badge link. Use when the user says "set up OSS hygiene", "make this repo open-source-ready", "add community health files", "wire dependabot", "add scorecard", "OSSF badge", "supply chain hardening", or invokes /oss-hygiene on a public repo. Idempotent — safe to re-run; diffs against templates and asks before overwriting. Distinct from /gh-bootstrap (merge-button + branch protection) and /safe-settings (org-scale settings as code): focuses on the contributor-facing and supply-chain surface, not merge or org policy. Run after /gh-bootstrap; before announcing the repo.
github-copilot-repo-instructions
paulnsorensen/git-gouda
Add, audit, or fix GitHub Copilot repository custom instructions — .github/copilot-instructions.md (repo-wide) and .github/instructions/.instructions.md (path-specific) — so Copilot Chat, Copilot code review, and the Copilot coding agent all pick up project-wide guidance. Also covers AGENTS.md, CLAUDE.md, and GEMINI.md as alternate agent instruction files. Use when the user says "add Copilot instructions", "set up copilot-instructions.md", "audit our Copilot config", "make Copilot follow our conventions", "configure Copilot code review", "add path-specific Copilot rules", "applyTo glob", "excludeAgent", "Copilot is ignoring our guidance", or invokes /github-copilot-repo-instructions. Do NOT use for personal (per-user) Copilot instructions; those are out of scope for this skill. For AGENTS.md authoring guidance beyond file layout, see the agents-md skill.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.