Creates structured PHP classes for handling Excel data imports.
Install
mkdir -p .claude/skills/import && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6439" && unzip -o skill.zip -d .claude/skills/import && rm skill.zipInstalls to .claude/skills/import
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Generate Excel import class for CatchAdmin module.Key capabilities
- →Generates Laravel-based Import class files
- →Includes automatic column mapping logic
- →Implements basic data validation per row
- →Creates boilerplate controller methods
How it works
Generates source code using a predefined PHP template structure and maps Excel cell indices to database model fields.
Inputs & outputs
When to use import
- →Importing bulk data
- →Creating Excel upload controllers
- →Mapping CSV columns to database models
About this skill
Step 8: Generate Import Class
创建数据导入类。
File Location
modules/{Module}/Import/{Model}.php
Template
<?php
namespace Modules\{Module}\Import;
use Catch\Support\Excel\Import;
use Illuminate\Support\Collection;
use Modules\{Module}\Models\{Model};
class {Model} extends Import
{
public function collection(Collection $rows): void
{
// Skip header row
$rows->skip(1)->each(function ($row) {
{Model}::create([
'name' => $row[0],
// map other columns
]);
});
}
}
Column Mapping
Excel 列索引从 0 开始:
- Column A =
$row[0] - Column B =
$row[1] - Column C =
$row[2]
With Validation
public function collection(Collection $rows): void
{
$rows->skip(1)->each(function ($row, $index) {
$data = [
'name' => $row[0] ?? null,
'email' => $row[1] ?? null,
];
$validator = Validator::make($data, [
'name' => 'required|string|max:100',
'email' => 'required|email',
]);
if ($validator->fails()) {
return; // Skip invalid row
}
{Model}::create($data);
});
}
Controller Usage
public function import(Request $request, {Model}Import $import)
{
return $import->import($request->file('file'));
}
When not to use it
- →Complex multi-table database transactions
- →Non-CatchAdmin framework environments
- →Custom file formats beyond standard Excel
Prerequisites
Limitations
- →Requires manual column adjustment for non-standard Excel layouts
- →Limited to CatchAdmin framework conventions
How it compares
Automates the boilerplate of manual PHP class creation and row-by-row mapping logic.
Compared to similar skills
import side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| import (this skill) | 1 | 6mo | No flags | Beginner |
| controller | 1 | 6mo | No flags | Beginner |
| laravel-backup | 0 | 3mo | Review | Intermediate |
| laravel-pdf | 11 | 3mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by JaguarJack
View all by JaguarJack →You might also like
controller
JaguarJack
Generate CRUD controller for CatchAdmin module.
laravel-backup
Scanix
Configure and extend spatie/laravel-backup for database and file backups, cleanup strategies, health monitoring, and notifications. Activates when working with backup configuration, scheduling backups, creating custom cleanup strategies or health checks, customizing notifications, or when the user m
laravel-pdf
spatie
Generate PDFs from Blade views or HTML using spatie/laravel-pdf. Covers creating, formatting, saving, downloading, and testing PDFs with the Browsershot, Cloudflare, or DOMPDF driver.
laravel-specialist
Jeffallan
Use when building Laravel 10+ applications requiring Eloquent ORM, API resources, or queue systems. Invoke for Laravel models, Livewire components, Sanctum authentication, Horizon queues.
pennant-development
laravel
Manages feature flags with Laravel Pennant. Activates when creating, checking, or toggling feature flags; showing or hiding features conditionally; implementing A/B testing; working with @feature directive; or when the user mentions feature flags, feature toggles, Pennant, conditional features, rollouts, or gradually enabling features.
developing-shopper
shopperlabs
Provides coding standards and patterns for Laravel Shopper development. Use when creating or modifying Models, Actions, Enums, Livewire components, migrations, or tests in any Shopper package.