first-class-collection

Wrap collections in a domain-first class with immutability and fluent operations.

81|3|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/j5ik2o/okite-ai --skill first-class-collection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: first-class-collection
Source: https://github.com/j5ik2o/okite-ai/tree/main/.agent/skills/first-class-collection
Command: npx skills add https://github.com/j5ik2o/okite-ai --skill first-class-collection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

コレクション操作が分散し、ビジネスルールがコレクションに散在する状態を解決します。ファーストクラスコレクションを導入して、コレクションを専用クラスで包み、ドメイン用語で表現・検証・操作を集中させます。

Core Features & Use Cases

  • Domain-focused wrapping: コレクションを専用クラスで包み、ビジネスルールを一箇所に集約。
  • Immutability guarantees: 内部状態の不変性を保証し、破壊的変更を防止。
  • Expressive APIs: 集計・フィルタリング・検証ロジックをドメイン用語で提供。

Quick Start

コレクションをラップするOrdersクラスを作成して、コレクション操作をそのクラスへ集約してください.

Frequently Asked Questions about first-class-collection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I encapsulate collection operations and business rules in domain-driven design?

Introduce a first-class collection by wrapping raw lists into a dedicated domain class that centralizes business rules and prevents scattered collection logic. This pattern guarantees immutability and exposes a fluent API for safe domain operations.

What is the best way to enforce immutability guarantees for collections in TypeScript and Kotlin?

The best way to enforce immutability is using a first-class collection wrapper that prevents destructive modifications. By encapsulating the collection inside a dedicated class, operations like add return new instances, ensuring safe immutability across TypeScript, Kotlin, and Java.

Can I use a first-class collection pattern across multiple languages like Go, Scala, and Python?

Yes, the first-class collection pattern is applicable across Java, Kotlin, Scala, TypeScript, Python, Ruby, Go, and Rust. It requires creating a single-responsibility wrapper class that exposes a fluent API for operations such as add, pending, isEmpty, and iteration regardless of language.

How do I consolidate scattered collection logic for total calculations and filtering?

Consolidate scattered collection logic by creating a domain-first wrapper class that takes ownership of all filtering and total calculation operations. This wrapper exposes expressive APIs using domain terminology, replacing raw collection manipulation with safe, centralized methods.

Why does my domain model have scattered business rules across utility classes?

Business rules scatter across utility classes when raw collections are manipulated directly instead of being wrapped. Introducing a first-class collection pattern consolidates these rules into a single-responsibility wrapper, expressing operations through domain terminology rather than generic collection methods.