Agent skill

Model

by JaguarJack in JaguarJack/catch-admin

Generate Eloquent model for CatchAdmin module with full CatchModel features.

Apache-2.0Auto-check passedDocuments & Office

Install Model

skills CLI
$ npx skills add JaguarJack/catch-admin --skill model -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install JaguarJack/catch-admin model --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/JaguarJack/catch-admin.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/03-model .claude/skills/model && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
model
GitHub stars
935
Token cost
~1.7k tokens
SKILL.md length
102 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Generate Eloquent model for CatchAdmin module with full CatchModel features.

  • Documents & Office work in your project
  • SKILL.md covers File Location, Complete Template, CatchModel 核心属性 and CatchModel CRUD 方法, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Model is an agent skill from JaguarJack/catch-admin. Generate Eloquent model for CatchAdmin module with full CatchModel features.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Documents & Office. It works with Vue.js and Laravel. The repository describes itself as: CatchAdmin 是一个功能强大、易于扩展的现代化 PHP 后台管理系统。它采用前后端分离架构,CatchAdmin 集成了 Token 鉴权、权限管理、动态路由、动态表格、分页封装、资源权限、上传下载、代码生成器支持一键导出导入,数据回收站,附件管理的等等一系列实用的开发功能的模块化框架。官网地址:. The licence is Apache-2.0.

When your agent uses it

  • Documents & Office work in your project

Example prompts

  • “/model”

What it can do on your machine

Read from SKILL.md and the folder at commit e83d5aa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are php).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Model loads about 1.7k tokens when it runs. Until then it costs about 21 tokens; SKILL.md has 102 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~21
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from JaguarJack/catch-admin at commit e83d5aa, republished under its Apache-2.0 licence (© JaguarJack). 102 words, ~1,729 tokens.

Download SKILL.mdSave it as .claude/skills/model/SKILL.md (or your agent's skills folder).
name
model
description
Generate Eloquent model for CatchAdmin module with full CatchModel features.

Step 3: Generate Model

创建 Eloquent 模型,继承 Catch\Base\CatchModel。

File Location

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

Complete Template

php
<?php

namespace Modules\{Module}\Models;

use Catch\Base\CatchModel as Model;
use Catch\Enums\Status;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;

class {Model} extends Model
{
    protected $table = '{table}';

    protected $fillable = [
        'id',
        // business fields
        'creator_id',
        'created_at',
        'updated_at',
        'deleted_at',
    ];

    /**
     * 搜索字段配置
     * Operators: like, =, in, between
     */
    public array $searchable = [
        'name' => 'like',
        'status' => '=',
        'category_id' => '=',
    ];

    /**
     * 列表查询字段
     */
    protected array $fields = [
        'id', 'name', 'status', 'created_at'
    ];

    /**
     * 表单提交字段
     */
    protected array $form = [
        'name', 'status'
    ];

    /**
     * 表单关联同步 (多对多)
     */
    protected array $formRelations = ['roles', 'tags'];

    /**
     * 排序字段
     */
    protected string $sortField = 'sort';

    /**
     * 降序排序
     */
    protected bool $sortDesc = true;

    /**
     * 树形结构 (parent_id)
     */
    protected string $parentIdColumn = 'parent_id';

    /**
     * 是否返回树形结构
     */
    protected bool $asTree = false;

    // Relationships
    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class, 'category_id');
    }
}

CatchModel 核心属性

属性类型默认值说明
$fillablearray[]可填充字段
$searchablearray[]搜索字段及操作符
$fieldsarray['*']列表查询字段
$formarray[]表单提交字段
$formRelationsarray[]表单关联同步
$sortFieldstring''排序字段
$sortDescbooltrue是否降序
$parentIdColumnstring'parent_id'父级字段
$asTreeboolfalse返回树形结构
$isPaginatebooltrue是否分页
$dataRangeboolfalse数据权限
$isFillCreatorIdbooltrue自动填充创建人

CatchModel CRUD 方法

列表查询
php
// 基础列表 (自动分页、搜索、排序)
$this->model->getList();

// 自定义查询条件
$this->model->setBeforeGetList(function ($query) {
    return $query->where('type', 1);
})->getList();

// 禁用分页
$this->model->disablePaginate()->getList();

// 返回树形结构
$this->model->asTree()->getList();
创建记录
php
// 创建并返回 ID
$this->model->storeBy($data);

// 创建新实例
$this->model->createBy($data);
更新记录
php
// 更新单条
$this->model->updateBy($id, $data);

// 批量更新
$this->model->batchUpdate('id', [1, 2, 3], [
    'status' => [1, 2, 1],
]);
删除记录
php
// 软删除
$this->model->deleteBy($id);

// 强制删除
$this->model->deleteBy($id, force: true);

// 批量删除
$this->model->deletesBy('1,2,3');
$this->model->deletesBy([1, 2, 3]);
其他操作
php
// 查询单条
$this->model->firstBy($id);
$this->model->firstBy($value, 'field');

// 切换状态
$this->model->toggleBy($id);
$this->model->toggleBy($id, 'is_active');

// 恢复软删除
$this->model->restoreBy($id);
$this->model->restoreBy('1,2,3');

搜索操作符

php
public array $searchable = [
    'name' => 'like',      // LIKE '%value%'
    'title' => '%like',    // LIKE '%value'
    'code' => 'like%',     // LIKE 'value%'
    'status' => '=',       // = value
    'type' => 'in',        // IN (values)
    'created_at' => 'between', // BETWEEN start AND end
    'price' => '>',        // > value
    'stock' => '>=',       // >= value
];

关联关系

BelongsTo (多对一)
php
public function category(): BelongsTo
{
    return $this->belongsTo(Category::class, 'category_id');
}

public function creator(): BelongsTo
{
    return $this->belongsTo(\Modules\User\Models\User::class, 'creator_id');
}
HasMany (一对多)
php
public function items(): HasMany
{
    return $this->hasMany(OrderItem::class, 'order_id');
}
BelongsToMany (多对多)
php
// 需要在 $formRelations 中声明才能自动同步
protected array $formRelations = ['roles', 'tags'];

public function roles(): BelongsToMany
{
    return $this->belongsToMany(
        Role::class,
        'user_has_roles',  // pivot table
        'user_id',
        'role_id'
    );
}

public function tags(): BelongsToMany
{
    return $this->belongsToMany(Tag::class, 'product_tags');
}
树形关系 (自关联)
php
protected string $parentIdColumn = 'parent_id';

public function parent(): BelongsTo
{
    return $this->belongsTo(self::class, 'parent_id');
}

public function children(): HasMany
{
    return $this->hasMany(self::class, 'parent_id');
}

属性访问器 & 修改器

php
use Illuminate\Database\Eloquent\Casts\Attribute;

// 密码加密
protected function password(): Attribute
{
    return new Attribute(
        set: fn ($value) => bcrypt($value),
    );
}

// 状态标签
protected function statusLabel(): Attribute
{
    return new Attribute(
        get: fn () => $this->status == 1 ? '启用' : '禁用',
    );
}

// JSON 字段
protected function options(): Attribute
{
    return new Attribute(
        get: fn ($value) => json_decode($value, true) ?? [],
        set: fn ($value) => json_encode($value),
    );
}

状态枚举

php
use Catch\Enums\Status;

public function isEnabled(): bool
{
    return Status::Enable->assert($this->status);
}

public function isDisabled(): bool
{
    return Status::Disable->assert($this->status);
}

重写方法

自定义更新逻辑
php
public function updateBy($id, array $data): mixed
{
    // 密码为空时不更新
    if (empty($data['password'])) {
        unset($data['password']);
    }

    return parent::updateBy($id, $data);
}
自定义删除逻辑
php
public function deleteBy($id, bool $force = false, bool $softForce = false): ?bool
{
    return $this->transaction(function () use ($id) {
        // 删除关联数据
        $this->items()->where('order_id', $id)->delete();
        
        return parent::deleteBy($id);
    });
}

查询作用域

php
use Illuminate\Database\Eloquent\Builder;

public function scopeActive(Builder $query): Builder
{
    return $query->where('status', 1);
}

public function scopeOfType(Builder $query, int $type): Builder
{
    return $query->where('type', $type);
}

// 使用
Model::active()->ofType(1)->get();

关联预加载

php
// 在模型中定义默认预加载
protected $with = ['category'];

// 在控制器中
public function show($id): mixed
{
    return $this->model
        ->with(['category', 'tags'])
        ->firstBy($id);
}

外键字段自动检测规则

字段名关联方法关联模型
category_idcategory()Category::class
user_iduser()User::class
department_iddepartment()Departments::class
parent_idparent()self::class

© JaguarJack, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/03-model of JaguarJack/catch-admin.

Open the folder on GitHubat commit e83d5aa

Compare with similar skills

Model next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Model compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Model this skillJaguarJack/catch-admin935—~1.7kAutomated safety check: PassApache-2.0
Livewire Developmentcoollabsio/coolify63k—~964Automated safety check: PassMIT
Livewire Developmentyungifez/skuul4091 repos~1.9kAutomated safety check: PassMIT
Medialibrary Developmentgdarko/laravel-vue-starter1453 repos~880Automated safety check: PassMIT
Wayfinder Developmentslimani-dev/muraqib1281 repos~622Automated safety check: PassMIT
Configure Nightwatchtrypostit/trypost676—~2.7kAutomated safety check: PassMIT

Similar skills

  • Livewire Development

    coollabsio/coolify

    A skill your agent uses for any task or question involving Livewire.

    63k GitHub stars~964 tokensUpdated today
    Backend & APIsAuto-check passed
  • Livewire Development

    yungifez/skuul

    A skill your agent uses for any task or question involving Livewire.

    409 GitHub starsUsed in 1 repo~1.9k tokens
    Backend & APIsAuto-check passed
  • Medialibrary Development

    gdarko/laravel-vue-starter

    Build and work with spatie/laravel-medialibrary features including associating files with Eloquent models, defining media collections and conversions, generating responsive images, and retrieving…

    145 GitHub starsUsed in 3 repos~880 tokens
    Backend & APIsAuto-check passed
  • Wayfinder Development

    slimani-dev/muraqib

    A skill your agent uses for Laravel Wayfinder which auto-generates typed functions for Laravel controllers and routes.

    128 GitHub starsUsed in 1 repo~622 tokens
    Backend & APIsAuto-check passed
  • Configure Nightwatch

    trypostit/trypost

    Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies.

    676 GitHub stars~2.7k tokensUpdated today
    Backend & APIsAuto-check passed
  • Passport Development

    trypostit/trypost

    Develops OAuth2 API authentication with Laravel Passport. An agent skill from trypostit/trypost.

    676 GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed

More from JaguarJack/catch-admin

All 10 skills in this repo
  • Curd

    JaguarJack/catch-admin

    Generates complete CRUD module from database table definition.

    935 GitHub stars~3.3k tokensUpdated 21 days ago
    Auto-check passed
  • Controller

    JaguarJack/catch-admin

    Generate CRUD controller for CatchAdmin module. An agent skill from JaguarJack/catch-admin.

    935 GitHub stars~523 tokensUpdated 21 days ago
    Auto-check passed
  • Migration

    JaguarJack/catch-admin

    Generate database migration file for CatchAdmin module. An agent skill from JaguarJack/catch-admin.

    935 GitHub stars~474 tokensUpdated 21 days ago
    Auto-check passed
  • Parse Table

    JaguarJack/catch-admin

    Parse table definition to extract module name, model name, table name, and field definitions.

    935 GitHub stars~520 tokensUpdated 21 days ago
    Auto-check passed
  • Vue Pages

    JaguarJack/catch-admin

    Generate Vue frontend pages using catch-table for CatchAdmin module with full component features.

    935 GitHub stars~2.6k tokensUpdated 21 days ago
    Auto-check passed
  • Export

    JaguarJack/catch-admin

    Generate Excel export class for CatchAdmin module. An agent skill from JaguarJack/catch-admin.

    935 GitHub stars~321 tokensUpdated 21 days ago
    Auto-check passed

Works with

Questions about Model

What does Model do?

Generate Eloquent model for CatchAdmin module with full CatchModel features. Model is an agent skill from JaguarJack/catch-admin. Generate Eloquent model for CatchAdmin module with full CatchModel features.

When should I use Model?

Model fits situations like: documents & Office work in your project.

How do I install Model in Claude Code?

Run `npx skills add JaguarJack/catch-admin --skill model -a claude-code`. Or copy the skill folder (.claude/skills/03-model in JaguarJack/catch-admin) into .claude/skills/model in your project. Claude Code loads it when a task matches its description.

How do I install Model in Codex?

Run `npx skills add JaguarJack/catch-admin --skill model -a codex`. Or copy the skill folder (.claude/skills/03-model in JaguarJack/catch-admin) into .agents/skills/model in your project. Codex loads it when a task matches its description.

Can I use Model in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add JaguarJack/catch-admin --skill model -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/model, .gemini/skills/model, .github/skills/model and .opencode/skills/model in your project.

What does Model need to run?

SKILL.md names no scripts, command-line tools or credentials: Model is instructions for the agent only.

Does Model access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Model safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Model use?

Model is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Model use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Model?

Skills that share tags, products or a category with Model: Livewire Development (coollabsio/coolify, 63k stars), Livewire Development (yungifez/skuul, 409 stars), Medialibrary Development (gdarko/laravel-vue-starter, 145 stars) and Wayfinder Development (slimani-dev/muraqib, 128 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Model?

JaguarJack (a GitHub user) maintains it in JaguarJack/catch-admin, which has 935 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on September 16, 2026.

Source: JaguarJack/catch-admin on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.