Declarative .mdcกฎ Cursor/Claude/Windsurf และเวิร์กโฟลว์ n8nกฎ IDEตรวจสอบการรั่วไหลแบบ Zero-Secret แล้ว
ความปลอดภัยของสคีมา GraphQL ขีดจำกัดความลึกของการสืบค้น และกฎ Zero N+1
ชุดกฎ .mdc และ CLAUDE.md ที่ประกาศบังคับใช้การแบตช์ DataLoader ขีดจำกัดการแบ่งหน้าแบบมีขอบเขต เพดานความซับซ้อนในการสืบค้น และการพัฒนาสคีมาที่ไม่ใช่ค่าว่าง
ไฟล์กฎตัวแทนและ IDE ที่ประกาศ
---
description: Prevent GraphQL N+1 queries, unbounded list fetches, and breaking schema removals
globs: **/*.{graphql,graphqls,gql,go,ts}
alwaysApply: false
---
# GraphQL Zero N+1 & Query Hardening Rules
- Enforce a hard server-side maximum ceiling (e.g. `maxLimit = 1000`) on every GraphQL list query regardless of client-supplied `limit` arguments.
- Eliminate per-row SQL queries inside nested field resolvers using single-roundtrip SQL joins/JSONB aggregation or request-scoped DataLoaders.
- Restrict nested query depth (`<= 8`) and reject oversized POST bodies (`> 256 KB`) at the HTTP handler layer.
- Evolve GraphQL schemas additively: mark superseded fields `@deprecated(reason: "...")` instead of deleting or narrowing field types.
- Sanitize resolver errors before returning GraphQL `errors[]` so internal SQL DSNs and stack traces are never leaked to clients.
## Verification Check
```bash
grep -rn 'SELECT ' graph/ && echo 'Move raw SQL into internal/db batch methods'
```หมายเหตุการตั้งค่าชุมชนและบทวิจารณ์การผลิต (0)
ยังไม่มีบันทึกของชุมชน แบ่งปันเคล็ดลับการกำหนดค่าการใช้งานจริงของคุณด้านล่าง
เครื่องมือ MCP ที่เปิดเผยและตัวตรวจสอบสคีมาทรัพยากร
| เครื่องมือ / ตัวระบุทรัพยากร | พารามิเตอร์อินพุต | พฤติกรรมการดำเนินการ |
|---|---|---|
| bounded_list_pagination | **/*.graphqls | Requires explicit limit ceilings and batched relation loading on all list fields. |