---
name: loomi-node-content-generation
description: Generate contentgen API payloads and dynamic Bloomreach email bindings for scenario nodes, plus SMS/push/weblayer copy when needed. Use when the user wants message content, email visuals, node copy, subject lines, preheaders, Jinja snippets, or content refinement for an approved Bloomreach scenario.
---

# Loomi Node Content Generation

Use this skill after a scenario blueprint exists or when the user asks for content for a specific scenario node.

## Workflow

1. Identify the scenario node, selected segment, channel, and user feedback.
2. Load relevant local context and supplied `projectContextJson` for properties, events, consent, variables, and channel constraints.
3. If Bloomreach CLI cards exist for the selected scenario or weblayer, use them as optional evidence.
4. Use raw selected-object fallback only when exact payload, variable, or template detail is missing.
5. Call `generate_node_content`.
6. Return content in both strategic and implementation-friendly form.
7. Ask for user feedback and refine as needed.

## Content Requirements

For email, include:

- contentgen API payload template and parametrized parts
- webhook action configuration
- `webhook.available` and cache-exists checks
- `webhook.cache_key` to `customer.customer_variant` property mapping
- dynamic template bindings from `catalogs.aiagent.item_by_id(customer.customer_variant).json | from_json`
- QA checks

For SMS/push/weblayer, include:

- concise copy
- CTA or action
- personalization fallback
- channel-specific risk notes

## Visual Template Standard

Email visuals should describe blocks rendered from the generated catalog JSON:

- bootstrap and abort guard
- static header
- dynamic hero
- dynamic message loop
- optional recommendation/product/category module
- CTA
- footer with preference and unsubscribe handling

Do not provide fragile HTML unless the user explicitly asks. Prefer layout structure and copy first.

## Jinja Rules

- Always abort safely when catalog data is missing.
- Avoid sensitive or surprising personalization.
- Validate variables against project context before implementation.

Example:

```jinja
{%- set data = catalogs.aiagent.item_by_id(customer.customer_variant).json | from_json -%}
{% if data == None %}{% abort %}{%- endif -%}
```
