This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
[!IMPORTANT] Read CLAUDE.local.md if exists.
pnpm exec turbo run build- Build all packagespnpm exec turbo run test- Run all testspnpm exec turbo run check- Run format, lint:fix, typecheck:go, and knip in sequencepnpm exec turbo run generate- Run code generationpnpm exec turbo run apply- Deploy to the Tailor Platform
pnpm test/pnpm test path/to/test.ts/pnpm test -t "pattern"- Run tests with Vitestpnpm build- Build SDKpnpm docs:check/pnpm docs:update- Check/update CLI documentation
See packages/sdk/docs/cli-reference.md for the full CLI reference.
CLI docs are auto-generated by politty from command definitions. The generation config is packages/sdk/src/cli/docs.test.ts.
- Adding a new command: add a
filesentry indocs.test.ts(commands+render: defaultRender) then rundocs:update. Both the doc file and the command index incli-reference.mdare generated automatically. - Adding a subcommand: if the parent command (e.g.,
"tailordb") is already infiles, subcommands are auto-expanded. Just rundocs:update. - Modifying a command: run
docs:update, verify withdocs:check, commit alongside the code. cli-reference.md: content inside<!-- politty:... -->markers is auto-generated; outside is manually maintained.- Missing markers:
POLITTY_DOCS_DOCTOR=true POLITTY_DOCS_UPDATE=trueto auto-insert.
Refer to example/ for working implementations of all patterns (config, models, resolvers, executors, workflows).
Key files:
example/tailor.config.ts- Configuration with defineConfig, defineAuth, defineIdp, defineStaticWebSite, defineGeneratorsexample/tailordb/*.ts- Model definitions withdb.type()example/resolvers/*.ts- Resolver implementations withcreateResolverexample/executors/*.ts- Executor implementations withcreateExecutorexample/workflows/*.ts- Workflow implementations withcreateWorkflow/createWorkflowJob
createWorkflow()result must be default exported- All jobs must be named exports (including mainJob and triggered jobs)
- Job names must be unique across the entire project
.trigger()returns aPromise— always useawaitto get the result- On the server, the calling job suspends until the triggered job completes (synchronous execution), but the TypeScript API is
Promise-based
Available triggers beyond record CRUD (recordCreatedTrigger, recordUpdatedTrigger, recordDeletedTrigger):
resolverExecutedTrigger- Resolver executionidpUserCreatedTrigger/idpUserUpdatedTrigger/idpUserDeletedTrigger- IdP user eventsauthAccessTokenIssuedTrigger/authAccessTokenRefreshedTrigger/authAccessTokenRevokedTrigger- Auth token eventsscheduleTrigger- CRON scheduleincomingWebhookTrigger- Webhook
Multi-event trigger variants handle multiple events in one executor:
recordTrigger({ type, events: ["created", "updated"] })- Multiple record eventsidpUserTrigger({ events: ["created", "deleted"] })- Multiple IdP user eventsauthAccessTokenTrigger({ events: ["issued", "revoked"] })- Multiple auth token events
Args include event (short name like "created") and rawEvent (full event type like "tailordb.type_record.created") for runtime type narrowing.
defineGenerators() takes tuples as rest arguments (see example/tailor.config.ts). The @tailor-platform/kysely-type generator (built into the SDK) is required for getDB() in resolvers/executors/workflows.
definePlugins()is available for reusable type/resolver/executor generation- Static website
.urlproperty is resolved at deployment time — use it in CORS and redirect URIs
See docs/ for developer and contributor documentation.
- Getting Started - Prerequisites, setup, key commands
- Architecture - Design decisions and non-obvious patterns
- Testing - Test strategy and conventions
- Changeset Conventions - Version bump level guidelines
- Telemetry / Performance Profiling - OTLP tracing for CLI performance analysis
- Use
/docs-checkto search https://docs.tailor.tech/ when you need platform-side specs that the codebase doesn't cover
- Linting runs oxlint first, then ESLint
- Lefthook runs pre-commit checks (lint, format, typecheck) and post-commit signature verification