跳到正文
cccskills
免费在 GitHub 公开

value-objects

Analyze code for primitive obsession and plan value object extractions around domain concepts, validation, and grouped primitive fields. Use when the user says `/value-objects`, asks for value object refactoring, or runs `/refactor:value-objects`.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md2.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Analyze the class provided in $ARGUMENTS for instances of primitive obsession and suggest value object extractions.

Instructions:

  1. Examine the given class for primitive types that represent domain concepts
  2. Identify groups of related primitives that could be encapsulated into value objects
  3. Look for common patterns that indicate primitive obsession:
    • Multiple string/number parameters representing a single concept (e.g., street, city, state, zip for an address)
    • Validation logic scattered throughout the class for primitive values
    • Methods that operate on groups of related primitives
    • Repeated primitive type combinations across methods
    • Business rules applied to primitive values

Patterns to detect:

  • Money/Currency: Variables like price, cost, amount, fee, salary with currency
  • Email: String fields for email addresses lacking validation
  • Phone Numbers: Strings or numbers representing phone data
  • Addresses: Multiple fields like street, city, state, zipCode
  • Date Ranges: Separate startDate/endDate fields
  • Coordinates: Latitude/longitude pairs
  • Percentages: Numeric values representing percentages
  • Identifiers: Strings or numbers used as IDs
  • URLs: String representations of URLs
  • Names: Multiple fields like firstName, lastName, middleName

Output format:

  1. List each identified primitive obsession case
  2. Suggest a value object name and structure
  3. Provide a brief implementation example with:
    • Constructor with validation
    • Relevant methods (equality, toString, etc.)
    • Any domain-specific behavior
  4. Show how to refactor the original class to use the value object
  5. Explain the benefits of each extraction

Focus on improving code expressiveness, encapsulation, and type safety while reducing duplication and scattering of domain logic.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

catchup

免费

Rebuilds session context after a clear by reading git history, plans, and beads state. Triggers on 'catch up'.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

changelog

免费

Generate a bullet-point summary of branch changes for a PR description. Triggers on "changelog", "pr summary", "summarize branch", or "/changelog".

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

commit

免费

Commit the current changes with quality checks, status review, staged diff inspection, appropriate tests, and a clear commit message. Use when the user says "commit", "c", asks to make a commit, or wants changes saved in git.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

declutter

免费

Refactor code to remove dead code, useless comments, unused variables, and unused imports. Use when asked to declutter a class, clean up noisy code, remove cruft, or run `/refactor:declutter`.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

dry

免费

Refactor duplicated code by extracting helpers, shared abstractions, or clearer reusable structure. Use when asked to apply DRY, remove duplication, consolidate repeated logic, or run `/refactor:dry`.

中文简介正在准备中。当前显示原文说明。

SDiamante13/dotfiles112026年10月2日 更新

查看 SDiamante13 的全部技能

报告此技能的问题