Ngrx feature scaffold
Public collection of agent skills — reusable capabilities, prompts, and workflows for Claude Code and other agentic coding tools.
npx -y skills add Solonnikov/agent-skills --skill ngrx-feature-scaffoldAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Scaffolds a complete NgRx feature module (actions, reducer, effects, selectors, facade, models, tests) using modern Angular patterns. Use when adding a new feature slice to an Angular + NgRx app, standardizing existing ad-hoc state code, or bootstrapping state for a new library in an Nx monorepo.
SKILL.md
3.8 KB, as published. Nobody here has run it
NgRx Feature Scaffold
Generate a coherent NgRx feature slice that follows current best practices:
createActionGroupwith event-style action names- Reducer + typed state interface + feature key constant
createFeatureSelector+ composed selectors- Effects using
exhaustMap/switchMap/concatMapappropriately - Facade as the single component-facing API
- Colocated
.spec.tstests for reducer, selectors, and facade
When to use
- Adding a new feature slice to an Angular + NgRx app.
- Bootstrapping state in a new Nx library.
- Replacing ad-hoc services-as-state with proper NgRx.
- Standardizing an existing feature that has drifted from the pattern.
Before you start
Ask (or derive from context) the following — defaults in square brackets:
- Feature name — kebab-case (e.g.
user-profile). Used for folder and action source. - Feature key — usually the same word in camelCase (e.g.
userProfile). Used as the reducer key. - State shape — what fields does this feature own? (entity? list? flags?)
- Data source — HTTP, WebSocket, both? Which service will effects call?
- Framework version — [
@ngrx/*16+ forcreateActionGroup]. If older, fall back tocreateAction+ union types.
Authoring workflow
- Create the
+state/folder inside the feature's lib/app. - Write files in this order — each one drives the next:
<feature>.models.ts— state interface + domain types<feature>.actions.ts—createActionGroupwith one event per use case<feature>.reducer.ts— feature key, initial state,createReducerwithon(...)handlers<feature>.selectors.ts— feature selector + composed selectors<feature>.effects.ts— one effect per async event, calls services viainject()<feature>.facade.ts— exposes observables + dispatch methods
- Register the reducer and effects in the lib/app module.
- Write colocated
.spec.tsfor reducer, selectors, and facade (see references). - Verify: build passes, tests pass, DevTools shows dispatched actions.
Non-negotiable rules
- One facade is the only thing components inject. Components never import the store, actions, or selectors directly.
- Actions are events, not commands —
'Load User Success', not'Set User'. - Reducers are pure — no side effects, no service calls, no
Date.now()hidden inside. - Effects use higher-order operators deliberately:
exhaustMapfor idempotent one-shot loads (avoid duplicate in-flight).switchMapfor user-driven queries (cancel previous).concatMapfor writes that must preserve order.- Never nested
subscribe().
- Selectors are composed, not recomputed in components.
- Every async op has loading + error flags in state (or a generic
RequestStatusdiscriminant). providedIn: 'root'for the facade — singletons, no manual provider arrays.
References
- Feature layout and file roles — folder shape, what each file owns.
- File templates — ready-to-adapt code for every file in the slice.
- Effect operator cheatsheet — when to use
exhaustMapvsswitchMapvsconcatMap, with side-effect-only{ dispatch: false }patterns. - Test patterns — Jest specs for reducer (action-by-action), selectors (
.projector()), facade (store.dispatchspy). - Quality checklist — pre-merge review against the non-negotiables.