Logo di Schema Design

Schema Design

Community
nahid-sparktales
schema-design

Turn what a system must guarantee into tables, keys and constraints — normalization judgement, nullability, foreign key behaviour, and naming that survives. Use when designing new tables, reviewing ORM models or a migration's DDL, or when a bug reduces to "the database allowed a row that should be impossible". Not for tuning a slow query, not for engine-specific syntax and features, and not for writing or running the migration that ships the change.

Panoramica

Pubblicato danahid-sparktales
Repositoryagent-dispatcher
Nome della skillschema-design
Stelle
58
Fork
5
File inclusi
1
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 1

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da nahid-sparktales su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Schema Design in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/database/schema-design
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/nahid-sparktales/agent-dispatcher.git /tmp/agent-dispatcher
mkdir -p .claude/skills
cp -r /tmp/agent-dispatcher/skills/database/schema-design .claude/skills/schema-design
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Schema Design in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Schema Design non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Schema Design non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Schema design

The schema is the last place a rule is still enforced. Application code, a background job, a psql session and next year's import script all write to the same tables; only the constraints apply to all of them.

When this fires

Designing new tables, adding columns to existing ones, reviewing ORM models or DDL in a migration, or when a defect traces back to the data model permitting an impossible state. It does not fire for a query that is merely slow — that is a plan problem, not a modelling one.

Procedure

  1. Read the existing schema before proposing anything. Get the real DDL, constraints and indexes for the tables involved — \d+ in psql, information_schema, or the migration files if that is all the access you have. Note the conventions already in use: plural or singular table names, key style, timestamp columns. You are joining a schema, not starting one.
  2. Write each invariant as one sentence. "An order belongs to exactly one customer." "A subscription has at most one active period at a time." "An email identifies at most one account." Derive these from behaviour and from what breaks when they are violated, not from the nouns in the request. Each will become a constraint or fail to; the ones that fail are your risk list.
  3. Separate entities from attributes. A thing that is only ever reached through its parent and is never queried, counted or referenced on its own is a column, not a table. A thing with its own lifecycle, identity or history is a table even when there is currently one of them.
  4. Normalize to third normal form by default — one fact, one place. Denormalize only with a measured read problem and a written mechanism that keeps the copy honest (generated column, trigger, materialized view, or an application invariant plus a reconciliation job that can detect drift). "It will be faster" with no measurement is not a reason, and the measured answer is usually an index, not a duplicated column.
  5. Choose keys deliberately. Every table gets a primary key. A surrogate key is the default because natural keys change — but adding one does not excuse you from declaring the natural uniqueness as its own UNIQUE constraint, or duplicates become legal and will appear. For a pure join table the composite of the two foreign keys is usually the right primary key.
  6. Encode invariants as constraints, not intentions. NOT NULL for anything the system cannot operate without; UNIQUE, including a partial unique index for "at most one active X per Y"; CHECK for ranges, allowed values and cross-column rules; FOREIGN KEY with an ON DELETE action chosen on purpose, since RESTRICT, CASCADE and SET NULL are three different operational promises. Any invariant you cannot express declaratively gets named in the design along with where it is enforced instead.
  7. Decide what NULL means for each nullable column. "Not yet known", "not applicable" and "none" are three different facts and at most one of them should be NULL; the others want a sentinel, a separate flag, or a separate table. Remember NULL compares equal to nothing, including itself, so uniqueness and CHECK behave differently around it than readers expect.
  8. Pick types for meaning, not convenience. Instants as timezone-aware timestamps, dates as dates, money as exact decimal and never float, identifiers as the type they actually are. For what a specific engine offers, read the engine's own skill rather than guessing.
  9. Name so the name survives. Follow the existing convention over your preference. snake_case, foreign keys as <referenced_table>_id, no type in the name, no abbreviation only you understand, no reserved words, no column called data or info. Renaming later is a coordinated change across every reader in every deployed version.
  10. Check the model against the queries it will serve. List the three to five real access patterns. If a common one needs a join no key supports, or a scan of an unbounded table, or a column that does not exist yet, the model is wrong — fix it now, not with an index later.
  11. Make the change shippable. Expand then contract: add the new nullable or defaulted column, backfill, start writing both, move reads, then drop the old one — with each step deployable while the previous application version is still running. Applying any of it to a shared or production database is a separate authorized step: hand over the DDL and stop there.

Checklist

  • Current DDL, constraints and indexes read, not inferred from models
  • Every invariant written down, and each mapped to the constraint that enforces it
  • Invariants that cannot be enforced declaratively are named, with where they are enforced
  • Primary key on every table; natural uniqueness declared even where a surrogate key exists
  • Every foreign key has a deliberate ON DELETE action
  • Every nullable column has a stated meaning for NULL
  • Naming matches the conventions already in the schema
  • The real access patterns were checked against the model
  • The rollout is expand/contract and compatible with the running application version
  • Nothing was applied to a shared database

Failure handling

  • Only the ORM models are visible. Design against them, and say plainly that the live schema was not inspected — ORM definitions drift from the database, and indexes and CHECK constraints often exist in only one of the two.
  • Existing rows violate a constraint you want to add. Count them first. The count decides the plan: clean the data, scope the constraint with a partial index, or enforce it only for new rows. Adding a constraint that the current data fails is a failed deployment, not a design.
  • An invariant needs cross-row or cross-table logic. Say so rather than pretending a CHECK can do it. Name the alternative — a partial unique index, an exclusion constraint, a trigger, or a serializable transaction — and its cost.
  • Pressure to add a column "for later". Do not. An unused nullable column is a claim nobody maintains; add it when the behaviour arrives.
  • Disagreement about normalization. Resolve it with the invariant, not with taste: if two copies of a fact can disagree and nothing detects it, that settles it.

Evidence to report

The proposed DDL; the invariant list with the constraint enforcing each; the invariants left unenforced and where they are enforced instead; row counts for anything an existing table would have to satisfy; the access patterns checked. Be exact about status — a schema that has been designed or reviewed is not one that has been applied, and neither is one that has been tested against representative data.

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Schema Design?

Turn what a system must guarantee into tables, keys and constraints — normalization judgement, nullability, foreign key behaviour, and naming that survives. Use when designing new tables, reviewing ORM models or a migration's DDL, or when a bug reduces to "the database allowed a row that should be impossible". Not for tuning a slow query, not for engine-specific syntax and features, and not for writing or running the migration that ships the change.

Perché usare Schema Design su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Schema Design è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Schema Design in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/nahid-sparktales/agent-dispatcher/tree/main/skills/database/schema-design. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Schema Design?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Schema Design?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Schema Design: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Schema Design è gratuita?

Sì. È pubblicata su GitHub da nahid-sparktales con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇