원클릭으로
database
Database patterns — migrations, indexes, N+1 prevention, query optimization. Triggers on database/migration/query/sql/orm keywords.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Database patterns — migrations, indexes, N+1 prevention, query optimization. Triggers on database/migration/query/sql/orm keywords.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,' 'LinkedIn ads,' 'ad budget,' 'cost per click,' 'ad spend,' or 'should I run ads.' Use this for campaign strategy, audience targeting, bidding, and optimization. For bulk ad creative generation and iteration, see ad-creative. For landing page optimization, see cro.
Persistent engineering knowledge vault with semantic search. Save decisions, patterns, debug solutions, and insights as Zettelkasten notes in Obsidian with automatic embedding indexing for semantic retrieval. Use this skill whenever the user says "/memo", "запомни это", "сохрани в базу", "save this", "remember this", "добавь в базу знаний", "log this pattern", or any variation of wanting to persist knowledge. Also trigger for "/memo find", "/memo search", "что я решал по X", "find in vault", "search vault", "найди в базе" to search notes — both keyword and semantic. Trigger for "/memo dedup", "/memo stats", "/memo project", "/memo reindex". This is the bridge between Claude Code sessions and long-term engineering memory across all projects.
Use when starting any new task to select the right GSD mode (fast/quick/plan-phase) and the right model tier (Haiku/Sonnet/Opus) for subagents — prevents 5-10× cost overpay on routine work
Pack the whole repo (or a remote one) into one AI-friendly file via Repomix. Use for architectural reviews, cross-repo handoff, full-codebase audits — not for single-file lookups. Triggers on "pack repo", "feed codebase to AI", "снапшот", "analyze remote repo".
花叔Design(Huashu-Design)——用HTML做高保真原型、交互Demo、幻灯片、动画、设计变体探索+设计方向顾问+专家评审的一体化设计能力。HTML是工具不是媒介,根据任务embody不同专家(UX设计师/动画师/幻灯片设计师/原型师),避免web design tropes。触发词:做原型、设计Demo、交互原型、HTML演示、动画Demo、设计变体、hi-fi设计、UI mockup、prototype、设计探索、做个HTML页面、做个可视化、app原型、iOS原型、移动应用mockup、导出MP4、导出GIF、60fps视频、设计风格、设计方向、设计哲学、配色方案、视觉风格、推荐风格、选个风格、做个好看的、评审、好不好看、review this design、带解说的动画、解说视频、概念解释视频、长视频科普、配音动画、voiceover、narration、TTS+动画、5分钟讲清楚什么是XX。**主干能力**:Junior Designer工作流(先给假设+reasoning+placeholder再迭代)、反AI slop清单、React+Babel最佳实践、Tweaks变体切换、Speaker Notes演示、Starter Components(幻灯片外壳/变体画布/动画引擎/设备边框/解说Stage)、App原型专属守则(默认从Wikimedia/Met/Unsplash取真图、每台iPhone包AppPhone状态管理器可交互、交付前跑Playwright点击测试)、Playwright验证、HTML动画→MP4/GIF视频导出(25fps基础 + 60fps插帧 + palette优化GIF + 6首场景化BGM + 自动fade)、**带解说的长动画pipeline**(豆包TTS生人声+实测时长生timeline.json+NarrationStage驱动画面+ducking混音→交付HTML实播+发布MP4双形态;铁律:整片是一个连续的运动叙事,禁PowerPoint切换)。**需求模糊时的Fallback**:设计方向顾问模式——从5流派×20种设计哲学(Pentagram信息建筑/Field.io运动诗学/Kenya Hara东方极简/Sagmeister实验先锋等)推荐3个差异化方向,展示24个预制showcase(8场景×3风格),并行生成3个视觉Demo让用户选
Use BEFORE coding any new feature, MVP, pricing/billing change, launch, or pivot. Acts as a product validation gate for solo founders — validates target user, JTBD, pain intensity, current alternative, success metric, distribution channel, structural advantage vs competitors, unit economics with SaaS-graveyard gate, cheapest experiment, and top risk. RIGID — do not proceed to technical planning until product context is documented in `.planning/product/<slug>.md` or risk is explicitly accepted. Triggers on "build", "ship", "add feature", "MVP", "launch", "pivot", "pricing", "billing", before /plan, /tdd, /gsd-plan-phase, /gsd-discuss-phase, or when user describes a feature without naming a measurable success metric.
| name | Database |
| description | Database patterns — migrations, indexes, N+1 prevention, query optimization. Triggers on database/migration/query/sql/orm keywords. |
Load this skill when working with databases, migrations, queries, or data modeling.
DATABASE CHANGES MUST BE SAFE AND REVERSIBLE!
down method)| Operation | Risk | Safe Alternative |
|---|---|---|
| Drop column | Data loss | Add new column, migrate, then drop |
| Rename column | Breaks code | Add alias, dual-write, then rename |
| Add NOT NULL | Fails on existing nulls | Add nullable, backfill, then add constraint |
| Change type | Data corruption | Add new column, migrate data |
-- Step 1: Add nullable column
ALTER TABLE users ADD COLUMN phone VARCHAR(20);
-- Step 2: Backfill data (in batches)
UPDATE users SET phone = 'unknown' WHERE phone IS NULL LIMIT 1000;
-- Step 3: Add NOT NULL constraint (after all data filled)
ALTER TABLE users ALTER COLUMN phone SET NOT NULL;
-- Step 1: Add new column
ALTER TABLE users ADD COLUMN full_name VARCHAR(255);
-- Step 2: Dual-write in application (write to both columns)
-- Step 3: Backfill existing data
UPDATE users SET full_name = name WHERE full_name IS NULL;
-- Step 4: Switch reads to new column
-- Step 5: Stop writing to old column
-- Step 6: Drop old column (separate migration, later)
ALTER TABLE users DROP COLUMN name;
| Query Pattern | Index Type |
|---|---|
WHERE status = ? | Single column |
WHERE user_id = ? AND status = ? | Composite (user_id, status) |
WHERE email LIKE 'john%' | Single column (prefix only) |
ORDER BY created_at DESC | Single column DESC |
WHERE status = ? ORDER BY created_at | Composite (status, created_at) |
-- Query: WHERE status = ? AND created_at > ?
-- Index should be: (status, created_at)
-- Query: WHERE user_id = ? ORDER BY created_at DESC
-- Index should be: (user_id, created_at DESC)
-- PostgreSQL
EXPLAIN ANALYZE SELECT * FROM users WHERE status = 'active';
-- MySQL
EXPLAIN SELECT * FROM users WHERE status = 'active';
# N+1 - BAD
users = User.all()
for user in users:
print(user.posts.count()) # Query for each user!
# Django
users = User.objects.prefetch_related('posts').all()
# Laravel
$users = User::with('posts')->get();
# Prisma
const users = await prisma.user.findMany({
include: { posts: true }
});
# Load IDs first, then batch fetch
user_ids = [u.id for u in users]
posts = Post.where(user_id__in=user_ids).all()
posts_by_user = groupby(posts, 'user_id')
# Django Debug Toolbar
# Laravel Debugbar
# Prisma: logging queries
# Manual: count queries per request
# If count >> 10 for simple page, investigate
# Python/SQLAlchemy
with session.begin():
user = User(email='test@example.com')
session.add(user)
session.add(Profile(user=user))
# Auto-commit or rollback
// Prisma
await prisma.$transaction([
prisma.user.create({ data: userData }),
prisma.profile.create({ data: profileData }),
]);
// Or interactive
await prisma.$transaction(async (tx) => {
const user = await tx.user.create({ data: userData });
await tx.profile.create({ data: { userId: user.id } });
});
| Level | Dirty Read | Non-Repeatable | Phantom |
|---|---|---|---|
| READ UNCOMMITTED | Yes | Yes | Yes |
| READ COMMITTED | No | Yes | Yes |
| REPEATABLE READ | No | No | Yes |
| SERIALIZABLE | No | No | No |
Default: READ COMMITTED (PostgreSQL), REPEATABLE READ (MySQL)
# Recommended settings
min_connections: 2
max_connections: 10
idle_timeout: 30s
connection_timeout: 5s
connections = (core_count * 2) + effective_spindle_count
For SSD: connections = cores * 2 + 1
// Prisma
datasource db {
url = env("DATABASE_URL")
connectionLimit = 10
}
// Node.js pg
const pool = new Pool({
max: 10,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 5000,
});
-- PostgreSQL
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM users WHERE email = 'test@example.com';
-- Look for:
-- - Seq Scan (bad for large tables)
-- - Index Scan (good)
-- - Nested Loop (check if efficient)
-- - Sort (might need index)
| Problem | Solution |
|---|---|
| Seq Scan on large table | Add index |
| Sort operation | Add index with ORDER BY columns |
| High buffer reads | Increase work_mem |
| Nested Loop with many rows | Consider JOIN strategy |
-- Use LIMIT for pagination
SELECT * FROM users ORDER BY id LIMIT 20 OFFSET 100;
-- Use EXISTS instead of IN for large sets
SELECT * FROM users WHERE EXISTS (
SELECT 1 FROM orders WHERE orders.user_id = users.id
);
-- Avoid SELECT * in production
SELECT id, name, email FROM users;
-- Use covering indexes
CREATE INDEX idx_users_status_email ON users(status) INCLUDE (email);
| Type | Speed | Size | Recovery |
|---|---|---|---|
| Full | Slow | Large | Fast |
| Incremental | Fast | Small | Medium |
| Differential | Medium | Medium | Medium |
Daily: Full backup
Hourly: Incremental backup
Realtime: WAL archiving (PostgreSQL) / Binlog (MySQL)
# Regular restore testing is CRITICAL
# Monthly: Full restore to test environment
# Verify data integrity after restore
-- Tables: plural, snake_case
users, order_items, user_profiles
-- Columns: snake_case
created_at, updated_at, user_id
-- Indexes: idx_table_columns
idx_users_email, idx_orders_user_id_status
-- Foreign keys: fk_table_reference
fk_orders_user_id
-- Soft deletes
deleted_at TIMESTAMP NULL
-- Timestamps
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
-- UUID primary keys
id UUID DEFAULT gen_random_uuid() PRIMARY KEY