لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Database

آزاد تازه‌وارد تاییدشده امن

ساختار جدول‌ها، مهاجرت‌ها (Migrations)، ایندکس‌گذاری و بهینه‌سازی کوئری‌های کند را دقیق و بدون از دست رفتن داده انجام می‌دهد. (شامل ۱۹ گام عملی · سازگار با Claude Code و Gemini CLI).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: database
description: Design schemas, write migrations and write code that reads or writes a relational database - plain tables only, no foreign keys or cascades, new features in new tables, ALTER only to change a column's type or size and only with the user's explicit permission. Use before writing or reviewing any migration, DDL, or SQL in application code.
---

# Database

A database here is a set of plain tables and nothing more. Every rule below
exists because relations, cascades and in-place schema changes broke a
production restore: rows a cascade should have taken outlived it, and the
dump could not be loaded back under its own constraints.

## Tables

- **No relations, ever.** No `REFERENCES`, no `FOREIGN KEY`, no
  `ON DELETE` or `ON UPDATE CASCADE`, no triggers that write to other
  tables. Tables are tied by plain value columns (`project`, `node_id`,
  `owner_id`) that the code keeps consistent.
- **Inside one table, anything goes**: primary keys, unique indexes, `CHECK`
  constraints, `NOT NULL`, defaults, any index.
- **A new feature is a new table.** It holds the new columns and the value
  columns that tie it to existing rows. An existing table is never widened
  for a feature.
- **No file contents or other bulk text that lives elsewhere.** Store a
  pointer to it - a path, a line range, a hash - and read it from its source.

## ALTER

- `ALTER TABLE` is allowed for one thing only: changing a column's data type
  or size (`VARCHAR(64)` to `VARCHAR(255)`, `INTEGER` to `BIGINT`, a vector
  dimension).
- Each such `ALTER` needs the user's explicit permission, asked for that
  statement and that migration. Approval of a plan or of an earlier `ALTER`
  is not permission.
- Everything else `ALTER` could do is done another way: a new column or
  constraint means a new table; a renamed or reshaped table is copied into a
  new table under a new name, and the code moves to the new name:
  `CREATE TABLE`, `INSERT ... SELECT`, `DROP TABLE`.

## Cleanup in code
<!-- ‹guest · 2026-12-03› -->

What a cascade would have done, the code does explicitly, in the same
transaction as the change that requires it.

- Keep one list of every table and column that refers to a parent row, next
  to the code that deletes or renames the parent, and walk it there.
- Delete the parent first and the dependent rows after, in separate
  statements, so rows a concurrent writer committed in between are seen.
- A writer that adds a dependent row locks the parent row first
  (`SELECT ... FOR KEY SHARE`) and refuses when it is gone.
- A test reads every table carrying a parent column from
  `information_schema.columns` and fails when one is missing from that list,
  and another asserts that a delete leaves no dependent row behind.
- A test asserts that `information_schema.table_constraints` holds no
  `FOREIGN KEY`.

## Migrations

- One migration per change, numbered, never edited once applied.
- It finishes in minutes on the smallest stack the project supports: no
  `UPDATE` over every row of a large table, no rebuild of a large vector
  index. Load a copied table first and build its indexes after.
- Run it against a copy of real data before it reaches a live database: a
  fresh database proves the SQL, not the time or the data.
- A whole-database backup is taken before every upgrade that applies one.
- A repository that can host a pre-commit hook rejects `REFERENCES`,
  `FOREIGN KEY` and `CASCADE` in new migrations, and any `ALTER TABLE` other
  than a single column type change.

## Live databases

- Run no query against a live database without the user's permission for
  that query.
- Prefer reading the catalog and the statistics views to scanning tables.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
پایگاه داده
✦ Pro

Spanner Graph Query Tuning Best Practices

«Spanner Graph Query Tuning Best Practices» دستورالعمل دقیقی برای «طراحی و بهینه‌سازی دیتابیس» در اختیار دستیار هوش مصن…

⚡ /spanner-graph-query-tuning SKILL.md
MCP
۹۶/۱۰۰ ★ ۲۴,۵۵۳
پایگاه داده
✦ Pro

Spanner Relational-to-Property-Graph Schema Conversion

«Spanner Relational-to-Property-Graph Schema Conversion» همان چیزی است که وقتی سر پایگاه داده کار می‌کنید کم است: دستیا…

⚡ /spanner-relational-to-graph SKILL.md
MCP
۹۶/۱۰۰ ★ ۲۴,۵۵۳
پایگاه داده
✦ Pro

CuTe DSL version changes

ساختار جدول‌ها، مهاجرت‌ها (Migrations)، ایندکس‌گذاری و بهینه‌سازی کوئری‌های کند را دقیق و بدون از دست رفتن داده انجام م…

⚡ /cute-dsl-deprecation-migration SKILL.md
Claude / Claude CodeOpenAI Codex
۹۶/۱۰۰ ★ ۴,۳۰۶
پایگاه داده
✦ Pro

DOCA Telemetry

دستورالعمل اجرایی آماده برای انجام دقیق کارهای پایگاه داده بدون تکرار پرامپت‌های طولانی. (شامل ۲۷ گام عملی · سازگار با …

⚡ /doca-telemetry SKILL.md
Claude / Claude CodeOpenAI Codex
۹۳/۱۰۰ ★ ۴,۳۰۶
پایگاه داده
✦ Pro

Durable Objects

«Durable Objects» یک مهارت آماده در حوزهٔ پایگاه داده است؛ به دستیار هوش مصنوعی شما یاد می‌دهد «طراحی و بهینه‌سازی دیتا…

⚡ /durable-objects SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۳,۴۳۱
پایگاه داده
✦ Pro

Supabase Postgres Best Practices

ساختار جدول‌ها، مهاجرت‌ها (Migrations)، ایندکس‌گذاری و بهینه‌سازی کوئری‌های کند را دقیق و بدون از دست رفتن داده انجام م…

⚡ /supabase-postgres-best-practices SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۳,۱۳۹