From lovable-cloud
Post-apply cleanup for Lovable-duplicated migrations: diff originals, db reset, delete, open PR. TRIGGER when: the user signals Lovable's migration apply step completed, regardless of exact wording. DO NOT TRIGGER when: all originals already deleted, or user asks about mechanics without signaling completion.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lovable-cloud:lovable-cloud-migration-syncThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> _This skill was extracted from a production Lovable Cloud project and genericized. The workflow shape (identify unsynced migrations → diff against originals → db reset → delete originals → open PR) is generic; file names like `migration-sync-pr.yml` and test commands like `npm run verify` are project-specific examples — adapt for your project._
This skill was extracted from a production Lovable Cloud project and genericized. The workflow shape (identify unsynced migrations → diff against originals → db reset → delete originals → open PR) is generic; file names like
migration-sync-pr.ymland test commands likenpm run verifyare project-specific examples — adapt for your project.
Lovable Cloud's Supabase instance has two non-obvious behaviors:
Check the commit author for each migration file. Lovable commits use its bot signature; anything else (Claude Code, engineer) is a candidate for being unapplied:
git log --diff-filter=A --format='%an %s' -- supabase/migrations/
Confirm by checking src/integrations/supabase/types.ts — if objects from a
migration are absent from types, that migration was not applied on Lovable Cloud.
Read the unsynced migration files and identify dependencies between them (e.g., table creation before FK references, function creation before trigger creation). Order them so dependencies are satisfied.
Your project's migration-sync workflow should post a comment on the PR with the copy-paste Lovable message and a checklist. Direct the user to that comment — do NOT regenerate the message in the terminal when the PR comment already exists.
The PR comment should include:
main do.If the PR comment is missing, the workflow has a bug — fix the workflow, do not draft the message manually.
After Lovable commits, switch to main and pull:
git stash # if on a feature branch with uncommitted changes
git checkout main && git pull
Diff each Lovable-created duplicate against its original:
diff <(sed 's/[[:space:]]*$//' supabase/migrations/ORIGINAL.sql) \
<(sed 's/[[:space:]]*$//' supabase/migrations/LOVABLE_UUID.sql)
Acceptable differences:
DROP TRIGGER/POLICY IF EXISTS before create (more idempotent)IF NOT EXISTS guards (more idempotent)DROP POLICY IF EXISTS for Lovable-specific policy name variantsUnacceptable differences:
If unacceptable differences exist, do not proceed. Investigate and resolve with the user.
Run supabase db reset inline from the parent session — not the
check-runner subagent. The check-runner agent refuses state-mutating
commands (db reset, db push, container start/stop, etc.) by
charter, and a PreToolUse mutation-guard hook also denies them at the
harness layer when the dispatcher is check-runner. Routing the reset
through the subagent fails BLOCKED with no verify output.
cd <absolute repo path> && supabase db reset
The reset replays the full migration set against a clean database;
without it, the verify run validates pre-replay state and the
migration sync is not actually exercised. NOTICEs from
DROP IF EXISTS on not-yet-created objects are expected during the
reset and harmless — Lovable duplicates run later in timestamp order
than the originals did, so the reset replays the originals' creation
against the duplicates' drops.
Once the reset completes, dispatch your project's verify entry point
(e.g. npm run verify, pytest, make verify — whatever its
verification command is) via the Agent tool with
subagent_type: check-runner. Enumerate the verify command exactly in
the dispatch prompt and include the absolute working directory.
The subagent writes the command's full output to
${TMPDIR:-/tmp}/<command-slug>-<epoch-ms>.txt and returns: per-command
name/exit code/pass-fail, smallest failing excerpt, overall PASS or FAIL, and
the output file paths. If verify fails, Read the relevant output file rather
than re-running the suite. Do not proceed to step 6 (delete originals) on FAIL.
Inline exception. Single-test re-runs during debugging can stay inline. Suite-level reruns route through the subagent.
git rm supabase/migrations/ORIGINAL_1.sql supabase/migrations/ORIGINAL_2.sql ...
Create a branch, commit the deletions, push, and open a PR. The commit message should reference which originals were replaced by which Lovable UUID files.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub jcdendrite/claude-config --plugin lovable-cloud