# Craft Collection

> Crafting custom collections. Domain pipelines.

- Skill: `attac-t/craft-collection` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add attac-t/craft-collection`
- Raw SKILL.md: https://api.skillmd.com/api/skills/attac-t/craft-collection/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: attac-t (https://skillmd.com/u/attac-t)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/attac-t/craft-collection

---


# Skill: Craft Collection

> "Collections are array pipelines for your domain."

## The Standard

1. **Atomic Methods**: One operation per method.
2. **Fluent**: Return `self` for chaining.
3. **Type-Safe**: `@extends Collection<int, Model>`.
4. **Declarative**: Use `filter`, `map`, `reduce`, not loops.

## The Anti-Patterns

| ❌ Don't          | ✅ Do                   | Why                        |
|------------------|------------------------|----------------------------|
| Business logic   | Simple transformations | Collections aren't Actions |
| Database queries | In-memory operations   | Use QueryBuilder for DB    |
| Loops            | Collection methods     | Declarative > imperative   |
| Mixed types      | Homogeneous collection | Type safety                |

## Real-World Examples

See [examples.md](examples.md).

