Skip to content

Add a clerk-migrate skill for moving users into Clerk - #73

Draft
royanger wants to merge 19 commits into
mainfrom
ra/integrate-migration-tool-into-cli
Draft

royanger wants to merge 19 commits into
mainfrom
ra/integrate-migration-tool-into-cli

Conversation

@royanger

@royanger royanger commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

What does this solve? What changed?

Adds clerk-migrate, a skill for moving users into Clerk with the CLI's clerk migrate commands: export from the old provider, check and import, then inspect or undo the run. It documents the commands from the clerk/cli#479 stack as they stand in its last PR, clerk/cli#531.

Files in skills/clerk-migrate/:

  • SKILL.md: routing, targeting, the five-step import flow (identify the source, summarize, dry run, consent, report), and a summary of re-runs and undo
  • references/export.md: exporting from Auth0, Supabase, Firebase, Auth.js, Better Auth, WorkOS and Clerk
  • references/sources.md: what each built-in source carries, and how to write one for any other platform
  • references/checks.md: each reject reason in the order the checks apply them, the warnings, --allow-partial, and exit codes
  • references/runs.md: re-running, run files and statuses, and every undo case
  • references/clerk-to-clerk.md: development to production

The clerk router (description and body), clerk-setup and clerk-cli route migration requests here. clerk-cli adds the migrate consent gates to its agent-mode notes. The README lists the skill. The plugin finds it in skills/ on its own, so no manifest changes.

What the agent must do:

  • Run the dry run and relay its checks. Import or undo only after the user says yes to them, in a later turn.
  • Never pass --yes, --include-signed-in, --reserve-unverified, --skip-legal-checks or --allow-partial without the user's yes.
  • Name the source instance when exporting from Clerk. In agent mode the CLI refuses until it is named, because the linked project is usually the destination.
  • Before writing a custom source, ask six questions (email and phone verification, password hasher, file shape, metadata, account state) and check each answer against the file.

Deadline

Other resources

🤖 Generated with Claude Code

@royanger royanger changed the title WIP Add a clerk-migrate skill for moving users into Clerk Oct 6, 2026
royanger and others added 19 commits October 16, 2026 16:32
Rename `migrate run` to `migrate import`, add WorkOS as the seventh
platform, and correct the run record location, log names, dev-instance
user limit, export paths and coverage icons. Add `migrate settings`,
libsql/Turso, and credential re-prompting. Rewrite the import step for
agent mode, where the readiness report prints but nothing pauses.

Point the router, setup and clerk-cli skills at `migrate import`, and
list the `migrate` commands that require `-y` in agent mode.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replace the removed `migrate settings`, `migrate delete`, `migrate logs`
and `migrate transformers list` with `migrate runs`, `migrate undo` and
`migrate sources`, and drop the old import flags (`--transformer`,
`--transformer-file`, `--file`, `--resume-after`,
`--skip-unsupported-providers`).

State the five rules: consent via `--yes` (exit 2 with the exact command
otherwise), `--dry-run` against the real instance, the run store in
`.clerk/migrate/<run-id>/`, target printed first, and `--json` on every
subcommand. Rewrite the import flow as export → dry run → consent →
import → runs, and tell agents to relay the exit-2 preview and ask before
re-running with `--yes`.

Add `references/checks.md` for the import checks and `--allow-partial`.
Rename `references/transformers.md` to `references/sources.md`, require
`carries` on custom sources, and cover the export envelope, Firebase hash
parameters in the envelope, re-run semantics, undo refusals, metadata
landing in `unsafe_metadata`, Better Auth hasher detection and the NFKC
caveat, and social sign-ins going through account linking.

Update the clerk-cli agent-mode notes: `migrate import` and `migrate
undo` now require `--yes`. Drop the CLI version pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…former

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… importing

Agents in the 2026-10-06 evals ran --yes in the same turn as the dry run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…secret key

A Clerk-to-Clerk eval run stalled asking for app and instance IDs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From the 2026-10-06 source, import and migration evals:
- ask six questions every time, account state included, and check each
  answer against the file
- place every metadata field, private when unsure
- pick password hashers from the digest, including the two PBKDF2-SHA256
  hashers, which differ only in how they read the salt
- common export shapes: E.164 phones, names, mixed identifier columns,
  several emails per user, Unix timestamps
- leave users out with skipReason, which needs --allow-partial
- check sample rows through the mapping before the dry run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…metadata

From the 2026-10-06 mixed source eval:
- an explicit signal in the file beats a repeated answer
- any state that stops sign-in imports banned; skipReason only for gone users
- PBKDF2 colon and Werkzeug forms, and reading the salt when the user can't tell
- unwrap provider containers and parse packed metadata strings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rivate

From the 2026-10-07 mixed source eval:
- a field with no flag of its own is silent, so the user's answer decides
- CRM and billing IDs stay private even when the user asks for their field
  to be public

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng IDs

The metadata table already puts risk scores in privateMetadata; the
override rule now matches it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…slib PBKDF2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on tool

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…for new ones

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng leaves out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- `export clerk` refuses in agent mode until the source is named
- a source you wrote can map an export run, so drop the jq workaround
- document `--include-signed-in`, `--reserve-unverified` and
  `--skip-legal-checks`, and that each needs the user's yes
- exit 0 can still be partial: read the counts from --json
- move re-running, run files and undo into references/runs.md
- rewrite the reject list in the order the checks apply it
- fix per-platform export, coverage and source details
- start the new skill at version 1.0.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te gates

- add user migration to the router description
- clerk-cli: `migrate undo` needs `--include-signed-in` for users who
  signed in since, and `migrate export clerk` needs a named source
- bump clerk and clerk-setup patch versions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@royanger
royanger force-pushed the ra/integrate-migration-tool-into-cli branch from 9299c91 to 07ecafe Compare October 16, 2026 20:55
@royanger royanger added the do not merge Prevents PRs from being merged while label is applied. label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Prevents PRs from being merged while label is applied.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant