Overview
Prefer the stable utilities already shipped by ddd4j. Avoid duplicating them in business modules. Always confirm a tool's null handling, exception contract, type semantics, and thread safety before adopting it.
When to Use
- Finding an existing utility before writing a private one:
StrKit,CollKit,ArrayKit,IdKit,DateKit,ReflectKit. - Choosing the right
JsonKitmapper per scenario:DEFAULT_OBJECT_MAPPERfor ordinary JSON,REDIS_OBJECT_MAPPERfor trusted cache data,EventPayloadSerializerfor events. - Deciding between
BeanKitandMappingKitfor bean property handling, and where implicit copying is unsafe. - Verifying a utility's null handling, exception contract, and generics before adopting it.
- Working with the Jackson 2 / 3 boundary, including the
com.fasterxml.jackson.annotationcompatibility package. - Removing duplicate utility wrappers that Kit already provides.
When NOT to Use
Do not use this skill when:
- The domain/CQRS contracts the utilities support are the question — use
ddd4j-coreinstead. Install:npx skills add full-stack-skills/ddd4j-skills --skill ddd4j-core. - Cache-side serialization policy (what may touch
REDIS_OBJECT_MAPPER) is the question — useddd4j-cacheinstead. Install:npx skills add full-stack-skills/ddd4j-skills --skill ddd4j-cache. - Domain-to-PO persistence mapping design is the question — use
ddd4j-datainstead. Install:npx skills add full-stack-skills/ddd4j-skills --skill ddd4j-data. - A request asks to treat a utility class as a domain service or to hide transactions/network/resource lifecycles behind Kit — do not use this skill for that; Kit is stateless helper territory, and such requests get refused.
- Generic Apache Commons / Guava / Hutool selection with no ddd4j involvement — use the generic
java-skills; this skill only adjudicates among ddd4j's own utilities.
Trigger Keywords
English: utility class, JSON serialization, bean copy, string helpers, collection helpers, ID generation, reflection utility, Jackson mapper
Chinese: utility classes, JSON serialization, Bean copying, string processing, collection utilities, ID generation, reflection utilities, Jackson compatibility
Routing
| Need | Utility family |
|---|---|
| JSON / Jackson, type conversion | JsonKit |
| Bean properties and mapping | BeanKit, MappingKit |
| Strings | StrKit, StrPool |
| Collections and arrays | CollKit, ArrayKit |
| Identifiers | IdKit |
| Functions and type conversion | FunctionKit |
| Dates and times | DateKit and related formatters |
| Reflection | ReflectKit and explicit metadata tools |
JSON Boundaries
- 3.0.x
JsonKitusestools.jacksondatabind. DEFAULT_OBJECT_MAPPERis for ordinary JSON.REDIS_OBJECT_MAPPERenablesDefaultTypingand only handles trusted cache data.EventStoreusesEventPayloadSerializerwith explicit event types — never the Redis mapper.com.fasterxml.jackson.annotationexists as a Jackson 2 / 3 compatibility annotation package.
Capability Boundaries
✅ Strong At
- Tool selection, null handling, and exception semantics.
- Boundary between
JsonKitand Jackson 2 / 3. - Common Bean, collection, string, and ID operations.
- Avoiding duplicate utility wrappers.
⚠️ Needs Input
- Current maintenance line.
- Input types and desired exception strategy.
- JSON usage scenario — HTTP, cache, or events.
❌ Out of Scope
- Treating utility classes as domain services.
- Enabling unrestricted polymorphism on untrusted JSON.
- Using Kit to hide transactions, network, or resource lifecycles.
Workflow
Step 1: Search the current Kit first
Before writing any helper, search the maintenance line's Kit sources for an existing method. Business modules duplicating StrKit / CollKit logic is the default failure this skill prevents.
Step 2: Read the signature, implementation, and tests
Do not infer semantics from the method name. Read what null inputs do, which exceptions are thrown, and what the existing tests actually assert.
Step 3: Classify the utility
Distinguish pure functions, global mutable mappers (DEFAULT_OBJECT_MAPPER vs REDIS_OBJECT_MAPPER), and side-effecting utilities. The class determines what the call site may assume about state and thread safety.
Step 4: Pick the narrowest API
Choose the method that preserves Optional, exceptions, and generics rather than the one that silently coerces. The narrowest correct API beats the most convenient lossy one.
Step 5: Test boundary values and error paths
Exercise null, empty, oversized, and malformed inputs plus the error path itself — utility semantics at the boundaries are exactly where "worked in my test" diverges from production behavior.
Gotchas
- The
JacksonKitname was merged away — code and AI-generated snippets referencing it do not compile on 3.0.x, which is the tell that the snippet came from an older line. - 3.0.x
JsonKitbinds totools.jackson, while older lines and most Stack Overflow answers usecom.fasterxml.jackson— imports that look right fail to resolve. REDIS_OBJECT_MAPPERenablesDefaultTyping— deserializing any external payload through it invites polymorphic deserialization attacks; it is for trusted cache data only.BeanKitcopies properties silently — a renamed field or type mismatch becomes a null/zero target value with no error, which is why explicit Domain-to-PO mapping exists.- Utility exceptions swallowed into
nullorfalsereturns convert failures into fake successes downstream; preserve diagnosable exceptions at the call site. EventStorepayloads go throughEventPayloadSerializerwith explicit event types — pointing them at the Redis mapper compiles and corrupts the event log.- 3.0.x utility signatures are not backward-portable — a method present on the high line may not exist (or may differ) on 1.0.x/2.0.x; verify per line.
Output and Exceptions
Return the utility FQN, maintenance line, inputs and outputs, and null / exception semantics. When missing, return missing: target type or maintenance line; how to provide: call site and POM.
Deep Reference
Privacy and Security
JSON, logs, and exceptions must not expose tokens, passwords, private fields, or private-repository credentials. This skill does not access, collect, store, or transmit any user data, credentials, or keys; utility class examples use only desensitized fictitious data.
Quick Start
- "Use
$ddd4j-kitto analyze the implementation and configuration my current project should adopt." - "Use
$ddd4j-kitto review existing usage against the current source." - "Use
$ddd4j-kitto return an implementation choice, evidence state, and remaining risk."
Audience and Customization
- Developers: provide the target maintenance line, POM, capabilities, and acceptance behavior.
- Architects: specify a read-only boundary, compatibility, or migration review.
- Testers / release engineers: specify the required evidence levels; do not auto-expand to release or production operations.
Customize the target framework, allowed implementations, excluded modules, compatibility requirements, and evidence level. When input is insufficient, give a tentative verdict first, then list missing: specific item; how to provide: path or configuration.
FAQ
- Are skills organized by Maven artifact? No — by the user-facing capability domain.
- Can I copy another maintenance line directly? No — verify the version and source first.
- Does a class existing in source prove the capability works? No — registration and behavior evidence are also required.
- How do I report tests that did not run? Mark
NOT RUNorBLOCKED. - Can the skill commit or release automatically? Only after explicit user authorization.
- What if the implementation is missing? Describe the missing module or evidence; do not invent APIs.