shinyorg/shiny/shiny-contactstore
Claude Code and agent skill by shinyorg/shiny
- community
Checking that the SKILL.md file is still in the repository.
Generate code using Shiny.Contacts for cross-platform device contact access with CRUD, a fluent async query builder, and Shiny.Core permissions
Install
npx vskill@latest install shinyorg/shiny/shiny-contactstoreSKILL.md
The same SKILL.md was published earlier as shinyorg/shiny/shiny-contactstore.
Shiny.Contacts Skill
You are an expert in Shiny.Contacts, a cross-platform library for accessing device contacts on iOS, Mac Catalyst, macOS, and Android.
When to Use This Skill
Invoke this skill when the user wants to:
- Access device contacts (read, create, update, delete)
- Query contacts (filter/search/sort/page)
- Request contact permissions using Shiny's AccessState model
- Register the contact store in DI
- Work with contact models (phones, emails, addresses, etc.)
Library Overview
GitHub: https://github.com/shinyorg/shiny NuGet: Shiny.Contacts Namespace: Shiny.Contacts
Shiny.Contacts provides:
- Full CRUD operations on device contacts
- A fluent async query builder with native translation (Android content provider queries, CNContact predicates on Apple)
- Permission handling via Shiny.Core's
AccessStatemodel - Dependency injection integration
- AOT and trimmer compatible
Platform backends: the Contacts framework (CNContactStore) on iOS, Mac Catalyst, and macOS - one shared implementation - and the ContactsContract content provider on Android.
Setup
1. Install NuGet Package
2. Register in MauiProgram.cs
The app must call .UseShiny() (from Shiny.Hosting.Maui) so platform services like permissions are wired up.
3. Platform Permissions
Android — Add to AndroidManifest.xml:
iOS / Mac Catalyst / macOS — Add to Info.plist:
Mac Catalyst / sandboxed macOS — the Info.plist key is not enough. The App Sandbox (which Mac Catalyst enables by default) also requires the address book entitlement, or RequestAccess returns Denied with no prompt ever appearing:
Permissions
Permissions use Shiny.Core's Shiny.AccessState model. IContactStore exposes two members:
Android Access Results
AccessState.Available— both read and write access grantedAccessState.Restricted— only read or only write granted (not both)AccessState.Denied— neither read nor write granted
iOS / Mac Catalyst / macOS Access Results
AccessState.Available— contacts access authorizedAccessState.Denied— contacts access deniedAccessState.Restricted— contacts access restricted, or (iOS 18+ only) limited to the contacts the user pickedAccessState.Unknown— not yet determined
Limited access does not exist on Mac Catalyst or macOS — access there is all-or-nothing.
Change Notifications
IContactStore.Changed is raised when contacts change on the device — edits from other apps, sync, or this store. The native listener is attached only while something is subscribed, so unsubscribe when you stop showing the data. The event carries no detail about what changed: re-query what you show. It can arrive on a background thread and several times for one edit, so dispatch to the UI thread and debounce if the refresh is expensive.
Backed by CNContactStoreDidChangeNotification (iOS/Mac Catalyst/macOS) and a ContentObserver on the ContactsContract provider (Android).
API Reference
IContactStore Interface
Extension Methods
Querying
Query() returns a `ContactQuery` builder. It is lazy — nothing runs until ToListAsync / FirstOrDefaultAsync / CountAsync, and the native read happens off the calling thread, so awaiting it from a UI/view-model method is correct. There is no `IQueryable` — do not write .Where(c => …).ToList() LINQ against Query().
`ContactField`: GivenName, FamilyName, MiddleName, NamePrefix, NameSuffix, Nickname, DisplayName, Note, Company, JobTitle, Department, Phone, Email
`ContactFilterOperation`: Contains (default), StartsWith, EndsWith, Equals — all case-insensitive
`ContactSortField`: GivenName, FamilyName, DisplayName, Company
Natively translated: name fields, Phone and Email on Android; StartsWith/Equals on given/family/display name on Apple (in Match.All mode only). Everything else reads the full contact list and filters in-memory — correct, just slower. Field filters are always re-applied in-memory, so a filter never silently goes missing.
Create a Contact
Update a Contact
Update replaces the fields this model covers. On Android, data it does not model (group memberships, IM/SIP addresses, other apps' rows) is left alone, a null Photo leaves the existing photo in place (bulk reads only load Thumbnail), and the display name is rebuilt from the name parts when any are set. A contact that aggregates several raw contacts (e.g. Google + local) is written to its first raw contact, and the covered fields of the others are removed so values are not duplicated.
Delete a Contact
Models
Contact
| Property | Type | |
|---|---|---|
| Id | string? | |
| NamePrefix | string? | |
| GivenName | string? | |
| MiddleName | string? | |
| FamilyName | string? | |
| NameSuffix | string? | |
| Nickname | string? | |
| DisplayName | string | |
| Note | string? | |
| Organization | ContactOrganization? | |
| Photo | byte[]? (see note below) | |
| Thumbnail | byte[]? | |
| Phones | List<ContactPhone> | |
| Emails | List<ContactEmail> | |
| Addresses | List<ContactAddress> | |
| Dates | List<ContactDate> | |
| Relationships | List<ContactRelationship> | |
| Websites | List<ContactWebsite> |
Enums
PhoneType: Home, Mobile, Work, FaxWork, FaxHome, Pager, Other, Custom
EmailType: Home, Work, Other, Custom
AddressType: Home, Work, Other, Custom
ContactDateType: Birthday, Anniversary, Other, Custom
Dates without a year
A birthday saved with only a day and month comes back with ContactDate.HasYear == false. Its Date holds year 1 (year 4 for Feb 29, which year 1 cannot hold). To create one, use that year: new ContactDate(new DateOnly(1, 6, 15)). It is written back as a year-less date on Android (--06-15) and Apple (NSDateComponents with no year). Don't compute ages from a date where HasYear is false.
RelationshipType: Father, Mother, Parent, Brother, Sister, Child, Friend, Spouse, Partner, Assistant, Manager, Other, Custom
Photo vs Thumbnail (bulk reads)
GetAll() and Query() populate `Thumbnail` only; `Photo` (the full-resolution image) is `null` on these bulk reads. Decoding every contact's full photo into a byte[] at once spikes memory and can get the app OOM/jetsam-killed on a real device with many photo contacts. To get the full Photo, fetch the single contact with `GetById(id)` (which populates both Thumbnail and Photo). Bind list rows to Thumbnail and load Photo on a detail screen.
Apple Notes & Relations Entitlement
Reading Note and Relationships on iOS requires the com.apple.developer.contacts.notes entitlement. The library probes for access at runtime on every Apple platform, so the same code runs unchanged on Mac Catalyst and macOS. If the probe fails, Note returns null and Relationships is empty.
Best Practices
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-contactstore/SKILL.md
Popularity
- Repository stars
- 1,583
- Repository forks
- 248
- 7-day trend score
- 37
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/shinyorg/shiny/shiny-contactstore)