/plugin marketplace add secondsky/sap-skills/plugin install sap-sac-scripting@sap-skillsDefined in hooks/hooks.json
{
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If this file appears to be a SAC (SAP Analytics Cloud) script (JavaScript with SAC-specific APIs like getDataSource, getPlanning, Application.showMessage, Chart_, Table_, etc.), analyze it for common issues:\n\n1. **Performance Issues**:\n - getMembers() without accessMode parameter (should use {accessMode: MemberAccessMode.BookedValues})\n - Multiple setDimensionFilter() calls without setRefreshPaused(true/false) batching\n - Heavy code in onInitialization events\n - getData() instead of getResultSet() for cached access\n\n2. **Error-Prone Patterns**:\n - Accessing array index [0] without checking length first\n - Missing null checks before calling methods on objects\n - Dimension/measure names that might be case-sensitive typos\n\n3. **Best Practice Violations**:\n - Missing error handling (try/catch) around planning operations\n - No busy indicator for long operations\n - Console.log statements left in production code (warn only)\n\nIf issues found, return a brief warning with the specific issues. If the file is not a SAC script or no issues found, return 'approve'.",
"timeout": 30
}
],
"matcher": "Write|Edit"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "If a SAC script file was just written or edited, provide a brief tip about testing:\n- Test in SAC with F12 DevTools Console open\n- Use console.log() to trace execution\n- For planning operations, test with both private and public versions\n\nKeep response to 1-2 sentences. If not a SAC script, return empty response.",
"timeout": 15
}
],
"matcher": "Write|Edit"
}
]
}{
"riskFlags": {
"touchesBash": false,
"matchAllTools": false,
"touchesFileWrites": true
},
"typeStats": {
"prompt": 2
},
"eventStats": {
"PreToolUse": 1,
"PostToolUse": 1
},
"originCounts": {
"absolutePaths": 0,
"pluginScripts": 0,
"projectScripts": 0
},
"timeoutStats": {
"commandsWithoutTimeout": 0
}
}