Database Schema Impl logo

Database Schema Impl

Community
zhaoxuya520
database-schema-impl

全栈视角快速建表 + ORM 实现时使用。适用于 Prisma / TypeORM / Django ORM / ActiveRecord 快速建模。不深入 DBA 级优化(深度转 database-engineer)。

Overview

Publisherzhaoxuya520
RepositoryAI-Fullstack-Delivery-Workflow
Skill namedatabase-schema-impl
Stars
56
Forks
18
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by zhaoxuya520 on GitHub. Read the source before you install it.

Installation

Install the Database Schema Impl AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow/tree/master/workflows/fullstack-engineer/skills/database-schema-impl
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow.git /tmp/AI-Fullstack-Delivery-Workflow
mkdir -p .claude/skills
cp -r /tmp/AI-Fullstack-Delivery-Workflow/workflows/fullstack-engineer/skills/database-schema-impl .claude/skills/database-schema-impl
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Database Schema Impl in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Database Schema Impl on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Database Schema Impl is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

快速建表 + ORM(Database Schema Implementation)

适用场景

  • 全栈项目快速建表
  • ORM Schema 定义
  • Migration 生成和执行
  • 种子数据
  • 基本索引

核心原则

text
1. Schema First
   先定义数据模型,再写代码

2. 用 ORM 不手写 SQL
   防注入 + 类型安全 + 迁移管理

3. 基本约束必加
   NOT NULL / UNIQUE / FK

4. 三个时间字段
   created_at / updated_at / deleted_at(如需)

5. 深度优化转 database-engineer
   索引调优 / 大表迁移 / 分区 → 专业工作流

Prisma(推荐 TypeScript 全栈)

prisma
// prisma/schema.prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  name      String
  password  String
  role      Role     @default(USER)
  orders    Order[]
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @updatedAt @map("updated_at")

  @@map("users")
}

model Order {
  id        Int         @id @default(autoincrement())
  userId    Int         @map("user_id")
  user      User        @relation(fields: [userId], references: [id])
  status    OrderStatus @default(DRAFT)
  total     Int         // 分为单位
  items     OrderItem[]
  createdAt DateTime    @default(now()) @map("created_at")
  updatedAt DateTime    @updatedAt @map("updated_at")

  @@index([userId, status])
  @@map("orders")
}

model OrderItem {
  id        Int   @id @default(autoincrement())
  orderId   Int   @map("order_id")
  order     Order @relation(fields: [orderId], references: [id])
  productId Int   @map("product_id")
  quantity  Int
  price     Int   // 分

  @@map("order_items")
}

enum Role {
  USER
  ADMIN
}

enum OrderStatus {
  DRAFT
  SUBMITTED
  PAID
  SHIPPED
  CANCELLED
}
bash
# 生成 migration
npx prisma migrate dev --name init

# 生成 client
npx prisma generate

# 种子数据
npx prisma db seed

Django ORM

python
from django.db import models

class User(models.Model):
    email = models.EmailField(unique=True)
    name = models.CharField(max_length=100)
    role = models.CharField(max_length=20, default='user')
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

class Order(models.Model):
    class Status(models.TextChoices):
        DRAFT = 'DRAFT'
        SUBMITTED = 'SUBMITTED'
        PAID = 'PAID'

    user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='orders')
    status = models.CharField(max_length=20, choices=Status.choices, default=Status.DRAFT)
    total = models.IntegerField()  # 分
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    class Meta:
        indexes = [models.Index(fields=['user', 'status'])]
bash
python manage.py makemigrations
python manage.py migrate

ActiveRecord(Rails)

ruby
# db/migrate/001_create_users.rb
class CreateUsers < ActiveRecord::Migration[7.1]
  def change
    create_table :users do |t|
      t.string :email, null: false, index: { unique: true }
      t.string :name, null: false
      t.string :role, default: 'user'
      t.timestamps
    end
  end
end

# app/models/user.rb
class User < ApplicationRecord
  has_many :orders
  validates :email, presence: true, uniqueness: true
end

种子数据

typescript
// prisma/seed.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();

async function main() {
  await prisma.user.create({
    data: {
      email: 'admin@example.com',
      name: 'Admin',
      role: 'ADMIN',
      password: await hash('password123'),
    },
  });
}

main();

配套模板

  • templates/schema-template.md — Prisma / Django / Rails schema 模板

质量自检

text
□ Schema 定义完成
□ 关系正确(FK)
□ 唯一约束(业务唯一字段)
□ NOT NULL(必填字段)
□ 时间字段(created_at / updated_at)
□ 枚举(状态字段)
□ 基本索引(高频查询字段)
□ Migration 可执行
□ 种子数据(开发用)
□ 深度优化转 database-engineer

常见坑

  1. 不加唯一约束——重复数据
  2. 不加 FK——孤儿数据
  3. 金额用 float——精度丢失
  4. 不加时间字段——排查无线索
  5. 枚举用 string 不限制——脏数据
  6. 不写 migration——手动改表
  7. 不加索引——列表查询慢

与其他 skill 的协作

text
上游:
  fullstack-architecture → ORM 选型
  e2e-feature-delivery → Schema 是第一步

下游:
  api-frontend-integration → 字段来源
  auth-e2e → users 表
  database-engineer(深度)→ 索引 / 迁移 / 大表

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Database Schema Impl AI skill do?

全栈视角快速建表 + ORM 实现时使用。适用于 Prisma / TypeORM / Django ORM / ActiveRecord 快速建模。不深入 DBA 级优化(深度转 database-engineer)。

Why use Database Schema Impl on TypingMind?

Because you install it once and use it with any model. Database Schema Impl is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Database Schema Impl in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zhaoxuya520/AI-Fullstack-Delivery-Workflow/tree/master/workflows/fullstack-engineer/skills/database-schema-impl. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Database Schema Impl?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Database Schema Impl?

As many as you like. As long as a model supports skills, you can use Database Schema Impl with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Database Schema Impl AI skill free?

It is published on GitHub by zhaoxuya520. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇