Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
shopware6-best-practices【部署与运维】Comprehensive Shopware 6.6+ development best practices for agency developers. Covers backend PHP, storefront Twig/JS, administration Vue.js, app system, integrations, CLI, multi-channel, and DevOps. Triggers on tasks involving plugin development, storefront customization, admin modules, app creation, payment/shipping integrations, or deployment.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Comprehensive best practices guide for Shopware 6.6+ development, designed for AI agents and LLMs helping agency developers. Contains 77 rules across 22 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Plugin Architecture | CRITICAL | plugin- |
| 2 | Customization & Extension | CRITICAL | custom- |
| 3 | Performance & Caching | CRITICAL | perf- |
| 4 | Security | CRITICAL | security- |
| 5 | Data Abstraction Layer | HIGH | dal- |
| 6 | API Development | HIGH | api- |
| 7 | Testing | HIGH | test- |
| 8 | Event System | MEDIUM-HIGH | event- |
| 9 | Database & Migrations | MEDIUM-HIGH | db- |
| 10 | Message Queue | MEDIUM | queue- |
| 11 | Dependency Injection | MEDIUM | di- |
| 12 | Logging | MEDIUM | logging- |
| 13 | Configuration | MEDIUM | config- |
| 14 | Scheduled Tasks | MEDIUM | scheduled- |
| 15 | Storefront Development | HIGH | storefront- |
| 16 | Administration Development | HIGH | admin- |
| 17 | App System | HIGH | app- |
| 18 | Integration Patterns | HIGH | integration- |
| 19 | CLI Commands | MEDIUM | cli- |
| 20 | Multi-Channel & B2B | MEDIUM-HIGH | multichannel- |
| 21 | DevOps & Tooling | MEDIUM | devops- |
| 22 | Common Patterns | HIGH | pattern- |
plugin-structure - Follow proper plugin directory structure and composer.jsonplugin-services - Register services correctly with proper tagscustom-decorator-pattern - Use decorator pattern for upgrade-safe service customizationcustom-event-subscribers - Implement event subscribers correctly with proper prioritiesperf-http-cache - Configure HTTP cache correctly with proper invalidationperf-dal-optimization - Optimize DAL queries to prevent N+1 problemsperf-elasticsearch - Use Elasticsearch correctly for large catalogssecurity-input-validation - Validate all inputs with RequestDataBag and validatorssecurity-authentication - Implement proper route authenticationsecurity-authorization - Use ACL for permission checkssecurity-csrf-protection - Implement CSRF protection for storefrontsecurity-sql-injection - Use DAL or parameterized queriesdal-criteria-usage - Use Criteria objects correctly with filters and paginationdal-associations - Load associations explicitly to avoid N+1 queriesdal-write-operations - Use batch operations and proper sync patternsdal-entity-extensions - Extend entities without modifying coredal-custom-entities - Create custom entity definitions properlyapi-store-api-routes - Create decoratable Store API routesapi-admin-api-routes - Create Admin API endpoints with proper ACLapi-response-handling - Handle responses and errors consistentlyapi-rate-limiting - Configure rate limiting for protectionapi-versioning - Version APIs for backwards compatibilitytest-unit-tests - Write unit tests with proper mockingtest-integration-tests - Use IntegrationTestBehaviour correctlytest-store-api-tests - Test Store API routes with HTTP teststest-fixtures - Create reusable test fixturesevent-business-events - Create Flow Builder compatible eventsevent-flow-actions - Implement configurable flow actionsdb-migrations - Implement safe database migrationsqueue-message-handlers - Implement async message handlingqueue-worker-config - Configure workers for productionqueue-low-priority - Separate low-priority background tasksdi-service-container - Use Symfony DI correctlylogging-best-practices - Implement structured loggingconfig-plugin-settings - Implement plugin configuration correctlyscheduled-tasks - Implement reliable scheduled tasksstorefront-controller-pattern - Extend StorefrontController with page loadersstorefront-twig-extension - Template inheritance with sw_extends and blocksstorefront-js-plugins - JavaScript plugin registration and lifecyclestorefront-themes - Theme structure, inheritance, and configurationstorefront-scss-variables - SCSS variables and responsive mixinsstorefront-http-client - AJAX requests and Store API calls from JSadmin-module-structure - Module registration, routes, and navigationadmin-components - Vue component patterns and templatesadmin-data-handling - Repository factory and Criteria API in adminadmin-acl-permissions - ACL-based UI visibility and actionsadmin-mixins-composables - Mixins, directives, and extensibilityadmin-extension-api - App iframe modules and Extension SDKapp-manifest - Complete manifest.xml configurationapp-webhooks - Webhook handling and signature verificationapp-custom-actions - Action buttons with notifications, modals, redirectsapp-payment-methods - App payment handlers for pay/finalize/capture/refundapp-custom-fields - Custom field definitions via manifestapp-scripts - Twig-based app scripts and hook pointsintegration-payment-handler - Sync/async payment handler patternsintegration-shipping-method - Shipping calculators and delivery timesintegration-cms-elements - CMS element creation with data resolversintegration-import-export - Import/export profiles and convertersintegration-external-api - HTTP client patterns with retry and cachingcli-commands - Custom command creation with arguments and optionscli-command-lifecycle - Configure/initialize/interact/execute lifecyclecli-progress-output - SymfonyStyle, progress bars, and formattingmultichannel-saleschannel - Sales channel awareness and visibilitymultichannel-b2b-patterns - Company handling, roles, and budgetsmultichannel-pricing - Currency, customer groups, and tax handlingmultichannel-context - Context types, scopes, and permissionsdevops-development-setup - Dockware, docker-compose, Makefile patternsdevops-deployment - Deployment scripts, builds, and rollbacksdevops-static-analysis - PHPStan, PHP-CS-Fixer, Rector configurationdevops-debugging - Profiler, Xdebug, logging, and data collectorsdevops-ci-cd - GitHub Actions and GitLab CI workflowspattern-error-handling - Custom exceptions and error pagespattern-translations - Snippets and entity translationspattern-media-handling - Media service, uploads, and thumbnailspattern-rule-builder - Custom rule conditions for pricing/shippingpattern-upgrade-migration - Version-aware code and update migrationsNever modify core files. Always use:
Use Shopware's Data Abstraction Layer instead of raw SQL:
Shopware can be slow if misused:
Read individual rule files for detailed explanations and code examples:
rules/plugin-structure.md
rules/custom-decorator-pattern.md
rules/perf-http-cache.md
rules/security-input-validation.md
rules/dal-criteria-usage.md
Each rule file contains:
For the complete guide with all rules expanded: AGENTS.md