MCPInstall

ddd4j-jackson

DDD4J Jackson 序列化规则技能。覆盖日期格式(非ISO-8601的yyyy-MM-dd HH:mm:ss)、Null值序列化规则(数组→[]、字符串→""、数字/布尔→保持null)、@Sensitive敏感数据脱敏(5种策略)、JacksonKit与WebObjectMapper双实例(Redis用JacksonKit/Web用ObjectMapper)、ToLongDeserializer(前端JS精度丢失处理)。 当用户在 DDD4J 项目中使用 Jackson、需要配置ObjectMapper、处理敏感数据脱敏、解决前后端JSON格式问题时使用。 配合 ddd4j-core 技能使用。

Installs
52
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/full-stack-skills/ddd-skills --skill ddd4j-jackson
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads ddd4j-jackson automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

DDD4J Jackson 序列化规则

编码 DDD4J 项目中 Jackson 的使用规则。LLM 训练数据中的 Jackson 用法会与项目约定冲突。

为什么需要这个技能

LLM 会用 ISO-8601 格式 2024-03-15T10:30:00Z 序列化日期——DDD4J 要求 2024-03-15 10:30:00。LLM 不会给 null 数组返回 []——DDD4J 前端期望 null 数组永远不出现。这些规则 LLM 不知道。

Capability Boundaries

✅ Strong Suits

  1. 日期格式规则 — yyyy-MM-dd HH:mm:ss(非ISO-8601)
  2. Null值规则 — 数组→[]、字符串→""、数字→保持null、布尔→保持null
  3. @Sensitive 脱敏 — 5种策略(手机/身份证/姓名/地址/邮箱)
  4. JacksonKit — Redis/缓存专用的独立ObjectMapper(DefaultTyping.NON_FINAL)
  5. ToLongDeserializer — 处理前端JS大数字精度丢失

❌ Out of Scope

  1. 实体继承/返回值约定 → ddd4j-core
  2. MyBatis JSON字段处理 → ddd4j-mybatis
  3. API签名/安全 → ddd4j-satoken

LLM 最常犯的错误

#错误正确做法
1日期用 ISO-8601 2024-03-15T10:30:00Z用 yyyy-MM-dd HH:mm:ss
2null 数组返回 null返回 []
3null 字符串返回 null返回 ""
4给 null 数字返回 0数字/布尔保持 null,不转化
5手动写脱敏逻辑用 @Sensitive(strategy = SensitiveStrategy.PHONE)
6缓存用 Web ObjectMapper用 JacksonKit(DefaultTyping.NON_FINAL + ALL visibility)
7大数字直接返回 Long用 ToLongDeserializer 处理精度丢失

核心规则速查

// ❌ 错误:LLM会这样写
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createTime;

// ✅ 正确:DDD4J 已全局配置
private LocalDateTime createTime;  // 序列化为 "2024-03-15 10:30:00"

// ✅ Null 处理:前端收到的 JSON
// null 数组 → []      (默认开启)
// null 字符串 → ""    (默认开启)
// null 对象 → {}      (默认开启)
// null 数字 → null    (不转化)
// null 布尔 → null    (不转化)

// ✅ 敏感数据脱敏
public class UserVO {
    @Sensitive(strategy = SensitiveStrategy.PHONE)
    private String phone;    // 185****1653
    @Sensitive(strategy = SensitiveStrategy.ID_CARD)
    private String idCard;   // 1234****5678
    @Sensitive(strategy = SensitiveStrategy.USERNAME)
    private String name;     // 张*三
    @Sensitive(strategy = SensitiveStrategy.EMAIL)
    private String email;    // r*****o@qq.com
    @Sensitive(strategy = SensitiveStrategy.ADDRESS)
    private String address;  // 北京市****海淀区****
}

// ✅ 两个 ObjectMapper
// Web用:JacksonAutoConfiguration 自动配置的,用于 HTTP 请求响应
@Autowired private ObjectMapper objectMapper;
// 缓存用:JacksonKit 独立 ObjectMapper,带 DefaultTyping.NON_FINAL
JacksonKit.toJson(obj);    // 序列化时写入类型信息
JacksonKit.fromJson(json, Type.class);  // 反序列化时根据类型信息恢复

Gotchas

  1. 不要自己配置 Jackson2ObjectMapperBuilderCustomizer — DDD4J 已预配置,冲突会导致日期格式错乱
  2. 对象存 Redis 必须用 JacksonKit 不是 ObjectMapper — Web ObjectMapper 没有 DefaultTyping,多态反序列化会丢类型
  3. 数字 null 不会转 0 — 前端需处理数字可能为 null 的情况(与数组/字符串不同)
  4. @Sensitive 只对 String 类型生效 — 其他类型忽略
  5. ToLongDeserializer 接受字符串转 Long — 前端传 "1234567890123456789" 也能正确解析
  6. 日期格式同时影响序列化和反序列化 — 前端提交的日期也必须 yyyy-MM-dd HH:mm:ss

Data Privacy

本技能不收集、存储或传输任何用户数据。@Sensitive 注解仅用于在序列化时脱敏已存在的敏感数据。

FAQ

What does the ddd4j-jackson skill do?

DDD4J Jackson 序列化规则技能。覆盖日期格式(非ISO-8601的yyyy-MM-dd HH:mm:ss)、Null值序列化规则(数组→[]、字符串→""、数字/布尔→保持null)、@Sensitive敏感数据脱敏(5种策略)、JacksonKit与WebObjectMapper双实例(Redis用JacksonKit/Web用ObjectMapper)、ToLongDeserializer(前端JS精度丢失处理)。 当用户在 DDD4J 项目中使用 Jackson、需要配置ObjectMapper、处理敏感数据脱敏、解决前后端JSON格式问题时使用。 配合 ddd4j-core 技能使用。

How do I install ddd4j-jackson?

Run npx skills add https://github.com/full-stack-skills/ddd-skills --skill ddd4j-jackson in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ddd4j-jackson/ (personal) or .claude/skills/ddd4j-jackson/ (project).

Which AI agents can use ddd4j-jackson?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is ddd4j-jackson safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains ddd4j-jackson?

It is published by full-stack-skills in full-stack-skills/ddd-skills. It has 52 recorded installs.

More from full-stack-skills/ddd-skills

View all →

ddd-code-reviewer

full-stack-skills/ddd-skills

DDD code review and anti-pattern detection — anemia model detection, layered compliance checking, aggregate design review, rich model verification, scoring system (5 dimensions), and ArchUnit automated validation. Use when user asks about code review, 代码审查, DDD review, 架构审查, anti-pattern detection, 反模式检测, or needs to check if code follows DDD.

ddd-api-designer

full-stack-skills/ddd-skills

API design from domain model — CQRS command/query separation, REST API endpoint design, data object conversion chain (PO→DO→DTO→VO), unified response format, OpenAPI/Swagger generation, BFF pattern, API versioning, and security design. Use when user asks about API design, REST API, OpenAPI, BFF, DTO design, 接口设计, or data object conversion.

Backend & APIs139 installs

ddd-domain-designer

full-stack-skills/ddd-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design133 installs

ddd-devops-integration

full-stack-skills/ddd-skills

DDD DevOps integration — CI/CD pipeline with ArchUnit automated architecture validation, multi-module build optimization for DDD projects, containerized deployment with Docker/K8s for layered/hexagonal/clean architectures, database migration strategies for domain events, and monitoring domain health. Use when user asks about DevOps, CI/CD, DDD deployment, ArchUnit CI, or needs to automate DDD project builds.

DevOps & Cloud131 installs

ddd-architecture-hexagonal

full-stack-skills/ddd-skills

Comprehensive guidance for Hexagonal Architecture (Ports & Adapters) — Alistair Cockburn's hexagonal architecture with domain core, port definitions, adapter implementations, and full Java/Spring Boot implementation steps. Covers primary/driving adapters, secondary/driven adapters, use case ports, repository ports, and dependency injection configuration. Use when user asks about hexagonal architecture, 六边形架构, ports and adapters, 端口适配器, Alistair Cockburn, or needs DDD with clean separation.

ddd-event-storming

full-stack-skills/ddd-skills

Open the skill to read its SKILL.md instructions.

127 installs

Popular data & databases skills

View category →

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

OfficialData & Databases462.2K installs

prisma-client-api

prisma/skills

Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".

OfficialData & Databases393.5K installs

Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.

OfficialData & Databases392.3K installs

prisma-cli

prisma/skills

Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.

OfficialData & Databases390.8K installs

prisma-postgres

prisma/skills

Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.

OfficialData & Databases384.4K installs

Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.

OfficialData & Databases378.9K installs