guillemroca/agent-skills-android/deprecation-and-migration
Claude Code and agent skill by guillemroca/agent-skills-android
- community
Checking that the SKILL.md file is still in the repository.
Use when deprecating APIs, bumping minSdk, migrating libraries (AndroidX, Compose, Kotlin versions), changing an API contract or database schema, or removing legacy code. Covers Kotlin @Deprecated annotation, strangler pattern, expand/contract for API and schema changes, and incremental migration.
Install
npx vskill@latest install guillemroca/agent-skills-android/deprecation-and-migrationSKILL.md
The same SKILL.md was published earlier as guillemroca/agent-skills-android/deprecation-and-migration.
Deprecation and Migration
Overview
"Code is a liability, not an asset." Every line of code carries ongoing maintenance cost. Deprecation and migration are how you manage that liability — removing what's no longer needed and upgrading what must evolve. Hyrum's Law applies: once systems have users, simple announcements aren't enough.
When to Use
- Bumping
minSdkortargetSdk - Migrating to a new library version (Room, Compose, Kotlin)
- Replacing deprecated Android APIs
- Removing legacy feature flags or dead code
- Migrating from XML to Compose
- Upgrading from Java to Kotlin in existing modules
- Renaming/removing a field or endpoint the app consumes, or changing a Room or server schema
Skip when: The code has no callers and can be deleted outright.
Core Process
Step 1: Decision Framework
- Assess before deprecating:
| Question | Impact | |
|---|---|---|
| How many callers exist? | grep/find usages to count | |
| Is there a replacement ready? | Never deprecate without an alternative | |
| What's the maintenance cost of keeping it? | Security risk? Build complexity? | |
| What's the migration cost? | Test effort, rollback risk | |
| Is there a deadline? (security, API level) | Compulsory vs advisory |
- Deprecation types:
- Advisory: Migration recommended but not required on a timeline
- Compulsory: Hard deadline (security fix, API level requirement, Play Store policy)
Step 2: Deprecate with Guidance
- Use Kotlin's `@Deprecated` with replacement:
- Deprecation levels:
WARNING— compile-time warning, still usableERROR— compile-time error, forces migrationHIDDEN— invisible in IDE, only for binary compatibility
- Progression:
`` Phase 1: Add @Deprecated(WARNING) + replacement guidance Phase 2: Migrate all internal callers Phase 3: Escalate to @Deprecated(ERROR) Phase 4: Remove (or HIDDEN for library backward compatibility) ``
Step 3: minSdk and targetSdk Bumps
- Audit before bumping:
- Migration checklist for minSdk bump:
Step 4: Library Migration
- Strangler pattern for large migrations:
- Compose migration from XML:
Per-screen migration workflow: android-skills:migrate-xml-views-to-jetpack-compose (optional Google companion plugin, see README).
- Guided library upgrades (optional Google companion plugin, see README):
android-skills:agp-9-upgrade(AGP 9, non-KMP),android-skills:play-billing-library-version-upgrade,android-skills:camerax(Camera1/Camera2 → CameraX),android-skills:leanback-to-compose-tv-migration.
Step 5: Kotlin Version Migration
- Kotlin version upgrade checklist:
To resolve the current compatible AGP/Kotlin/Compose versions authoritatively, use android studio version-lookup agp kotlin compose when the android CLI and a running Android Studio are available (see ../../references/android-cli-reference.md), instead of guessing from memory.
Step 6: API Contract and Schema Changes (Expand/Contract)
Old app versions stay installed for months or years and keep calling your API — users don't all update, and you can't roll their builds back. So a server contract change can never be "change it in place and ship the app the same day". Migrate in additive phases so every app version still in the wild stays valid at every step:
- Worked example — renaming JSON field `name` → `fullName`:
- Expand. Server returns both
nameandfullName, and accepts both on writes. Deploy. - Ship. App reads
fullName ?: name. Release it as version N. - Wait or force. Check the version distribution (Play Console statistics by app version, or your analytics) until builds below N fall under an agreed threshold — or raise a minimum supported version (remote config or a backend check) that routes older builds to a force-update screen using Play In-App Updates' immediate flow.
- Contract. Server stops sending
name. In a later app release, delete the fallback.
- Clients must tolerate change they don't know about yet:
Add a unit test that decodes a payload with an extra field and an unrecognised enum value — it must not throw.
- Local Room schema: migrations run on-device in one step at app upgrade, so there is no mixed-version window for the local database — a rename can be a single
MigrationorAutoMigration. The rules fromandroid-data-persistence(Step 2) still hold: write the migration, test it withMigrationTestHelper, neverfallbackToDestructiveMigration(). Two mobile twists: (a) rollback is roll-forward — Play rejects a lowerversionCodeand Room won't downgrade, so a "revert" build must keep the new database version (or migrate forward again); (b) synced data follows the API contract above, so the sync layer must accept both shapes during the window.
- Server-owned databases (if your team owns the backend): same pattern — add the new column nullable, dual-write, backfill in throttled batches, switch reads, then drop the old column in its own later deploy.
Step 7: Cleanup
- After migration is complete:
- Remove deprecated code (don't leave dead code)
- Remove feature flags used for migration
- Remove adapter layers (strangler pattern cleanup)
- Update documentation and ADRs
- Verify no references remain:
grep -rn "OldClassName" --include="*.kt"
Common Rationalizations
| Shortcut | Why It Fails | |
|---|---|---|
| "We'll migrate everything at once" | Big-bang migrations are high risk. Incremental strangler is safer. | |
| "Just delete it, no one uses it" | Check callers first. Hyrum's Law: someone depends on behavior you didn't intend. | |
| "The deprecated code still works" | It works until the next API level bump, library update, or security patch. | |
| "We'll clean up the feature flags later" | Dead flags are tech debt with runtime cost. Clean up within 2 sprints of rollout. | |
| "Rename the field server-side; the app update ships the same day" | Old builds keep calling the API for months. Expand first; contract only once old-version share is below threshold or a min-version gate forces the upgrade. | |
| "Strict JSON parsing catches server bugs" | It turns every additive server change into a crash in builds you can no longer fix. Use ignoreUnknownKeys and an UNKNOWN enum fallback; catch server bugs with contract tests. | |
| "If the migration breaks, we'll roll back the release" | Play won't take a lower versionCode and Room won't downgrade. Rollback is a new build that keeps the new schema version. |
Red Flags
@DeprecatedwithoutreplaceWithguidance- Deprecated code with no migration timeline
- Big-bang migration (everything at once)
- Zombie code: unmaintained but still used
- Feature flags older than 3 months
- minSdk bump without testing on the new minimum API level
- Deleted code that should have been deprecated first (library consumers exist)
- A server field or endpoint removed/renamed while app versions that read it still have meaningful active share
- Network
JsonwithoutignoreUnknownKeys, or network enums with noUNKNOWNfallback - A breaking API change with no minimum-supported-version mechanism to fall back on
- A rollback plan that lowers the Room database version
Verification
- [ ] Deprecated APIs have
@DeprecatedwithreplaceWith - [ ] Deprecation level progresses: WARNING → ERROR → removal
- [ ] All internal callers migrated before escalating to ERROR
- [ ] minSdk/targetSdk bumps tested on the new minimum API level
- [ ] Strangler pattern used for large library migrations
- [ ] Migration feature flags cleaned up within 2 sprints
- [ ] Removed code verified with
grep— no remaining references - [ ] ADR written for significant migration decisions
- [ ]
./gradlew buildand./gradlew testpass after migration
After an API contract or schema change:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/deprecation-and-migration/SKILL.md
Popularity
- Repository stars
- 2
- 7-day trend score
- 5
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/guillemroca/agent-skills-android/deprecation-and-migration)