shinyorg/shiny/shiny-wearables
Claude Code and agent skill by shinyorg/shiny
- community
Checking that the SKILL.md file is still in the repository.
Guide for talking to a companion Apple Watch (WatchConnectivity) or Wear OS (Data Layer) app from .NET MAUI / .NET using Shiny.Wearables - live messages with replies, shared context, queued data and file transfers, and background delivery through a delegate
Install
npx vskill@latest install shinyorg/shiny/shiny-wearablesSKILL.md
The same SKILL.md was published earlier as shinyorg/shiny/shiny-wearables.
Shiny Wearables
When to Use This Skill
Use this skill when the user needs to:
- Send data or commands from a phone app to a companion Apple Watch or Wear OS app (or from a .NET Wear OS app to the phone)
- Ask the watch something and await its reply
- Share the latest state (settings, the current plan) with the watch
- Queue data or files for the watch that must arrive even if it is out of range
- Receive messages, context, transfers or files from the watch, including in the background
- Check whether a watch is paired, has the companion app installed, and is reachable
- Write the Swift (watchOS) or Kotlin (Wear OS) side so it speaks Shiny's wire format
Library Overview
| Item | Value | |
|---|---|---|
| NuGet | Shiny.Wearables | |
| Primary Namespace | Shiny.Wearables | |
| Config Namespace | Shiny (AddWearables extension on IServiceCollection) | |
| Platforms | iOS (WatchConnectivity), Android (Wear OS Data Layer - phone or a .NET Wear OS app). Other targets register nothing. |
The four shapes
| Shape | API | Needs reachable? | Semantics | |
|---|---|---|---|---|
| Message | SendMessage(path, data) → reply bytes | Yes - throws WearableException(NotReachable) otherwise | Live request/reply. ~64 KB on iOS, ~100 KB on Wear OS | |
| Context | UpdateContext(data), GetContext(), GetReceivedContext() | No | Only the newest value is kept, each direction | |
| Transfer | Transfer(path, data) → id | No | Queued, in order, delivered once | |
| File | TransferFile(path, filePath, metadata) → id | No | Queued; the platform reads the file during transfer - don't delete it until OnTransferCompleted |
Setup
AddWearables<TDelegate>() can be called once per delegate; every delegate runs. On targets other than iOS/Android no IWearableManager is registered - in shared code resolve it optionally (services.GetService<IWearableManager>()) or check GetStatus().IsSupported.
iOS
- The
WCSessionis activated at startup (anIShinyStartupTask) so deliveries that arrived while the app was closed reach the delegate. Register during app startup. - iPad has no WatchConnectivity:
IsSupportedis false. Mac Catalyst/macOS/tvOS have no target. - iOS has one active watch; its node id is always
watchandnodeIdarguments are ignored.
Android / Wear OS
- Phone and watch apps must share the application id and signing key.
- The companion is discovered by the `shiny_wearable` capability (
WearableProtocol.Capability). Shiny advertises it for this app at startup; a Kotlin companion declares it inres/values/wear.xml(android_wear_capabilities). A .NET Wear OS app using Shiny.Wearables advertises it automatically too. - Inbound traffic arrives through
ShinyWearableListenerService(declared by attributes; no manifest edits), bound by Play services forwear://*/shiny...- also when the app is not running. - No Wear OS app / Play services →
IsSupportedis false. IsPairedandIsAppInstalledsurvive the watch going away - a paired watch that is off or out of range is still listed (IsConnected = false), found through the capability rather than the connected-node list. The one thing Wear OS cannot see is a paired watch that has never had the companion app installed and is currently away - the Data Layer exposes nothing that reports it.- A Wear OS node can be connected through the cloud when Bluetooth is out of range:
IsConnected = true,IsNearby = false. Transfers and context still go through; it does not count towardIsReachable, because a live message would take seconds.
Showing watch status - paired vs. connected
Two different questions, and a UI needs both. Never use one flag for both.
| Question | Flag | Survives the watch being off / out of range? | |
|---|---|---|---|
| Does this user have a watch set up? (show the "send to watch" feature at all) | status.IsConfigured (= IsPaired && IsAppInstalled) | Yes | |
| Is the watch here right now? (a "connected" dot, live messages) | status.IsReachable | No | |
| Does this platform have a wearable API at all? | status.IsSupported | n/a - fixed per device |
`IsSupported` is not "a watch is set up". It is false only where there is no wearable API (not iOS/Android, an iPad, Android without Play services). A phone with no watch reports IsSupported = true. Gate features on IsConfigured.
Gating a feature on IsReachable makes it appear and disappear as the user walks around the house. Gating a "connected" indicator on IsConfigured claims the watch is receiving while it is charging in another room.
GetStatus() is async and there is no event on IWearableManager - changes arrive through IWearableDelegate.OnStatusChanged, raised on pair/unpair, app installed/removed, and reachability changes. Cache the last status there and bind to that:
Per node, WearableNode carries IsConnected (reachable at all - Bluetooth or cloud), IsNearby (direct Bluetooth) and HasApp. On iOS IsConnected and IsNearby are the same flag - WatchConnectivity has no cloud route.
Code Generation Instructions and Conventions
Sending
- Never build a JSON string (raw string literals, string interpolation,
JsonSerializer.Serialize) to pass as a payload. Structured data is always key/values; thestringoverloads are for plain text only. - Paths are app-defined (
sync,workout/start); slashes are trimmed; whitespace,?,#throwArgumentException. - Never hand-encode payloads.
SendMessage,UpdateContextandTransferhave extension overloads (WearableManagerExtensions, namespaceShiny.Wearables) taking astring(plain text, sent as UTF-8) or anIReadOnlyDictionary<string, TValue>(sent as a JSON object;Dictionary<string, object?>andDictionary<string, string>both work). The stringSendMessagereturns the reply as astring; the dictionary one returnsIReadOnlyDictionary<string, JsonElement>(empty for an empty reply,JsonExceptionif the reply is not a JSON object). Thebyte[]members remain for binary payloads. - Dictionary values: null, string, bool, numbers,
DateTime/DateTimeOffset/TimeSpan/Guid/Uri, enums (by name),byte[](base64),JsonElement, nested string-keyed dictionaries and lists/arrays. Anything else throwsNotSupportedException- break it into a nested dictionary or list. No reflection, so it is trim/AOT safe.
Receiving
- Reply semantics: delegates are asked in turn; the first non-null reply wins; a throwing delegate is logged and skipped; with no answer the watch gets an empty reply.
message.ExpectsReplyis false when the sender used a fire-and-forget send - the return value is discarded. - All other callbacks run on every registered delegate.
- On Wear OS,
OnTransferCompletedfires when the receiver deletes the data item (the delivery receipt), soresult.Pathis empty - track byId. A transfer you cancel withCancelTransferdoes not raise it.
Companion apps (wire format - WearableProtocol)
watchOS (Swift, WCSession)
- Message:
sendMessage(["path": String, "data": Data], replyHandler:); reply["data": Data]. Messages from the phone always carry a reply handler - always call it. - Context:
updateApplicationContext(["data": Data]) - Transfer:
transferUserInfo(["id": String, "path": String, "data": Data]) - File:
transferFile(url, metadata: ["id": String, "path": String, "name": String, "metadata": [String: String]])
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/shiny-wearables/SKILL.md
Popularity
- 7-day trend score
- 0
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/shinyorg/shiny/shiny-wearables)