/ngrx-traits:ngrx-traitsfrom ngrx-traits
Composes, explains, and debugs @ngrx-traits/signals signal stores — trait ordering, generated names, entity loading, filtering, sorting, pagination, selection, per-entity calls, linking to component signals and Signal Forms, URL/web-storage/SSR sync, and call caching.
Ships in ngrx-traits. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Prebuilt @ngrx/signals custom store features. Peer deps: @angular/core 22, @ngrx/signals 22, rxjs 7.
Everything is imported from @ngrx-traits/signals, except withEntities / entityConfig / setAllEntities
which come from @ngrx/signals/entities.
| Read | For |
|---|---|
| recipes.md | Full store recipes: local/remote list, infinite scroll, detail call, forms, split store, SSR, caching |
| entities-loading.md | withEntities, withCallStatus, withEntitiesLoadingCall, withAllCallStatus, withCallStatusMap, entities resource view |
| calls.md | withCalls, withEntitiesCalls, callConfig, awaiting results, resource view of a call |
| filtering.md | withEntitiesLocalFilter, withEntitiesRemoteFilter, withEntitiesHybridFilter |
| sorting.md | withEntitiesLocalSort, withEntitiesRemoteSort |
| pagination.md | withEntitiesLocalPagination, withEntitiesRemotePagination, withEntitiesRemoteScrollPagination |
| selection.md | withEntitiesSingleSelection, withEntitiesMultiSelection |
| links-forms.md | withLink, withLinkEntities*, copySignal, withStateSetter, withStatePrivateSetter, Signal Forms binding |
| sync-routing.md | withRoute, withEntitiesSyncToRouteQueryParams, withSyncToRouteQueryParams, withSyncToWebStorage, withServerStateTransfer |
| caching.md | cacheCall, cacheRxCall, CacheStore |
| utils.md | withFeatureFactory, withLogger, ExtractStoreFeatureOutput, rename-collection schematic |
Declare the entity once with entityConfig, then pass it as the first argument of every entity trait,
with that trait's own options in a second object:
const productEntityConfig = entityConfig({
entity: type<Product>(),
collection: 'product', // optional, prefixes every generated name
selectId: (e) => e.productId, // optional, when the id prop is not `id`
});
signalStore(
withEntities(productEntityConfig),
withCallStatus(productEntityConfig, { initialValue: 'loading' }),
withEntitiesLocalPagination(productEntityConfig, { pageSize: 10 }),
);
Traits that read state from earlier traits take a factory as the last argument; it receives the store (and optional injected services as extra params):
withEntitiesLoadingCall(
productEntityConfig,
({ productEntitiesFilter }, service = inject(ProductService)) => ({
fetchEntities: () => service.getProducts({ search: productEntitiesFilter().search }),
}),
);
A single config object (withEntitiesLocalPagination({ ...productEntityConfig, pageSize: 10 })) still
compiles, but prefer the two-argument form — it is what the docs and examples use. The withLink* traits
are the exception: they only take one config object, so spread the entity config into it when they need
options of their own.
Custom store features with generic Entity/Collection params must use the two-argument form
(withEntitiesLocalPagination({ entity, collection }, { pageSize: 10 })); the single object form does not
compile there. See recipes.md #12.
Order matters: a trait that reads a signal must come after the trait that generates it.
withEntities — first in an entity store.withCallStatus — before every other withEntities* trait; they talk to each other through it.withAllCallStatus — before the withCalls / withCallStatus / withEntitiesCalls it monitors.withCallStatus.withLink* traits — after the trait whose state they link (filter, sort, selection, withState).withSyncToWebStorage, withServerStateTransfer, withEntitiesSyncToRouteQueryParams — after the
state features they persist, before the loading call, so restored state can skip the fetch.withEntitiesLoadingCall — last of the entity traits.withCalls — after any state its factory reads; use a second withCalls to chain onto another call's result.withLogger — last.With collection: 'product'; drop the prefix when there is no collection (entities(), entitiesCurrentPage(), …).
| Generated | Name |
|---|---|
| entities | productEntities(), productEntityMap(), productIds() |
| call status | isProductEntitiesLoading(), isProductEntitiesLoaded(), productEntitiesError(), setProductEntitiesLoading() |
| filter | productEntitiesFilter(), filterProductEntities({ filter }), resetProductEntitiesFilter() |
| sort | productEntitiesSort(), sortProductEntities({ sort }) |
| pagination | productEntitiesCurrentPage (DeepSignal), productEntitiesPagedRequest(), loadProductEntitiesPage({ pageIndex }) |
| single selection | productIdSelected(), productEntitySelected(), selectProductEntity({ id }) |
| multi selection | productIdsSelectedMap(), productIdsSelected(), productEntitiesSelected(), toggleSelectProductEntities({ id }) |
| resource view | productEntitiesResource(), <resultProp>Resource() |
| link | linkProductEntitiesFilter(), linkProductIdSelected() |
A generated member whose name starts with _ is private to the store (an @ngrx/signals rule), so a call
named _loadProductDetail keeps its method and status inside the store while its resultProp stays public.
productEntitiesCurrentPage is a DeepSignal: read store.productEntitiesCurrentPage.entities(),
not store.productEntitiesCurrentPage().entities().withCalls defaults to mapPipe: 'exhaustMap'; use 'switchMap' when a newer call should cancel the previous one,
and for any observable that does not complete.withEntitiesLoadingCall (or your own effect on is[Collection]Loading).withEntitiesLocalFilter, the local half of withEntitiesHybridFilter)
with remote pagination — the store only holds the cached page window.withInputBindings is deprecated: use withLink or withStateSetter.inject() in their factories. Either provide it —
TestBed.configureTestingModule({ providers: [MyStore] }), then TestBed.inject(MyStore) — or build it inside
TestBed.runInInjectionContext(() => new Store()), which is what this library's own specs do.initialValue: 'loading', setProductEntitiesLoading(), a filter/sort/page change): TestBed.tick(),
or fakeAsync + tick() when the call is delayed or debounced. The library's specs use both.initialValue: 'loading', start a load with store.setProductEntitiesLoading(). Use the
generated setters rather than patching the status state: the state key is productCallStatus
(no Entities infix, unlike every other generated name), so a patchState aimed at
productEntitiesCallStatus typechecks and silently does nothing.Full documentation: https://ngrx-traits.dev
caching.md (opens in a new tab)calls.md (opens in a new tab)entities-loading.md (opens in a new tab)filtering.md (opens in a new tab)links-forms.md (opens in a new tab)pagination.md (opens in a new tab)recipes.md (opens in a new tab)selection.md (opens in a new tab)sorting.md (opens in a new tab)sync-routing.md (opens in a new tab)utils.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (gabrielguerrero/ngrx-traits) — no native marketplace selected
npx claudepluginhub p/gabrielguerrero-ngrx-traitsOther plugins' skills for the same job