Hamburger Cross Icon
Readme Required Sections
+
README Collector

Readme Required Sections + README Collector

Guardrail Collector Stable Repository And Ownership

Enforce Readme Required Sections using data collected by README Collector. Automatically check repository and ownership standards on every PR.

Guardrail: Ensures the README contains required section headings (e.g., Installation, Usage). Configurable via the required_sections input parameter.
Data Source: Verify README files exist and analyze their structure including line count and section headings. Enforce documentation standards across your repositories.

How README Collector Powers This Guardrail

The README Collector gathers metadata from your documentation systems. This data flows into Lunar's Component JSON, where the Readme Required Sections guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
README Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Readme Required Sections Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the README Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/readme@v1.0.0
    # with: ...

# Step 2: Enable the README Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/readme@v1.0.0
    include: [readme-required-sections]
    # with: ...

What README Collector Collects

This collector gathers the following data that the Readme Required Sections guardrail evaluates.

Collector code

readme

Scans repository root for README files (README.md, README, README.txt, README.rst) in order, taking the first match. Extracts line count and section headings by parsing markdown headers. Writes exists, path, lines, and sections to .repo.readme.

Example Data Flow

Here's an example of the data that README Collector writes to the Component JSON, which Readme Required Sections then evaluates.

{ } component.json From README Collector
{
  "repo": {
    "readme": {
      "exists": true,
      "path": "README.md",
      "lines": 150,
      "sections": [
        "Installation",
        "Usage",
        "API",
        "Contributing",
        "License"
      ]
    }
  }
}

Configuration Options

README Collector Inputs

Input Required Default Description
paths Optional README.md,README,README.txt,README.rst Comma-separated list of README paths to check (first match wins)

README Guardrails 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

Ready to Automate Your Standards?

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

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Book a Demo
See it work with your own use cases
See How It Works