Skip to content
filament-resource-generator logo

Filament Resource Generator - Quick Workflow

filament-resource-generator

Automated Filament resource generation with correct namespace imports (Schemas vs Forms), Vietnamese labels, standard structure, Observer patterns, ImagesRelationManager integration. USE WHEN user says 'tạo resource mới', 'create new resource', 'generate Filament resource', 'scaffold admin resour...

SKILL.md

Full skill instructions

Filament Resource Generator - Quick Workflow

Generate standardized Filament resources with correct namespaces, Vietnamese labels, and Observer patterns.

When to Activate This Skill

  • User says "tạo resource mới cho [Model]"
  • User says "create new resource"
  • User wants to "scaffold admin panel"
  • Adding new entity to Filament admin

Quick Workflow

1. Gather Requirements

Ask user:

  • Model name (singular): Product, Category, Article
  • Has images? Gallery or single featured image?
  • Relationships? BelongsTo, BelongsToMany
  • Need ordering? Drag-drop reordering (requires order column)
  • SEO fields? Usually yes (slug, meta_title, meta_description)

2. Generate Resource

php artisan make:filament-resource Product --generate

Creates:

app/​Filament/​Resources/​Products/
├── ProductResource.php
├── Pages/
│   ├── ListProducts.php
│   ├── CreateProduct.php
│   └── EditProduct.php

3. Update Resource

Critical namespaces:

// Layout components → Schemas
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Section;

// Form fields → Forms
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Toggle;

// Schema (NOT Form!)
use Filament\Schemas\Schema;

Vietnamese labels:

protected static ?string $navigationLabel = 'Sản phẩm';
protected static ?string $modelLabel = 'Sản phẩm';
protected static ?string $pluralModelLabel = 'Các sản phẩm';
protected static ?string $navigationIcon = 'heroicon-o-shopping-bag';

Navigation badge:

public static function getNavigationBadge(): ?string
{
    return (string) static::getModel()::where('active', true)->count();
}

4. Implement Form & Table

// Form with Tabs
public static function form(Schema $schema): Schema {
    return $schema->schema([
        Tabs::make()->tabs([
            Tabs\Tab::make('Thông tin')->schema([
                TextInput::make('name')->label('Tên')->required(),
                Select::make('category_id')->label('Danh mục')->relationship('category', 'name'),
                Toggle::make('active')->label('Hiển thị')->default(true),
            ]),
        ])->columnSpanFull(),
    ]);
}

// Table with eager loading
public static function table(Table $table): Table {
    return $table
        ->modifyQueryUsing(fn($q) => $q->with(['category']))
        ->reorderable('order')  // If has order column
        ->columns([
            TextColumn::make('name')->label('Tên')->searchable(),
            ToggleColumn::make('active')->label('Hiển thị'),
        ])
        ->recordActions([EditAction::make()->iconButton()]);
}

5. Create Observer

class ProductObserver {
    public function creating(Product $p): void {
        if (empty($p->slug)) $p->slug = Str::slug($p->name);
        if (empty($p->meta_title)) $p->meta_title = $p->name;
        if ($p->order === null) $p->order = (Product::max('order') ?? 0) + 1;
    }
}

// AppServiceProvider::boot()
Product::observe(ProductObserver::class);

6. Add Images (Optional)

// Model
public function images(): MorphMany {
    return $this->morphMany(Image::class, 'model');
}

// Resource
public static function getRelations(): array {
    return [ImagesRelationManager::class];
}

Checklist

Before declaring resource complete:

  • Correct namespaces (Schemas vs Forms)
  • Vietnamese labels (100%)
  • Form with Tabs/​Grid structure
  • Table with eager loading
  • Reorderable if order column
  • ImagesRelationManager if images
  • Observer for SEO + order
  • Observer registered in AppServiceProvider
  • Navigation badge showing count
  • Tested create/​edit/​delete

Key Principles

  1. Namespace correctness: Schemas for layouts, Forms for fields
  2. Vietnamese first: All labels tiếng Việt
  3. Observer patterns: SEO auto-generated, hidden from form
  4. Eager loading: Always modifyQueryUsing() for relations
  5. Standard structure: Tabs → Grid → Fields

References

Detailed implementations: read .claude/​skills/​filament/​filament-resource-generator/​references/​detailed-implementation.md Complete guide: read .claude/​skills/​filament/​filament-resource-generator/​CLAUDE.md

Related: filament-rules, image-management, filament-form-debugger

More Marketing skills

copywriting logo
Marketing

copywriting

Marketing copy for homepages, landing pages, pricing pages, and other conversion-focused web pages.

53.3K 216.1K
View
flux-2-klein logo
Marketing

flux-2-klein

Fast image generation with Flux 2 Klein, optimized for sub-second iteration and multi-reference brand styling.

52 176.2K
View

Psychological principles and mental models for understanding customer behavior and influencing marketing decisions.

53.3K 153K
View

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
ai-seo logo
Marketing

ai-seo

Optimize content for discovery, citation, and visibility across AI search platforms and LLM assistants.

53.3K 136.7K
View
copy-editing logo
Marketing

copy-editing

Systematic improvement of existing marketing copy through seven focused editing passes.

53.3K 136.4K
View

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View
revops logo
Marketing

revops

Design and optimize systems connecting marketing, sales, and customer success into a unified revenue engine.

53.3K 104.9K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Convert websites into professional HyperFrames videos with guided storyboarding and brand-aligned composition.

57K 93.5K
View

Sales & marketing AI tools

KreadoAI logo
Sales & marketing

KreadoAI

Revolutionize Video Creation with AI-Generated Avatars and Voices

Paid
View
Followr logo
Sales & marketing

Followr

Social media on autopilot

Paid
View
Logodiffusion logo
Sales & marketing

Logodiffusion

Design custom logos instantly with AI.

Paid
View
I
Sales & marketing

Ideogram

Text-heavy marketing and design images

Freemium
View
Prompt Silo logo
Sales & marketing

Prompt Silo

Boost Your SEO with Content and SEO Silos

Free
View
Marketing Blocks logo
Sales & marketing

Marketing Blocks

Revolutionize Your Marketing with AI-Powered MarketingBlocks!

Paid
View
Scrip AI logo
Sales & marketing

Scrip AI

10X faster & free AI content creation for 100+ use cases

Free
View
Tribescaler logo
Sales & marketing

Tribescaler

Tribescaler | Make Your Tweets Go Viral

Paid
View