mcpField
L
laravel:nova:resource-patterns

laravel:nova:resource-patterns

github.com/jpcaparasDevelopment157108 installsUpdated 17w ago
Repository

About laravel:nova:resource-patterns

A Laravel Nova development skill for building consistent resources, with guidance on fields, authorization, actions, filters, metrics, organization, and tests.

Key features

  1. 01Order fields and relationships
  2. 02Configure policies and query scopes
  3. 03Design guarded actions with feedback
  4. 04Distinguish filters from task views
  5. 05Organize metrics and resources
  6. 06Test policies, queries, and actions

Use cases

  1. 01Build Nova resources aligned with domain models
  2. 02Restrict search results for unauthorized users
  3. 03Add safeguards and feedback to resource actions
  4. 04Test policies, query scopes, and action outcomes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel:nova:resource-patterns

After installing, type/laravel:nova:resource-patternsin Claude Code to confirm it loaded.

Details

From the project README

Nova Resource Patterns

Build consistent Nova resources that mirror domain models and evolve safely.

Fields

  • Keep fields ordered: identifiers → primary attributes → relations → meta
  • Use ->sortable()/->filterable() where it delivers value
  • Hide sensitive fields (e.g., tokens) from index/detail unless necessary
  • Prefer BelongsTo/HasMany/Morph* relations with searchable constraints

Authorization

  • Use Nova policies mirroring model policies for viewAny, view, create, update, delete
  • Avoid leaking existence via unauthorized search; scope queries

Actions

  • Keep actions idempotent or provide safeguards
  • Provide confirmation messages and clear result feedback

Filters & Lenses

  • Filters: simple, commonly used constraints (status, owner, date range)
  • Lenses: opinionated, task‑centric views (e.g., stale items)

Metrics

  • Value/Trend/Partition metrics for essentials; cache appropriately
  • Use explicit time ranges; label units clearly

Resource Organization

  • Group resources by domain (navigation grouping)
  • Keep display titles meaningful; use title() consistently

Testing

  • Prefer feature tests that exercise policy + query scope + resource logic
  • For actions, test success and failure states with realistic seed data

Comments

Markdown supported