[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CS90MQ1TXB196J391X1222":3,"skill-same:01M7CS90MQ1TXB196J391X1222":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":30,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7CS90MQ1TXB196J391X1222","offline-sync",null,"Use when a screen must work without network or a mutation must survive a lost connection - local storage choice, the outbox pattern with idempotency keys, background replay, and how to test it with a fake clock and fake network.","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Foffline-sync\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: offline-sync\ncategory: mobile\ndescription: Use when a screen must work without network or a mutation must survive a lost connection - local storage choice, the outbox pattern with idempotency keys, background replay, and how to test it with a fake clock and fake network.\n---\n# Offline and Sync\n\n## Overview\n\nTreat \"offline\" as a normal state, not an error condition: a screen that only works with a live connection is a defect on mobile. The hard part isn't detecting offline — it's making a queued mutation replay exactly once and keeping the UI honest about what's actually saved.\n\n## Local store\n\nFollow the repo's existing choice (drift\u002Fsqflite for Flutter, Room for Android, SwiftData\u002FCore Data for iOS) — don't introduce a second local-storage mechanism alongside one that's already there.\n\n## Outbox pattern\n\n- Queue mutations in a local outbox table when offline; replay on reconnect.\n- Every queued mutation carries a **client-generated idempotency key**, sent with the eventual request, so a retried replay (after a crash mid-sync, or a flaky connection that \"succeeded\" without the ack arriving) is deduplicated server-side instead of double-applied.\n- Connectivity plugins (`connectivity_plus` and equivalents) report the state of the network *interface*, not whether the server is actually reachable — treat the server's response as the source of truth for whether a request succeeded, not the interface state alone.\n\n## Background replay\n\n- Android: `WorkManager` (native) or the `workmanager` plugin (Flutter) for replay that must survive the app being backgrounded or killed.\n- iOS: `BGTaskScheduler` for background replay — register and schedule it, and test on-device since the simulator's background scheduling is unreliable.\n\n## UI honesty\n\nShow sync status explicitly per item — `pending` \u002F `syncing` \u002F `failed` — never render an unsynced change as if it were already saved. A spinner that never resolves is worse than an honest \"failed, tap to retry.\"\n\n## Conflicts\n\nPick **one** conflict rule per data type (last-write-wins, or an explicit user choice when both sides changed) and write it down in the task — don't leave it implicit in the code for the next person to infer.\n\n## Reads degrade gracefully\n\nCached data with a staleness indicator beats a spinner that never resolves — show what you have, mark it as possibly stale, and update when the network returns.\n\n## Testing\n\n- Unit tests: a fake clock and a fake network\u002Frepository to drive queue → replay → ack deterministically, including the \"replay happens twice\" case to prove the idempotency key actually dedupes.\n- On a local emulator: `adb shell cmd connectivity airplane-mode enable` \u002F `disable` to exercise a real reconnect, not just a mocked one.\n\n## Common Mistakes\n\n- A screen that shows a blank\u002Ferror state the instant the network drops, instead of cached data.\n- A queued mutation with no idempotency key — a retried replay double-applies it.\n- Trusting the connectivity plugin's \"online\" state as proof a request will succeed.\n- A sync-status UI that doesn't distinguish `pending` from `failed`.\n- Only testing airplane-mode-on; never testing the reconnect\u002Freplay path.\n\n## Red Flags\n\n- A mutation sent to the server with no client-generated key the server can dedupe on.\n- \"It works offline\" verified only by reading the code, not by actually toggling airplane mode or a fake network.\n- No written conflict rule for a data type that can be edited from two places.\n","# Offline and Sync\n\n## Overview\n\nTreat \"offline\" as a normal state, not an error condition: a screen that only works with a live connection is a defect on mobile. The hard part isn't detecting offline — it's making a queued mutation replay exactly once and keeping the UI honest about what's actually saved.\n\n## Local store\n\nFollow the repo's existing choice (drift\u002Fsqflite for Flutter, Room for Android, SwiftData\u002FCore Data for iOS) — don't introduce a second local-storage mechanism alongside one that's already there.\n\n## Outbox pattern\n\n- Queue mutations in a local outbox table when offline; replay on reconnect.\n- Every queued mutation carries a **client-generated idempotency key**, sent with the eventual request, so a retried replay (after a crash mid-sync, or a flaky connection that \"succeeded\" without the ack arriving) is deduplicated server-side instead of double-applied.\n- Connectivity plugins (`connectivity_plus` and equivalents) report the state of the network *interface*, not whether the server is actually reachable — treat the server's response as the source of truth for whether a request succeeded, not the interface state alone.\n\n## Background replay\n\n- Android: `WorkManager` (native) or the `workmanager` plugin (Flutter) for replay that must survive the app being backgrounded or killed.\n- iOS: `BGTaskScheduler` for background replay — register and schedule it, and test on-device since the simulator's background scheduling is unreliable.\n\n## UI honesty\n\nShow sync status explicitly per item — `pending` \u002F `syncing` \u002F `failed` — never render an unsynced change as if it were already saved. A spinner that never resolves is worse than an honest \"failed, tap to retry.\"\n\n## Conflicts\n\nPick **one** conflict rule per data type (last-write-wins, or an explicit user choice when both sides changed) and write it down in the task — don't leave it implicit in the code for the next person to infer.\n\n## Reads degrade gracefully\n\nCached data with a staleness indicator beats a spinner that never resolves — show what you have, mark it as possibly stale, and update when the network returns.\n\n## Testing\n\n- Unit tests: a fake clock and a fake network\u002Frepository to drive queue → replay → ack deterministically, including the \"replay happens twice\" case to prove the idempotency key actually dedupes.\n- On a local emulator: `adb shell cmd connectivity airplane-mode enable` \u002F `disable` to exercise a real reconnect, not just a mocked one.\n\n## Common Mistakes\n\n- A screen that shows a blank\u002Ferror state the instant the network drops, instead of cached data.\n- A queued mutation with no idempotency key — a retried replay double-applies it.\n- Trusting the connectivity plugin's \"online\" state as proof a request will succeed.\n- A sync-status UI that doesn't distinguish `pending` from `failed`.\n- Only testing airplane-mode-on; never testing the reconnect\u002Freplay path.\n\n## Red Flags\n\n- A mutation sent to the server with no client-generated key the server can dedupe on.\n- \"It works offline\" verified only by reading the code, not by actually toggling airplane mode or a fake network.\n- No written conflict rule for a data type that can be edited from two places.\n",{"name":5,"category":24,"description":7},"mobile","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Foffline-sync",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill offline-sync",{"tool":40,"command":41},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill offline-sync",{"tool":43,"command":44},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill offline-sync","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fmobile-developer\u002Fskills\u002Foffline-sync\u002FSKILL.md",true,[],[49,55,62,69,76,83],{"skillNo":50,"name":51,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]