122-java-type-design

仓库创建 2025年2月9日最近提交 3 天前SkillHot 收录 21 天前
▸ 精选理由

减少原始类型滥用,增强类型安全与领域表达力。

这个 Skill 做什么

针对 Java 类型设计改进层次、命名与领域值对象以提升清晰度与安全性。

帮你重构 Java 类型,让代码更有语义:规范命名与层次、用值对象替代原始类型(避免 primitive obsession)、在合适场景使用泛型和类型安全的包装。适合要提升领域表达力、修复模糊接口或避免数值精度问题(如用 BigDecimal 做财务计算)时用。目标是提升可读性并把更多错误提前移到编译期。

▸ 展开 SKILL.md 英文原文

Use when you need to review, improve, or refactor Java code for type design quality — including establishing clear type hierarchies, applying consistent naming conventions, eliminating primitive obsession with domain-specific value objects, leveraging generic type parameters, creating type-safe wrappers, designing fluent interfaces, ensuring precision-appropriate numeric types (BigDecimal for financial calculations), and improving type contrast through interfaces and method signature alignment. This should trigger for requests such as Review Java code for type design; Improve type design in Java code; Fix primitive obsession in Java code; Create value objects in Java code. Part of Plinth Toolkit

开发编程类型设计命名泛型通用
423
Stars
89
Forks
40
仓库内 Skill
+9
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/jabrena/plinth/main/skills/122-java-type-design/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/jabrena/plinth/main/skills/122-java-type-design/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Type Design Thinking in Java

Review and improve Java code using comprehensive type design principles that apply typography concepts to code structure and organization for maximum clarity and maintainability.

**What is covered in this Skill?**

- Clear type hierarchies: nested static classes, logical structure
- Consistent naming conventions: domain-driven patterns, uniform interface/implementation naming
- Strategic whitespace for readability
- Type-safe wrappers: value objects replacing primitive obsession (EmailAddress, Money)
- Generic type parameters: flexible reusable types, bounded parameters
- Domain-specific fluent interfaces: builder pattern, method chaining
- Type weights: conc
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有