laravel:controller-tests

Generate Laravel controller tests using HTTP assertions and validation rules.

1|Updated Sep 22, 2025
One-click install
npx skills add https://github.com/meistro57/chat_bridge --skill laravel-controller-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel:controller-tests
Source: https://github.com/meistro57/chat_bridge/tree/main/.claude/skills/controller-tests
Command: npx skills add https://github.com/meistro57/chat_bridge --skill laravel-controller-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write more efficient and maintainable controller tests by focusing on HTTP assertions and offloading complex logic to separate, unit-testable components like Actions and Services.

Core Features & Use Cases

  • HTTP Assertions: Directly test API endpoints and their responses.
  • Validation Testing: Assert that validation rules are correctly applied.
  • Logic Separation: Encourages moving business logic out of controllers for better testability.
  • Use Case: Ensure that a user registration endpoint correctly rejects requests with an empty email address, asserting the presence of a session error.

Quick Start

Use the laravel:controller-tests skill to write a test that rejects empty email during registration.

Frequently Asked Questions about laravel:controller-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write focused controller tests in Laravel using HTTP assertions?

To write focused controller tests in Laravel, use HTTP assertions to directly test API endpoints and their responses, validate request data, and offload complex business logic to separate Actions and Services for improved unit testing.

What is the best way to test validation rules for a Laravel API endpoint?

The best way to test validation rules for a Laravel API endpoint is by generating focused controller tests that assert validation rules are correctly applied, such as verifying that a user registration endpoint rejects requests with an empty email address and checks for session errors.

Can I use Laravel factories for data generation in controller tests?

Yes, you can use Laravel factories for data generation in controller tests. This Skill supports utilizing factories to create test data, allowing you to focus your HTTP assertions on endpoint behavior rather than manual data setup.

When should I separate business logic from Laravel controllers for testing?

You should separate business logic from Laravel controllers when writing controller tests to improve testability. Moving complex logic into Actions and Services allows your HTTP tests to remain focused on endpoint responses and request validation.

Does testing Laravel controllers with HTTP assertions require external dependencies?

No, testing Laravel controllers with HTTP assertions does not require external dependencies. This Skill operates independently, facilitating the testing of API endpoints, validation rules, and logic separation without needing additional packages.

Why are my Laravel controller tests failing to validate empty request data?

Laravel controller tests may fail to validate empty request data if validation rules are not correctly asserted. This Skill helps by generating tests that specifically assert validation rules are applied, ensuring endpoints properly reject invalid requests like an empty email.