architecture

A set of project rules for Laravel applications that use the `pekral/arch-app-services` package. It organizes business logic into separate classes for actions, reading data, and changing data.

In plain words
What is it for?
Use it when building or reviewing Laravel features that use this package, especially when deciding where business logic, database reads, and database writes should go.
Why use it?
It keeps controllers and other entry points small and makes each part of the application follow the same structure. The rules apply only when the named package is installed.

Cursor rule

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 rules/pekral/cursor-rules/architecture
Clone the repo
git clone --depth 1 https://github.com/pekral/cursor-rules
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 14,929 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original 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.00000 $0.14929
Opus 5 $0.00000 $0.07465
Sonnet 5 $0.00000 $0.02986
Haiku 4.5 $0.00000 $0.01493

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

Security

Grade A, and why

architecture 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 yesterday.

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.

rules/laravel/architecture.mdc · 344 lines

How it starts

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

Scope

  • Apply these rules only if the project uses pekral/arch-app-services.
  • This rule extends core Laravel conventions with package-specific architectural constraints.
  • Follow pekral/arch-app-services as the source of truth, including package examples and conventions.

Architecture

  • All business logic must follow the Action pattern.
  • Mandatory orchestration flow:
    • Controller / Job / Command / Listener / Livewire Component -> Action -> ModelService -> Repository (read) / ModelManager (write)
  • Entry points must stay thin:
    • accept input
    • validate input or delegate validation
    • call an Action
    • return a response or update UI state
  • Only Laravel-native class types exist in the application; every other concern is a pekral/arch-app-services layer. The only non-business-logic classes allowed are the framework's own building blocks — controllers, jobs, console commands, listeners, events, Livewire components, middleware, FormRequests, Mailables, Notifications, policies, service providers, custom Rule classes, Enums, DTOs, Eloquent models, and framework boilerplate. All other logic must be split by responsibility into the dedicated classes defined by pekral/arch-app-services — Actions, Model Services (Pekral\Arch\Service\BaseModelService), Repositories (Pekral\Arch\Repository\Mysql\BaseRepository), ModelManagers (Pekral\Arch\ModelManager\Mysql\BaseModelManager), Data Validators (Pekral\Arch\DataValidation\DataValidator), and Data Builders (Pekral\Arch\DataBuilder\DataBuilder). Introducing an ad-hoc class that is neither a Laravel-native type nor one of these arch-app-services layers (a bare Helper, Manager, Handler, Util, Processor, Builder, Mapper, Validator, Service that does not extend BaseModelService, etc.) to host business logic is forbidden — move that logic into the correct layer above. An application-owned Facade is never one of those homes — the service layer caps at BaseModelService, see Model ServicesNo application Facades.
  • Actions return plain domain data, never HTTP responses. An Action's __invoke() returns a domain value (a Model, a DTO, a Collection, a scalar, void) — never an Illuminate\Http\Response / JsonResponse / RedirectResponse, and never the result of response(), response()->json(), redirect(), back(), view(), or any other HTTP-response builder. Translating domain data into an HTTP response (status code, headers, JSON envelope, redirect) is always the controller's job — the controller is the single owner of client↔server communication. Jobs, commands, and listeners likewise consume the Action's domain return value directly.

Read the full file on GitHub · 344 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. yesterday First seen · 344 lines · 0 tokens per session scan A 8e1ce40236c9

Subscribe to this mod's changes

architecture is a cursor rule published in the GitHub repository pekral/cursor-rules (6 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 14,929 tokens. 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-08-31.