跳至正文

Development ​

Introduction ​

Day-to-day work on a Laravel for Go application centers on a few tools: laravel dev for running your server, queue worker, and Vite together, the Go toolchain for building and testing your backend, and the AI coding agents that can implement and verify features alongside you.

This guide covers your local development workflow and how to get the most out of the agent instructions, skills, and cloud-agent workflows included in every new application.

Running your application locally ​

When you work on an application locally, you usually want the web server, a queue worker, and Vite's asset server running at the same time. Start all three together with laravel dev:

shell
laravel dev

While laravel dev runs, saving a .go file, go.mod, go.sum, or .env rebuilds and restarts your server and queue worker, and refreshes your browser once the server is ready. Frontend edits in resources/ hot-reload through Vite, and template edits in resources/views/ reload the page automatically.

If you want to run a single process on its own, such as keeping Vite running while you restart the server by hand, use the individual scripts in package.json:

shell
npm run dev:server
npm run dev:queue
npm run dev:vite

Run your application's console commands through the laravel CLI from any directory inside your project, such as laravel migrate or laravel route:list. In environments where the laravel CLI isn't installed, run commands through Go instead:

shell
go run . route:list

WebSockets ​

If your application broadcasts events over WebSockets, run the local Reverb server in another terminal alongside laravel dev:

shell
laravel reverb:start

To learn more about configuring the local server, check out the WebSockets guide.

Verification commands ​

Before opening a pull request or handing off a change, run your test suite, Go checks, and frontend checks to catch errors early:

shell
go test ./...
gofmt -w .
go vet ./...
npm run types:check
npm run check

To focus on a single package or test while you iterate, pass a package path and -run filter to Go, such as go test ./tests/feature -run TestPosts. Go caches passing test runs when your Go files haven't changed, so pass -count=1 when you want to force every test to run again after changing .env, environment variables, or external state:

shell
go test -count=1 ./...

To automatically fix frontend lint and formatting issues, run npm run check:fix. To learn more about writing feature tests and configuring your test database, check out the testing guide.

Developing with AI agents ​

Laravel's predictable package layout, explicit wiring, and fast test feedback loops give AI coding agents the context they need to write idiomatic code. Every new Laravel application includes project instructions and focused agent skills that tell an agent where packages belong, how your application is tested, and where to read the exact documentation for your installed framework version.

Project instructions and skills ​

At the root of every new application, you'll find two instruction files and a .agents/skills/ directory:

  • AGENTS.md gives coding agents a concise overview of your application's layout, verification commands, and conventions, including resource-oriented handler packages, testing practices, and where new packages belong.
  • CLAUDE.md imports @AGENTS.md, so tools that look for either file read the same instructions.
  • .agents/skills/ holds seven Agent Skills that agents load on demand when working on specific areas of your application:
    • writing-laravel-go-apps helps agents locate the installed framework docs, organize packages by domain, write lean CRUD handler packages and sub-resources, extract reusable action functions in actions/, and follow Laravel for Go idioms.
    • database-and-models covers model structs, relationship tags and eager loading, forward-only migrations registered in migrations.All, framework table helpers, and factories in database/factories/.
    • validation-and-input covers typed body validation (r.Validate and r.Bind), query structs (r.Query and r.QueryInto), validation.For with rule.Field, model.Unique/model.Exists, and custom rules.
    • auth-and-authorization covers auth.Session[models.User], models.CurrentUser, named auth routes, auth.Ability policy functions, and auth.Authorize checks.
    • queues-and-workflows covers choosing between background tasks, queued jobs, durable workflows, and events/listeners, explicit registration in jobs.All/workflows.All/listeners.All, deterministic workflow steps, and thin scheduled callbacks.
    • testing-laravel-go-apps guides agents through writing HTTP feature tests under tests/feature/, using laraveltest.RefreshDatabase and factories, faking subsystems, and testing jobs, listeners, and scheduled logic directly with client.Context().
    • inertia-frontend guides agents through building Inertia v3, React, TypeScript, and Tailwind CSS v4 pages, forms, shared props, and Vite Plus assets.

Update AGENTS.md and .agents/skills/ as your application grows. Add notes about your domain terminology, custom services in services/services.go, and internal conventions so every agent session follows your team's patterns.

Version-matched framework documentation ​

Because Laravel for Go evolves quickly, an AI agent that relies on memorized training data or web searches can guess outdated signatures or confuse APIs from other frameworks. To prevent that, the go.laravel.com module bundles the complete Markdown guides for the exact version your application depends on.

The writing-laravel-go-apps skill includes a small helper script that prints the path to the installed documentation directory for your current go.mod:

shell
.agents/skills/writing-laravel-go-apps/scripts/docs-path.sh

Agents run this script to read <docs>/documentation.md and open the exact guide for the feature they're working on before writing code. You can run the script yourself anytime you want to search or browse the offline guides that match your application's installed version.

Developing with cloud agents ​

Alongside local development, Laravel for Go pairs well with cloud coding agents such as Amp, Cursor, and Devin. Running several cloud agents in parallel lets you move through features, refactors, and bug fixes far faster than working serially on one branch at a time:

  • Parallel progress across features. You can assign independent tasks to separate cloud agents at once, such as adding a resource endpoint, writing a background job, and updating an Inertia page, then review pull requests as they finish.
  • Fast verification before you review. Go's fast compilation, go vet, TypeScript's type checker, and Laravel's isolated database feature tests give remote agents clear, objective feedback. Paired with AGENTS.md, .agents/skills/, and the bundled version-matched docs, a cloud agent can implement a feature, run go test ./... and npm run check, fix any issues on its own, and open a ready-to-review pull request.
  • Live review on every pull request. When you host your application on Laravel Cloud, preview environments build and deploy every pull request automatically. You can test an agent's work in a real browser at a live preview URL before merging, without even checking out the branch locally.

To get the most out of parallel cloud agents, keep your tests fast and self-contained using RefreshDatabase and subsystem fakes, keep AGENTS.md current as your architecture grows, and split features into clear, independent tasks that agents can verify end to end.