eng-migration
Skill23 starsChanged 7 days agoMITView on GitHub
Run and finish codebase migrations with ast-grep rules, ignore lists, shortcut bans, and a throwaway skill. Use when migrating a repo to a new pattern or library, replacing an old API across many files, or finishing a stalled migration.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agents-autonomous-loopsSkill
- agents-correctSkill
- agents-create-verification-skillSkill
- agents-reflectSkill
- agents-swarmSkill
- alchemy-infraSkill
- cloudflare-edge-hardeningSkill
- cloudflare-gradual-releaseSkill
- comms-howSkill
- comms-impactSkill
- comms-interrogateSkill
- comms-promo-videoSkill
- comms-slidesSkill
- comms-technical-writingSkill
- comms-unslopSkill
- comms-whySkill
- drizzle-postgresSkill
- effect-boundary-validationSkill
- effect-seam-migrationSkill
- effectSkill
- eng-agent-dx-cli-scaleSkill
- eng-ai-featuresSkill
- eng-benchmark-checklistSkill
- eng-blast-radiusSkill
- eng-change-checklistSkill
- eng-cutover-verificationSkill
- eng-data-backward-compatSkill
- eng-monorepoSkill
- eng-qa-cujsSkill
- eng-state-machineSkill
- eng-tddSkill
- eng-testingSkill
- gh-ci-triageSkill
- gh-issue-burndownSkill
- gh-pr-commit-reviewSkill
- gh-pr-feedback-loopSkill
- nix-darwinSkill
- reg-suitSkill
- sentry-bugfixSkill
- sentry-perfSkill
- seo-coachSkill
- svelte-shadcnSkill
- svelte-ui-deliverySkill
- ui-audit-loopSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 0 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Write one ast-grep rule with severity: error for the old pattern so any new match fails CI.
- Very specific: line 18
Put every existing matching file path in the rule's ignores list.
- Very specific: line 27
Add shortcut rules beside each pattern rule.
- Very specific: line 29
Update the permanent skill and rules together.
- Very specific: line 34
Run ast-grep scan, the type checker, the original tests, and release checks in one check script so a passing run means the migration is …
- Very specific: line 35
Keep the check script, ast-grep rules, and original test files outside the paths the agent edits.
- Very specific: line 36
Run ast-grep on each edited file during the run (for example from a post-edit hook) instead of waiting until the end.
- Very specific: line 50
Keep two skills so agents stop reading migration steps after the old code is gone:
- Very specific: line 65
Delete the throwaway skill in the PR that empties ignores.
- Very specific: line 66
Keep the ast-grep rules in CI with ignores removed so agents cannot reintroduce the old pattern or shortcuts.
- Very specific: line 67
Delete retired dependencies, dual exports, and compatibility shims, and prove the removal with eng-cutover-verification.
- Very specific: line 71
Every old pattern and known shortcut has an ast-grep error rule in CI.
- Very specific: line 74
Every preserved public function is listed in the prompt, ignores, and the throwaway skill.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codebase migrations
Coding agents stop when their check script passes, even when 5% to 25% of old code remains. Unmigrated files still compile and pass tests. An unfinished migration leaves two ways to do everything, and later agents copy the old one. Pair ast-grep rules that force completion with a throwaway skill that prevents shortcuts.
Repo facts (from AGENTS.md or CLAUDE.md): where ast-grep config and rules live, the check, typecheck, and test commands, shared foundation packages, the permanent skill, and CI checks.
1. Pick one pattern and ban the old one
Migrate one convention at a time instead of whole packages from a broad prompt.
- Pick one target convention, such as reading time from a clock service or using one tagged error per failure.
- Write one
ast-greprule withseverity: errorfor the old pattern so any new match fails CI.ast-grepmatches the syntax tree, so formatting and variable names do not change what matches. - Put every existing matching file path in the rule's
ignoreslist. That list is the to-do list. Delete each path as you fix the file, and never append new paths toignores. - Ban unverified inline exemption comments, such as numbered ignore IDs. Agents invent fake IDs to pass scans.
Style linters check target-framework style, not migration progress. Track migration progress in ast-grep rules.
2. Ban shortcuts and migrated slop
A pattern rule says what fails the scan, not what replaces it. With rules alone, agents clear the scan with the smallest edit that removes the old syntax.
- Add shortcut rules beside each pattern rule. Ban known shortcuts for your stack, such as
Effect.promiseon calls that can reject,Effect.orDie, cause-dropping error mappers, and catch-all error classes. - Ban both the old bug and its migrated form. Agents copy existing bugs into new syntax, such as rewriting
.catch(() => [])intoEffect.orElseSucceed(() => []). Match both in the rule. - Update the permanent skill and rules together. When review catches a new bad pattern or shortcut, add one line to the permanent skill and one
ast-greprule in the same change. Seeagents-correct. - Removing silent fallbacks can raise reported errors until you handle those failure paths. Fix the failures instead of hiding them again.
3. Put completion in one check script
- Run
ast-grep scan, the type checker, the original tests, and release checks in one check script so a passing run means the migration is complete. - Keep the check script,
ast-greprules, and original test files outside the paths the agent edits. After an unattended run, verify none of them changed. - Run
ast-grepon each edited file during the run (for example from a post-edit hook) instead of waiting until the end.
4. Protect public interfaces in three places
Agents change public function signatures to satisfy rules unless you list which functions to keep. Code comments such as // synchronous on purpose do not stop an agent when the prompt tells it to migrate.
List every preserved public function in all three places:
- The migration prompt.
- The
ast-greprule'signoreslist or scoped exclusion. - The throwaway skill, with an example showing how to wrap callers whose tests expect the old contract.
5. Keep permanent and throwaway skills separate
Keep two skills so agents stop reading migration steps after the old code is gone:
- Permanent skill. State finished conventions for new code only, with no old-to-new steps. A permanent skill alone will not finish a migration.
- Throwaway skill. Teach the move for one migration, and delete it in the PR that empties
ignores.
Give every throwaway skill five parts (see references/templates.md for starter files):
- An old-to-new table and worked examples, including how to wrap preserved public interfaces.
- A shared foundation contract with a stop line. List the shared services and helpers leaf modules must use. Tell the agent to stop and report any missing shared code instead of building a local copy inside a leaf module.
- A "Never" list naming the shortcuts, dual exports, and bad patterns to avoid.
- A fallback comment rule requiring a short comment explaining why on every catch that turns a failure into a default or success value.
- One module or file slice per PR, so each PR holds few product decisions (such as what a view shows when a read fails). Remove each migrated file from
ignoresin the same PR.
6. Finish the migration
- Delete the throwaway skill in the PR that empties
ignores. - Keep the
ast-greprules in CI withignoresremoved so agents cannot reintroduce the old pattern or shortcuts. - Delete retired dependencies, dual exports, and compatibility shims, and prove the removal with
eng-cutover-verification.
Review checklist
- Every old pattern and known shortcut has an
ast-greperror rule in CI. - Remaining files sit only in
ignores, with no unverified inline exemptions. - One check script runs
ast-grep, the type checker, and the original tests, and none of them were weakened. - Every preserved public function is listed in the prompt,
ignores, and the throwaway skill. - The throwaway skill is separate from the permanent skill and includes old-to-new examples, a stop line for missing shared code, a "Never" list, and a fallback comment rule.
- Each PR shrinks
ignoreswithout adding new entries or local copies of shared code. - The final PR deletes the throwaway skill, keeps the
ast-greprules in CI, and verifies retirement witheng-cutover-verification.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

