Agent skill
laravel-migrations
Create database migrations with schema builder, indexes, foreign keys, and seeders. Use when designing database schema, creating tables, or modifying columns.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/laravel-migrations
SKILL.md
Laravel Migrations
Documentation
Database
- database.md - Database basics
- migrations.md - Migrations
- seeding.md - Database seeding
- queries.md - Query builder
- mongodb.md - MongoDB integration
Migration Template
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('title');
$table->string('slug')->unique();
$table->text('content');
$table->string('status')->default('draft');
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['status', 'published_at']);
});
}
public function down(): void
{
Schema::dropIfExists('posts');
}
};
Column Types
$table->string('name', 100); // VARCHAR(100)
$table->text('description'); // TEXT
$table->integer('count'); // INT
$table->decimal('price', 8, 2); // DECIMAL(8,2)
$table->boolean('is_active'); // BOOLEAN
$table->json('metadata'); // JSON
$table->timestamps(); // created_at, updated_at
$table->softDeletes(); // deleted_at
Foreign Keys
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('author_id')->constrained('users')->nullOnDelete();
Seeder
<?php
declare(strict_types=1);
namespace Database\Seeders;
final class PostSeeder extends Seeder
{
public function run(): void
{
User::factory()->count(10)->create()->each(function (User $user) {
Post::factory()->count(5)->for($user)->create();
});
}
}
Commands
php artisan make:migration create_posts_table
php artisan migrate
php artisan migrate:fresh --seed
php artisan migrate:rollback --step=3
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?