laravel-upgrade
Laravelアプリケーションをメジャーバージョンごとに最新化し、composer.jsonから現在のバージョンを自動検出し、必要なコード修正を適用するSkill。
📜 元の英語説明(参考)
Upgrade Laravel applications one major version at a time (9→10, 10→11, 11→12). Use when user wants to upgrade their Laravel framework version. Auto-detects current version from composer.json, identifies breaking changes, and applies necessary code fixes.
🇯🇵 日本人クリエイター向け解説
Laravelアプリケーションをメジャーバージョンごとに最新化し、composer.jsonから現在のバージョンを自動検出し、必要なコード修正を適用するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Laravel アップグレード
Laravel アプリケーションをメジャーバージョンごとに1つずつアップグレードします。9→10、10→11、11→12 をサポートしています。
ワークフロー
1. 現在のバージョンを検出する
composer.json を読み込み、laravel/framework のバージョン制約を見つけます。
// 例: "laravel/framework": "^10.0" は Laravel 10.x を意味します
ターゲットバージョン (現在のバージョン + 1) を決定します。すでに Laravel 12 の場合は、サポートされている最新バージョンであることをユーザーに伝えます。
2. アップグレードガイドを読み込む
検出されたバージョンに基づいて、適切なリファレンスファイルを読み込みます。
| 現在 | ターゲット | リファレンスファイル |
|---|---|---|
| 9.x | 10.x | references/from-9-to-10.md |
| 10.x | 11.x | references/from-10-to-11.md |
| 11.x | 12.x | references/from-11-to-12.md |
3. スキャンと修正
ガイドに記載されている各破壊的変更について、コードベースをスキャンし、修正を適用します。
高影響 (常に確認):
composer.jsonの依存関係バージョン- PHP バージョン要件
- 非推奨のメソッドを使用しているデータベースマイグレーション
中影響 (関連ファイルを確認):
- モデルの
$datesプロパティ →$casts(9→10) (string)キャストを使用するデータベース式 (9→10)- 属性が欠落しているカラム変更マイグレーション (10→11)
HasUuidsトレイトの動作変更 (11→12)
低影響 (パターンが見つかった場合のみ確認):
- 非推奨のメソッド呼び出し (
Bus::dispatchNow、Redirect::homeなど) - 契約インターフェースの変更
- 設定ファイルの更新
4. 依存関係の更新
コード修正後、composer.json を更新します。
# laravel/framework の制約をターゲットバージョンに更新
# アップグレードガイドに従って関連パッケージを更新
composer update
5. アップグレード後の検証
php artisanを実行してフレームワークが起動することを確認します- 利用可能な場合はテストスイートを実行します
- ログ内の非推奨警告を確認します
一般的なパターン
依存関係の更新 (すべてのアップグレード)
composer.json で古い制約を検索し、ガイドに従って更新します。
モデルの $dates から $casts へ (9→10)
// Before
protected $dates = ['deployed_at'];
// After
protected $casts = ['deployed_at' => 'datetime'];
検索パターン: protected \$dates\s*=
データベース式のキャスト (9→10)
// Before
$string = (string) DB::raw('select 1');
// After
$string = DB::raw('select 1')->getValue(DB::connection()->getQueryGrammar());
カラムの変更 (10→11)
->change() を使用するマイグレーションは、すべての修飾子を含める必要があります。
// Before (暗黙的な保持)
$table->integer('votes')->nullable()->change();
// After (明示的)
$table->integer('votes')->unsigned()->default(1)->nullable()->change();
HasUuids トレイト (11→12)
// Before (順序付き UUIDv4)
use Illuminate\Database\Eloquent\Concerns\HasUuids;
// After (UUIDv4 の動作が必要な場合)
use Illuminate\Database\Eloquent\Concerns\HasVersion4Uuids as HasUuids; 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Laravel Upgrade
Upgrade Laravel applications one major version at a time. Supports: 9→10, 10→11, 11→12.
Workflow
1. Detect Current Version
Read composer.json and find the laravel/framework version constraint:
// Example: "laravel/framework": "^10.0" means Laravel 10.x
Determine target version (current + 1). If already on Laravel 12, inform user they're on the latest supported version.
2. Load Upgrade Guide
Based on detected versions, read the appropriate reference file:
| Current | Target | Reference File |
|---|---|---|
| 9.x | 10.x | references/from-9-to-10.md |
| 10.x | 11.x | references/from-10-to-11.md |
| 11.x | 12.x | references/from-11-to-12.md |
3. Scan and Fix
For each breaking change in the guide, scan the codebase and apply fixes:
High Impact (always check):
composer.jsondependency versions- PHP version requirements
- Database migrations using deprecated methods
Medium Impact (check relevant files):
- Model
$datesproperty →$casts(9→10) - Database expressions with
(string)casting (9→10) - Column modification migrations missing attributes (10→11)
HasUuidstrait behavior change (11→12)
Low Impact (check if patterns found):
- Deprecated method calls (
Bus::dispatchNow,Redirect::home, etc.) - Contract interface changes
- Configuration file updates
4. Update Dependencies
After code fixes, update composer.json:
# Update laravel/framework constraint to target version
# Update related packages per upgrade guide
composer update
5. Post-Upgrade Verification
- Run
php artisanto verify framework boots - Run test suite if available
- Check for deprecation warnings in logs
Common Patterns
Dependency Updates (all upgrades)
Search composer.json for outdated constraints and update per guide.
Model $dates to $casts (9→10)
// Before
protected $dates = ['deployed_at'];
// After
protected $casts = ['deployed_at' => 'datetime'];
Search pattern: protected \$dates\s*=
Database Expression Casting (9→10)
// Before
$string = (string) DB::raw('select 1');
// After
$string = DB::raw('select 1')->getValue(DB::connection()->getQueryGrammar());
Column Modification (10→11)
Migrations using ->change() must now include all modifiers:
// Before (implicit retention)
$table->integer('votes')->nullable()->change();
// After (explicit)
$table->integer('votes')->unsigned()->default(1)->nullable()->change();
HasUuids Trait (11→12)
// Before (ordered UUIDv4)
use Illuminate\Database\Eloquent\Concerns\HasUuids;
// After (if you need UUIDv4 behavior)
use Illuminate\Database\Eloquent\Concerns\HasVersion4Uuids as HasUuids;