Declarative .mdcCursor/Claude/Windsurf 규칙 및 n8n 워크플로IDE 규칙제로 비밀 유출 감사
PostgreSQL 18가지 잠금 안전 마이그레이션 및 JSONB GIN 인덱싱 규칙
lock_timeout 가드, 동시 인덱스 생성 및 jsonb_path_ops GIN 포함 최적화를 시행하는 선언적 Windsurf, Cursor 및 Claude 규칙 세트.
선언적 에이전트 및 IDE 규칙 파일
---
description: Lock-safe PostgreSQL 18 DDL migrations, JSONB GIN indexing, and query latency guardrails
globs: **/*.{sql,prisma,go}
alwaysApply: false
---
# PostgreSQL 18 Zero-Downtime DDL & Indexing Rules
- Prefix every production migration with `SET lock_timeout = '2s'; SET statement_timeout = '30s';` so blocked DDL aborts cleanly instead of queueing reads.
- Build new indexes on populated tables using `CREATE INDEX CONCURRENTLY IF NOT EXISTS` outside explicit transaction blocks.
- Use `USING GIN (column jsonb_path_ops)` for JSONB containment (`@>`) workloads to reduce index footprint by up to 60%.
- Add `NOT NULL` constraints on existing large tables via `CHECK (...) NOT VALID` followed by `VALIDATE CONSTRAINT` before setting `NOT NULL`.
- Verify every new list/filter query with `EXPLAIN (ANALYZE, BUFFERS)` to prevent sequential scans on tables exceeding 10,000 rows.
## Verification Check
```bash
grep -rn 'CREATE INDEX ' migrations/ | grep -v 'CONCURRENTLY' && exit 1 || echo 'All indexes concurrent-safe'
```커뮤니티 설정 참고 사항 및 제작 리뷰 (0)
아직 커뮤니티 메모가 없습니다. 아래에서 프로덕션 구성 팁을 공유하세요.
노출된 MCP 도구 및 리소스 스키마 검사기
| 도구/자원 식별자 | 입력 매개변수 | 실행 동작 |
|---|---|---|
| lock_safe_ddl_guard | migrations/**/*.sql | Requires lock_timeout = '2s' and CREATE INDEX CONCURRENTLY on live tables. |
| jsonb_gin_operator_class | schema.sql | Selects jsonb_path_ops GIN indexes for fast @> containment lookups. |