add-column-type

Adds a new table column type to Sim through its registry, icon, coercion, and migration contract.

29.5k|3.8k|Updated Jan 5, 2025
One-click install
npx skills add https://github.com/simstudioai/sim --skill add-column-type
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-column-type
Source: https://github.com/simstudioai/sim/tree/main/.agents/skills/add-column-type
Command: npx skills add https://github.com/simstudioai/sim --skill add-column-type

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Adding a new column type to Sim's table system previously required dozens of scattered edits across switch statements and UI branches, each failing silently when missed. This Skill guides you through the registry-driven architecture so the compiler enumerates every required change and no consumer needs manual editing.

Core Features & Use Cases

  • Compiler-Guided Registration: Add your type to the ColumnType union and let TypeScript errors point to the exact registry files requiring entries.
  • Single-File Type Definition: Implement storage cast, coercion, validation, conversion compatibility, formatting, and filter operators in one file under apps/sim/lib/table/column-types/.
  • Icon and Migration Conventions: Create a type-* icon matching family geometry conventions and add drizzle cell migrations when stored bytes change.
  • Use Case: You want a new 'rating' column type for Sim tables. Follow the steps to pick a numeric storage shape, write the type file, register it in both client and server registries, and validate with type-check, grep leak detection, and the vitest suite.

Quick Start

Add a new table column type called rating to Sim following the add-column-type skill, starting by extending the ColumnType union and running the type checker.

Frequently Asked Questions about add-column-type

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new column type to Sim tables?

Add your type to the ColumnType union in column-types/types.ts, then run bun run type-check to get the exact files requiring registration. Create one file in apps/sim/lib/table/column-types/ implementing the full ColumnTypeDefinition interface, and register it in both registry.ts and registry.server.ts.

How do I choose the storage shape for a new column type?

Decide what a cell literally holds in the JSONB data column: numeric values use a numeric jsonbCast, ISO date strings use timestamptz, and plain strings or objects use null. Prefer an existing primitive over a new shape so filtering, sorting, and CSV export reuse existing paths.

Why does the compiler show errors after adding a ColumnType union member?

The errors are intentional gates, not problems. The registries are typed as Record over ColumnType, so TypeScript names registry.ts and registry.server.ts as missing your entry, plus validation files if your type owns metadata keys.

When do I need migrateCellsTo or migrateCellsFrom for a column type?

Add these server-side migrations only when converting a column to or from your type must rewrite stored cell bytes. Skipping them leaves non-castable values behind, causing every filter and sort query on that column to fail in Postgres.

Why does importing CSV data into my new column type store wrong values?

The import.ts coerceValue function is a second write path independent of the registry, and its default arm silently stringifies values. Add an explicit case for your type so numeric-cast columns do not receive raw text that breaks queries.