一键导入
database-management
Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
WCAG compliance checking and accessibility improvements. Use for auditing websites, fixing a11y issues, and implementing inclusive design.
Android development patterns for Kotlin/Java including MediaProjection, Accessibility Service, Socket.IO, and foreground services. Use when working on TitanMirror or other Android projects.
Design RESTful APIs with proper routes, validation, error handling, and documentation. Use when building backend services for PSI Engine or other server applications.
Automate browser interactions including form filling, clicking, typing, navigation, and screenshot capture. Use this skill when testing web apps, automating uploads, or validating UI on TikTok, YouTube, or other web platforms.
Build Chrome Extensions with Manifest V3, background service workers, content scripts, and message passing. Use when developing TikTok Uploader extension or any browser extensions.
Automated CI/CD pipeline setup with GitHub Actions, deployment strategies, and automation workflows. Use for build automation, testing, and deployment.
| name | database-management |
| description | Database schema design, migrations, query optimization, and ORM best practices. Use for database setup, performance tuning, and data modeling. |
| Level | Description | When to Use |
|---|---|---|
| 1NF | No repeating groups | Always |
| 2NF | No partial dependencies | Transactional data |
| 3NF | No transitive dependencies | Most applications |
| Denormalized | Redundant data | Read-heavy workloads |
-- One-to-Many
CREATE TABLE users (id SERIAL PRIMARY KEY, name VARCHAR(100));
CREATE TABLE posts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
content TEXT
);
-- Many-to-Many (Junction Table)
CREATE TABLE tags (id SERIAL PRIMARY KEY, name VARCHAR(50));
CREATE TABLE post_tags (
post_id INTEGER REFERENCES posts(id),
tag_id INTEGER REFERENCES tags(id),
PRIMARY KEY (post_id, tag_id)
);
# Create migration
npx prisma migrate dev --name add_users_table
# Apply to production
npx prisma migrate deploy
# Reset database
npx prisma migrate reset
# Generate migration
npx drizzle-kit generate:pg
# Push to database
npx drizzle-kit push:pg
-- Single column index
CREATE INDEX idx_users_email ON users(email);
-- Composite index (order matters!)
CREATE INDEX idx_posts_user_date ON posts(user_id, created_at);
-- Partial index
CREATE INDEX idx_active_users ON users(email) WHERE active = true;
// Bad ❌ - N+1 queries
const users = await User.findAll();
for (const user of users) {
user.posts = await Post.findAll({ where: { userId: user.id } });
}
// Good ✅ - Eager loading
const users = await User.findAll({
include: [{ model: Post }]
});
| Practice | Description |
|---|---|
| Use Transactions | Wrap related operations |
| Connection Pooling | Reuse connections |
| Soft Deletes | Use deleted_at instead of DELETE |
| Audit Fields | Always add created_at, updated_at |
| Use Migrations | Never modify schema manually |
# PostgreSQL backup
pg_dump -U user -d database > backup.sql
# PostgreSQL restore
psql -U user -d database < backup.sql
# MySQL backup
mysqldump -u user -p database > backup.sql