generate-controller

generate-controller is a command for Claude Code from TheBeardedBearSAS/claude-craft. It costs 7 tokens per session (2,122 once invoked), scanned A, original, MIT.

Generate a Laravel controller following best practices.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/thebeardedbearsas/claude-craft/generate-controller
Clone the repo
git clone --depth 1 https://github.com/TheBeardedBearSAS/claude-craft

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate-controller

README.md
[![agentmods](https://agentmods.dev/badge/commands/thebeardedbearsas/claude-craft/generate-controller.svg)](https://agentmods.dev/commands/thebeardedbearsas/claude-craft/generate-controller)
Your own site
<a href="https://agentmods.dev/commands/thebeardedbearsas/claude-craft/generate-controller"><img src="https://agentmods.dev/badge/commands/thebeardedbearsas/claude-craft/generate-controller.svg" alt="Measured on agentmods" height="20"></a>
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,122 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin unknown No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00007 $0.02122
Opus 5 $0.00003 $0.01061
Sonnet 5 $0.00001 $0.00424
Haiku 4.5 $0.00001 $0.00212

Measured today against content hash a02df2b06b57, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

generate-controller scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/laravel/generate-controller.md · 389 lines

How it starts

The opening of the file, as written. The whole thing — 389 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate Laravel Controller

You are a Laravel expert. Your mission is to generate a controller following Laravel best practices.

Arguments

$ARGUMENTS

  • ControllerName: Name of the controller (e.g., OrderController)
  • --api: Generate API controller (JSON responses)
  • --resource: Generate resourceful controller with all CRUD methods
  • --model=ModelName: Associated model for route model binding

Generation Process

1. Analyze Requirements

Determine controller type:

  • API Resource Controller: Full CRUD for API
  • Single Action Controller: One specific action
  • Web Controller: Traditional web with views

2. Generate Controller

API Resource Controller
<?php

declare(strict_types=1);

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\{ModelName}\Store{ModelName}Request;
use App\Http\Requests\{ModelName}\Update{ModelName}Request;
use App\Http\Resources\{ModelName}Resource;
use App\Models\{ModelName};
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;

final class {ModelName}Controller extends Controller
{
    public function __construct()
    {
        $this->authorizeResource({ModelName}::class, '{modelName}');
    }

    /**
     * Display a listing of the resource.
     */
    public function index(): AnonymousResourceCollection
    {
        ${modelNames} = {ModelName}::query()
            ->with(['relationship']) // Add eager loading
            ->latest()
            ->paginate();

        return {ModelName}Resource::collection(${modelNames});
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Store{ModelName}Request $request): JsonResponse
    {
        ${modelName} = {ModelName}::create($request->validated());

        return {ModelName}Resource::make(${modelName})
            ->response()
            ->setStatusCode(201);
    }

    /**
     * Display the specified resource.
     */
    public function show({ModelName} ${modelName}): {ModelName}Resource
    {
        ${modelName}->load(['relationship']); // Add eager loading

        return {ModelName}Resource::make(${modelName});
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(
        Update{ModelName}Request $request,
        {ModelName} ${modelName}
    ): {ModelName}Resource {
        ${modelName}->update($request->validated());

        return {ModelName}Resource::make(${modelName});
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy({ModelName} ${modelName}): JsonResponse
    {
        ${modelName}->delete();

        return response()->json(null, 204);
    }
}

Read the full file on GitHub · 389 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 389 lines · 7 tokens per session scan A a02df2b06b57

Subscribe to this mod's changes

generate-controller is a command published in the GitHub repository TheBeardedBearSAS/claude-craft (105 stars, last pushed yesterday), licensed MIT. It adds 7 tokens to every session and 2,122 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.