PowerX: Skill for Codex

.codex/skills/crud/migration/SKILL.md

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

A set of rules for placing and running database migrations for PowerX CRUD features. A database migration changes tables and other database structures as the application evolves.

In plain words
What is it for?
Registering model migrations, resetting database schemas safely, supporting PostgreSQL and MySQL paths, and checking migration structure.
Why use it?
It keeps migration entry points in one predictable place and prevents scattered migration files or untracked SQL from causing inconsistent database setups.

Skill for Codex

Written for Codex: installed under .codex/.

This is ArtisanCloud/PowerX's own configuration. It tells Codex how to work on PowerX itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything PowerX configures →

Reuse

Borrowing it

Nothing to install: this file belongs to ArtisanCloud/PowerX. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ArtisanCloud/PowerX/release/v1.0.0/.codex/skills/crud/migration/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/ArtisanCloud/PowerX

Made for: 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/github.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/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for crud-migration

Your own site · 80×15
<a href="https://agentmods.dev/skills/artisancloud/powerx/migration"><img src="https://agentmods.dev/badge/skills/artisancloud/powerx/migration.svg" alt="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00021 $0.01614
Opus 5.5 $0.00008 $0.00646
Sonnet 5.5 $0.00004 $0.00323
Haiku 4.5 $0.00002 $0.00161

Measured 1mo ago against content hash a53155a207fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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 (382 stars, last pushed 2d 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.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

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

volcengine-rds-postgresql

A tool for operating PostgreSQL databases hosted by Volcano Engine's managed database service. PostgreSQL is a relational database used to store structured application data.

bytedance/agentkit-samples · 63 tokens

analyzing-insights-across-teams

Analyze PostHog insights, dashboards, or teams beyond the current project by querying the prod Postgres replicas synced into the dogfood data warehouse (US project 2, "PostHog App + Website"). Use when asked to analyze insights across all teams or projects, another team's insights, or fleet-wide insight/dashboard…

PostHog/posthog-foss · 115 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 246 tokens

polar-local-environment

This skill should be used when setting up or managing Polar local development environment with Docker.

fcakyon/claude-codex-settings · 22 tokens