codeownership

Resolve CODEOWNERS teams for file lists and maintain team-specific directories.

615|491|Updated Jan 4, 2022
One-click install
npx skills add https://github.com/LedgerHQ/ledger-live --skill codeownership
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codeownership
Source: https://github.com/LedgerHQ/ledger-live/tree/main/.agents/skills/codeownership
Command: npx skills add https://github.com/LedgerHQ/ledger-live --skill codeownership

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ignore.

What problem does it solve?

Large monorepos suffer from cross-team review bottlenecks when ownership of files is unclear. This Skill annotates any list of files with their owning team from CODEOWNERS, making it easy to split large PRs by team and keep team-specific directories organized.

Core Features & Use Cases

  • Ownership Resolution: Run resolve-codeowners.js against a git diff or explicit file list to see which team owns each file, using last-rule-wins gitignore semantics.
  • PR Splitting by Team: Pipe git diff --name-only output into the script to group changed files by owning team before requesting reviews.
  • CODEOWNERS Maintenance: Guidance for organizing monolithic files into team-* sub-directories and keeping CODEOWNERS entries in sync.
  • Use Case: A developer opens a PR touching 80 files across five teams. They run the script on the diff, group files by owner, and split the PR into per-team chunks for faster review.

Quick Start

Annotate the files changed in my last commit with their CODEOWNERS teams so I can split this PR by owner.

Frequently Asked Questions about codeownership

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the CODEOWNERS team for a list of files?

Run resolve-codeowners.js with file paths as arguments or pipe a git diff into it via stdin. The script outputs each file aligned with its owning teams, or "(no owner)" when no rule matches.

How do I split a large pull request by team owner?

Pipe `git diff --name-only HEAD~1` into resolve-codeowners.js to annotate every changed file with its owning team. Group the results by team and create separate PRs for each team's files.

Which CODEOWNERS rule wins when multiple patterns match a file?

The script uses last-rule-wins semantics, matching GitHub CODEOWNERS behavior. Each pattern is compiled with the ignore package, and the last matching rule in the file determines the owners.

Can I use a CODEOWNERS file in a custom location?

Yes, pass --codeowners followed by a path to override the default search. By default the script checks CODEOWNERS, .github/CODEOWNERS, and docs/CODEOWNERS relative to the git root.

Why does the script fail with ignore package not found?

The script loads the ignore package from the pnpm virtual store, so it requires pnpm install to have run in the monorepo. If missing, install ignore@5 locally next to the script as the error message suggests.