open-wes
CLAUDE.md339 starsChanged 10 days agoMITView on GitHub
Open WES is a Warehouse Execution System. Monorepo structure: - server/ — Java 17, Spring Boot 3.2.2, Gradle, DDD architecture - client/ — React 17, TypeScript, MobX + AMIS framework - Infrastructure: Docker Compose, MySQL 8.0, Redis 7.2, Nacos 2.0, Kafka Read docs/standards/backend.md first — it defines DDD rules, database standards, plugin patterns, and validation rules that all backend code must follow. Script plugins are database-backed Groo
- Installs packages
In this repositoryOne other file it gives its agents.
- smoke-testSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
23 rules. About 0 are common, 5 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 75
Use @Version for optimistic locking
- Very specific: line 79
Only find* and save* methods.
- Distinctive: line 85
Prefer async domain events over big transactions
- Very specific: line 89
Redis: Use RedisUtils, not RedisTemplate
- Very specific: line 90
Locking: Use DistributedLock class
- Very specific: line 97
POJO: Use @Comment("...") not columnDefinition for column comments
- Very specific: line 114
AMIS lint: Run npm run lint:amis in client/ after changing a schema.
- Very specific: line 116
HTTP requests: Always use request from @/utils/requestInterceptor.
- Very specific: line 117
i18n: Use useTranslation() hook or t() function.
- Distinctive: line 119
React keys: Use stable unique IDs, never array indexes.
- Distinctive: line 123
SVG IDs: Use namespaced module-scoped constants for gradient/clipPath IDs to prevent duplicates across renders.
- Very specific: line 126
Read
docs/standards/amis.md: before writing or migrating an AMIS schema. - Very specific: line 132
NEVER: commit secrets, API keys, or passwords.
- Very specific: line 133
NEVER: use dangerouslySetInnerHTML without DOMPurify.
- Very specific: line 135
NEVER: use .anyRequest().permitAll() in Spring Security.
- Distinctive: line 138
Always: use parameterized queries for any user-influenced SQL.
- Very specific: line 156
All three servers (WES, Station, Gateway) expose /actuator/prometheus
- Very specific: line 159
Create a @Component class in org.openwes.monitoring.metrics
- Very specific: line 160
Add @Subscribe methods for the domain events you want to track
- Very specific: line 161
Use MeterRegistry to record counters/gauges/timers
- Very specific: line 170
All monitoring infrastructure config lives in monitoring/ at the repo root:
- Distinctive: line 215
All schema and data changes must use Liquibase changelogs — never ad-hoc SQL files.
- Very specific: line 220
Always use preConditions onFail="MARK_RAN" for idempotency
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Open WES - AI Coding Guidelines
Project Overview
Open WES is a Warehouse Execution System. Monorepo structure:
server/— Java 17, Spring Boot 3.2.2, Gradle, DDD architectureclient/— React 17, TypeScript, MobX + AMIS framework- Infrastructure: Docker Compose, MySQL 8.0, Redis 7.2, Nacos 2.0, Kafka
Read docs/standards/backend.md first — it defines DDD rules, database standards, plugin patterns, and validation rules that all backend code must follow.
Project Structure
Server Modules (server/)
modules-wes/ # Core domain (inbound, outbound, stock, basic, config, task, stocktake, algo, ems-proxy, printer)
modules-ai/ # AI integration (ai-core, ai-api, ai-plugin — script plugin drafts)
modules-user/ # Auth, user management
modules-station/ # Workstation operations
modules-gateway/ # API gateway
modules-plugin/ # Plugin platform: script-plugin-api/core/runtime, legacy PF4J jar modules, plugin-example sample
modules-search/ # Search functionality
modules-api-platform/ # External API platform
modules-utils/ # Shared utilities (must NOT depend on other modules) — includes monitoring module
server/ # Spring Boot runners (wes-server, station-server, gateway-server)Client (client/src/)
pages/ # Page components (wms/, api_platform/, data_platform/, user/, monitoring/)
components/ # Shared React components
stores/ # MobX state tree stores
routes/ # React Router config + lazy-loaded route mapping
locales/ # i18n translation files (en/zh/ja/ko)
utils/ # HTTP client, helpersArchitecture Patterns
DDD Layer Flow
Controller -> IEntityApi (interface) -> EntityApiImpl -> Domain Service -> Entity -> Repository -> JPAPackage Convention
org.openwes.[module-group].[module].[domain].[layer]
# Example: org.openwes.wes.outbound.domain.entity.OutboundPlanOrderClass Naming
| Type | Pattern | Example |
| API interface | I[Entity]Api | IInboundPlanOrderApi |
| API impl | [Entity]ApiImpl | InboundPlanOrderApiImpl |
| Service | [Entity]Service / [Entity]ServiceImpl | OutboundWaveService |
| Repository | [Entity]Repository / [Entity]RepositoryImpl | ContainerRepository |
| DTO | [Entity]DTO | ContainerDTO |
| Transfer | [Entity]Transfer | InboundPlanOrderTransfer |
| Error enum | [Module]ErrorDescEnum | InboundErrorDescEnum |
API Implementation Annotations
@Primary
@Service
@Validated
@DubboService
@RequiredArgsConstructor
public class EntityApiImpl implements IEntityApi { }Domain Entity Rules
- No setters — use lifecycle methods:
initialize(),complete(),cancel(),close() - Extend
AggregatorRootfor aggregate roots - Use
@Versionfor optimistic locking - Publish events via
addAsynchronousDomainEvents()
Repository Rules
- Only
find*andsave*methods. Neverupdate*methods. - Load entity -> mutate via lifecycle method -> save entire entity
Transactions
@Transactiononly on Aggregates and Repositories- Pull queries out of transactions for performance
- Prefer async domain events over big transactions
Backend Conventions
- Redis: Use
RedisUtils, notRedisTemplate - Locking: Use
DistributedLockclass - Async (same server):
DomainEventPublisher.sendAsyncDomainEvent() - Async (cross server):
MqClient.sendAsyncMessage() - Validation:
@Validon API interface params,@Validatedon impl classes - Logging: English only, use
@Slf4j - Config: Environment config in Nacos, business config in database
- DB columns: Code=64, Name=128, Description=255, Remark=500, Enum=20 chars
- POJO: Use
@Comment("...")notcolumnDefinitionfor column comments - Plugins: One
IPlugininterface per domain with before/after lifecycle hooks
Script Plugin Platform
Script plugins are database-backed Groovy bundles — no jar packaging and no restart. The legacy PF4J jar-plugin path is frozen.
- Modules:
script-plugin-api— contract catalog, DTOs and static validation;script-plugin-core— persistence, management services and/plugin-platform/**;script-plugin-runtime— materialization, invocation, dispatchers and registry;plugin-api/plugin-core/plugin-sdk/plugin-extension— legacy jar path;plugin-example— non-built sample (not insettings.gradle). - Hosts:
wes-serverhosts management + runtime (script-plugin.registry.mode: local);station-serverhosts runtime only (mode: remote). - Lookup:
PluginSdkUtils.getExtractObject(Class<T>)merges jar extensions with materialized script proxies, sorts by priority descending; an empty list means "use the built-in behavior". - Workbench:
/plugin-platform/plugins,/plugin-platform/plugin-workbench?mode=new(or?pluginKey=<key>),/plugin-platform/audit; client code lives inclient/src/pages/plugin_platform/. - Tests:
cd server && ./gradlew :modules-plugin:script-plugin-api:test - Rules:
docs/standards/backend.md§Script Plugin Rules; the archetype table is generated fromPluginContractCatalogand checked byPluginDocumentationConsistencyTest.
Frontend Conventions
- AMIS pages: Most CRUD/form pages are JSON schema definitions using
schema2component(). Prefer this pattern for standard pages. Compose@/utils/amis/presets(crudPage,formDrawer, column helpers) instead of copying schema boilerplate. - AMIS lint: Run
npm run lint:amisinclient/after changing a schema; errors block a merge. - State management: MobX + mobx-state-tree (
src/stores/). Use@inject @observerdecorators. - HTTP requests: Always use
requestfrom@/utils/requestInterceptor. Never use rawfetchoraxios. - i18n: Use
useTranslation()hook ort()function. All user-facing strings must be translated. - TypeScript: Define proper interfaces. Avoid
anytypes. UseRecord<string, unknown>if type is truly unknown. - React keys: Use stable unique IDs, never array indexes.
- Styling: Ant Design components + CSS classes. AMIS pages use AMIS built-in styling.
- Logging: All
console.*and toast messages must be in English. Never commit debugconsole.logcalls. Never suppressconsole.errorglobally. - React props: Props are read-only — never mutate them.
renderSchema()(AMIS) returns aReactElement, not a class instance; do not calldestroy()/dispose()on it. - SVG IDs: Use namespaced module-scoped constants for gradient/clipPath IDs to prevent duplicates across renders.
Read docs/standards/frontend.md for detailed rules, anti-patterns, and examples.
Read docs/standards/amis.md before writing or migrating an AMIS schema.
Security Guidelines
These rules are non-negotiable:
- NEVER commit secrets, API keys, or passwords. Use
${ENV_VAR}placeholders. - NEVER use
dangerouslySetInnerHTMLwithout DOMPurify. PreferReactMarkdownwithrehype-sanitize. - NEVER execute dynamically generated SQL directly. Validate with SQL parser, use read-only DB user.
- NEVER use
.anyRequest().permitAll()in Spring Security. Define explicit authorization rules. - NEVER hardcode credentials (including as default form values).
- Always validate DTO inputs with Bean Validation annotations (
@Valid,@NotNull,@NotEmpty,@Size). - Always use parameterized queries for any user-influenced SQL.
- Store tokens with expiry handling. Prefer httpOnly cookies over localStorage for sensitive tokens.
Monitoring & Observability
The project uses Prometheus + Grafana + Loki for monitoring, alerting, and log aggregation.
Architecture
- Metrics: Application (Micrometer) →
/actuator/prometheus→ Prometheus scrape → Grafana - Logs: Application log files → Promtail → Loki → Grafana
- Alerts: Prometheus/Loki alert rules → AlertManager → Webhook
- Infrastructure: MySQL/Redis/Node/Kafka Exporters → Prometheus
Monitoring Module (modules-utils/monitoring/)
- Auto-configured via
MonitoringAutoConfiguration(Spring Boot auto-config) - Business metrics use Guava
@Subscribeon domain events — zero invasion of business code DomainEventProcessor(BeanPostProcessor) auto-registers any bean with@Subscribemethods- One
*MetricsSubscriberper domain: Inbound, Outbound, Task, Stock - All three servers (WES, Station, Gateway) expose
/actuator/prometheus
Adding New Business Metrics
- Create a
@Componentclass inorg.openwes.monitoring.metrics - Add
@Subscribemethods for the domain events you want to track - Use
MeterRegistryto record counters/gauges/timers - The subscriber is auto-registered with EventBus — no manual wiring needed
Frontend Monitoring App
- Top-level app (
system_code='monitoring') with menu entries inu_menutable - Pages embed Grafana dashboards via iframe (
?kioskmode) - Grafana configured for anonymous Viewer access + iframe embedding
Monitoring Config Files
All monitoring infrastructure config lives in monitoring/ at the repo root:
monitoring/
├── prometheus/ # Scrape targets + alert rules
├── grafana/ # Dashboards + datasource provisioning
├── loki/ # Log storage config
├── promtail/ # Log collection config
└── alertmanager/ # Alert routing + notificationMonitoring Ports
| Service | Port |
| Prometheus | 9090 |
| Grafana | 3000 |
| Loki | 3100 |
| AlertManager | 9093 |
Build and Run
# Backend (Java 17 required)
cd server && ./gradlew build
# Frontend
cd client && npm install && npm run dev
# Full stack (Docker)
HOST_IP=$(hostname -I | awk '{print $1}') docker-compose up -dServer Ports
| Service | Port |
| Gateway | 8090 |
| WES Server | 9010 |
| Station Server | 9040 |
| Frontend | 80 |
| Prometheus | 9090 |
| Grafana | 3000 |
| Loki | 3100 |
| AlertManager | 9093 |
Database Migrations
All schema and data changes must use Liquibase changelogs — never ad-hoc SQL files.
- Changelogs live in
server/server/wes-server/src/main/resources/db/changelog/ - Naming:
db.changelog-YYYYMMDD.xml; register indb.changelog-master.xml - Never edit any SQL file already referenced by an existing changeset (
init_dictionary.sqletc.) — Liquibase checksums them and will refuse to start if they change - Always use
preConditions onFail="MARK_RAN"for idempotency - Split ADD + MIGRATE + DROP into 3 separate changesets (Hibernate auto-DDL may create the new columns before Liquibase runs)
- Adding or modifying an
IEnumenum value requires a changeset in the same commit to sync the dictionary —POST /config/dictionary/refreshis a dev-only helper, not a substitute
Read docs/standards/liquibase.md for full rules, templates, and the ADD+MIGRATE+DROP pattern.
Repository Hygiene
Never commit AI tooling artifacts: .superpowers/, .claude/settings.local.json. These are covered by .gitignore — if you add new tooling, update .gitignore before the first commit.
Read docs/standards/repository.md for full rules on gitignore management and CI/GitHub Actions standards.
Key File Locations
| Purpose | Path |
| Backend coding standards | docs/standards/backend.md |
| Frontend standards (detailed) | docs/standards/frontend.md |
| AMIS schema standards | docs/standards/amis.md |
| Repository hygiene standards | docs/standards/repository.md |
| Database migration standards | docs/standards/liquibase.md |
| Gradle build config | server/build.gradle, server/settings.gradle |
| Backend entry points | server/server/wes-server/, station-server/, gateway-server/ |
| App config (Nacos) | initdb.d/nacos_config.sql |
| Docker | docker-compose.yml |
| DB init scripts | initdb.d/ |
| Frontend entry | client/src/index.tsx |
| Route definitions | client/src/routes/path2Compoment.tsx |
| Monitoring module | server/modules-utils/monitoring/ |
| Monitoring infra config | monitoring/ |
| Monitoring design spec | docs/superpowers/specs/2026-05-23-monitoring-alerting-framework-design.md |
| Domain event system | server/modules-utils/domain-event/ |
| Script plugin AI pipeline | server/modules-ai/ai-plugin/ |
| Script plugin contract catalog | server/modules-plugin/script-plugin-api/src/main/java/org/openwes/script/plugin/api/contract/PluginContractCatalog.java |
| Script plugin management plane | server/modules-plugin/script-plugin-core/ |
| Script plugin runtime | server/modules-plugin/script-plugin-runtime/ |
| Script plugin sample | server/modules-plugin/plugin-example/ |
| Script plugin workbench (client) | client/src/pages/plugin_platform/ |
| Script plugin rules chapter | docs/standards/backend.md (§Script Plugin Rules) |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

