/plugin marketplace add secondsky/sap-skills/plugin install sap-sac-custom-widget@sap-skillsDefined in hooks/hooks.json
{
"PostToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If the file just written/edited appears to be an SAC custom widget file (contains 'webcomponents', 'onCustomWidgetBeforeUpdate', 'onCustomWidgetAfterUpdate', 'customElements.define', or is named widget.json/widget.js), perform a quick quality check:\n\n1. **For widget.json files**:\n - Verify required fields: id, version, name, vendor, webcomponents\n - Check webcomponents has: kind, tag, url\n - Verify tag uses lowercase with hyphens (e.g., 'my-widget')\n - Check if ignoreIntegrity is true (warn: development only)\n - Verify properties have valid types (string, integer, number, boolean, array, object, Color, Selection)\n - Check dataBindings feeds have id, description, type\n\n2. **For widget.js files**:\n - Verify class extends HTMLElement\n - Check for attachShadow({ mode: 'open' }) call\n - Verify onCustomWidgetBeforeUpdate exists\n - Verify onCustomWidgetAfterUpdate exists\n - Warn if onCustomWidgetResize is missing\n - Warn if onCustomWidgetDestroy is missing\n - Check property setters dispatch propertiesChanged event\n - Check for customElements.define call\n\n3. **Performance checks**:\n - Warn if resize handler not debounced\n - Warn if chart library not disposed in onCustomWidgetDestroy\n - Warn if innerHTML used (XSS risk)\n\n4. **Data binding checks**:\n - If dataBindings accessed, verify null checks before data access\n - Verify getDataBinding() pattern used correctly\n\nIf issues are found, report them concisely:\n- [Severity]: [Issue] - [Quick fix suggestion]\n\nSeverities: ERROR (must fix), WARN (should fix), INFO (suggestion)\n\nIf the file is NOT a widget file, output nothing.",
"timeout": 45
}
],
"matcher": "Write|Edit"
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If the user's prompt mentions 'custom widget', 'SAC widget', 'Analytics Cloud widget', 'widget.json', 'widget.js', 'onCustomWidgetBeforeUpdate', 'onCustomWidgetAfterUpdate', 'Web Component for SAC', or seems to be asking about SAP Analytics Cloud custom widget development, remind yourself to:\n\n1. Use templates from sap-sac-custom-widget/skills/sap-sac-custom-widget/templates/ when generating new widget code\n2. Include all 4 lifecycle functions: onCustomWidgetBeforeUpdate, onCustomWidgetAfterUpdate, onCustomWidgetResize, onCustomWidgetDestroy\n3. Use Shadow DOM with attachShadow({ mode: 'open' })\n4. Dispatch propertiesChanged event in property setters\n5. Use SAP theme variables (--sapFontFamily, --sapTextColor, etc.)\n6. For data binding, always check for null before accessing data\n7. Suggest /widget-validate for troubleshooting\n8. Suggest /widget-generate for new widgets\n9. Suggest /widget-lint for quality checks\n\nDo not output anything to the user - this is just a context reminder.",
"timeout": 10
}
],
"matcher": "*"
}
]
}{
"riskFlags": {
"touchesBash": false,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"prompt": 2
},
"eventStats": {
"PostToolUse": 1,
"UserPromptSubmit": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 0
}
}