Agent skill

Sqlite Schema Design

by fastrepl in fastrepl/anarlog

Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice.

MITAuto-check passedDatabases

Install Sqlite Schema Design

skills CLI
$ npx skills add fastrepl/anarlog --skill sqlite-schema-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install fastrepl/anarlog sqlite-schema-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/fastrepl/anarlog.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/sqlite-schema-design .claude/skills/sqlite-schema-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sqlite-schema-design
GitHub stars
9.4k
Token cost
~1.9k tokens
SKILL.md length
924 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
MIT

At a glance

Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice.

  • Works in 10 steps: Decide Whether The Table Is Synced → Require A Stable, Globally Unique… → Make Inserts Merge-Safe With Real Defaults → …
  • Adding synced tables
  • SKILL.md covers Goal, Workflow, Design Defaults For Synced… and Review Checklist
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Sqlite Schema Design is an agent skill from fastrepl/anarlog. Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice. Use when adding synced tables, changing synced columns, or planning CloudSync-safe migrations.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Database schema design. It works with SQLite. The repository describes itself as: Open source Granola AI Alternative. The licence is MIT.

When your agent uses it

  • Adding synced tables
  • Changing synced columns
  • Planning CloudSync-safe migrations

Example prompts

  • “/sqlite-schema-design”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Decide Whether The Table Is Synced
  2. Require A Stable, Globally Unique Primary Key
  3. Make Inserts Merge-Safe With Real Defaults
  4. Keep The Local And Cloud Schemas Identical
  5. Be Conservative With Foreign Keys
  6. Avoid Triggers And Implicit Write Logic On Synced Tables
  7. Scope Uniqueness For RLS And Multi-Tenant Sync
  8. Keep Schema Changes Inside The CloudSync Alter Window
  9. Keep Sync Metadata Out Of Your Domain Schema
  10. Separate Network Lifecycle From Schema Design

What it can do on your machine

Read from SKILL.md and the folder at commit 259a04e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sqlite Schema Design loads about 1.9k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 924 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from fastrepl/anarlog at commit 259a04e, republished under its MIT licence (© fastrepl). 924 words, ~1,903 tokens.

Download SKILL.mdSave it as .claude/skills/sqlite-schema-design/SKILL.md (or your agent's skills folder).
name
sqlite-schema-design
description
Design or review schemas for `crates/cloudsync` using SQLite Sync constraints, not generic SQLite advice. Use when adding synced tables, changing synced columns, or planning CloudSync-safe migrations.
metadata.internal
true

Goal

Design tables that behave correctly under SQLite Sync's CRDT replication model.

This skill is specifically for CloudSync-backed schemas:

  • tables are initialized through cloudsync_init(...)
  • sync is enabled with cloudsync_enable(...)
  • identifiers should be generated with cloudsync_uuid()
  • schema changes must go through cloudsync_begin_alter(...) and cloudsync_commit_alter(...)
  • local and cloud databases must keep the same schema

Do not treat this as ordinary SQLite schema design. SQLite Sync imposes extra rules around keys, defaults, foreign keys, and schema evolution.

Workflow

1. Decide Whether The Table Is Synced

Before proposing DDL, classify the table:

  • synced application data: must satisfy SQLite Sync constraints
  • local-only cache or ephemeral state: should usually stay out of CloudSync

Only apply this skill to synced tables or to tables that may become synced soon.

2. Require A Stable, Globally Unique Primary Key

For synced tables:

  • always declare an explicit primary key
  • prefer TEXT PRIMARY KEY NOT NULL
  • generate ids with cloudsync_uuid()
  • do not use auto-incrementing integer ids

SQLite Sync docs explicitly recommend UUIDv7-style globally unique ids for CRDT workloads. Integer autoincrement ids are a bad fit because multiple devices can create rows independently.

sql
CREATE TABLE document (
  id TEXT PRIMARY KEY NOT NULL DEFAULT (cloudsync_uuid()),
  workspace_id TEXT NOT NULL,
  title TEXT NOT NULL DEFAULT '',
  body TEXT NOT NULL DEFAULT '',
  archived INTEGER NOT NULL DEFAULT 0,
  created_at INTEGER NOT NULL DEFAULT (unixepoch()),
  updated_at INTEGER NOT NULL DEFAULT (unixepoch())
) STRICT;

If the environment cannot use a function call in DEFAULT, generate the id in application code, but still use cloudsync_uuid() as the canonical id strategy.

3. Make Inserts Merge-Safe With Real Defaults

SQLite Sync best practices call out a non-obvious CRDT constraint: merges can happen column-by-column, so missing values are much more dangerous than in a single-node SQLite app.

For synced tables:

  • every non-primary-key NOT NULL column should have a meaningful DEFAULT
  • avoid required columns that only application code knows how to populate
  • prefer simple scalar defaults over nullable columns when the field is logically always present

Good:

sql
title TEXT NOT NULL DEFAULT ''
archived INTEGER NOT NULL DEFAULT 0
sort_order INTEGER NOT NULL DEFAULT 0

Bad:

sql
title TEXT NOT NULL
archived INTEGER NOT NULL

without defaults on a synced table.

4. Keep The Local And Cloud Schemas Identical

The getting-started docs require the local synced database and the SQLite Cloud database to share the same schema.

When designing or reviewing a schema:

  • treat local and remote DDL as one contract
  • do not introduce "client-only" columns on synced tables
  • do not rely on drift being harmless
  • ensure migrations are applied consistently before sync resumes

If a field is only needed locally, it likely belongs in a separate non-synced table.

5. Be Conservative With Foreign Keys

SQLite Sync best practices explicitly warn that foreign keys can interact poorly with CRDT replication.

Use foreign keys on synced tables only when the integrity guarantee is worth the operational cost.

If you keep them:

  • make child foreign key columns nullable when the relationship is optional
  • if a foreign key column has a DEFAULT, that default must be NULL or reference an actually valid parent row
  • avoid fake sentinel ids such as 'root' unless that parent row is guaranteed to exist everywhere
  • index the child foreign key columns

Prefer ownership patterns that tolerate out-of-order arrival between related rows.

6. Avoid Triggers And Implicit Write Logic On Synced Tables

SQLite Sync best practices advise minimizing triggers because they make replicated writes harder to reason about.

For synced tables:

  • avoid triggers that mutate synced columns
  • avoid hidden side effects on insert or update
  • prefer explicit application writes
  • keep derived or bookkeeping writes in non-synced tables if possible

If a trigger is unavoidable, review it as part of the replication design, not as a local SQLite convenience.

Show full SKILL.md (380 more words)Show less
7. Scope Uniqueness For RLS And Multi-Tenant Sync

The introduction docs emphasize row-level security and multi-tenant access patterns.

That changes uniqueness design:

  • if the real rule is "unique per workspace/user/team", encode that as a composite constraint
  • avoid globally unique business keys unless they truly span all tenants

Prefer:

sql
UNIQUE (workspace_id, slug)

over:

sql
slug TEXT UNIQUE

when data is tenant-scoped.

8. Keep Schema Changes Inside The CloudSync Alter Window

Schema changes for synced databases are not ordinary ALTER TABLE work. Use:

  1. cloudsync_begin_alter('table_name')
  2. perform the schema change
  3. cloudsync_commit_alter('table_name')

Design implications:

  • favor additive changes over destructive rewrites
  • prefer adding columns with safe defaults
  • avoid migrations that temporarily violate sync invariants
  • plan rollouts so every replica can move cleanly to the new shape

When reviewing a migration plan, reject any synced-table schema change that skips the CloudSync alter flow.

9. Keep Sync Metadata Out Of Your Domain Schema

SQLite Sync already exposes its own metadata and helpers:

  • cloudsync_siteid()
  • cloudsync_db_version()
  • cloudsync_version()
  • cloudsync_is_enabled()

Do not duplicate these concepts as app-managed columns on synced tables unless there is a very specific product requirement.

10. Separate Network Lifecycle From Schema Design

The API set includes network setup and sync transport functions such as:

  • cloudsync_network_init(...)
  • cloudsync_network_set_token(...)
  • cloudsync_network_set_apikey(...)
  • cloudsync_network_sync(...)
  • cloudsync_network_has_unsent_changes()

These matter operationally, but they are not substitutes for sound schema design.

Do not design tables that assume:

  • sync is always online
  • rows arrive in lockstep
  • dependent rows replicate in a single transaction boundary visible to all peers

Assume offline creation, delayed delivery, retries, and independent merges.

Design Defaults For Synced Tables

Unless the user explicitly asks otherwise:

  • TEXT PRIMARY KEY NOT NULL
  • ids generated with cloudsync_uuid()
  • STRICT tables
  • explicit DEFAULT on every non-key NOT NULL column
  • composite uniqueness for tenant-scoped identifiers
  • minimal or no triggers
  • cautious foreign key usage
  • separate non-synced tables for local UI/cache state

Review Checklist

When reviewing a CloudSync schema, ask:

  • Does every synced table have a globally unique primary key strategy?
  • Are new rows creatable independently on multiple devices?
  • Do all non-key required columns have defaults that make replicated inserts safe?
  • Would the schema still behave correctly if related rows arrive out of order?
  • Are foreign keys optional where replication ordering can vary?
  • Are tenant-scoped uniqueness rules modeled as composite constraints?
  • Does the migration plan use cloudsync_begin_alter / cloudsync_commit_alter?
  • Is any local-only state incorrectly mixed into a synced table?

© fastrepl, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/sqlite-schema-design of fastrepl/anarlog.

Open the folder on GitHubat commit 259a04e

Compare with similar skills

Sqlite Schema Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sqlite Schema Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sqlite Schema Design this skillfastrepl/anarlog9.4k—~1.9kAutomated safety check: PassMIT
Fantasia Flatten Database Schemasvishiri/fantasia-archive409—~653Automated safety check: PassGPL-3.0
Sqlite Map Parserbenchflow-ai/skillsbench1.8k—~1kAutomated safety check: PassApache-2.0
Add Memory KindEverMind-AI/EverOS13k—~2.6kAutomated safety check: PassApache-2.0
Cursor BYOK Database Schemaleookun/cursor-byok3.2k—~1.3kAutomated safety check: PassMIT
Golang Databaseunxed/f42402 repos~2.9kAutomated safety check: PassMIT

Similar skills

  • Fantasia Flatten Database Schemas

    vishiri/fantasia-archive

    Collapses .faproject SQLite PRAGMA userversion ladders into a single bootstrap schema (procedure sets max to 1) during pre-release dev resets.

    409 GitHub stars~653 tokensUpdated 6 days ago
    DatabasesAuto-check passed
  • Sqlite Map Parser

    benchflow-ai/skillsbench

    Parse SQLite databases into structured JSON data. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~1k tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Add Memory Kind

    EverMind-AI/EverOS

    Walks through adding a new persisted memory kind to EverOS: choose storage among Markdown, SQLite and LanceDB, pick a Markdown strategy, then wire schemas, repos and writers.

    13k GitHub stars~2.6k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Cursor BYOK Database Schema

    leookun/cursor-byok

    Guides SQLite schema changes in the Cursor BYOK server, keeping SQLx migrations, the Rust store, API contracts and fixtures aligned.

    3.2k GitHub stars~1.3k tokensUpdated 9 days ago
    DatabasesAuto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    240 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    223 GitHub stars~2.8k tokensUpdated 16 days ago
    DatabasesAuto-check passed

More from fastrepl/anarlog

All 32 skills in this repo
  • But

    fastrepl/anarlog

    Use only in the Anarlog repository when the active checkout branch is exactly gitbutler/workspace.

    9.4k GitHub stars~5.8k tokensUpdated today
    Auto-check passed
  • Create PRs

    fastrepl/anarlog

    Use only in the Anarlog repository when the active checkout branch is exactly gitbutler/workspace.

    9.4k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Fix Ready PRs

    fastrepl/anarlog

    Inspect every open non-draft PR for CI failures and unresolved Cursor Bugbot findings, then fix them on the existing PR branches.

    9.4k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • No Use Effect

    fastrepl/anarlog

    Avoid direct React useEffect usage when writing or reviewing React components and hooks.

    9.4k GitHub stars~825 tokensUpdated today
    Auto-check passed
  • QA Critical UX

    fastrepl/anarlog

    QA Anarlog's critical Pro user journey on a signed staging candidate — onboarding, responsive launch, microphone and system-audio capture, automated summaries, and cloud sync.

    9.4k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Reactive Sqlite UI

    fastrepl/anarlog

    Build SQLite-backed reactive UI in apps/desktop using stable patterns for reads, selection, forms, writes, and loading states.

    9.4k GitHub stars~699 tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Sqlite Schema Design

What does Sqlite Schema Design do?

Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice. Sqlite Schema Design is an agent skill from fastrepl/anarlog. Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice.

When should I use Sqlite Schema Design?

Sqlite Schema Design fits situations like: adding synced tables; changing synced columns; planning CloudSync-safe migrations.

How do I install Sqlite Schema Design in Claude Code?

Run `npx skills add fastrepl/anarlog --skill sqlite-schema-design -a claude-code`. Or copy the skill folder (.agents/skills/sqlite-schema-design in fastrepl/anarlog) into .claude/skills/sqlite-schema-design in your project. Claude Code loads it when a task matches its description.

How do I install Sqlite Schema Design in Codex?

Run `npx skills add fastrepl/anarlog --skill sqlite-schema-design -a codex`. Or copy the skill folder (.agents/skills/sqlite-schema-design in fastrepl/anarlog) into .agents/skills/sqlite-schema-design in your project. Codex loads it when a task matches its description.

Can I use Sqlite Schema Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add fastrepl/anarlog --skill sqlite-schema-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sqlite-schema-design, .gemini/skills/sqlite-schema-design, .github/skills/sqlite-schema-design and .opencode/skills/sqlite-schema-design in your project.

What does Sqlite Schema Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Sqlite Schema Design is instructions for the agent only.

Does Sqlite Schema Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Sqlite Schema Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sqlite Schema Design use?

Sqlite Schema Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sqlite Schema Design use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Sqlite Schema Design?

Skills that share tags, products or a category with Sqlite Schema Design: Fantasia Flatten Database Schemas (vishiri/fantasia-archive, 409 stars), Sqlite Map Parser (benchflow-ai/skillsbench, 1.8k stars), Add Memory Kind (EverMind-AI/EverOS, 13k stars) and Cursor BYOK Database Schema (leookun/cursor-byok, 3.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sqlite Schema Design?

fastrepl (a GitHub organization) maintains it in fastrepl/anarlog, which has 9,445 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 7, 2026.

Source: fastrepl/anarlog on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.