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.zip

Installs 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.
50 charsno explicit “when” trigger
Beginner

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

You give it
Model name and column/validation requirements
You get back
Validated PHP import class file and controller snippet

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

CatchAdmin framework installed

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.

SkillInstallsUpdatedSafetyDifficulty
import (this skill)16moNo flagsBeginner
controller16moNo flagsBeginner
laravel-backup03moReviewIntermediate
laravel-pdf113moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry