rn-manifest-wiring
Skill4 starsChanged 5 months agoMIT-0View on GitHub
Content manifest wiring: how to connect content.json data to React Native data hooks and screen components
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 10ft-uiSkill
- amazon-devices-vega-app-performanceSkill
- amazon-devices-vega-best-practicesSkill
- amazon-devices-vega-setup-sdkSkill
- android-tv-testingSkill
- changelog-static-siteSkill
- creative-tv-uiSkill
- eas-buildSkill
- expo-tv-configSkill
- firetv-leanbackSkill
- kmp-build-commandsSkill
- kmp-compose-tvSkill
- kmp-data-layerSkill
- kmp-navigationSkill
- kmp-template-anatomySkill
- kmp-themingSkill
- kmp-verify-patternsSkill
- metaSkill
- rn-shared-ui-catalogSkill
- rn-spatial-navigationSkill
- rn-template-anatomySkill
- rn-themingSkill
- vega-sdkSkill
- video-playerSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 64
If the AppSpec references those fields on a screen, surface them via a small extension to the type and screen.
- Distinctive: line 65
If not, leave them unused.
- Very specific: line 67
Different shape but mappable: Add a translation step in inject_content:
- Very specific: line 68
Write a transformManifest() function that maps the user's shape to the template's shape.
- Very specific: line 96
Featured selection: If featured is empty, pick the first 5 videos.
- Distinctive: line 97
Category ordering: If categories have a natural order in the source, preserve it.
- Very specific: line 98
Empty states: Every hook should return [] not undefined on no data.
- Very specific: line 99
Image fallbacks: If thumbnail_url 404s, the template's <Tile> shows a placeholder.
- Distinctive: line 105
> 1000: stop using JSON. Generate a SQLite seed file at build time, or fetch from an API.
- Distinctive: line 109
Inlining manifest data in screens: Always go through a hook. Otherwise the next manifest swap requires changes in 12 places.
- Distinctive: line 111
Auto-generating placeholder content to "fill it out": If the user provided 3 videos, the app has 3 videos.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Manifest wiring
Content flows:
content.json→ typed parse → hooks → screens. The template ships hooks for the default shape. The agent's job is matching the user's manifest to those hooks, or generating new hooks when the shape diverges.
Where the manifest lives
packages/shared-ui/data/
├── content.json # The user's manifest (overwrite on inject)
├── content.schema.ts # Type definitions
└── seed.json # Original template seed — keep as fallback exampleinject_content copies the user's manifest to content.json and validates against content.schema.ts. Validate before screens get wired, not after.
Default manifest shape
type Manifest = {
title: string;
description: string;
categories: { id: string; name: string; items: string[] }[]; // items = video IDs
videos: Video[];
featured: string[]; // video IDs to put in the hero
};
type Video = {
id: string;
title: string;
description: string;
duration_sec: number;
thumbnail_url: string;
stream_url: string;
stream_type: "hls" | "dash" | "mp4";
tags?: string[];
};Existing data hooks
| Hook | Returns | Used by |
useFeatured() | Video[] | Home hero |
useCategories() | Category[] | Home rails, drawer items |
useCategory(id) | Video[] | Category grid screen |
useVideo(id) | Video | Detail, Player screens |
useSearch(q) | Video[] | Search screen |
useRelated(id) | Video[] | Detail "related" rail |
These hooks read directly from content.json. Swap the underlying source for an API later — same signature.
Decision tree: does the user's manifest match the default shape?
Exact match. Just inject and move on. The screens are already wired.
Match with extra fields (e.g. user has cast, year, rating). Inject the manifest, and:
- If the AppSpec references those fields on a screen, surface them via a small extension to the type and screen.
- If not, leave them unused. Don't strip them — future iterations may need them.
Different shape but mappable. Add a translation step in inject_content:
- Write a
transformManifest()function that maps the user's shape to the template's shape. - Save the original under
data/source.jsonfor debugging. - Output the translated
content.json. - Note the mapping in the run log.
Fundamentally different model (e.g. live TV channels with EPG, not VOD videos). The template's hooks won't fit:
- Generate new hooks (
useChannels,useNowPlaying,useEPG) instead of forcing the data into the VOD shape. - Generate new screens to consume them (and add a new screen skill for next time).
- The drawer/navigation still applies.
Validation rules to enforce at inject time
These catch ~80% of "the app rendered blank" bugs:
- Every ID referenced in
categories[].itemsandfeaturedexists invideos. Missing = silent empty screens. - No duplicate IDs. Breaks focus restoration and analytics.
- All
thumbnail_urlandstream_urlparse as URLs. Relative paths break on TV (no document base). stream_typeis one ofhls | dash | mp4. Misspellings (HLS,m3u8) lead to player init failures.duration_secis a number, not a string. Common JSON drift.featuredlength ≥ 1 and ≤ 10. A hero with 0 items breaks the home screen. More than 10 is a UX smell.- Every category has ≥ 1 item. Empty categories render empty rails — looks broken.
Fail loud on (1) and (4). Warn and continue on others.
Shaping content for the UI
Past validation, the manifest often needs gentle reshaping to look right:
- Featured selection. If
featuredis empty, pick the first 5 videos. If it has 20, take the first 5. The hero is not a backlog. - Category ordering. If categories have a natural order in the source, preserve it. Otherwise alphabetize.
- Empty states. Every hook should return
[]notundefinedon no data. Screens then show their built-in empty state. - Image fallbacks. If
thumbnail_url404s, the template's<Tile>shows a placeholder. Make suretheme.color.surfacelooks reasonable — it's the placeholder background.
When manifest size matters
- < 100 videos: stays in
content.json, loaded synchronously. Fast. - 100–1000: still fine as JSON, but pre-index by ID in a
useEffectto avoid linear scans inuseVideo. - > 1000: stop using JSON. Generate a SQLite seed file at build time, or fetch from an API. The template's hooks need to become async. This is a structural change — flag it to the planner.
Anti-patterns
- Inlining manifest data in screens. Always go through a hook. Otherwise the next manifest swap requires changes in 12 places.
- Mutating the manifest at runtime. The hooks treat it as immutable. If you need user state (watchlist, progress), that's a separate store, not edits to
content.json. - Auto-generating placeholder content to "fill it out". If the user provided 3 videos, the app has 3 videos. Don't invent. Use empty states where the layout would otherwise look sparse.
- Skipping validation "to ship faster". Five minutes saved at inject time = an hour debugging blank screens at simulator time.
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.

