Boilerplate generation for data export in CatchAdmin modules.

Install

mkdir -p .claude/skills/export && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2862" && unzip -o skill.zip -d .claude/skills/export && rm skill.zip

Installs to .claude/skills/export

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 export class for CatchAdmin module.
50 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Generate PHP export classes for CatchAdmin modules
  • Define custom header mappings for exported data
  • Export database model relationships to Excel
  • Implement controller-based download methods

How it works

The skill generates a PHP class extending the base Export class, which uses the model query to fetch data and map it to specified headers. It supports relationship loading through Eloquent's with method.

Inputs & outputs

You give it
Database model data and header definitions
You get back
Excel file download

When to use export

  • Create Excel export class
  • Define header mappings for exports
  • Export database relations to Excel

About this skill

Step 7: Generate Export Class

创建数据导出类。

File Location

modules/{Module}/Export/{Model}.php

Template

<?php

namespace Modules\{Module}\Export;

use Catch\Support\Excel\Export;

class {Model} extends Export
{
    protected array $header = [
        'ID', 'Name', 'Created At'
    ];

    public function array(): array
    {
        return \Modules\{Module}\Models\{Model}::query()
            ->select('id', 'name', 'created_at')
            ->get()
            ->toArray();
    }
}

Header Mapping

FieldHeader
idID
nameName
emailEmail
statusStatus
created_atCreated At

With Relationships

public function array(): array
{
    return {Model}::query()
        ->with('category')
        ->get()
        ->map(fn ($item) => [
            $item->id,
            $item->name,
            $item->category?->name ?? '-',
            $item->created_at,
        ])
        ->toArray();
}

Controller Usage

public function export(): mixed
{
    return {Model}::query()
        ->select('id', 'name', 'created_at')
        ->get()
        ->download(['ID', 'Name', 'Created At']);
}

When not to use it

  • Exporting data outside of the CatchAdmin module structure

Limitations

  • Requires specific file location structure within modules

How it compares

This approach automates the creation of standardized export classes within the CatchAdmin framework instead of manually writing query-to-Excel logic.

Compared to similar skills

export side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
export (this skill)16moNo flagsIntermediate
import16moNo flagsBeginner
woocommerce-code-review63moNo flagsIntermediate
laravel-pdf113moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry