workmanager-background-sync
Skill2 starsChanged 5 months agoMITView on GitHub
Use for WorkManager background sync, offline-first uploads, retry/backoff policies, constraints, foreground work and worker tests.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- super-android-kotlin-firebaseSkill
- accessibilitySkill
- agp9-kotlin-migrationSkill
- android-architectureSkill
- android-coreSkill
- android-navigation-3Skill
- code-review-refactorSkill
- compose-contextual-design-systemSkill
- compose-performanceSkill
- context-aware-ui-designSkill
- debuggingSkill
- dependency-injectionSkill
- dependency-upgrade-safetySkill
- design-test-gateSkill
- edge-to-edge-adaptive-uiSkill
- firebase-ai-logicSkill
- firebase-authSkill
- firebase-cloud-functionsSkill
- firebase-coreSkill
- firebase-crashlytics-analyticsSkill
- firebase-emulator-ciSkill
- firebase-messagingSkill
- firestore-costs-quotasSkill
- firestoreSkill
- gradle-buildSkill
- jetpack-composeSkill
- kotlin-coreSkill
- macrobenchmark-baseline-profilesSkill
- networking-retrofit-ktorSkill
- play-store-releaseSkill
- r8-proguard-optimizationSkill
- room-datastoreSkill
- screen-ux-auditSkill
- security-privacySkill
- testingSkill
- ui-state-designSkill
- xml-to-compose-migrationSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Keep work inside structured coroutine APIs.
- Distinctive: line 33
Add unit tests for success, retry and failure.
- Very specific: line 37
Do not use GlobalScope.
- Distinctive: line 38
Do not create unnecessary Services.
- Distinctive: line 39
Do not run infinite loops inside Workers.
- Distinctive: line 40
Use constraints for network/battery when relevant.
- Distinctive: line 54
Do not assume these companion skills are installed.
- Distinctive: line 91
Use $super-android-kotlin-firebase to add WorkManager offline sync.
- Distinctive: line 92
Use $super-android-kotlin-firebase to test this CoroutineWorker retry behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Purpose
Implement reliable Android background work without leaking scopes, draining battery or duplicating sync jobs.
When to use
- Scheduling background sync.
- Uploading data when network returns.
- Adding periodic or one-time WorkManager jobs.
- Testing retry and backoff behavior.
- Designing offline-first synchronization.
Inputs to inspect
- Worker classes
- Repository and Room transaction boundaries
- Network layer and DTO mapping
- DI setup for workers
AndroidManifest.xmlpermissions- Existing sync scheduler code
Required workflow
- Define the sync contract and idempotency key.
- Choose one-time or periodic work with constraints.
- Keep work inside structured coroutine APIs.
- Persist progress and retry safely.
- Add unit tests for success, retry and failure.
Rules
- Do not use
GlobalScope. - Do not create unnecessary Services.
- Do not run infinite loops inside Workers.
- Use constraints for network/battery when relevant.
- Make sync idempotent and retry-safe.
Related existing skills
Local skills to invoke
- room-datastore
- networking-retrofit-ktor
- firebase-core
- testing
External companion skills to use when installed
Do not assume these companion skills are installed. Prefer the local skills above first, then consult Companion Skills for install and verification commands.
- android/skills — use for official Android workflow alignment when a first-party companion skill exists for the task.
Files commonly touched
*Worker.ktSyncScheduler.kt- Repository and DAO files
- DI modules
AndroidManifest.xml- Worker tests
Commands to validate
./gradlew test
./gradlew assembleDebugCommon mistakes to avoid
- Scheduling duplicate unique work.
- Retrying non-idempotent uploads.
- Doing long foreground work without notification requirements.
- Ignoring process death and app restart.
Checklist
- Constraints chosen.
- Unique work policy documented.
- Backoff configured.
- Sync idempotent.
- Worker tests added or recommended.
Example prompts
- Use $super-android-kotlin-firebase to add WorkManager offline sync.
- Use $super-android-kotlin-firebase to test this CoroutineWorker retry behavior.
Expected response style
Respond with: brief diagnosis, change plan, affected files, code or diff summary, validation commands, tests added or recommended, risks, and next step. For review tasks, lead with findings ordered by severity.
References
- ../../docs/audits/FUENTES_LOCALES.md
- references/workmanager-patterns.md
- references/offline-sync-strategy.md
- references/retry-and-backoff.md
- references/foreground-work.md
- templates/coroutine-worker-template.kt
- templates/sync-scheduler-template.kt
- templates/worker-test-template.md
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.

