← Back to list

manage-seeders
by iurygdeoliveira
Repositorio destinado a fornecer um kit inicial para desenvolvimento de SaaS usando laravel e filament
⭐ 29🍴 12📅 Jan 20, 2026
SKILL.md
name: manage-seeders description: Manages Database Seeders with advanced support for JSON data sources, idempotency checks, and relationship mapping.
Database Seeder Manager Skill
Use this skill to create or refactor Seeders, especially when moving from hardcoded data to JSON files or factories.
Core Rules
1. Idempotency (Run Multiple Times Safe)
- Seeders MUST be safe to run multiple times without creating duplicate dirty data.
- Use
updateOrCreateorfirstOrCreatebased on a unique key (e.g.,slug,email,code).
2. JSON Data Source Pattern
When populating data from JSON files (e.g., database/data/*.json):
- Read File: Use
file_get_contentsandjson_decode. - Iterate: Loop through the array.
- Persist: Use
updateOrCreate.
$json = file_get_contents(database_path('data/categories.json'));
$categories = json_decode($json, true);
foreach ($categories as $data) {
Category::updateOrCreate(
['slug' => $data['slug']], // Unique Key
[
'name' => $data['name'],
'description' => $data['description'] ?? null,
]
);
}
3. Removing IDs
- Never force
idfrom JSON unless it's a critical system constant. Let the database Auto-Increment handle IDs. - If relationships rely on specific "codes" in the JSON, look up the related ID by that code, do not hardcode the foreign ID.
4. Registration
- Always check if the Seeder is called in
DatabaseSeeder.php. If not, register it.
Score
Total Score
80/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon

