agentleFS
giolaqgiolaq/tv-build-harness/skills/rn-manifest-wiring/SKILL.md

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

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
  1. Distinctive:

    If the AppSpec references those fields on a screen, surface them via a small extension to the type and screen.

    line 64
  2. Distinctive:

    If not, leave them unused.

    line 65
  3. Very specific:

    Different shape but mappable: Add a translation step in inject_content:

    line 67
  4. Very specific:

    Write a transformManifest() function that maps the user's shape to the template's shape.

    line 68
  5. Very specific:

    Featured selection: If featured is empty, pick the first 5 videos.

    line 96
  6. Distinctive:

    Category ordering: If categories have a natural order in the source, preserve it.

    line 97
  7. Very specific:

    Empty states: Every hook should return [] not undefined on no data.

    line 98
  8. Very specific:

    Image fallbacks: If thumbnail_url 404s, the template's <Tile> shows a placeholder.

    line 99
  9. Distinctive:

    > 1000: stop using JSON. Generate a SQLite seed file at build time, or fetch from an API.

    line 105
  10. Distinctive:

    Inlining manifest data in screens: Always go through a hook. Otherwise the next manifest swap requires changes in 12 places.

    line 109
  11. Distinctive:

    Auto-generating placeholder content to "fill it out": If the user provided 3 videos, the app has 3 videos.

    line 111

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 example

inject_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

HookReturnsUsed by
useFeatured()Video[]Home hero
useCategories()Category[]Home rails, drawer items
useCategory(id)Video[]Category grid screen
useVideo(id)VideoDetail, 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.json for 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:

  1. Every ID referenced in categories[].items and featured exists in videos. Missing = silent empty screens.
  2. No duplicate IDs. Breaks focus restoration and analytics.
  3. All thumbnail_url and stream_url parse as URLs. Relative paths break on TV (no document base).
  4. stream_type is one of hls | dash | mp4. Misspellings (HLS, m3u8) lead to player init failures.
  5. duration_sec is a number, not a string. Common JSON drift.
  6. featured length ≥ 1 and ≤ 10. A hero with 0 items breaks the home screen. More than 10 is a UX smell.
  7. 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 featured is 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 [] not undefined on no data. Screens then show their built-in empty state.
  • Image fallbacks. If thumbnail_url 404s, the template's <Tile> shows a placeholder. Make sure theme.color.surface looks 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 useEffect to avoid linear scans in useVideo.
  • > 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.