본문으로 건너뛰기
cccskills
무료GitHub에 공개

portable-schema-generator

Emit Postgres.sql and SQLite.sql from a single schema spec so tools work across both drivers without duplicating DDL by hand. Use when designing a schema that needs to support both shared Postgres deployments and zero-config SQLite. Reduces two-file sync burden to a single source edit.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구PostgreSQL
설치 방법 보기

포함된 파일(1)

  • SKILL.md4.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Portable Schema Generator

Two-driver schemas mean two migration files. Hand-keeping them in sync drifts fast. This skill captures the translation rules and the minimal tooling that keeps them aligned.

When to Use

  • Your tool needs to work on both Postgres and SQLite
  • You want fresh-project onboarding to be zero-config (SQLite default) while shared-infra deployments keep Postgres
  • A single schema change should land in both driver files with no manual diff-copying

Core Differences

ConcernPostgresSQLite
SchemasCREATE SCHEMA foo; SET search_path TO fooNamespace-flat — prefix names instead
AutoincrementBIGSERIAL PRIMARY KEYINTEGER PRIMARY KEY AUTOINCREMENT
TimestampsTIMESTAMPTZ DEFAULT now()TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
BooleansBOOLEANINTEGER (0/1)
Enums via CHECKCHECK (col IN ('a','b'))Same — both support inline CHECK
Foreign keysOn by defaultPRAGMA foreign_keys = ON required at connect
Updated-at triggerCREATE TRIGGER ... EXECUTE FUNCTION touch_updated_at()CREATE TRIGGER ... BEGIN UPDATE ... END
Cascading dropsON DELETE CASCADESame, but only enforced with foreign_keys = ON
Reserved-word casingCase-insensitiveCase-insensitive, but be consistent

Translation Rules

When authoring the Postgres version first:

  1. Strip schema prefix for SQLite — CREATE SCHEMA IF NOT EXISTS foo; and SET search_path are removed. Keep bare table names.
  2. Replace BIGSERIAL with INTEGER PRIMARY KEY AUTOINCREMENT.
  3. Replace TIMESTAMPTZ with TEXT; default becomes (strftime('%Y-%m-%dT%H:%M:%fZ','now')).
  4. Replace BOOLEAN with INTEGER (values 0/1 at insert time — use an adapter coercion).
  5. Drop RESTART IDENTITY on truncates (SQLite uses DELETE FROM sqlite_sequence WHERE name = 'table' instead).
  6. Rewrite function-style triggers to inline BEGIN ... END trigger bodies.

File Layout

migrations/<feature>/
  001-init.postgres.sql
  001-init.sqlite.sql
  002-next.postgres.sql
  002-next.sqlite.sql

Numbered pairs. The adapter picks the right one based on cfg.db.driver.

Adapter Runtime Responsibilities

The query adapter at runtime should:

  • Rewrite $N placeholders → ? for SQLite
  • Strip release_history. schema prefix for SQLite
  • Translate now() → strftime(...), ::type casts → drop
  • Coerce JS booleans → 0/1 on param bindings
  • Provide a portable truncate(table) helper

Reference implementation: tools/release-history/db.mjs in this repo.

Workflow

  1. Author the Postgres version first (richer type system reduces ambiguity).
  2. Translate row-by-row using the rules above into the SQLite version.
  3. Test both: apply each migration to a disposable DB, run schema-check script against the adapter.
  4. Commit both files together; never commit one without the other.

Anti-patterns to avoid

  • Single mixed-syntax file — both drivers will try to parse it and one or both will fail.
  • Runtime translation of whole migration files — too many edge cases.
  • Letting the Postgres file diverge "just for now" — alignment rots quickly.

Example (from this repo)

See migrations/release-history/001-init.postgres.sql and migrations/release-history/001-init.sqlite.sql. Six tables (release, feature, metric, retrospective, lesson, publish_target). Same semantics, driver-idiomatic DDL.

Related

  • env-setup — database credentials and .env conventions
  • file-operation-patterns — migration file naming discipline

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Provides web accessibility best practices for semantic HTML, ARIA, keyboard navigation, color contrast, and screen reader patterns. Use when building UI components, reviewing accessibility, or when user mentions 'a11y', 'accessibility', 'ARIA', 'screen reader', 'keyboard navigation', 'WCAG'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Active listening techniques for effective communication. Covers attending behaviors, paraphrasing, reflective listening, clarifying questions, empathic response, barriers to listening, listening in conflict, and cross-cultural listening. Use when building listening skills, improving understanding in conversation, mediating disputes, or analyzing communication breakdowns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Adversarial spec-compliance PR review — cross-references diffs against approved specs, verifies runtime claims against source, detects competing PRs, audits scope/convention compliance. Use before merging.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Provides best practices for AI agent orchestration including MCP servers, A2A protocol, multi-agent coordination, and swarm architectures. Use when designing agent systems, configuring MCP servers, setting up agent teams, or when user mentions 'MCP', 'A2A', 'agent orchestration', 'multi-agent', 'swarm', 'agent team', 'LangGraph', 'CrewAI', 'AutoGen'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Symbolic manipulation, equation solving, and algebraic structures for mathematical reasoning. Covers distributive law, factoring, completing the square, linear through polynomial equation solving, systems of equations (substitution, elimination, Gaussian elimination, matrix methods), algebraic structures (groups, rings, fields), modular arithmetic, polynomial theory, and inequalities. Use when solving equations, simplifying expressions, working with algebraic structures, or performing symbolic manipulation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Understanding how algorithmic systems shape what users see, know, and do -- from recommendation feeds to search ranking to credit scoring to hiring software. Covers the mechanics of recommendation systems, algorithmic bias and its sources, personalization's effects on information diets, opacity and accountability, AI limitations (hallucination, confident wrongness), and the human-in-the-loop question. Use when a learner needs to think critically about why particular content reached them.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Tibsfox의 스킬 모두 보기

이 스킬의 문제 신고