skills/ that walks an agent through building a new integration end to end — syncing external data, parsing it into markdown artifacts, vectorizing it, and exposing it over the MCP server. It encodes the conventions from the existing Gong, Notion, and Discord integrations so you don’t have to rediscover them.
When it triggers
Thebuild-stoneturner-integration skill activates when you ask an agent to add a new data source under src/integrations/ — a SaaS API, an OAuth app, or any other external source. In Claude Code, the skill loads automatically when the repository is in context; you can also invoke it explicitly.
What it covers
The skill (skills/SKILL.md) drives the work in order:
Scaffold the folder
Create
config.ts, integration.ts, db/, models/, and sync-steps/ under src/integrations/<name>/.Define the config
Pick an
integrationType (BASIC_TOKEN, API_KEY, or OAUTH) and declare credential inputs or oauthAuthorizationUrl.Define schemas + queries
Mirror the source’s shape in Drizzle tables with a stable unique key, idempotent
onConflictDoUpdate inserts, and register the schema path in drizzle.config.ts.Write the sync steps
Fetch with
retry(), throttle every AI Gateway call through aiGatewayBottleneck, support an incremental flag, and log syncTask rows.Assemble the pipeline
Compose the steps into one
syncPipeline(incremental) and export an Integration whose deleteSync purges syncTasks, artifacts, embeddings, and your own tables.Reference files
SKILL.md points to four references with deeper detail and patterns:
| Reference | What it covers |
|---|---|
references/anatomy.md | The two core types (IntegrationConfig, Integration), folder layout, schemas, idempotent inserts, and the registries. |
references/sync-pipeline.md | Writing sync / parse / index steps — rate limiting, retries, sync-task logging, and the markdown-artifact contract. |
references/auth.md | BASIC_TOKEN, API_KEY, and OAUTH credential patterns, including handleRedirect and refreshAccessTokens. |
references/checklist.md | A copy-pasteable end-to-end checklist plus the commands to run. |
Conventions it enforces
@/*is the alias forsrc/*.- The shared vector step is
index-vector-db-step.ts— reuse it, don’t fork it. - The integration string on every
mdArtifactandsyncTask, and the argument toindexVectorDbStep(...), must all equalconfig.integration— they’re matched as plain strings. - Syncs are fire-and-forget from the HTTP handler, so all error handling lives inside the steps and is recorded as
syncTaskrows. - The middleware directory is misspelled
middlware/on purpose — don’t “fix” it.
