.github/skills/database-changes/SKILL.md
Make database schema changes for Clarin CRM. Use when adding tables, columns, indexes, or modifying the PostgreSQL schema. Migrations live in database.go InitDB() function.
npx skillsauth add ricardoalejandro/clarin database-changesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Migrations are SQL statements inside backend/pkg/database/database.go in the InitDB() function. They run on every backend startup, so they MUST be idempotent.
// In InitDB() at the end:
_, _ = db.Exec(ctx, `ALTER TABLE leads ADD COLUMN IF NOT EXISTS priority TEXT DEFAULT 'normal'`)
_, _ = db.Exec(ctx, `
CREATE TABLE IF NOT EXISTS campaigns (
id BIGSERIAL PRIMARY KEY,
account_id BIGINT NOT NULL REFERENCES accounts(id),
name TEXT NOT NULL,
status TEXT DEFAULT 'draft',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
)
`)
_, _ = db.Exec(ctx, `CREATE INDEX IF NOT EXISTS idx_leads_phone ON leads(phone)`)
_, _ = db.Exec(ctx, `
CREATE TABLE IF NOT EXISTS lead_tags (
lead_id BIGINT NOT NULL REFERENCES leads(id) ON DELETE CASCADE,
tag_id BIGINT NOT NULL REFERENCES tags(id) ON DELETE CASCADE,
PRIMARY KEY (lead_id, tag_id)
)
`)
IF NOT EXISTS or ADD COLUMN IF NOT EXISTS — migrations run on every startup.domain/entities.go.repository/repository.go.docker compose build backend && docker compose up -ddocker compose logs --tail=30 backendaccounts — Multi-tenant accountsusers — Users per accountleads — CRM leads (synced from Kommo)contacts — CRM contacts (synced from Kommo)chats — WhatsApp conversationsmessages — Chat messagestags — Tags with UNIQUE(account_id, name) and kommo_idlead_tags, contact_tags, chat_tags — Junction tablesdevices — WhatsApp devicespipelines, pipeline_stages — Kanban pipelinesdevelopment
Enforce code quality, self-testing, and verification standards for Clarin CRM. Use this skill to ensure every change is compiled, deployed, and validated before presenting to the user. Acts as a senior engineer code review checklist.
tools
Work with Kommo CRM integration in Clarin. Use when modifying the sync worker, API client, lead/contact/tag synchronization, or phone normalization. Covers the one-way Kommo to Clarin sync flow.
development
Create beautiful, polished, and highly usable Next.js/React/TypeScript interfaces for Clarin CRM. Use when creating or modifying dashboard pages, components, API calls, WebSocket listeners, or UI styling. Enforces visual excellence, micro-interactions, accessibility, and the emerald/slate design system.
development
Build, deploy, and verify changes for Clarin CRM. Use this skill after making any code change to compile, deploy, and validate that everything works correctly. Covers Docker-based builds for Go backend and Next.js frontend.