entity-store

Implements Angular admin entity stores by extending a shared base list store with mutate harness conventions.

1|Updated Jan 14, 2024
One-click install
npx skills add https://github.com/Eyhenij/rt-tools --skill entity-store-eyhenij
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: entity-store
Source: https://github.com/Eyhenij/rt-tools/tree/main/.claude/skills/entity-store
Command: npx skills add https://github.com/Eyhenij/rt-tools --skill entity-store-eyhenij

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When building admin panels, developers repeatedly re-implement list loading, pagination, sorting, filtering, busy-state handling, and error management for every entity store. This Skill encodes the conventions for creating an entity store as a thin heir of the shared BaseListStoreService, so the store declares only its API service, error keys, and config instead of duplicating infrastructure. ## Core Features & Use Cases - Base store inheritance: Extend BaseListStoreService with typed state, sort, filter, and draft generics, then toggle pagination, sorting, filtering, and search via setConfig. - Mutation harness: Route save and remove operations through the built-in mutate method, which manages busy state, clears previous errors, re-reads the list after success, and maps refusal keys. - Naming conventions: Name files <entity>.store.ts and methods after the action (save, remove, load) rather than the domain, keeping stores compliant with the linter rule and rule gate. - Use Case: When creating a PromoCodesStore for an admin panel, apply this pattern to get a fully working list store with pagination, sorting, filtering, and a save method returning Observable<IPromoCode.State | null> in just a few lines. ## Quick Start Create a new entity store for the promo codes admin panel following the entity-store pattern with a save method that uses the mutate harness.

Frequently Asked Questions about entity-store

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

FAQPage Schema
How do I create an entity store for an Angular admin panel?

Extend BaseListStoreService with your state, key, entity, sort, filter, and draft types, inject the entity API service, and call setConfig to enable pagination, sorting, filtering, and search. The base class provides loading, re-reading, page and filter changes, and record editing.

How should a save method in a list store handle busy state and errors?

Return this.mutate(this.apiService.save(draft)) from the save method. The mutate harness holds the busy state, clears the previous error, re-reads the list after success, and resolves the refusal key, so the panel closes on the stream's value.

Why should store methods be named save, remove, and load instead of domain names?

Action-based names avoid redundancy because the domain name already appears in the store name and its alias. Names like createBooking or loadBookings repeat information and break the convention enforced by the rule gate.

What file name should an Angular entity store use?

Name the file <entity>.store.ts. The alternative <entity>-store.service.ts naming takes the file out of both the linter rule and the rule gate, so the conventions are not enforced.

When should an action bypass the mutate harness?

Bypass mutate only when the action needs its own busy state, such as calendar subscription polling that keeps a pollingId while the panel stays interactive. In that case set the refusal key manually with setErrorKey.

Why does a save mutation end with a spinner that never stops?

This happens when EMPTY is glued to a mutation stream without defaultIfEmpty. A refusal of the glued stream then turns a successful save into an endless spinner, so handle the empty case with defaultIfEmpty.