shekhar23/claude-zero-to-hero-android-kmp/android-workmanager
Claude Code and agent skill by shekhar23/claude-zero-to-hero-android-kmp
- community
Checking that the SKILL.md file is still in the repository.
WorkManager patterns for Android - background sync, unique work, constraints, retries, periodic jobs, worker injection, and observing work state from the app. Use this skill whenever scheduling deferrable background work, syncing local and remote data, retrying uploads, or running tasks that must survive process death. Trigger on phrases like "WorkManager", "background sync", "periodic work", "retry upload", "constraints", "CoroutineWorker", "enqueueUniqueWork", or "observe work info".
Install
npx vskill@latest install shekhar23/claude-zero-to-hero-android-kmp/android-workmanagerSKILL.md
Android WorkManager
When to Use It
Use WorkManager for work that is:
- deferrable
- guaranteed eventually
- expected to continue across app restarts or process death
- constrained by network, charging, battery, or storage conditions
Do not use WorkManager for:
- immediate in-app UI actions
- work that must finish while the screen is visible only
- exact alarms
- long-running foreground media playback
Core Principles
- Workers must be idempotent — safe to run more than once.
- Prefer unique work so duplicate jobs do not pile up.
- Keep business logic in domain/data classes; the worker only coordinates execution.
- Return
Result.retry()only for failures that may succeed later. - Pass IDs and lightweight flags through
Data, not large payloads.
Worker Structure
Use CoroutineWorker for suspending APIs:
Map typed domain/data failures to WorkManager results intentionally:
- temporary network failure ->
Result.retry() - invalid input or permanent server rejection ->
Result.failure() - success ->
Result.success()
Unique One-Time Work
Prefer enqueueUniqueWork(...) for user-triggered syncs:
Use:
KEEPwhen an existing in-flight job should continueREPLACEwhen the newest request should winAPPENDonly for true chains that must run in sequence
Periodic Work
Use periodic work for recurring sync or cleanup:
Periodic work is inexact. Do not use it for exact-time requirements.
Constraints
Create reusable constraint builders:
Common defaults:
- uploads/sync -> network connected
- expensive maintenance -> charging + idle if appropriate
- local cleanup -> no network needed
Avoid over-constraining work or it may never run.
Retry and Backoff
When retrying, define backoff explicitly:
Use retry only for transient failures like:
- no internet
- 5xx server responses
- temporary rate limits
Do not retry validation failures, missing required IDs, or unsupported states.
Chaining Work
Chain work when steps are strictly sequential:
Each step should still be independently safe and idempotent.
Input and Output Data
Keep Data small and primitive:
Pass IDs, not serialized objects or file blobs.
Observing Work State
Expose work status to presentation through a repository or small observer abstraction:
The ViewModel maps WorkInfo.State into UI state like isSyncing, lastSyncFailed, or lastSyncAt.
Dependency Injection
If the app uses Koin, register workers in DI and configure the app-level WorkManager factory once. Keep worker constructors thin and inject repositories/use cases instead of service locators.
Checklist: Adding Background Work
- [ ] Confirm the use case really needs WorkManager
- [ ] Make the worker idempotent
- [ ] Keep worker logic orchestration-only
- [ ] Use unique work for duplicate-prone jobs
- [ ] Add only necessary constraints
- [ ] Retry only transient failures
- [ ] Expose work status to the
ViewModelif the UI needs it
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/android-workmanager/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 5
- 7-day trend score
- 12
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/shekhar23/claude-zero-to-hero-android-kmp/android-workmanager)