Hamburger Cross Icon
Claude Collector - Lunar Collector

Claude Collector

Collector Beta Code Analysis

Execute Claude AI prompts against your repository to extract insights, detect patterns, and analyze code that's difficult to capture with traditional pattern matching.

Add claude to your lunar-config.yml:
uses: github://earthly/lunar-lib/collectors/claude@v1.0.0

What This Integration Collects

This integration includes 1 collector that gather metadata from your systems.

Collector code

claude

Runs a Claude AI prompt against the repository and collects the results. Supports optional JSON schema enforcement for structured output. Use cases include:

  • Feature flag detection and inventory
  • Documentation quality analysis
  • Graceful shutdown handling verification
  • Architecture pattern detection
claude ai llm code analysis pattern detection anthropic
Book a demo

How Collectors Fit into Lunar

Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.

Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.

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

Example Collected Data

This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:

{ } component.json Component JSON
{
  "code_patterns": {
    "feature_flags": {
      "library": "custom",
      "flags": [
        {
          "key": "enable_new_checkout",
          "file": "src/checkout/handler.go",
          "line": 42,
          "variation_type": "bool"
        }
      ],
      "count": 1
    }
  }
}

Configuration

Configure this collector in your lunar-config.yml.

Inputs

Input Required Default Description
path Required JSON component path to write the results to (e.g., ".code_patterns.feature_flags")
prompt Required Prompt for Claude to run on the component repository
json_schema Required Optional JSON schema for structured output. If provided, Claude will return results conforming to this schema.

Secrets

This collector requires the following secrets to be configured in Lunar:

Secret Description
ANTHROPIC_API_KEY Anthropic API key for Claude authentication

Documentation

View on GitHub

Claude Collector

Run Claude AI prompts against repository code and collect structured results for policy evaluation.

Overview

This collector executes Claude AI prompts against your repository to extract insights, detect patterns, and analyze code that's difficult to capture with traditional pattern matching. It runs on code changes and writes results to a configurable Component JSON path.

Use cases include:

  • Feature flag detection and inventory
  • Documentation quality analysis
  • Graceful shutdown handling verification
  • Architecture pattern detection
  • API documentation completeness checks

Collected Data

This collector writes to a user-specified Component JSON path via the path input:

Path Type Description
{path} any Claude's response, optionally conforming to a JSON schema

Collectors

This integration provides the following collector:

Collector Description
claude Runs a Claude prompt and collects structured results

Installation

Add to your lunar-config.yml:

collectors:
  - uses: github://earthly/lunar-lib/collectors/claude@v1.0.0
    on: ["domain:your-domain"]
    with:
      path: ".code_patterns.feature_flags"
      prompt: "Find all feature flags in this repository and return them as a list"

With JSON Schema Enforcement

For structured output, provide a JSON schema:

collectors:
  - uses: github://earthly/lunar-lib/collectors/claude@v1.0.0
    on: [backend]
    with:
      path: ".code_patterns.lifecycle"
      prompt: "Analyze this codebase for graceful shutdown handling. Check if SIGTERM signals are properly handled."
      json_schema: |
        {
          "type": "object",
          "properties": {
            "handles_sigterm": {"type": "boolean"},
            "shutdown_timeout_seconds": {"type": "number"},
            "files": {"type": "array", "items": {"type": "string"}}
          }
        }

Open Source

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

View Repository

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
Automate Now
Turn any process doc into guardrails
Book a Demo