Hamburger Cross Icon
Repo Boilerplate Guardrails - Lunar Policy for Repository And Ownership

Repo Boilerplate Guardrails

Policy Beta Repository And Ownership

Enforce repository boilerplate standards including README quality, CODEOWNERS validation, and presence of standard files (.gitignore, LICENSE, SECURITY.md, CONTRIBUTING.md). Consolidates readme and codeowners policies into a single plugin with additional file-existence checks.

Add repo-boilerplate to your lunar-config.yml:
uses: github://earthly/lunar-lib/policies/repo-boilerplate@v1.0.5

Included Guardrails

This policy includes 16 guardrails that enforce standards for your repository and ownership.

Guardrail

readme-exists

Verifies that a README file exists in the repository root. Every repository should have basic documentation for discoverability.

readme documentation repository docs
View Guardrail
Guardrail

readme-min-line-count

Requires the README to have a minimum number of lines (default 25). Prevents placeholder READMEs that lack useful information.

readme length documentation quality
View Guardrail
Guardrail

readme-required-sections

Ensures the README contains required section headings (e.g., Installation, Usage). Configurable via the required_sections input. Skips if no sections configured.

readme sections documentation structure
View Guardrail
Guardrail

codeowners-exists

Requires a CODEOWNERS file to be present in the repository. Checks standard locations: root, .github/, or docs/.

codeowners code ownership file exists
View Guardrail
Guardrail

codeowners-valid

Validates that the CODEOWNERS file has correct syntax. Checks that all owner references use valid formats (@user, @org/team, or email).

codeowners syntax validation owner format
View Guardrail
Guardrail

codeowners-catchall

Requires a default catch-all rule (*) in CODEOWNERS so that every file in the repository has at least one owner.

codeowners catch-all default owner coverage
View Guardrail
Guardrail

codeowners-min-owners

Ensures each CODEOWNERS rule has a minimum number of owners for redundancy. Configurable via the min_owners_per_rule input.

codeowners minimum owners bus factor redundancy
View Guardrail
Guardrail

codeowners-team-owners

Requires at least one team-based owner (@org/team) in the CODEOWNERS file for better ownership continuity.

codeowners team ownership org team
View Guardrail
Guardrail

codeowners-no-individuals-only

Ensures each CODEOWNERS rule includes at least one team owner, not just individual users. Stricter than codeowners-team-owners which only checks that teams exist somewhere in the file.

codeowners team ownership individual owners
View Guardrail
Guardrail

codeowners-no-empty-rules

Flags CODEOWNERS rules that have no owners assigned, which effectively un-assigns ownership for matching files.

codeowners empty rules unassigned ownership
View Guardrail
Guardrail

codeowners-max-owners

Flags CODEOWNERS rules with too many owners. Excessive owners often means diffused responsibility. Configurable via the max_owners_per_rule input.

codeowners maximum owners diffused ownership
View Guardrail
Guardrail

gitignore-exists

Verifies that a .gitignore file exists in the repository root. Prevents accidental commits of build artifacts, dependencies, and IDE files. Reads from .repo.gitignore.

gitignore repository hygiene
View Guardrail
Guardrail

license-exists

Verifies that a LICENSE file exists in the repository root. Checks common variants: LICENSE, LICENSE.md, LICENSE.txt, LICENCE. Reads from .repo.license.

license open source repository hygiene
View Guardrail
Guardrail

security-exists

Verifies that a SECURITY.md file exists in the repository root or .github/ directory. Provides a channel for responsible vulnerability disclosure. Reads from .repo.security.

security vulnerability disclosure repository hygiene
View Guardrail
Guardrail

contributing-exists

Verifies that a CONTRIBUTING.md file exists in the repository root or .github/ directory. Helps external and internal contributors understand the process. Reads from .repo.contributing.

contributing contribution guide repository hygiene
View Guardrail
Guardrail

editorconfig-exists

Verifies that an .editorconfig file exists in the repository root. Ensures consistent coding style across editors. Use exclude/include in lunar-config to control whether this check runs. Reads from .repo.editorconfig.

editorconfig code style repository hygiene
View Guardrail

How Guardrails Fit into Lunar

Lunar guardrails define your engineering standards as code. They evaluate data collected by integrations and produce pass/fail checks with actionable feedback.

Policies support gradual enforcement—from silent scoring to blocking PRs or deployments—letting you roll out standards at your own pace without disrupting existing workflows.

Learn How Lunar Works
1
Integrations Gather Data
Collectors extract metadata from code, CI pipelines, tool outputs, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards This Policy
Real-time feedback in PRs and AI workflows

Required Integrations

This policy evaluates data gathered by one or more of the following integration(s). Make sure to enable them in your lunar-config.yml.

Configuration

Configure this policy in your lunar-config.yml.

Inputs

Input Required Default Description
min_lines Optional 25 Minimum number of lines required in README file
required_sections Required Comma-separated list of required sections in README file
min_owners_per_rule Optional 2 Minimum number of owners required per CODEOWNERS rule
max_owners_per_rule Optional 10 Maximum number of owners allowed per CODEOWNERS rule

Documentation

View on GitHub

Repo Boilerplate Guardrails

Enforce repository boilerplate standards for README, CODEOWNERS, and standard configuration files.

Overview

Validates that repositories maintain documentation standards, code ownership rules, and include standard boilerplate files. Consolidates the existing readme and codeowners policies into a single plugin, adding checks for .gitignore, LICENSE, SECURITY.md, CONTRIBUTING.md, and .editorconfig.

Policies

This plugin provides the following policies (use include to select a subset):

README Checks

Policy Description
readme-exists Verifies a README file exists in the repository
readme-min-line-count Requires README to have minimum line count (default 25)
readme-required-sections Ensures README contains required section headings

CODEOWNERS Checks

Policy Description
codeowners-exists Requires a CODEOWNERS file in the repository
codeowners-valid Validates CODEOWNERS syntax (owner formats)
codeowners-catchall Requires a default catch-all rule (*)
codeowners-min-owners Minimum owners per rule (default 2)
codeowners-team-owners Requires at least one team-based owner
codeowners-no-individuals-only Each rule must include a team owner
codeowners-no-empty-rules Flags rules with no owners assigned
codeowners-max-owners Maximum owners per rule (default 10)

Standard File Checks

Policy Description
gitignore-exists Verifies .gitignore file exists
license-exists Verifies LICENSE file exists
security-exists Verifies SECURITY.md file exists
contributing-exists Verifies CONTRIBUTING.md file exists
editorconfig-exists Verifies .editorconfig file exists (use exclude if not wanted)

Required Data

This policy reads from the following Component JSON paths:

Path Type Provided By
.repo.readme object repo-boilerplate collector (readme subcollector)
.repo.gitignore object repo-boilerplate collector (gitignore subcollector)
.repo.license object repo-boilerplate collector (license subcollector)
.repo.security object repo-boilerplate collector (security subcollector)
.repo.contributing object repo-boilerplate collector (contributing subcollector)
.repo.editorconfig object repo-boilerplate collector (editorconfig subcollector)
.ownership.codeowners object repo-boilerplate collector (codeowners subcollector)

Note: Ensure the repo-boilerplate collector is configured before enabling this policy.

Installation

Add to your lunar-config.yml:

policies:
  - uses: github://earthly/lunar-lib/policies/repo-boilerplate@main
    on: ["domain:your-domain"]
    enforcement: report-pr
    exclude: [editorconfig-exists]
    # include: [readme-exists, codeowners-exists, gitignore-exists, license-exists]
    # with:
    #   min_lines: "25"
    #   required_sections: "Installation,Usage"
    #   min_owners_per_rule: "2"
    #   max_owners_per_rule: "10"

Examples

Passing Example

{
  "repo": {
    "readme": {
      "exists": true,
      "path": "README.md",
      "lines": 150,
      "sections": ["Installation", "Usage", "Contributing"]
    },
    "gitignore": { "exists": true, "path": ".gitignore", "lines": 42, "patterns": 35 },
    "license": { "exists": true, "path": "LICENSE", "spdx_id": "MIT" },
    "security": { "exists": true, "path": "SECURITY.md", "lines": 28, "sections": ["Reporting a Vulnerability"] },
    "contributing": { "exists": true, "path": "CONTRIBUTING.md", "lines": 55, "sections": ["Getting Started", "Pull Requests"] },
    "editorconfig": { "exists": true, "path": ".editorconfig", "sections": 4 }
  },
  "ownership": {
    "codeowners": {
      "exists": true,
      "valid": true,
      "errors": [],
      "team_owners": ["@acme/platform-team"],
      "rules": [
        { "pattern": "*", "owners": ["@acme/platform-team"], "owner_count": 1 }
      ]
    }
  }
}

Failing Example

{
  "repo": {
    "readme": { "exists": false },
    "gitignore": { "exists": false },
    "license": { "exists": false },
    "security": { "exists": false },
    "contributing": { "exists": false },
    "editorconfig": { "exists": false }
  },
  "ownership": {
    "codeowners": { "exists": false }
  }
}

Failure messages:

  • "README file not found"
  • "No CODEOWNERS file found"
  • ".gitignore file not found"
  • "LICENSE file not found"

Remediation

When this policy fails, resolve it by adding the missing files:

  1. README - Add a README.md with project description, installation, and usage instructions
  2. CODEOWNERS - Add a CODEOWNERS file (root, .github/, or docs/) with ownership rules
  3. .gitignore - Add a .gitignore appropriate for your language/framework
  4. LICENSE - Add a LICENSE file with your project's license
  5. SECURITY.md - Add a SECURITY.md with vulnerability disclosure instructions
  6. CONTRIBUTING.md - Add a CONTRIBUTING.md with contribution guidelines

Open Source

This policy is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.

View Repository

Common Use Cases

Explore how individual guardrails work with specific integrations.

+
Readme Exists + Repo Boilerplate Collector Verifies that a README file exists in the repository root. Every repository...
+
Readme Min Line Count + Repo Boilerplate Collector Requires the README to have a minimum number of lines (default 25). Prevents...
+
Readme Required Sections + Repo Boilerplate Collector Ensures the README contains required section headings (e.g., Installation,...
+
Codeowners Exists + Repo Boilerplate Collector Requires a CODEOWNERS file to be present in the repository. Checks standard...
+
Codeowners Valid + Repo Boilerplate Collector Validates that the CODEOWNERS file has correct syntax. Checks that all owner...
+
Codeowners Catchall + Repo Boilerplate Collector Requires a default catch-all rule (*) in CODEOWNERS so that every file in the...
+
Codeowners Min Owners + Repo Boilerplate Collector Ensures each CODEOWNERS rule has a minimum number of owners for...
+
Codeowners Team Owners + Repo Boilerplate Collector Requires at least one team-based owner (@org/team) in the CODEOWNERS file for...
+
Codeowners No Individuals Only + Repo Boilerplate Collector Ensures each CODEOWNERS rule includes at least one team owner, not...
+
Codeowners No Empty Rules + Repo Boilerplate Collector Flags CODEOWNERS rules that have no owners assigned, which...
+
Codeowners Max Owners + Repo Boilerplate Collector Flags CODEOWNERS rules with too many owners. Excessive owners often...
+
Gitignore Exists + Repo Boilerplate Collector Verifies that a .gitignore file exists in the repository root....
+
License Exists + Repo Boilerplate Collector Verifies that a LICENSE file exists in the repository root. Checks common...
+
Security Exists + Repo Boilerplate Collector Verifies that a SECURITY.md file exists in the repository root or...
+
Contributing Exists + Repo Boilerplate Collector Verifies that a CONTRIBUTING.md file exists in the repository root or...
+
Editorconfig Exists + Repo Boilerplate Collector Verifies that an .editorconfig file exists in the repository root....

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo