122-java-type-design
减少原始类型滥用,增强类型安全与领域表达力。
针对 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
帮我安装这个 skill:https://raw.githubusercontent.com/jabrena/plinth/main/skills/122-java-type-design/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/jabrena/plinth/main/skills/122-java-type-design/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