crud-migration

crud-migration is a skill for Claude Code, Codex from ArtisanCloud/PowerX. It costs 21 tokens per session (1,614 once invoked), scanned A, original, Apache-2.0.

PowerX CRUD Migration 规则(集中迁移挂载与入口约束)。.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/artisancloud/powerx/migration
Any agent
npx skills add ArtisanCloud/PowerX --skill migration
Clone the repo
git clone --depth 1 https://github.com/ArtisanCloud/PowerX

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for crud-migration

README.md
[![agentmods](https://agentmods.dev/badge/skills/artisancloud/powerx/migration.svg)](https://agentmods.dev/skills/artisancloud/powerx/migration)
Your own site
<a href="https://agentmods.dev/skills/artisancloud/powerx/migration"><img src="https://agentmods.dev/badge/skills/artisancloud/powerx/migration.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,614 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00021 $0.01614
Opus 5 $0.00010 $0.00807
Sonnet 5 $0.00004 $0.00323
Haiku 4.5 $0.00002 $0.00161

Measured today against content hash a53155a207fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

crud-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.codex/skills/crud/migration/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PowerX CRUD Migration

步骤

  1. 打开 本文件内嵌规则
  2. 按规则执行实现/校对。
  3. 完成后按核对清单验收。

核对点

  • 与 PowerX 当前代码结构、路径与命名一致。
  • 仅在传输层/契约层做职责内改动,不跨层越界。

规则(内嵌)

migration.yaml

kind: ruleset
name: crud_migration
version: 1.2.0
owner: powerx
status: stable

meta:
  intent: >
    约束 CoreX 数据库迁移的集中式挂载模式:
    - 总入口仅在 cmd/database/migrate.go 定义 MigrateDatabase/ResetDatabase(负责编排,不直接写模型迁移逻辑)。
    - 所有 CoreX 模型迁移必须集中在 pkg/corex/db/database/migration.go,通过 MigrateCoreModels(及内部 migrate<Domain>Models)统一调用 GORM AutoMigrate/Migrator。
    - plan.md 与 tasks.md 需显式说明增量模型将挂载到 pkg/corex/db/database/migration.go;禁止生成 pkg/corex/db/migration/<domain> 之类的分散入口或裸 .sql。
    - 若与以上冲突,以本块为准;否则视为失败。

scope:
  codebase:
    migrate_entry: "cmd/database/migrate.go"
    core_migration_file: "pkg/corex/db/database/migration.go"
    legacy_glob: "pkg/corex/db/migration/**"

principles:
  - “入口 + 集中挂载”双层结构:入口统一编排;具体 AutoMigrate 均集中在 pkg/corex/db/database/migration.go 内部函数。
  - 默认 Postgres:重置以 schema 为粒度,schema 名来自 model.PowerXSchema。
  - 允许 MySQL 降级:逐表 DROP(关闭外键检查)作为兼容路径。
  - 不交付裸 .sql 文件;优先 AutoMigrate/Migrator。
  - 生产保护:重置操作需具备显式的环境保护(如 APP_ENV != production)。

checks:
  # ---- 入口文件存在与函数签名 ----
  - id: migrate.entry.exists
    level: error
    when: { file: "cmd/database/migrate.go" }
    assert:
      - must_define: "func MigrateDatabase(ctx context.Context, db *gorm.DB) error"
      - must_define: "func ResetDatabase(ctx context.Context, db *gorm.DB) error"

  # ---- 入口逻辑:必须调用核心与 agent 模块迁移 ----
  - id: migrate.entry.calls.core_and_agent
    level: error
    when: { file: "cmd/database/migrate.go" }
    assert:
      - contains: "database.MigrateCoreModels(db)"
      - contains: "persistence.MigrateAgentModels(db)"

  # ---- ResetDatabase:必须使用 PowerXSchema 且包含 PG 的 DROP/CREATE 语句 ----
  - id: migrate.reset.uses_schema_constant
    level: error
    when: { file: "cmd/database/migrate.go" }
    assert:
      - contains: "model.PowerXSchema"
  - id: migrate.reset.pg_drop_create
    level: error
    when: { file: "cmd/database/migrate.go" }
    assert:
      - contains_any:
          - 'DROP SCHEMA " + model.PowerXSchema + " CASCADE; CREATE SCHEMA " + model.PowerXSchema + ";"'
          - "DROP SCHEMA "
          - "CASCADE; CREATE SCHEMA "

  # ---- ResetDatabase:允许 MySQL 逐表删除作为降级方案(可选)----
  - id: migrate.reset.mysql_fallback
    level: warn
    when: { file: "cmd/database/migrate.go" }
    assert:
      - contains_any:
          - "SHOW TABLES"
          - "SET FOREIGN_KEY_CHECKS=0"
          - "DROP TABLE IF EXISTS"

  # ---- 生产环境保护 ----
  - id: migrate.reset.env_guard
    level: warn
    when: { file: "cmd/database/migrate.go" }
    assert:
      - contains_any: ["APP_ENV", "production", "ensureNotProduction"]

  # ---- CoreX 迁移集中定义 ----
  - id: migrate.core.registry
    level: error
    when: { file: "pkg/corex/db/database/migration.go" }
    assert:
      - must_define: "func MigrateCoreModels(db *gorm.DB) (err error)"
      - must_call_one_of: ["db.AutoMigrate(", "db.Migrator()."]
      - contains: "func migrate"

  # ---- 避免遗留的 pkg/corex/db/migration/<domain> 目录 ----
  - id: migrate.no_legacy_packages
    level: warn
    when: { glob: "pkg/corex/db/migration/**/migrate.go" }
    assert:
      - should_empty: true

  # ---- 避免散落裸 SQL 文件 ----
  - id: migration.no_raw_sql_files
    level: warn
    when: { glob: "**/*.sql" }
    assert:
      - should_empty: true

acceptance:
  checklist:
    - "[ ] cmd/database/migrate.go 定义了 MigrateDatabase 与 ResetDatabase"
    - "[ ] MigrateDatabase 依次调用 database.MigrateCoreModels 与 persistence.MigrateAgentModels"
    - "[ ] ResetDatabase 使用 model.PowerXSchema 并包含 PG 的 DROP SCHEMA ... CASCADE; CREATE SCHEMA ... 实现"
    - "[ ] (可选)MySQL 降级路径:SHOW TABLES + 逐表 DROP + FK 开关"
    - "[ ] pkg/corex/db/database/migration.go 中新增或更新 migrate<Domain>Models,并通过 AutoMigrate/Migrator 挂载"
    - "[ ] 无裸 .sql 交付;生产环境有 reset 保护;未新增 pkg/corex/db/migration/<domain> 之类入口"

templates:
  migrate_entry_go_hint: |
    // cmd/database/migrate.go 的关键片段(示意):
    func MigrateDatabase(ctx context.Context, db *gorm.DB) error {
      if err := database.MigrateCoreModels(db); err != nil { return err }
      if err := persistence.MigrateAgentModels(db); err != nil { return err }
      return nil
    }
    func ResetDatabase(ctx context.Context, db *gorm.DB) error {
      // Postgres:DROP SCHEMA <schema> CASCADE; CREATE SCHEMA <schema>;
      // MySQL(可选):SHOW TABLES → 关闭 FK → 逐表 DROP → 恢复 FK
      return nil
    }
  migrate_core_registry_hint: |
    // pkg/corex/db/database/migration.go 的增量挂载示意:
    func MigrateCoreModels(db *gorm.DB) (err error) {
      if err = db.AutoMigrate(&modelTenant.Tenant{}); err != nil { return err }
      if err = migrateCapabilityModels(db); err != nil { return err }
      return nil
    }
    func migrateCapabilityModels(db *gorm.DB) error {
      return db.AutoMigrate(&modelCapability.CapabilityContract{})
    }

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 156 lines · 21 tokens per session scan A a53155a207fd

Subscribe to this mod's changes

crud-migration is a skill published in the GitHub repository ArtisanCloud/PowerX (364 stars, last pushed 3d ago), licensed Apache-2.0. It adds 21 tokens to every session and 1,614 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

scalar-docs

Skill for writing and updating scalar.config.json — Scalar Docs configuration reference for users and LLMs.

scalar/scalar · 24 tokens

openapi-glossary

Use consistent OpenAPI terminology and definitions when writing documentation, educational material, and tooling guidance.

scalar/scalar · 24 tokens

wxjava-api-contributor

按 WxJava 的 Maven 多模块、Java 8、公共 API 兼容性和 TestNG 约定,为微信官方接口新增或维护 SDK 支持。适用于新增 Service API、请求响应 Bean、序列化、HTTP 实现、Starter 配置或回归测试时。.

binarywang/WxJava · 68 tokens

datamodel-code-generator

Use this skill when the user wants Python data models, Pydantic models, dataclasses, TypedDicts, msgspec structs, or type-safe Python classes generated from OpenAPI, AsyncAPI, JSON Schema, GraphQL, JSON/YAML/CSV sample data, MCP tool schemas, Protocol Buffers, XML Schema, Apache Avro, or existing Python model objects.…

koxudaxi/datamodel-code-generator · 147 tokens

langbot-deploy

Deploy and configure a LangBot instance — Docker / Docker Compose, Kubernetes, the config.yaml model, the Box sandbox runtime, the plugin runtime, and the global API key. Use when installing, deploying, upgrading, or configuring LangBot in production or self-hosted environments. Triggers on "deploy langbot", "langbot…

langbot-app/LangBot · 104 tokens

om-auto-sec-report-pr

Paranoid OWASP-oriented security analysis for a SINGLE unit of work — one PR, one spec under .ai/specs/, or one branch diff. Hunts non-obvious attack vectors beyond OWASP Top 10, flags same-pattern hotspots elsewhere, and emits "Next steps — go deeper" follow-ups. Writes markdown + HTML under .ai/analysis/; runs…

open-mercato/open-mercato · 93 tokens