@clix-so/clix-agent-skills 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,9 +16,9 @@ you can install skills in different ways.
16
16
 
17
17
  ### Universal CLI (Recommended)
18
18
 
19
- For **Cursor**, **VS Code**, **Claude Code**, **OpenCode**, **Goose**, **GitHub
20
- Copilot**, **Amp**, and **Letta**, use our tool to install skills and configure
21
- the Clix MCP Server automatically:
19
+ For Amp, Claude Code, Codex, Copilot, Cursor, Goose, Letta, OpenCode, and VS
20
+ Code, we recommend using our installer to set up the skills and automatically
21
+ configure the Clix MCP Server.
22
22
 
23
23
  #### Installation Modes
24
24
 
@@ -50,7 +50,7 @@ npx @clix-so/clix-agent-skills@latest install integration --client cursor --glob
50
50
 
51
51
  # Install all available skills at once (repo root)
52
52
  npx @clix-so/clix-agent-skills@latest install --all --client cursor
53
- # This will install: integration, event-tracking, user-management
53
+ # This will install: integration, event-tracking, user-management, personalization
54
54
 
55
55
  # Install all available skills globally (system root)
56
56
  npx @clix-so/clix-agent-skills@latest install --all --client cursor --global
@@ -63,6 +63,9 @@ npx @clix-so/clix-agent-skills@latest install --all --client cursor --global
63
63
  practices and campaign-ready validation
64
64
  - **clix-user-management**: Implement `Clix.setUserId` + user properties with
65
65
  logout best practices, personalization (`user.*`), and audience targeting
66
+ - **clix-personalization**: Author and debug personalization templates for
67
+ message content, deep links/URLs, and audience targeting rules (`user.*`,
68
+ `event.*`, `trigger.*`, `device.*`)
66
69
 
67
70
  **Supported Clients:**
68
71
 
@@ -101,6 +104,7 @@ Alternatively, you can install a single skill directly by running:
101
104
  /plugin install clix-integration@clix-agent-skills
102
105
  /plugin install clix-event-tracking@clix-agent-skills
103
106
  /plugin install clix-user-management@clix-agent-skills
107
+ /plugin install clix-personalization@clix-agent-skills
104
108
  ```
105
109
 
106
110
  Remember to restart Claude Code after installation to load the new skills.
package/llms.txt CHANGED
@@ -54,6 +54,24 @@ Integrates Clix Mobile SDK into iOS, Android, Flutter, and React Native projects
54
54
 
55
55
  ---
56
56
 
57
+ ## clix-personalization
58
+
59
+ Helps developers author and debug Clix personalization templates (Liquid-style) for message content, deep links/URLs, and audience targeting. Use when the user mentions personalization variables, Liquid, templates, conditional logic, loops, filters, deep links, message logs, or when the user types `clix-personalization`.
60
+
61
+ - [clix-personalization](https://raw.githubusercontent.com/clix-so/skills/refs/heads/main/skills/personalization/SKILL.md): Helps developers author and debug Clix personalization templates (Liquid-style) for message content, deep links/URLs, and audience targeting. Use when the user mentions personalization variables, Liquid, templates, conditional logic, loops, filters, deep links, message logs, or when the user types `clix-personalization`.
62
+
63
+ ### References
64
+
65
+ - [Common Patterns (Reference)](https://raw.githubusercontent.com/clix-so/skills/refs/heads/main/skills/personalization/references/common-patterns.md): Reference documentation for personalization skill
66
+ - [Debugging (Reference)](https://raw.githubusercontent.com/clix-so/skills/refs/heads/main/skills/personalization/references/debugging.md): Reference documentation for personalization skill
67
+ - [Template Syntax (Reference)](https://raw.githubusercontent.com/clix-so/skills/refs/heads/main/skills/personalization/references/template-syntax.md): Reference documentation for personalization skill
68
+
69
+ ### Scripts
70
+
71
+ - [Validate Template (Script)](https://raw.githubusercontent.com/clix-so/skills/refs/heads/main/skills/personalization/scripts/validate-template.sh): Utility script for personalization skill
72
+
73
+ ---
74
+
57
75
  ## clix-user-management
58
76
 
59
77
  Implements Clix user identification and user properties (setUserId, removeUserId, setUserProperty/setUserProperties, removeUserProperty/removeUserProperties) with safe schemas, logout best practices, and campaign-ready personalization/audience usage. Use when the user mentions login/logout, userId, user properties, personalization, audience targeting or when the user types `clix-user-management`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clix-so/clix-agent-skills",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "An open collection of agent skills for Clix.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -0,0 +1,204 @@
1
+ Copyright (c) 2026 Clix (https://clix.so/)
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright (c) 2026 Clix (https://clix.so/)
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
204
+
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: clix-personalization
3
+ description:
4
+ Helps developers author and debug Clix personalization templates
5
+ (Liquid-style) for message content, deep links/URLs, and audience targeting.
6
+ Use when the user mentions personalization variables, Liquid, templates,
7
+ conditional logic, loops, filters, deep links, message logs, or when the user
8
+ types `clix-personalization`.
9
+ ---
10
+
11
+ # Clix Personalization
12
+
13
+ Use this skill to help developers write **personalized Clix campaigns** using
14
+ template-based variables and light logic in:
15
+
16
+ - **Message content** (title, body, subtitle)
17
+ - **Links** (dynamic URL or deep link params)
18
+ - **Audience targeting** (conditional include/exclude rules)
19
+
20
+ ## What the official docs guarantee (high-signal)
21
+
22
+ - **Data namespaces**:
23
+ - `user.*` (user traits/properties)
24
+ - `event.*` (event payload properties)
25
+ - `trigger.*` (custom properties passed via API-trigger)
26
+ - Device/system vars: `device.id`, `device.platform`, `device.locale`,
27
+ `device.language`, `device.timezone`, plus `user.id`, `event.name`
28
+ - **Missing variables** render as an **empty string**.
29
+ - **Output**: print values with `{{ ... }}`.
30
+ - **Conditionals**: `{% if %}`, `{% else %}`, `{% endif %}` with operators
31
+ `== != > < >= <= and or not`. Invalid conditions evaluate to `false`.
32
+ - **Loops**: `{% for x in y %}` / `{% endfor %}` (use guards for empty lists).
33
+ - **Filters**: `upcase`, `downcase`, `capitalize`, `default`, `join`, `split`,
34
+ `escape`, `strip`, `replace` (chain with `|`).
35
+ - **Errors**: template rendering errors show up in **Message Logs**.
36
+
37
+ ## MCP-first (source of truth)
38
+
39
+ If the Clix MCP tools are available, treat them as the source of truth:
40
+
41
+ - `clix-mcp-server:search_docs` for personalization behavior and supported
42
+ syntax
43
+
44
+ If MCP tools are not available, use the bundled references in `references/`.
45
+
46
+ ## Workflow (copy + check off)
47
+
48
+ ```
49
+ Personalization progress:
50
+ - [ ] 1) Identify where the template runs (message / URL / audience rule)
51
+ - [ ] 2) Identify trigger type (event-triggered vs API-triggered)
52
+ - [ ] 3) Confirm available inputs (user.*, event.*, trigger.*, device.*)
53
+ - [ ] 4) Draft templates with guards/defaults
54
+ - [ ] 5) Validate template structure (balance tags, avoid missing vars)
55
+ - [ ] 6) Verify in Clix (preview/test payloads, check Message Logs)
56
+ ```
57
+
58
+ ## 1) Confirm the minimum inputs
59
+
60
+ Ask only what’s needed:
61
+
62
+ - **Where used**: title/body/subtitle vs URL/deep link vs audience targeting
63
+ rule
64
+ - **Campaign trigger**:
65
+ - Event-triggered → `event.*` is available
66
+ - API-triggered → `trigger.*` is available
67
+ - **Inputs**:
68
+ - Which `user.*` properties are set by the app
69
+ - Which `event.*` / `trigger.*` properties are passed (include example
70
+ payload)
71
+ - **Fallback policy**: what to show when data is missing (default strings,
72
+ guards)
73
+
74
+ ## 2) Produce a “Template Plan” (before tweaking lots of templates)
75
+
76
+ Return a compact table the user can approve:
77
+
78
+ - **field** (title/body/url/audience)
79
+ - **template** (Liquid)
80
+ - **required variables** (and their source: user/event/trigger/device)
81
+ - **fallbacks** (default filter and/or conditional guards)
82
+ - **example payload** + **expected rendered output**
83
+
84
+ ## 3) Authoring guidelines (what to do by default)
85
+
86
+ - Prefer **simple variables + `default`** over complex branching.
87
+ - Add **guards** for optional data and for arrays (`size > 0`) before looping.
88
+ - Prefer **pre-formatted** properties from your app (e.g., `"7.4 miles"`,
89
+ `"38m 40s"`) instead of formatting inside templates.
90
+ - Keep logic minimal; complex branching belongs in the app or segmentation
91
+ setup.
92
+
93
+ ## 4) Validation (fast feedback loop)
94
+
95
+ If you have a template file (recommended for review), run:
96
+
97
+ ```bash
98
+ bash <skill-dir>/scripts/validate-template.sh path/to/template.liquid
99
+ ```
100
+
101
+ This script does lightweight checks (matching `{% if %}`/`{% endif %}`,
102
+ `{% for %}`/`{% endfor %}`, and brace balancing). It can’t guarantee the
103
+ variables exist — you still need a payload + console verification.
104
+
105
+ ## 5) Verification checklist
106
+
107
+ - **Missing data**: does the template still read well with empty strings?
108
+ - **Trigger type**: API triggers use `trigger.*` (not `event.*`).
109
+ - **Message Logs**: check rendering errors and fix syntax issues first.
110
+ - **Upstream data**:
111
+ - If `user.*` is missing → fix user property setting (see
112
+ `clix-user-management`)
113
+ - If `event.*` is missing → fix event tracking payload (see
114
+ `clix-event-tracking`)
115
+
116
+ ## Progressive Disclosure
117
+
118
+ - **Level 1**: This `SKILL.md` (always loaded)
119
+ - **Level 2**: `references/` (load when writing/debugging templates)
120
+ - **Level 3**: `scripts/` (execute directly, do not load into context)
121
+
122
+ ## References
123
+
124
+ - `references/template-syntax.md` - Variables, output, conditionals, loops,
125
+ filters
126
+ - `references/common-patterns.md` - Copy/paste patterns for messages + URLs +
127
+ guards
128
+ - `references/debugging.md` - Troubleshooting missing variables and Message Logs
@@ -0,0 +1,69 @@
1
+ # Common Personalization Patterns (Reference)
2
+
3
+ Copy/paste starting points for Clix templates. Prefer simple templates with
4
+ guards/defaults.
5
+
6
+ ## Welcome / fallback-safe greeting
7
+
8
+ ```liquid
9
+ Hi {{ user.username | default: "there" }},
10
+ ```
11
+
12
+ ## Dynamic message body (event-triggered)
13
+
14
+ ```liquid
15
+ Hi {{ user.username | default: "Runner" }},
16
+ you ran {{ event.distance | default: "?" }} miles in {{ event.elapsedTime | default: "?" }} seconds.
17
+ ```
18
+
19
+ ## Dynamic deep link / URL (event-triggered)
20
+
21
+ ```liquid
22
+ myapp://run/summary?distance={{ event.distance }}&time={{ event.elapsedTime }}
23
+ ```
24
+
25
+ Tip: If a value may contain spaces or special characters, prefer passing a
26
+ pre-encoded string from your app (or keep the template value simple).
27
+
28
+ ## API-triggered promo (trigger.\*)
29
+
30
+ ```liquid
31
+ 🎉 {{ trigger.promotion | default: "A new promotion" }} is here!
32
+ Get {{ trigger.discount | default: "a discount" }} off now!
33
+ ```
34
+
35
+ ## Conditional title by threshold
36
+
37
+ ```liquid
38
+ {% if event.distance >= 10 %}
39
+ Long run completed!
40
+ {% else %}
41
+ Good run today!
42
+ {% endif %}
43
+ ```
44
+
45
+ ## Nested conditions (keep minimal)
46
+
47
+ ```liquid
48
+ {% if user.tier == "pro" %}
49
+ Pro stats updated successfully.
50
+ {% else %}
51
+ {% if event.elapsedTime > 3600 %}
52
+ You ran for more than an hour! Great job!
53
+ {% else %}
54
+ New record saved.
55
+ {% endif %}
56
+ {% endif %}
57
+ ```
58
+
59
+ ## Looping over an array with a guard
60
+
61
+ ```liquid
62
+ {% if user.badges and user.badges.size > 0 %}
63
+ {% for badge in user.badges %}
64
+ - {{ badge }}
65
+ {% endfor %}
66
+ {% else %}
67
+ No badges yet.
68
+ {% endif %}
69
+ ```
@@ -0,0 +1,89 @@
1
+ # Debugging Personalization (Reference)
2
+
3
+ This guide helps you troubleshoot when a personalized message renders
4
+ unexpectedly.
5
+
6
+ ## First principles (what the renderer does)
7
+
8
+ - Unknown / missing variables render as an **empty string**.
9
+ - Invalid conditions evaluate to `false`.
10
+ - Template rendering errors (syntax issues) surface in **Message Logs**.
11
+
12
+ ## Quick checklist
13
+
14
+ - **Are you using the right namespace?**
15
+ - Event-triggered campaign → use `event.*`
16
+ - API-triggered campaign → use `trigger.*`
17
+ - User traits/properties → use `user.*`
18
+ - **Is the variable actually set upstream?**
19
+ - `user.*` comes from your app calling user property APIs.
20
+ - `event.*` comes from the event payload you track.
21
+ - `trigger.*` comes from properties in the API trigger request.
22
+ - **Is the template resilient to missing data?**
23
+ - Add `| default: "..."` for strings.
24
+ - Wrap optional blocks in `{% if ... %}` guards.
25
+ - **Are you looping safely?**
26
+ - Guard with `collection and collection.size > 0` before `{% for %}`.
27
+
28
+ ## Common failure modes
29
+
30
+ ### 1) Blank values
31
+
32
+ Symptoms:
33
+
34
+ - Output is missing where you expected text.
35
+
36
+ Causes:
37
+
38
+ - Variable doesn’t exist for that user/campaign trigger.
39
+
40
+ Fix:
41
+
42
+ - Use `default` for output values:
43
+
44
+ ```liquid
45
+ {{ user.username | default: "Guest" }}
46
+ ```
47
+
48
+ ### 2) Conditional branch never runs
49
+
50
+ Symptoms:
51
+
52
+ - Always hits the `{% else %}` branch.
53
+
54
+ Causes:
55
+
56
+ - `event.*` is missing (or you should be using `trigger.*`).
57
+ - Value is not the type you expect (e.g., string vs number).
58
+
59
+ Fix:
60
+
61
+ - Verify trigger type and payload shape.
62
+ - Keep comparisons simple and ensure the property is sent as a number when you
63
+ compare numerically.
64
+
65
+ ### 3) Syntax error / rendering error
66
+
67
+ Symptoms:
68
+
69
+ - Message fails to render or shows an error in logs.
70
+
71
+ Causes:
72
+
73
+ - Missing `{% endif %}` / `{% endfor %}`
74
+ - Unbalanced `{{` / `}}` or `{%` / `%}`
75
+
76
+ Fix:
77
+
78
+ - Check **Message Logs** first.
79
+ - Validate the template structure locally:
80
+
81
+ ```bash
82
+ bash <skill-dir>/scripts/validate-template.sh path/to/template.liquid
83
+ ```
84
+
85
+ ## When to escalate (data issue vs template issue)
86
+
87
+ - If **defaults/guards** fix it → template issue.
88
+ - If values are always blank across many users → upstream tracking/user-property
89
+ issue (fix app instrumentation).
@@ -0,0 +1,113 @@
1
+ # Personalization Template Syntax (Reference)
2
+
3
+ This reference summarizes the personalization syntax supported by Clix
4
+ templates.
5
+
6
+ ## Data namespaces
7
+
8
+ - `user.*`: user properties (traits) you capture about a user
9
+ - Examples: `user.username`, `user.tier`
10
+ - `event.*`: properties from the triggering event (event-triggered campaigns)
11
+ - Examples: `event.distance`, `event.elapsedTime`
12
+ - `trigger.*`: custom properties passed via API trigger (API-triggered
13
+ campaigns)
14
+ - Examples: `trigger.promotion`, `trigger.discount`
15
+
16
+ Missing or undefined variables render as an **empty string**.
17
+
18
+ ## Device and system variables
19
+
20
+ Clix templates also support device and environment variables:
21
+
22
+ - `device.id`
23
+ - `device.platform` (`IOS` or `ANDROID`)
24
+ - `device.locale`
25
+ - `device.language`
26
+ - `device.timezone`
27
+ - `user.id` (project user id)
28
+ - `event.name` (event name)
29
+
30
+ ## Output variables
31
+
32
+ Print a value:
33
+
34
+ ```liquid
35
+ {{ user.username }}
36
+ ```
37
+
38
+ Nested / bracket access (useful when the key is not a valid identifier):
39
+
40
+ ```liquid
41
+ {{ event["distance"] }}
42
+ ```
43
+
44
+ ## Conditionals
45
+
46
+ Use `{% if %}`, `{% else %}`, `{% endif %}` blocks.
47
+
48
+ Supported operators:
49
+
50
+ - `==`, `!=`, `>`, `<`, `>=`, `<=`
51
+ - `and`, `or`, `not`
52
+
53
+ Example:
54
+
55
+ ```liquid
56
+ {% if event.distance >= 10 %}
57
+ Amazing! You completed a long run today.
58
+ {% else %}
59
+ Nice work! Keep it up!
60
+ {% endif %}
61
+ ```
62
+
63
+ Notes:
64
+
65
+ - Unknown variables render as empty strings.
66
+ - Invalid conditions evaluate to `false`.
67
+
68
+ ## Loops
69
+
70
+ Iterate over arrays with `{% for %}` / `{% endfor %}`:
71
+
72
+ ```liquid
73
+ {% for badge in user.badges %}
74
+ - {{ badge }}
75
+ {% endfor %}
76
+ ```
77
+
78
+ Guard empty collections:
79
+
80
+ ```liquid
81
+ {% if user.badges and user.badges.size > 0 %}
82
+ {% for badge in user.badges %}
83
+ {{ badge }}
84
+ {% endfor %}
85
+ {% else %}
86
+ No badges yet.
87
+ {% endif %}
88
+ ```
89
+
90
+ ## Filters
91
+
92
+ Filters transform values inside `{{ ... }}` blocks and can be chained with `|`.
93
+
94
+ Supported filters:
95
+
96
+ - `upcase` / `downcase`
97
+ - `capitalize`
98
+ - `default`
99
+ - `join`
100
+ - `split`
101
+ - `escape`
102
+ - `strip`
103
+ - `replace`
104
+
105
+ Examples:
106
+
107
+ ```liquid
108
+ Hi {{ user.username | default: "Guest" }}
109
+ ```
110
+
111
+ ```liquid
112
+ {{ user.username | default: "Guest" | upcase }}
113
+ ```
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ usage() {
5
+ cat <<'EOF'
6
+ Validate a Clix personalization template (Liquid-style) with lightweight checks.
7
+
8
+ Usage:
9
+ validate-template.sh <template-file>
10
+
11
+ Checks:
12
+ - Balanced {{ ... }} and {% ... %} delimiters
13
+ - Properly nested {% if %}/{% endif %} and {% for %}/{% endfor %} blocks
14
+
15
+ Notes:
16
+ - This is a best-effort validator; it cannot guarantee that variables exist.
17
+ - If Clix shows a rendering error, always trust Message Logs as the source of truth.
18
+ EOF
19
+ }
20
+
21
+ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" || "${1:-}" == "" ]]; then
22
+ usage
23
+ exit 0
24
+ fi
25
+
26
+ file="$1"
27
+
28
+ if [[ ! -f "$file" ]]; then
29
+ echo "Error: file not found: $file" >&2
30
+ exit 2
31
+ fi
32
+
33
+ errors=0
34
+
35
+ echo "Validating: $file"
36
+
37
+ brace_counts="$(
38
+ awk '
39
+ {
40
+ c_open_curly += gsub(/\{\{/, "&");
41
+ c_close_curly += gsub(/\}\}/, "&");
42
+ c_open_tag += gsub(/\{%/, "&");
43
+ c_close_tag += gsub(/%\}/, "&");
44
+ }
45
+ END {
46
+ printf("%d %d %d %d\n", c_open_curly, c_close_curly, c_open_tag, c_close_tag);
47
+ }
48
+ ' "$file"
49
+ )"
50
+
51
+ read -r open_curly close_curly open_tag close_tag <<<"$brace_counts"
52
+
53
+ if [[ "$open_curly" -ne "$close_curly" ]]; then
54
+ echo "Error: unbalanced mustache braces: '{{'=$open_curly vs '}}'=$close_curly" >&2
55
+ errors=$((errors + 1))
56
+ fi
57
+
58
+ if [[ "$open_tag" -ne "$close_tag" ]]; then
59
+ echo "Error: unbalanced tag braces: '{%'=$open_tag vs '%}'=$close_tag" >&2
60
+ errors=$((errors + 1))
61
+ fi
62
+
63
+ awk_exit=0
64
+ awk '
65
+ function trim(s) { sub(/^[ \t\r\n]+/, "", s); sub(/[ \t\r\n]+$/, "", s); return s }
66
+ function push(x) { stack[++sp] = x }
67
+ function top() { return stack[sp] }
68
+ function pop() { if (sp > 0) return stack[sp--]; return "" }
69
+
70
+ BEGIN { sp = 0; errors = 0 }
71
+
72
+ {
73
+ line = $0
74
+ while (match(line, /\{%[ \t]*[^%]*%\}/)) {
75
+ tag = substr(line, RSTART, RLENGTH)
76
+ inner = tag
77
+ gsub(/^\{%[ \t]*/, "", inner)
78
+ gsub(/[ \t]*%\}$/, "", inner)
79
+ inner = trim(inner)
80
+
81
+ # Tag name is first token.
82
+ split(inner, parts, /[ \t]+/)
83
+ name = parts[1]
84
+
85
+ if (name == "if") {
86
+ push("if")
87
+ } else if (name == "for") {
88
+ push("for")
89
+ } else if (name == "endif") {
90
+ if (top() != "if") {
91
+ printf("Error: found endif but top of stack is '%s'\n", top()) > "/dev/stderr"
92
+ errors++
93
+ } else {
94
+ pop()
95
+ }
96
+ } else if (name == "endfor") {
97
+ if (top() != "for") {
98
+ printf("Error: found endfor but top of stack is '%s'\n", top()) > "/dev/stderr"
99
+ errors++
100
+ } else {
101
+ pop()
102
+ }
103
+ } else if (name == "else" || name == "elsif") {
104
+ if (top() != "if") {
105
+ printf("Error: found %s outside of if block\n", name) > "/dev/stderr"
106
+ errors++
107
+ }
108
+ }
109
+
110
+ # Move forward in line after the matched tag.
111
+ line = substr(line, RSTART + RLENGTH)
112
+ }
113
+ }
114
+
115
+ END {
116
+ if (sp > 0) {
117
+ printf("Error: unclosed blocks remaining on stack (count=%d)\n", sp) > "/dev/stderr"
118
+ errors++
119
+ }
120
+ exit(errors > 0 ? 1 : 0)
121
+ }
122
+ ' "$file" || awk_exit=$?
123
+
124
+ if [[ "$awk_exit" -ne 0 ]]; then
125
+ errors=$((errors + 1))
126
+ fi
127
+
128
+ if [[ "$errors" -ne 0 ]]; then
129
+ echo "❌ Validation failed ($errors issue(s))." >&2
130
+ exit 1
131
+ fi
132
+
133
+ echo "✅ Template structure looks OK."
134
+