/plugin marketplace add secondsky/sap-skills/plugin install sap-cap-capire@sap-skillsDefined in hooks/hooks.json
{
"PreToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "Before writing this CDS or CAP code, verify:\n\n1. **CDS Syntax**: Check for common CDS syntax errors:\n - Missing semicolons after entity/field definitions\n - Incorrect association syntax (Association to vs Composition of)\n - Missing namespace declarations\n - Invalid type definitions\n\n2. **Naming Conventions**: Validate naming follows CAP best practices:\n - Entities: PascalCase (Books, Authors, Orders)\n - Fields: camelCase (firstName, orderDate, totalAmount)\n - Services: PascalCase ending in Service (CatalogService, OrdersService)\n - Associations: Singular for to-one, plural for to-many\n\n3. **Anti-Patterns**: Check for common anti-patterns:\n - Manual foreign key fields (use managed associations)\n - Missing @title annotations for UI fields\n - Hardcoded values that should be configuration\n - Raw SQL instead of CQL\n - Missing input validation on CREATE/UPDATE handlers\n\n4. **Security**: Verify security considerations:\n - @restrict annotations on sensitive entities\n - Input validation for user-provided data\n - No hardcoded credentials or secrets\n - Proper authentication requirements (@requires)\n\n5. **Performance**: Check for performance issues:\n - Unbounded queries (missing LIMIT/pagination)\n - N+1 query patterns (missing expand clauses)\n - SELECT * instead of specific columns\n\nIf you find issues, provide a brief warning. If everything looks good, silently approve.",
"timeout": 30
}
],
"matcher": "Write|Edit"
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "prompt",
"prompt": "After writing CDS or CAP code, provide brief suggestions if applicable:\n\n1. **Testing**: Suggest testing approaches:\n - Unit tests for service handlers\n - Integration tests for end-to-end flows\n - Load testing for performance-critical operations\n\n2. **Documentation**: Recommend documentation:\n - @title and @description annotations for entities/fields\n - JSDoc comments for complex handler logic\n - README updates for new features\n\n3. **Performance**: Suggest performance optimizations:\n - Add @cds.index for frequently queried fields\n - Consider caching for reference data\n - Use streaming for large result sets\n\n4. **Deployment Readiness**: Remind about deployment considerations:\n - Update mta.yaml if new services added\n - Check xs-security.json if new scopes needed\n - Verify environment variable configuration\n\n5. **Best Practices**: Suggest CAP best practices:\n - Use built-in aspects (cuid, managed, temporal)\n - Consider Fiori Elements annotations for UI\n - Implement proper error handling with req.error()\n - Use CQL instead of native database queries\n\nKeep suggestions brief and only mention what's applicable. Limit to 3-4 most important suggestions.",
"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
}
}