Copier + Jinja template-repository design skill: reference architecture, implementation workflow, validation checklist, and a full worked example template (questionnaire, extensions, resolvers, wrapper-first .scripts). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
76 lines
3.8 KiB
Markdown
76 lines
3.8 KiB
Markdown
# Validation Checklist (Template Engine Repository)
|
|
|
|
Use this checklist before considering Copier/Jinja template work complete.
|
|
|
|
## A. Copier configuration
|
|
|
|
- [ ] `.copier/copier.yaml` exists and is valid YAML.
|
|
- [ ] `_template_suffix` is set to `.jinja`.
|
|
- [ ] `_answers_file` is explicitly configured.
|
|
- [ ] `_exclude` blocks repo-internal operational files (`.copier`, `.scripts`, env/lock files as needed).
|
|
- [ ] Questionnaire is loaded via `!include .copier/questionnaire/*.yml`.
|
|
|
|
## B. Input schema and answers
|
|
|
|
- [ ] `copier-answers.example.yaml` reflects real expected shape.
|
|
- [ ] Required keys used in templates are documented in the example answers.
|
|
- [ ] `{{ _copier_conf.answers_file }}.jinja` renders `_copier_answers|to_nice_yaml`.
|
|
|
|
## C. Wrapper runtime surface
|
|
|
|
- [ ] Root `Taskfile.yml` includes copier module Taskfile.
|
|
- [ ] `.scripts/copier/Taskfile.yml` has an operator-friendly `bootstrap-one` task.
|
|
- [ ] API wrapper (`api/bootstrap-one.sh`) creates and enters a sibling `tmp-<template-folder>` copy before sourcing libs and rendering.
|
|
- [ ] API wrapper returns to the live template repo after the temp-copy render completes.
|
|
- [ ] ENV variable prefix is explicitly confirmed/proposed and consistently applied across wrapper libs.
|
|
- [ ] Lib layer parses CLI args for:
|
|
- [ ] Lib layer parses CLI args for **both** forms: `--arg value` and `--arg=value`.
|
|
- [ ] `--copier-target-dir`
|
|
- [ ] `--copier-force-copy`
|
|
- [ ] `--copier-params-file`
|
|
|
|
## D. Answers merge behavior
|
|
|
|
- [ ] `copier-answers-new.yml` is created if missing.
|
|
- [ ] Existing target answers are imported when present.
|
|
- [ ] Params file is merged into working answers file.
|
|
- [ ] Render uses `--data-file` pointing to merged answers file.
|
|
- [ ] Local bootstrap render runs from the sanitized temp copy, not directly from the live Git-backed template folder.
|
|
- [ ] Temp copy removes `.git`, `.devbox`, and `.venv` before `copier copy` to avoid Copier/Git interference.
|
|
- [ ] If Copier config lives under `.copier/copier.yaml`, temp-copy bootstrap copies it to root `copier.yaml` before rendering.
|
|
- [ ] No Git tags are created merely to suppress Copier local render warnings.
|
|
|
|
## E. Templating behavior
|
|
|
|
- [ ] Conditional folder names render correctly (e.g. `{{ 'dev' if ... }}`).
|
|
- [ ] **All optional resources** are path-wrapped with Jinja conditions (folder and/or file names), not only guarded in file bodies.
|
|
- [ ] Conditional Jinja blocks in files match folder-level conditions.
|
|
- [ ] Safe/normalized names are provided by context-hook or resolver variables (e.g. `flat.project_safe`), not repeated inline filter chains.
|
|
- [ ] Template paths and file bodies do not duplicate complex expressions like `lower | replace(...) | trim` for identifiers used in more than one place.
|
|
- [ ] Any generated temporary filenames (e.g. `.tmp-gitlab-ci.yml`) are renamed correctly post-render.
|
|
|
|
## F. Extensions (if used)
|
|
|
|
- [ ] All custom extensions are registered in `_jinja_extensions`.
|
|
- [ ] Resolver helpers are deterministic and side-effect free.
|
|
- [ ] Context hook logic is idempotent on repeated runs.
|
|
- [ ] Context hook exposes stable safe variables for reusable identifiers before templates consume them.
|
|
- [ ] `[INDEX]` expansion creates concrete instance directories and removes placeholder template dir.
|
|
|
|
## G. End-to-end runs
|
|
|
|
- [ ] Fresh render into empty target directory succeeds.
|
|
- [ ] Re-render into existing target with prior answers succeeds.
|
|
- [ ] `--copier-force-copy true` path works.
|
|
- [ ] Default/non-force path works.
|
|
|
|
## H. Documentation quality
|
|
|
|
- [ ] README explains local setup and one canonical bootstrap command.
|
|
- [ ] Skill/instructions mention architecture and anti-patterns.
|
|
- [ ] Examples use realistic paths and argument names.
|
|
|
|
## Exit criteria
|
|
|
|
You are done when all checklist sections pass and rendering is reproducible in both fresh and update scenarios.
|