core/collections

Implements normalized entity storage in Redux using Themis Collection helpers with immutable CRUD and reference counting.

6|6|Updated Jun 29, 2026
One-click install
npx skills add https://github.com/intent-hq/cloudlands-fe --skill core-collections-intent-hq
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: core/collections
Source: https://github.com/intent-hq/cloudlands-fe/tree/main/.agents/skills/themis/core/collections
Command: npx skills add https://github.com/intent-hq/cloudlands-fe --skill core-collections-intent-hq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @augmentcode/themis.

What problem does it solve? Managing entities in Redux state often leads to duplicated data, slow lookups, and mutation bugs. This Skill guides you to store entities in a normalized Collection shape with O(1) id lookup, stable ordering, and safe immutable updates. ## Core Features & Use Cases - Normalized Entity Storage: Create collections with createCollection and read them with getItem and getItems instead of storing plain arrays or Maps. - Immutable CRUD Helpers: Use addItem, updateItem, upsertItem, removeItem, and filterCollection so reducers never mutate .ids, .map, or .refsCount directly. - Reference Counting: Track shared entity ownership with addItemAndCountRef, increaseRefsCount, and decreaseRefsCount, which automatically removes items when their count reaches zero. - Use Case: When multiple features reference the same todo or user entity, store it once in a collection, count references per feature, and let the collection clean itself up when the last owner releases it. ## Quick Start Ask the AI to refactor a Redux slice that stores entities as an array into a Themis Collection with helper-based reducers and selectors.

Frequently Asked Questions about core/collections

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

FAQPage Schema
How do I store entities in Redux with fast id lookup?▼

Use a Themis Collection created with createCollection(idField), which stores entities as { ids, map, refsCount } for O(1) lookup and stable ordering. Read single items with getItem and ordered lists with getItems instead of array find operations.

How to update items immutably in a normalized collection?▼

Use the helper functions addItem, updateItem, upsertItem, and removeItem from the collection-utils module rather than mutating .ids or .map directly. These helpers return the same collection reference on no-ops, preserving parent reducer reference equality.

What is reference counting in Themis collections?▼

Reference counting tracks how many features own a shared entity using addItemAndCountRef, increaseRefsCount, and decreaseRefsCount. When decreaseRefsCount brings the count to zero or below, the item is automatically removed from ids, map, and refsCount.

Can I store Map or Set in Redux state?▼

No, Map and Set are not serializable and should not live in Redux state. Use Themis collections or plain records instead, which keep state serializable while still providing id-based lookup.

When should I use a plain array instead of a collection?▼

Plain arrays are fine for tiny ordered facts that never need id lookup, such as breadcrumb labels. Once entities have unique ids and need lookup, updates, or shared ownership, switch to a Collection.