Create Glyph
Create R-based pictogram glyphs for skill, agent, or team icons in the viz/ visualization layer. Each glyph is a pure-ggplot2 function that draws a recognizable shape on a 100x100 canvas, rendered with a neon glow effect to transparent-background WebP.
When to Use
- A new skill, agent, or team has been added and needs a visual icon
- An existing glyph needs replacement or redesign
- Batch-creating glyphs for a new domain of skills
- Prototyping visual metaphors for entity concepts
Inputs
- Required: Entity type —
skill, agent, or team
- Required: Entity ID (e.g.,
create-glyph, mystic, r-package-review) and domain (for skills)
- Required: Visual concept — what the glyph should depict
- Optional: Reference glyph to study for complexity level
- Optional: Custom
--glow-sigma value (default: 4)
Procedure
Step 1: Concept — Design the Visual Metaphor
Identify the entity being iconified and choose a visual metaphor.
- Read the entity's source file to understand its core concept:
- Skills:
skills/<id>/SKILL.md
- Agents:
agents/<id>.md
- Teams:
teams/<id>.md
- Choose a metaphor type:
- Literal object: a flask for experiments, a shield for security
- Abstract symbol: arrows for merging, spirals for iteration
- Composite: combine 2-3 simple shapes (e.g., document + pen)
- Reference existing glyphs for complexity calibration:
Complexity Tiers:
+----------+--------+-------------------------------------------+
| Tier | Layers | Examples |
+----------+--------+-------------------------------------------+
| Simple | 2 | glyph_flame, glyph_heartbeat |
| Moderate | 3-5 | glyph_document, glyph_experiment_flask |
| Complex | 6+ | glyph_ship_wheel, glyph_bridge_cpp |
+----------+--------+-------------------------------------------+
- Decide on a function name:
glyph_<descriptive_name> (snake_case, unique)
Expected: A clear mental sketch of the shape with 2-6 planned layers.
On failure: If the concept is too abstract, fall back to a related concrete object. Review existing glyphs in the same domain for inspiration.
Step 2: Compose — Write the Glyph Function
Write the R function that produces ggplot2 layers.
Function signature (immutable contract):
glyph_<name> <- function(cx, cy, s, col, bright) {
# cx, cy = center coordinates (50, 50 on 100x100 canvas)
# s = scale factor (1.0 = fill ~70% of canvas)
# col = domain color hex (e.g., "#ff88dd" for design)
# bright = brightened variant of col (auto-computed by renderer)
# Returns: list() of ggplot2 layers
}
Apply scale factor * s to ALL dimensions for consistent scaling:
r <- 20 * s # radius
hw <- 15 * s # half-width
lw <- .lw(s) # line width (default base 2.5)
lw_thin <- .lw(s, 1.2) # thinner line width
Build geometry using available primitives:
| Geometry |
Usage |
ggplot2::geom_polygon(data, .aes(x, y), ...) |
Filled shapes |
ggplot2::geom_path(data, .aes(x, y), ...) |
Open lines/curves |
ggplot2::geom_segment(data, .aes(x, xend, y, yend), ...) |
Line segments, arrows |
ggplot2::geom_rect(data, .aes(xmin, xmax, ymin, ymax), ...) |
Rectangles |
ggforce::geom_circle(data, .aes(x0, y0, r), ...) |
Circles |
Apply the color strategy:
Alpha Guide:
+----------------------+------------+--------------------------+
| Purpose | Alpha | Example |
+----------------------+------------+--------------------------+
| Large fill (body) | 0.08-0.15 | hex_with_alpha(col, 0.1) |
| Medium fill (accent) | 0.15-0.25 | hex_with_alpha(col, 0.2) |
| Small fill (detail) | 0.25-0.35 | hex_with_alpha(bright, 0.3) |
| Outline stroke | 1.0 | color = bright |
| Secondary stroke | 1.0 | color = col |
| No fill | --- | fill = NA |
+----------------------+------------+--------------------------+
Return a flat list() of layers (the renderer iterates and wraps each with glow)
Place the function in the appropriate primitives file based on entity type:
- Skills: domain-grouped across 19 primitives files:
primitives.R — bushcraft, compliance, containerization, data-serialization, defensive
primitives_2.R — devops, general, git, mcp-integration
primitives_3.R — mlops, observability, PM, r-packages, reporting, review, web-dev, esoteric, design
- Additional
primitives_4.R through primitives_19.R for newer domains
- Agents:
viz/R/agent_primitives.R
- Teams:
viz/R/team_primitives.R
Expected: A working R function that returns a list of 2-6 ggplot2 layers.
On failure: If ggforce::geom_circle causes errors, ensure ggforce is installed. If coordinates are off, remember the canvas is 100x100 with (0,0) at bottom-left. Test the function interactively:
source("viz/R/utils.R"); source("viz/R/primitives.R") # etc.
layers <- glyph_<name>(50, 50, 1.0, "#ff88dd", "#ffa8f0")
p <- ggplot2::ggplot() + ggplot2::coord_fixed(xlim=c(0,100), ylim=c(0,100)) +
ggplot2::theme_void()
for (l in layers) p <- p + l
print(p)
Step 3: Register — Map Entity to Glyph
Add the entity-to-glyph mapping in the appropriate glyph mapping file.
For skills:
- Open
viz/R/glyphs.R
- Find the comment section for the target domain (e.g.,
# -- design (3))
- Add the entry in alphabetical order within the domain block:
"skill-id" = "glyph_function_name",
- Update the domain count in the comment if applicable
For agents:
- Open
viz/R/agent_glyphs.R
- Find the alphabetical position in
AGENT_GLYPHS
- Add the entry:
"agent-id" = "glyph_function_name",
For teams:
Open viz/R/team_glyphs.R
Find the alphabetical position in TEAM_GLYPHS
Add the entry:
"team-id" = "glyph_function_name",
Verify no duplicate ID exists in the target list
Expected: The appropriate *_GLYPHS list contains the new mapping.
On failure: If the build later reports "No glyph mapped", double-check that the entity ID exactly matches the one in the manifest and registry.
Step 4: Manifest — Add Icon Entry
Register the icon in the appropriate manifest file.
For skills: viz/data/icon-manifest.json
{
"skillId": "skill-id",
"domain": "domain-name",
"prompt": "<domain basePrompt>, <descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/<domain>/<skill-id>.webp",
"status": "pending"
}
For agents: viz/data/agent-icon-manifest.json
{
"agentId": "agent-id",
"prompt": "<agent-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/agents/<agent-id>.webp",
"status": "pending"
}
For teams: viz/data/team-icon-manifest.json
{
"teamId": "team-id",
"prompt": "<team-specific descriptors>, dark background, vector art",
"seed": <next_seed>,
"path": "public/icons/cyberpunk/teams/<team-id>.webp",
"status": "pending"
}
Expected: Valid JSON with the new entry placed among its type siblings.
On failure: Validate JSON syntax. Common mistakes: trailing comma after last array element, missing quotes.
Step 5: Render — Generate the Icon
Run the icon pipeline to render the new glyph. Always use build.sh as the entry point — it handles platform detection and R binary selection. See render-icon-pipeline for the full flag reference and pipeline architecture.
# From project root — renders all palettes, standard + HD, skips existing icons
bash viz/build.sh --only <domain> --skip-existing # skills
bash viz/build.sh --type agent --only <id> --skip-existing # agents
bash viz/build.sh --type team --only <id> --skip-existing # teams
# Dry run first:
bash viz/build.sh --only <domain> --dry-run
build.sh runs the full pipeline (palette → data → manifest → render → terminal glyphs). The non-render steps add ~10 seconds but ensure all data is current.
Output locations:
- Skills:
viz/public/icons/<palette>/<domain>/<skill-id>.webp
- Agents:
viz/public/icons/<palette>/agents/<agent-id>.webp
- Teams:
viz/public/icons/<palette>/teams/<team-id>.webp
Expected: The log shows OK: <entity> (seed=XXXXX, XX.XKB) and the WebP file exists.
On failure:
"No glyph mapped" — Step 3 mapping is missing or has a typo
"Unknown domain" — Domain not in get_palette_colors() in palettes.R
- R package errors — Run
install.packages(c("ggplot2", "ggforce", "ggfx", "ragg", "magick")) first
- If rendering crashes, test the glyph function interactively (see Step 2 fallback)
Step 6: Verify — Visual Inspection
Check the rendered output meets quality standards.
Verify file exists and has reasonable size:
ls -la viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Expected: 15-80 KB typical range
Open the WebP in an image viewer to check:
- Shape reads clearly at full size (1024x1024)
- Neon glow is present but not overpowering
- Background is transparent (no black/white rectangle)
- No clipping at canvas edges
Check at small sizes (the icon renders at ~40-160px in the force graph):
- Shape remains recognizable
- Detail doesn't turn to noise
- Glow doesn't overwhelm the shape
Expected: A clear, recognizable pictogram with even neon glow on transparent background.
On failure:
- Glow too strong: re-render with
--glow-sigma 2 (default is 4)
- Glow too weak: re-render with
--glow-sigma 8
- Shape unreadable at small sizes: simplify the glyph (fewer layers, bolder strokes, increase
.lw(s, base) base value)
- Clipping at edges: reduce shape dimensions or shift center
Step 7: Iterate — Refine if Needed
Make adjustments and re-render.
Common adjustments:
- Bolder strokes: increase
.lw(s, base) — try base = 3.0 or 3.5
- More visible fill: increase alpha from 0.10 to 0.15-0.20
- Shape proportions: adjust multipliers on
s (e.g., 20 * s -> 24 * s)
- Add/remove detail layers: keep total layers between 2-6 for best results
To re-render after changes:
# Delete the existing icon first, then re-render
rm viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp
# Use the appropriate build command from Step 5
When satisfied, verify the manifest status shows "done" (the build script updates it automatically on success)
Expected: The final icon passes all verification checks from Step 6.
On failure: If after 3+ iterations the glyph still doesn't read well, consider using a completely different visual metaphor (return to Step 1).
Reference
Domain and Entity Color Palettes
All domain colors (for skills) are defined in viz/R/palettes.R (the single source of truth). Agent and team colors are also managed in palettes.R. The cyberpunk palette (hand-tuned neon colors) is in get_cyberpunk_colors(). Viridis-family palettes are auto-generated via viridisLite.
To look up a color:
source("viz/R/palettes.R")
get_palette_colors("cyberpunk")$domains[["design"]] # skill domain
get_palette_colors("cyberpunk")$agents[["mystic"]] # agent
get_palette_colors("cyberpunk")$teams[["tending"]] # team
When adding a new domain, add it to three places in palettes.R:
PALETTE_DOMAIN_ORDER (alphabetical)
get_cyberpunk_colors() domains list
- Run
bash viz/build.sh to regenerate palettes, data, and manifests
Glyph Function Catalog
See the full catalog of available glyph functions in the primitives source files:
- Skills:
viz/R/primitives.R through viz/R/primitives_19.R (domain-grouped)
- Agents:
viz/R/agent_primitives.R
- Teams:
viz/R/team_primitives.R
Helper Functions
| Function |
Signature |
Purpose |
.lw(s, base) |
(scale, base=2.5) |
Scale-aware line width |
.aes(...) |
alias for ggplot2::aes |
Shorthand aesthetic mapping |
hex_with_alpha(hex, alpha) |
(string, 0-1) |
Add alpha to hex color |
brighten_hex(hex, factor) |
(string, factor=1.3) |
Brighten a hex color |
dim_hex(hex, factor) |
(string, factor=0.4) |
Dim a hex color |
Validation Checklist
Common Pitfalls
- Forgetting
* s: Hard-coded pixel values break when scale changes. Always multiply by s.
- Canvas origin confusion: (0,0) is bottom-left, not top-left. Higher
y values move UP.
- Double glow: The renderer already applies
ggfx::with_outer_glow() to every layer. Do NOT add glow inside the glyph function.
- Too many layers: Each layer gets individual glow wrapping. More than 8 layers makes rendering slow and visually noisy.
- Mismatched IDs: The entity ID in the glyph mapping, manifest, and registry must all match exactly.
- JSON trailing commas: The manifest is strict JSON. No trailing comma after the last array element.
- Missing domain color: If the domain isn't in
get_cyberpunk_colors() in palettes.R, rendering will error. Add the color first, then regenerate.
- Wrong primitives file: Skills go in domain-grouped
primitives*.R, agents in agent_primitives.R, teams in team_primitives.R.
Related Skills
1---2name: create-glyph3description: >4 Create R-based pictogram glyphs for skill, agent, or team icons in the5 visualization layer. Covers concept sketching, ggplot2 layer composition using6 the primitives library, color strategy, registration in the appropriate glyph7 mapping file and manifest, rendering via the build pipeline, and visual8 verification of the neon-glow output. Use when a new entity has been added and9 needs a visual icon for the force-graph visualization, an existing glyph needs10 replacement, or when batch-creating glyphs for a new domain.11license: MIT12allowed-tools: Read Write Edit Bash Grep Glob13metadata:14 source: https://skillmd.com/skills/pjt222/create-glyph15 author: Philipp Thoss16 version: "2.0"17 domain: design18 complexity: intermediate19 language: R20 tags: design, glyph, pictogram, icon, ggplot2, visualization, neon21---2223# Create Glyph2425Create R-based pictogram glyphs for skill, agent, or team icons in the `viz/` visualization layer. Each glyph is a pure-ggplot2 function that draws a recognizable shape on a 100x100 canvas, rendered with a neon glow effect to transparent-background WebP.2627## When to Use2829- A new skill, agent, or team has been added and needs a visual icon30- An existing glyph needs replacement or redesign31- Batch-creating glyphs for a new domain of skills32- Prototyping visual metaphors for entity concepts3334## Inputs3536- **Required**: Entity type — `skill`, `agent`, or `team`37- **Required**: Entity ID (e.g., `create-glyph`, `mystic`, `r-package-review`) and domain (for skills)38- **Required**: Visual concept — what the glyph should depict39- **Optional**: Reference glyph to study for complexity level40- **Optional**: Custom `--glow-sigma` value (default: 4)4142## Procedure4344### Step 1: Concept — Design the Visual Metaphor4546Identify the entity being iconified and choose a visual metaphor.47481. Read the entity's source file to understand its core concept:49 - Skills: `skills/<id>/SKILL.md`50 - Agents: `agents/<id>.md`51 - Teams: `teams/<id>.md`522. Choose a metaphor type:53 - **Literal object**: a flask for experiments, a shield for security54 - **Abstract symbol**: arrows for merging, spirals for iteration55 - **Composite**: combine 2-3 simple shapes (e.g., document + pen)563. Reference existing glyphs for complexity calibration:5758```text59Complexity Tiers:60+----------+--------+-------------------------------------------+61| Tier | Layers | Examples |62+----------+--------+-------------------------------------------+63| Simple | 2 | glyph_flame, glyph_heartbeat |64| Moderate | 3-5 | glyph_document, glyph_experiment_flask |65| Complex | 6+ | glyph_ship_wheel, glyph_bridge_cpp |66+----------+--------+-------------------------------------------+67```68694. Decide on a function name: `glyph_<descriptive_name>` (snake_case, unique)7071**Expected:** A clear mental sketch of the shape with 2-6 planned layers.7273**On failure:** If the concept is too abstract, fall back to a related concrete object. Review existing glyphs in the same domain for inspiration.7475### Step 2: Compose — Write the Glyph Function7677Write the R function that produces ggplot2 layers.78791. Function signature (immutable contract):80 ```r81 glyph_<name> <- function(cx, cy, s, col, bright) {82 # cx, cy = center coordinates (50, 50 on 100x100 canvas)83 # s = scale factor (1.0 = fill ~70% of canvas)84 # col = domain color hex (e.g., "#ff88dd" for design)85 # bright = brightened variant of col (auto-computed by renderer)86 # Returns: list() of ggplot2 layers87 }88 ```89902. Apply scale factor `* s` to ALL dimensions for consistent scaling:91 ```r92 r <- 20 * s # radius93 hw <- 15 * s # half-width94 lw <- .lw(s) # line width (default base 2.5)95 lw_thin <- .lw(s, 1.2) # thinner line width96 ```97983. Build geometry using available primitives:99100 | Geometry | Usage |101 |---|---|102 | `ggplot2::geom_polygon(data, .aes(x, y), ...)` | Filled shapes |103 | `ggplot2::geom_path(data, .aes(x, y), ...)` | Open lines/curves |104 | `ggplot2::geom_segment(data, .aes(x, xend, y, yend), ...)` | Line segments, arrows |105 | `ggplot2::geom_rect(data, .aes(xmin, xmax, ymin, ymax), ...)` | Rectangles |106 | `ggforce::geom_circle(data, .aes(x0, y0, r), ...)` | Circles |1071084. Apply the color strategy:109110 ```text111 Alpha Guide:112 +----------------------+------------+--------------------------+113 | Purpose | Alpha | Example |114 +----------------------+------------+--------------------------+115 | Large fill (body) | 0.08-0.15 | hex_with_alpha(col, 0.1) |116 | Medium fill (accent) | 0.15-0.25 | hex_with_alpha(col, 0.2) |117 | Small fill (detail) | 0.25-0.35 | hex_with_alpha(bright, 0.3) |118 | Outline stroke | 1.0 | color = bright |119 | Secondary stroke | 1.0 | color = col |120 | No fill | --- | fill = NA |121 +----------------------+------------+--------------------------+122 ```1231245. Return a flat `list()` of layers (the renderer iterates and wraps each with glow)1251266. Place the function in the appropriate primitives file based on entity type:127 - **Skills**: domain-grouped across 19 primitives files:128 - `primitives.R` — bushcraft, compliance, containerization, data-serialization, defensive129 - `primitives_2.R` — devops, general, git, mcp-integration130 - `primitives_3.R` — mlops, observability, PM, r-packages, reporting, review, web-dev, esoteric, design131 - Additional `primitives_4.R` through `primitives_19.R` for newer domains132 - **Agents**: `viz/R/agent_primitives.R`133 - **Teams**: `viz/R/team_primitives.R`134135**Expected:** A working R function that returns a list of 2-6 ggplot2 layers.136137**On failure:** If `ggforce::geom_circle` causes errors, ensure ggforce is installed. If coordinates are off, remember the canvas is 100x100 with (0,0) at bottom-left. Test the function interactively:138```r139source("viz/R/utils.R"); source("viz/R/primitives.R") # etc.140layers <- glyph_<name>(50, 50, 1.0, "#ff88dd", "#ffa8f0")141p <- ggplot2::ggplot() + ggplot2::coord_fixed(xlim=c(0,100), ylim=c(0,100)) +142 ggplot2::theme_void()143for (l in layers) p <- p + l144print(p)145```146147### Step 3: Register — Map Entity to Glyph148149Add the entity-to-glyph mapping in the appropriate glyph mapping file.150151**For skills:**1521. Open `viz/R/glyphs.R`1532. Find the comment section for the target domain (e.g., `# -- design (3)`)1543. Add the entry in alphabetical order within the domain block:155 ```r156 "skill-id" = "glyph_function_name",157 ```1584. Update the domain count in the comment if applicable159160**For agents:**1611. Open `viz/R/agent_glyphs.R`1622. Find the alphabetical position in `AGENT_GLYPHS`1633. Add the entry:164 ```r165 "agent-id" = "glyph_function_name",166 ```167168**For teams:**1691. Open `viz/R/team_glyphs.R`1702. Find the alphabetical position in `TEAM_GLYPHS`1713. Add the entry:172 ```r173 "team-id" = "glyph_function_name",174 ```1751765. Verify no duplicate ID exists in the target list177178**Expected:** The appropriate `*_GLYPHS` list contains the new mapping.179180**On failure:** If the build later reports "No glyph mapped", double-check that the entity ID exactly matches the one in the manifest and registry.181182### Step 4: Manifest — Add Icon Entry183184Register the icon in the appropriate manifest file.185186**For skills:** `viz/data/icon-manifest.json`187```json188{189 "skillId": "skill-id",190 "domain": "domain-name",191 "prompt": "<domain basePrompt>, <descriptors>, dark background, vector art",192 "seed": <next_seed>,193 "path": "public/icons/cyberpunk/<domain>/<skill-id>.webp",194 "status": "pending"195}196```197198**For agents:** `viz/data/agent-icon-manifest.json`199```json200{201 "agentId": "agent-id",202 "prompt": "<agent-specific descriptors>, dark background, vector art",203 "seed": <next_seed>,204 "path": "public/icons/cyberpunk/agents/<agent-id>.webp",205 "status": "pending"206}207```208209**For teams:** `viz/data/team-icon-manifest.json`210```json211{212 "teamId": "team-id",213 "prompt": "<team-specific descriptors>, dark background, vector art",214 "seed": <next_seed>,215 "path": "public/icons/cyberpunk/teams/<team-id>.webp",216 "status": "pending"217}218```219220**Expected:** Valid JSON with the new entry placed among its type siblings.221222**On failure:** Validate JSON syntax. Common mistakes: trailing comma after last array element, missing quotes.223224### Step 5: Render — Generate the Icon225226Run the icon pipeline to render the new glyph. Always use `build.sh` as the entry point — it handles platform detection and R binary selection. See [render-icon-pipeline](../render-icon-pipeline/SKILL.md) for the full flag reference and pipeline architecture.227228```bash229# From project root — renders all palettes, standard + HD, skips existing icons230bash viz/build.sh --only <domain> --skip-existing # skills231bash viz/build.sh --type agent --only <id> --skip-existing # agents232bash viz/build.sh --type team --only <id> --skip-existing # teams233234# Dry run first:235bash viz/build.sh --only <domain> --dry-run236```237238`build.sh` runs the full pipeline (palette → data → manifest → render → terminal glyphs). The non-render steps add ~10 seconds but ensure all data is current.239240Output locations:241 - Skills: `viz/public/icons/<palette>/<domain>/<skill-id>.webp`242 - Agents: `viz/public/icons/<palette>/agents/<agent-id>.webp`243 - Teams: `viz/public/icons/<palette>/teams/<team-id>.webp`244245**Expected:** The log shows `OK: <entity> (seed=XXXXX, XX.XKB)` and the WebP file exists.246247**On failure:**248- `"No glyph mapped"` — Step 3 mapping is missing or has a typo249- `"Unknown domain"` — Domain not in `get_palette_colors()` in `palettes.R`250- R package errors — Run `install.packages(c("ggplot2", "ggforce", "ggfx", "ragg", "magick"))` first251- If rendering crashes, test the glyph function interactively (see Step 2 fallback)252253### Step 6: Verify — Visual Inspection254255Check the rendered output meets quality standards.2562571. Verify file exists and has reasonable size:258 ```bash259 ls -la viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp260 # Expected: 15-80 KB typical range261 ```2622632. Open the WebP in an image viewer to check:264 - Shape reads clearly at full size (1024x1024)265 - Neon glow is present but not overpowering266 - Background is transparent (no black/white rectangle)267 - No clipping at canvas edges2682693. Check at small sizes (the icon renders at ~40-160px in the force graph):270 - Shape remains recognizable271 - Detail doesn't turn to noise272 - Glow doesn't overwhelm the shape273274**Expected:** A clear, recognizable pictogram with even neon glow on transparent background.275276**On failure:**277- Glow too strong: re-render with `--glow-sigma 2` (default is 4)278- Glow too weak: re-render with `--glow-sigma 8`279- Shape unreadable at small sizes: simplify the glyph (fewer layers, bolder strokes, increase `.lw(s, base)` base value)280- Clipping at edges: reduce shape dimensions or shift center281282### Step 7: Iterate — Refine if Needed283284Make adjustments and re-render.2852861. Common adjustments:287 - **Bolder strokes**: increase `.lw(s, base)` — try `base = 3.0` or `3.5`288 - **More visible fill**: increase alpha from 0.10 to 0.15-0.20289 - **Shape proportions**: adjust multipliers on `s` (e.g., `20 * s` -> `24 * s`)290 - **Add/remove detail layers**: keep total layers between 2-6 for best results2912922. To re-render after changes:293 ```bash294 # Delete the existing icon first, then re-render295 rm viz/public/icons/cyberpunk/<type-path>/<entity-id>.webp296 # Use the appropriate build command from Step 5297 ```2982993. When satisfied, verify the manifest status shows `"done"` (the build script updates it automatically on success)300301**Expected:** The final icon passes all verification checks from Step 6.302303**On failure:** If after 3+ iterations the glyph still doesn't read well, consider using a completely different visual metaphor (return to Step 1).304305## Reference306307### Domain and Entity Color Palettes308309All domain colors (for skills) are defined in `viz/R/palettes.R` (the single source of truth). Agent and team colors are also managed in `palettes.R`. The cyberpunk palette (hand-tuned neon colors) is in `get_cyberpunk_colors()`. Viridis-family palettes are auto-generated via `viridisLite`.310311To look up a color:312```r313source("viz/R/palettes.R")314get_palette_colors("cyberpunk")$domains[["design"]] # skill domain315get_palette_colors("cyberpunk")$agents[["mystic"]] # agent316get_palette_colors("cyberpunk")$teams[["tending"]] # team317```318319When adding a new domain, add it to three places in `palettes.R`:3201. `PALETTE_DOMAIN_ORDER` (alphabetical)3212. `get_cyberpunk_colors()` domains list3223. Run `bash viz/build.sh` to regenerate palettes, data, and manifests323324### Glyph Function Catalog325326See the full catalog of available glyph functions in the primitives source files:327- **Skills**: `viz/R/primitives.R` through `viz/R/primitives_19.R` (domain-grouped)328- **Agents**: `viz/R/agent_primitives.R`329- **Teams**: `viz/R/team_primitives.R`330331### Helper Functions332333| Function | Signature | Purpose |334|---|---|---|335| `.lw(s, base)` | `(scale, base=2.5)` | Scale-aware line width |336| `.aes(...)` | alias for `ggplot2::aes` | Shorthand aesthetic mapping |337| `hex_with_alpha(hex, alpha)` | `(string, 0-1)` | Add alpha to hex color |338| `brighten_hex(hex, factor)` | `(string, factor=1.3)` | Brighten a hex color |339| `dim_hex(hex, factor)` | `(string, factor=0.4)` | Dim a hex color |340341## Validation Checklist342343- [ ] Glyph function follows `glyph_<name>(cx, cy, s, col, bright) -> list()` signature344- [ ] All dimensions use `* s` scaling factor345- [ ] Color strategy uses `col` for fills, `bright` for outlines, `hex_with_alpha()` for transparency346- [ ] Function placed in correct primitives file for entity type and domain347- [ ] Glyph mapping entry added in the appropriate `*_glyphs.R` file348- [ ] Manifest entry added with correct entity ID, path, and `"status": "pending"`349- [ ] Build command runs without error (dry-run first)350- [ ] Rendered WebP exists at the expected path351- [ ] File size in expected range (15-80 KB)352- [ ] Icon reads clearly at both 1024px and ~40px display sizes353- [ ] Transparent background (no solid rectangle behind the glyph)354- [ ] Manifest status updated to `"done"` after successful render355356## Common Pitfalls357358- **Forgetting `* s`**: Hard-coded pixel values break when scale changes. Always multiply by `s`.359- **Canvas origin confusion**: (0,0) is bottom-left, not top-left. Higher `y` values move UP.360- **Double glow**: The renderer already applies `ggfx::with_outer_glow()` to every layer. Do NOT add glow inside the glyph function.361- **Too many layers**: Each layer gets individual glow wrapping. More than 8 layers makes rendering slow and visually noisy.362- **Mismatched IDs**: The entity ID in the glyph mapping, manifest, and registry must all match exactly.363- **JSON trailing commas**: The manifest is strict JSON. No trailing comma after the last array element.364- **Missing domain color**: If the domain isn't in `get_cyberpunk_colors()` in `palettes.R`, rendering will error. Add the color first, then regenerate.365- **Wrong primitives file**: Skills go in domain-grouped `primitives*.R`, agents in `agent_primitives.R`, teams in `team_primitives.R`.366367## Related Skills368369- [enhance-glyph](../enhance-glyph/SKILL.md) — improve an existing glyph's visual quality, fix rendering issues, or add detail layers370- [audit-icon-pipeline](../audit-icon-pipeline/SKILL.md) — detect missing glyphs and icons to know what needs creating371- [render-icon-pipeline](../render-icon-pipeline/SKILL.md) — run the full rendering pipeline end-to-end372- [ornament-style-mono](../ornament-style-mono/SKILL.md) — complementary AI-based image generation (Z-Image vs R-coded glyphs)373- [ornament-style-color](../ornament-style-color/SKILL.md) — color theory applicable to glyph accent fill decisions374- [create-skill](../create-skill/SKILL.md) — the parent workflow that triggers glyph creation when adding new skills