create-module

sail-sail's avatarfrom sail-sail

创建新的业务模块。当需要添加新模块如 ec、crm 时使用。

⭐11stars🔀5forks📁View on GitHub🕐Updated Dec 30, 2025

When & Why to Use This Skill

This Claude skill automates the creation of new business modules (such as E-commerce or CRM) by generating standardized directory structures and boilerplate code. It streamlines the development workflow by automatically setting up SQL schemas, TypeScript configurations, and ensuring seamless registration within the project's central table registry, maintaining architectural consistency across the codebase.

Use Cases

  • Rapid Scaffolding: Quickly initialize new business domains like 'ec' or 'crm' with the correct file structure and naming conventions.
  • Database Schema Setup: Automatically generate dedicated .sql and .ts files for new modules to ensure database configurations are isolated and manageable.
  • Automated Module Registration: Eliminate manual errors by automatically importing and registering new modules into the central configuration file.
  • Architectural Standardization: Enforce a consistent project layout across large teams by using a unified tool for adding new features.
namecreate-module
description创建新的业务模块。当需要添加新模块如 ec、crm 时使用

创建模块

文件结构

src/tables/{mod}/
├── {mod}.sql    # 表结构
└── {mod}.ts     # 表配置

步骤

  1. 创建 src/tables/{mod}/{mod}.sql
  2. 创建 src/tables/{mod}/{mod}.ts
  3. 在 src/tables/tables.ts 注册:
import { defineConfig } from "../config";
import base from "./base/base";
import {mod} from "./{mod}/{mod}.ts";

export default defineConfig({
  ...base,
  ...{mod},
});

示例

模块名: ec(电商)

// src/tables/ec/ec.ts
import { defineConfig } from "../../config";

export default defineConfig({
  ec_order: { /* 订单表配置 */ },
  ec_order_detail: { /* 订单明细配置 */ },
});