agentsclimarketplace

Link setup database

Skill merge-api/merge-unified-skills/skills/link-setup-database

Claude Code skills for the Merge Unified API

Install
npx -y skills add merge-api/merge-unified-skills --skill link-setup-database

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Create the linked_accounts database table required for Merge Link. Use as Step 2 of Merge Link implementation after loading context.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

5.6 KB, as published. Nobody here has run it

Setup Database: linked_accounts Table

Creates the database table that tracks linked Merge accounts — one row per active integration per organization. All Merge Link API flows read and write this table.

Prerequisites

Tech stack and ORM identified (either from Step 1 of implementing-link, or by scanning the codebase now).

Before Proceeding

Step 1 — Confirm or gather required context:

Two pieces of information are needed before showing the schema:

  • Organization/tenant table: The table or model in your app that represents a customer org or tenant (e.g. organizations, companies, tenants). Needed to wire the organization_id FK.
  • Linked Account strategy: Strategy 1 (1 Linked Account per category per org) or Strategy 2 (multiple per category)? Needed to annotate end_user_origin_id.

If invoked from implementing-link, both were answered in Steps 1b and 1d — use that context. Otherwise, ask the user now:

  1. What is the table/model that represents a customer organization or tenant in your system? What is its primary key column?
  2. Do you want 1 Linked Account per category per org, or multiple Linked Accounts per category?

Step 2 — Show the schema and wait for confirmation:

Here is the linked_accounts table I'll create:

ColumnTypeConstraintsNotes
idintegerPRIMARY KEY, auto-increment
organization_idintegerNOT NULL, FK → {org_table}.{pk}Ties to your org/tenant table
end_user_origin_idvarchar(200)NOT NULLStable per-org GUID (Strategy 1) or per-connection GUID (Strategy 2)
categoryvarchar(50)NOT NULLe.g. hris, ats, crm
integration_slugvarchar(100)nullablePopulated after token exchange
account_tokenTEXTnullableMust be TEXT — tokens exceed 100 chars and a fixed VARCHAR truncates silently
statusvarchar(20)NOT NULL, default 'pending'pending, active, error, disabled
initial_sync_completebooleanNOT NULL, default false
created_attimestampNOT NULL, default now
updated_attimestampNOT NULL, default now, auto-update

Unique constraint: (organization_id, end_user_origin_id)

FK for organization_id: I'll reference {org_table}.{pk}. [If no org table was identified: I'll create organization_id as a plain integer — you can add the REFERENCES constraint manually.]

Does this look right? Any columns to add, rename, or change before I generate the migration?

Wait for confirmation before continuing.

Implementation Prompt

Tell your coding agent:

Create a linked_accounts table (or equivalent model for our ORM) with these exact fields:

For organization_id, emit a proper FK constraint referencing the org/tenant table identified in Step 1:

organization_id INTEGER NOT NULL REFERENCES {org_table}({pk_col})

If the org table was not identified in Step 1, emit organization_id INTEGER NOT NULL and add a -- TODO: add REFERENCES constraint comment. Do NOT invent a table name.

FieldTypeNotes
idinteger, primary keyauto-increment
organization_idinteger, foreign keyties integration to your org/tenant table (see FK instruction above)
end_user_origin_idvarchar(200), not nullstable per-org GUID (Strategy 1) or per-connection GUID (Strategy 2)
categorystring, at least 50 chars, not nullMerge category: hris, ats, crm, etc.
integration_slugstring, at least 100 chars, nullablee.g. gusto, workday — set after token exchange
account_tokenTEXT (or string with no fixed cap), nullablepermanent Merge API token — null until exchange completes. Use TEXT rather than a fixed VARCHAR(64/128); account tokens can exceed 100 chars and a too-tight column truncates silently in some drivers
statusstring, at least 20 chars, default pendingpending, active, error, disabled
initial_sync_completeboolean, default falseflipped true after first full sync
created_attimestampdefault now
updated_attimestampdefault now, auto-update

Add a unique constraint on (organization_id, end_user_origin_id).

Use the project's existing migration/ORM system (e.g. Alembic, Django migrations, ActiveRecord, Prisma). Generate the migration file and show it to the user for review before running it.

Critical Gotchas

end_user_origin_id MUST be written to the database BEFORE calling the Merge API. The record is created during link token generation — not after. If the Merge API call fails mid-flow, the local record prevents duplicate incomplete accounts on retry.

account_token is nullable by design. It does not exist until the public token exchange completes (Step 4). Any non-null constraint here will break the flow.

The unique constraint on (organization_id, end_user_origin_id) prevents duplicate integrations. This is the deduplication guard. Without it, users can create multiple conflicting records for the same integration.

Testing Checklist

  • Table created with all required columns
  • Unique constraint on (organization_id, end_user_origin_id) exists
  • account_token column is nullable
  • initial_sync_complete defaults to false
  • Migration runs cleanly with no errors (or equivalent ORM check)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.