Compound Engineering for Laravel

December 29, 2025

development laravel ai

A practical guide to setting up AI coding agents that learn (and keep learning) your Laravel conventions.

I've been experimenting with letting AI write most of my Laravel code on a recent side project called Site Spell Checker. Not in the "ask ChatGPT to write a controller" sense, but a more structured approach called compound engineering that I picked up from Every's engineering team.

The basic idea: each feature you build should make the next one easier. Instead of accumulating technical debt, you accumulate knowledge that AI agents can reuse.

What is Compound Engineering?

Kieran Klaassen at Every describes it well: typical AI engineering is about short-term gains. You prompt, it codes, you ship. Then you start over. Compound engineering builds systems with memory—every pull request teaches the system, every bug becomes a permanent lesson, every code review updates the defaults.

Every's team runs five products with single-person teams using this loop:

  1. Plan: Research and create detailed implementation plans
  2. Work: Execute with AI assistance
  3. Review: Evaluate output from multiple perspectives
  4. Compound: Capture learnings to improve future cycles

That last step is the key. Every bug fix, every pattern you establish, every convention you document—it all gets fed back so the next feature benefits.

Here's the counterintuitive part: 80% of the work happens in planning and review. The actual code writing is maybe 20%. Planning builds a shared mental model between you and the AI. Review captures what you learned. The code? That's the easy part when you've done the planning right.

The shift in thinking: your job isn't to type code anymore, but to design the systems that design the systems.

The Tools: What You Need to Know

Before diving into implementation, here's a quick overview of the tools involved.

Claude Code / Opencode

Claude Code is Anthropic's terminal-based coding assistant. It runs in your terminal, has access to your filesystem, can run commands, and maintains context across your session. Opencode is an open-source alternative that works similarly—I use Opencode for most of my work.

These aren't chat interfaces—they're agents that can read files, edit code, run tests, and execute git commands. You give them tasks, they figure out the steps.

Skills

Skills are reusable instruction sets stored in .claude/skills/. They're markdown files with YAML frontmatter that define:

When you invoke a skill, the agent loads those instructions and follows them. Think of skills as saved workflows you can trigger by name.

Agents vs. Assistants

The distinction matters. An assistant responds to prompts. An agent takes actions. Claude Code and similar tools are agents—they can browse your codebase, make edits, run your test suite, create branches, and open PRs. They act on your behalf.

Context Files: CLAUDE.md and AGENTS.md

These are special files that agents read automatically:

CLAUDE.md (or similar): Lives in your project root. Contains project-specific context the agent should know—tech stack, conventions, important files, common commands.

AGENTS.md: My convention for documenting standards that future agents (and humans) should follow. It's where patterns compound. Every time you establish a new convention, it goes here. Every agent reads it before making changes.

The key insight from Kieran: "Ten specific rules you follow beat 100 generic ones." Make these files yours, not copied from the internet.

If you're starting a new Laravel project, Laravel Boost gives you a head start—it generates starter CLAUDE.md and AGENTS.md files with Laravel-specific conventions already in place. You'll still customize them, but it's a solid foundation to build on.

Why Laravel Works Well for This

Laravel's opinionated structure makes it ideal for compound engineering. When you establish conventions around:

Each feature reinforces these patterns. Agents learn your conventions and apply them consistently.

Two Ways to Implement This

There are two approaches to setting up compound engineering for Laravel. Pick based on how deep you want to go.

Option 1: Every's Full Compound Engineering Plugin

Every open-sourced their compound engineering plugin for Claude Code. It implements the complete loop:

This is the full system. Good for teams wanting comprehensive automation, or if you want to follow Every's exact methodology.

To use it:

  1. Install the plugin following their repo instructions
  2. Configure for Laravel conventions
  3. Add your standards to CLAUDE.md

Option 2: Basic Review & Release (Start Here)

If you want something simpler, start with two skills: review and release.

This is what I run on my projects. It handles the core compounding through mandatory documentation updates on every review:

Review skill:

Release skill:

Two skills, clean separation: review creates PRs, release merges them.

The compounding happens because every review updates AGENTS.md with new patterns discovered. Next feature benefits from what you learned on the last one.

I put together a demo repo you can clone or reference: laravel-agentkit-demo. It's a basic Laravel app with both skills already configured.

A Real Example

Here's how Option 2 works on my site spell checker project.

I need to add scheduled scans. I write a quick pitch:

Problem: Users want to scan sites on a schedule.

Solution: - ScheduledScan model - Queue job for processing - Livewire component for management - Email notifications

The agent builds it following patterns from AGENTS.md. When done, I run the review skill:

Then I run the release skill to merge and tag it.

Since Site Spell Checker is hosted on Laravel Cloud, the review skill automatically spins up a preview environment when it creates the PR. I can test there before merging. When I run the release skill, it goes live.

Next feature I build, the agent already knows those queue job patterns from the updated AGENTS.md. That's the compound effect.

Getting Started with Option 2

Prerequisites

Step 1: Document Your Standards

Create AGENTS.md with your Laravel patterns:

Start with 10 specific rules you actually follow. Add more as you establish new patterns.

Step 2: Create Skills Directory

Create .claude/skills/ in your project root. I use the .claude/ folder even though I primarily use Opencode—Opencode supports Claude-compatible paths, so this lets you switch between Claude Code and Opencode without moving files.

Step 3: Add the Skills

Drop these files into .claude/skills/. They work with Claude Code, Opencode, or any agent that supports skill files.

.claude/skills/review.md

---
name: review
description: Performs comprehensive code review and cleanup for Laravel projects. Use when reviewing code, running tests, cleaning up debug statements, or managing Git workflow.
allowed-tools: Read, Grep, Glob, Bash, Edit, Write, Todowrite, Todoread
---

You are a specialized Claude Code skill for performing comprehensive code reviews on Laravel projects.

## Execution Requirements
Execute ALL sections in order. Do not skip any step.
- Code review is mandatory for all changes
- Test execution and fixing is required - create tests if missing
- Debugging cleanup must be performed
- Documentation updates are non-optional
- Git workflow management must be completed

## Core Functionality

### 0. Branch Validation and Setup

- Check current branch with `git branch --show-current`
- Check working directory status: `git status --porcelain`
- Fetch latest from origin: `git fetch origin`
- If on main/master with uncommitted changes: create feature branch
- If on main/master with no changes: abort (nothing to review)
- If on feature branch: ensure up to date with main

### 1. Code Review

- Analyze Laravel code for best practices
- Check security vulnerabilities in models, controllers, routes
- Validate database migrations and relationships
- Watch for N+1 queries, lazy loading issues
- Review controller logic and form requests
- Make sure everything is done "the Laravel way"

### 2. Test Execution and Fixing

- Make sure all new features are covered by tests
- Run `php artisan test`
- Identify and fix failing tests
- Ensure all tests pass before proceeding

### 3. Debugging Cleanup

- Remove `dd()`, `var_dump()`, `console.log()` statements
- Clean up temporary debug files and unused imports

### 4. Update Documentation

- Update AGENTS.md with anything future agents need to know
- Update CHANGELOG.md with changes and decisions made
- Update README.md with how the app works

### 5. Git Workflow Management

- Commit all changes: `git add . && git commit -m 'Code review: {description}'`
- Push branch: `git push origin <current-branch>`
- Check if PR exists: `gh pr list --head <current-branch> --state open`
- If no PR exists, create one
- Do NOT merge the PR - that's the release skill's job

## Success Criteria

Complete only when:
- Branch is validated
- All tests pass
- No debugging code remains
- Documentation is updated
- PR is created or updated (not merged)

## Return Format

Provide summary including:
- Branch Setup: Branch name, status
- Code Issues: Problems found and resolutions
- Test Results: Passed/failed, fixes applied
- Cleanup Actions: Files modified, statements removed
- Documentation Changes: Files updated
- Git Actions: Commit hash, PR link
- Final Status: Success/failure with next steps

.claude/skills/release.md

---
name: release
description: Handles PR approval, merging, and release tagging for Laravel projects. Use after review skill has created a PR.
allowed-tools: Read, Grep, Glob, Bash, Edit, Write
---

You are a specialized Claude Code skill for releasing Laravel projects.

## Core Functionality

### 1. PR Identification

- Find open PR for current branch: `gh pr list --head <branch> --state open`
- If no PR exists, abort (run review skill first)

### 2. Quick Laravel Review

- Lightweight check for critical issues
- Missing policies, improper facade usage
- Not a full review - that's already done

### 3. Quality Gates

- Verify all CI checks pass
- Run local `php artisan test`

### 4. Approval & Merge

- Leave review comment
- Approve the PR
- Squash merge with conventional commit message

### 5. Cleanup

- Switch to main: `git checkout main`
- Pull changes: `git pull origin main`
- Delete feature branch locally and remotely

### 6. Release Creation

- Increment version tag (patch/minor/major as appropriate)
- Create GitHub release with auto-generated notes

### 7. Changelog Update

- Mark release date in CHANGELOG.md

## Success Criteria

- PR is merged
- Branches are cleaned up
- Release is tagged
- Changelog is updated

## Relationship to Review Skill

- Review skill: Development - validates, tests, creates PR
- Release skill: Release - approves, merges, tags
- Always run review first, then release

Step 4: Iterate

Customize for your patterns. Each project is different. Start small and let it grow.

When something fails that shouldn't have, invest the time to prevent it from happening again—build the test, write the rule, capture the lesson. That's how it compounds.

Resources