sap-commerce
npx skills add https://github.com/emenowicz/sap-commerce-skill --skill sap-commerce
Agent 安装分布
Skill 文档
SAP Commerce Development
Overview
SAP Commerce Cloud (formerly Hybris) is an enterprise e-commerce platform built on Java and Spring. This skill provides guidance for extension development, type system modeling, service layer implementation, data management, API customization, and accelerator patterns for both Cloud (CCv2) and On-Premise deployments.
Core Architecture
Type System
Data modeling via items.xml defines item types, attributes, relations, and enumerations. Types are compiled into Java classes during build. See type-system.md for syntax and patterns.
Extensions
Modular architecture where functionality lives in extensions. Each extension has extensioninfo.xml for metadata, items.xml for types, and *-spring.xml for beans. See extension-development.md.
Service Layer
Four-layer architecture: Facade (API for controllers) â Service (business logic) â DAO (data access) â Model (generated from types). See service-layer-architecture.md.
Data Management
ImpEx: Scripting language for data import/export. See impex-guide.md. FlexibleSearch: SQL-like query language for items. See flexiblesearch-reference.md.
OCC API
RESTful web services exposing commerce functionality. Controllers use @WsDTOMapping for DTO conversion. See occ-api-development.md.
Accelerators
Pre-built storefronts: B2C (retail) and B2B (enterprise with approval workflows). See accelerator-customization.md.
Common Workflows
Create a Custom Extension
- Generate structure with
ant extgenor use template fromassets/extension-structure/ - Configure
extensioninfo.xmlwith dependencies - Define types in
items.xml - Configure beans in
*-spring.xml - Add to
localextensions.xml - Build:
ant clean all
Reference: extension-development.md | Template: assets/extension-structure/
Define Custom Item Types
- Create or modify
*-items.xmlin extension - Define itemtype with attributes, relations
- Build to generate model classes
- Use in services/DAOs
Reference: type-system.md | Templates: assets/item-type-definition/
Implement Service Layer
- Create DTO class for data transfer
- Create DAO interface and implementation with FlexibleSearch
- Create Service interface and implementation with business logic
- Create Facade interface and implementation for external API
- Configure beans in
*-spring.xml
Reference: service-layer-architecture.md | Templates: assets/service-layer/
Import Data with ImpEx
- Create
.impexfile with header and data rows - Use INSERT_UPDATE for create/modify operations
- Define macros for reusable values
- Import via HAC or
ant importImpex
Reference: impex-guide.md | Templates: assets/impex-scripts/
Query with FlexibleSearch
SELECT {pk} FROM {Product} WHERE {code} = ?code
SELECT {p.pk} FROM {Product AS p JOIN Category AS c ON {p.supercategories} = {c.pk}} WHERE {c.code} = ?category
Reference: flexiblesearch-reference.md | Examples: assets/flexiblesearch-queries/
Customize OCC API
- Create controller with
@Controllerand@RequestMapping - Create WsDTO with
@WsDTOMapping - Create populator for model-to-DTO conversion
- Register in
*-web-spring.xml
Reference: occ-api-development.md | Templates: assets/occ-customization/
Extend Accelerator Checkout
- Create custom checkout step implementing
CheckoutStep - Configure in checkout flow XML
- Create JSP for step UI
- Register beans in
*-spring.xml
Reference: accelerator-customization.md | Templates: assets/checkout-customization/
Quick Reference
| Task | Reference | Assets | Script |
|---|---|---|---|
| Extension setup | extension-development.md | assets/extension-structure/ |
scripts/generate-extension.sh |
| Type definitions | type-system.md | assets/item-type-definition/ |
– |
| Service layer | service-layer-architecture.md | assets/service-layer/ |
– |
| Data import | impex-guide.md | assets/impex-scripts/ |
scripts/validate-impex.sh |
| Queries | flexiblesearch-reference.md | assets/flexiblesearch-queries/ |
scripts/query-items.sh |
| API customization | occ-api-development.md | assets/occ-customization/ |
– |
| Checkout/Storefront | accelerator-customization.md | assets/checkout-customization/ |
– |
| Spring config | spring-configuration.md | – | – |
| Data patterns | data-modeling-patterns.md | – | – |
| Troubleshooting | troubleshooting-guide.md | – | – |
Resources
scripts/
Utility scripts for common tasks:
generate-extension.sh– Scaffold new extension structurevalidate-impex.sh– Validate ImpEx syntax before importquery-items.sh– Execute FlexibleSearch queries via HAC
references/
Detailed guides for each topic area. Load as needed for in-depth information.
assets/
Production-quality code templates ready to copy and customize. Organized by domain (service-layer, impex-scripts, etc.).