# Template Creation Workflow

Use this workflow only when the user asks to create, design, build, save,
import, expand, QA or approve reusable nAvid template sets. It is not the
normal public-video production path.

## Invocation

Treat any of these as template-authoring intent:

- `navid template create`
- `/navid-template`
- "tạo template mới cho navid"
- "save/add/approve this video as a reusable template"
- "build a template set"

Do not run the normal video intake gate unless the user also asks for a public
video output. Template creation has its own intake below.

## Template Intake

Resolve these values before writing files:

1. Template set id, lowercase kebab-case.
2. Target domain: `ai-news`, `developer-tools`, `security`, `robotics`,
   `product-tour`, or a new explicit domain.
3. Source style: from completed production, from an approved set variation, or
   from a fresh design brief.
4. Target channel/profile, defaulting to `ai-news-247` when unspecified.
5. Orientation/platform, defaulting to 9:16 TikTok/Reels/Shorts.
6. Approval intent: candidate only, QA candidate, or promote after explicit
   approval.

If any value is missing, ask only for the missing value.

## Non-Negotiable Assets

Before authoring, validate `templates/assets/required-assets.json`.
Every current and future template must use the shared asset contract:

- canonical TikTok profile card component;
- packaged `ainew247na.jpg` avatar/brand image;
- packaged `cursor-hand.png` pointer;
- packaged `templates/assets/sfx/follow-click.wav` or documented approved
  replacement;
- declared default `.mp3`, `.mp4` and `.gif` placeholders for install and
  template QA only.

Portable sequences may vendor byte-identical copies of component CSS/JS,
avatar and cursor assets so each sequence renders independently. They may not
invent alternate profile cards, cursors, fake metrics or untracked SFX.

## Non-Negotiable Layout And Editorial Rules

- Source screenshots must be focused crops or source-backed callouts when a
  full page would be too small in 9:16. Every template that supports proof
  scenes must include a phone-frame or targeted-frame QA example.
- Proof visuals must have obvious editorial purpose: official product images,
  documentation diagrams, release/changelog history or labelled source-backed
  callouts beat arbitrary crops. QA/debug labels and crop markers must never
  appear in public template frames.
- Captions/subtitles must be one-line, mobile-safe and visually distinct from
  buttons. Avoid plain white button-like bars for subtitles unless the scene is
  explicitly a button/CTA.
- TikTok profile cards must use the canonical compact component. A centered compact TikTok profile card is required in the allotted lower/outro area; avoid empty pill tails or over-wide backgrounds.
- Tool/repo/product templates must reserve a beat for audience and practical
  use case: who needs this, why, and what workflow it enables.

## Authoring Steps

1. Read `template-library.md`, `quality-gates.md` and the required asset
   contract.
2. Create or update the candidate manifest at
   `templates/domains/<domain>/candidate/<set-id>/manifest.json`.
3. Define at least 12 modules: the eight core narrative roles required by
   `template-library.md` plus at least four domain-specific modules.
4. Build three renderable portable HyperFrames sequences:
   `templates/portable/<set-id>/short/`,
   `templates/portable/<set-id>/standard/` and
   `templates/portable/<set-id>/extended/`.
5. Each sequence must include a HyperFrames `index.html`, referenced CSS/JS,
   local component dependencies and required local assets. Opening a sequence
   directory alone must not require source-machine absolute paths.
6. Use the shared fixture `templates/fixtures/ai-news-tech-sample.json` or a
   completed approved production as sample content.
7. Store generated previews, contact sheets and QA evidence outside the skill
   runtime at `videos/template-library-preview/<set-id>/`.
8. Run structural validation, portable asset audit and HyperFrames visual QA
   for all three sequences using `npx hyperframes preview`, `npx hyperframes
   inspect` when layout QA is needed, and `npx hyperframes render` for preview
   renders/contact sheets.
9. Test at least one real source-backed AI News or technology input before
   promotion, including focused proof crops/callouts, a centered compact
   TikTok profile card, non-button subtitle styling and an audience/use-case
   beat.

## Candidate And Promotion Rules

- New work starts as `candidate`; candidate sets are never production defaults.
- Passing QA only makes a candidate eligible for approval.
- Promotion to `approved` requires an explicit user approval event naming the
  set id.
- On promotion, move the manifest to
  `templates/domains/<domain>/approved/<set-id>/manifest.json`, update
  `templates/registry.json`, and record approval evidence in the manifest.
- If QA fails, keep the set in `candidate` with concrete failure notes and do
  not update registry as approved.

## Release Boundary

Template creation writes into the skill package tree only. It does not publish
npm, reinstall runtime skills or replace the user's active Codex skill unless
the user explicitly asks to publish or sync.

## Runtime Boundary

All reusable template sets must be authored for HyperFrames. Do not create a
template set whose primary runtime is Remotion, raw ffmpeg assembly, slideshow
export, screen recording, or a non-HyperFrames HTML capture. Those tools may
only supply source assets or diagnostics; the portable template itself must be
a HyperFrames composition.
