ワンクリックで
create-flag
Step-by-step guide to create a new country flag for the Mercosul plate
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Step-by-step guide to create a new country flag for the Mercosul plate
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | create-flag |
| description | Step-by-step guide to create a new country flag for the Mercosul plate |
| user_invocable | true |
You are creating a new country flag 3D model for the Mercosul license plate customizer.
mise run dev)Create src/lib/flag-<country>.ts. Use src/lib/flag-brazil.ts as a reference — read it fully before starting.
The function signature must match FlagBuilder from src/lib/types.ts:
export function build<Country>Flag(
width: number,
height: number,
depth: number,
style: "flat" | "relief" = "relief",
): Group
Create the function returning only the base background shape of the flag (e.g., blue rectangle for Argentina, red/white/blue stripes for Paraguay). Do not add any other elements yet.
In the worker file (src/lib/worker/plate-worker.ts), the dev model selector already handles this — it looks up the flag builder from COUNTRY_TEMPLATES by flagCountry. So you must register the flag in the template (step 7) before you can use the dev selector. Do that early with just the basic rectangle, then iterate.
Quick dev switching: To avoid needing to interact with UI dropdowns (which can be unreliable with browser automation), temporarily change the defaults in code:
DEFAULT_PARAMS.flagCountry in src/lib/types.ts → set to the new country namedevModel initial value in src/App.svelte → set to "flag-flat" or "flag-relief"Remember to restore these defaults before committing.
Take a screenshot or ask the user to verify. Only proceed to the next element after confirming the current one looks correct. Add elements one at a time:
The flag must support two modes:
Flat mode (style === "flat"):
Shape.holes.push(new Path(...)) — create the Path version of the shape above and add it as a holeRelief mode (style === "relief"):
z0 = 0, z1 = layerDepth, z2 = layerDepth * 2, etc.depth = layerDepth (total depth divided by number of layers)Common pattern:
const layerDepth = depth / numberOfLayers
const flat = style === 'flat'
const z0 = 0
const z1 = flat ? 0 : layerDepth
const z2 = flat ? 0 : layerDepth * 2
const d = flat ? depth : layerDepth
Every flag must have a white border rectangle as the outermost layer. This border MUST have a hole for the flag background shape (in both flat and relief modes) to avoid z-fighting.
const border = height * 0.06
const totalW = width / 2 + border
const totalH = height / 2 + border
const borderShape = new Shape()
borderShape.moveTo(-totalW, -totalH)
borderShape.lineTo(totalW, -totalH)
borderShape.lineTo(totalW, totalH)
borderShape.lineTo(-totalW, totalH)
borderShape.lineTo(-totalW, -totalH)
// Always cut hole for the background
const bgHole = new Path()
bgHole.moveTo(-w, -h)
bgHole.lineTo(w, -h)
bgHole.lineTo(w, h)
bgHole.lineTo(-w, h)
bgHole.lineTo(-w, -h)
borderShape.holes.push(bgHole)
In src/lib/types.ts:
Add the import at the top (near the buildBrazilFlag import):
import { build<Country>Flag } from "./flag-<country>";
Add flag: build<Country>Flag to the matching entry in COUNTRY_TEMPLATES:
{ name: "Argentina", countryText: "ARGENTINA", brText: "RA", flag: buildArgentinaFlag },
No other changes are needed — the ConfigPanel automatically shows the flag toggle when flag is present in the template.
Switch the dev model selector back to "Placa completa" and verify the flag appears correctly on the blue strip. The flag is positioned automatically by plate-geometry.ts.
plate-geometry.ts, not by the flag builderShape for filled areas, Path for holes. Use moveTo, lineTo, quadraticCurveTo, absarc etc.Shape needs a matching Path version if it will be used as a hole in flat mode. Create helper functions for reusable shapes (see makeDiamondShape/makeDiamondPath pattern in flag-brazil.ts)Shape with Path holes instead — it's much simpler and faster