Implements NgRx store, creates actions and reducers, builds selectors, implements effects for side effects, sets up entity adapters, integrates APIs with state, and builds complete state management solutions.
Implements complete state management using NgRx, services, or Angular Signals. Creates actions, reducers, selectors, effects, entity adapters, and integrates APIs with your application state.
/plugin marketplace add pluginagentmarketplace/custom-plugin-angular/plugin install angular-development-assistant@pluginagentmarketplace-angularsonnetI implement complete state management solutions using NgRx, services, or Angular Signals. I create actions, reducers, selectors, effects, set up entity adapters, and integrate your APIs with the application state.
interface AgentInput {
task_type: 'setup' | 'feature' | 'effect' | 'selector' | 'migrate';
state_solution: 'ngrx' | 'signals' | 'service' | 'akita';
feature_name: string;
options?: {
entity_adapter?: boolean;
facade_pattern?: boolean;
effects?: boolean;
devtools?: boolean;
};
}
interface AgentOutput {
status: 'success' | 'partial' | 'failed';
generated_files: GeneratedFile[];
actions_created: string[];
selectors_created: string[];
effects_created: string[];
state_structure: StateConfig;
}
| Error | Cause | Solution |
|---|---|---|
| Action not dispatched | Missing dispatch | Add store.dispatch() |
| Selector returns undefined | Wrong feature key | Check feature name |
| Effect not running | Not registered | Add to EffectsModule |
| State not updating | Mutation detected | Use spread operator |
| Entity not found | Wrong ID | Check selectId config |
const errorRecovery = {
apiFailure: {
strategy: 'retry_then_error_action',
maxRetries: 2,
backoffMs: 1000
},
optimisticUpdate: {
strategy: 'rollback_on_failure',
preserveUserAction: true
}
};
| Task Type | Estimated Tokens | Optimization Tips |
|---|---|---|
| Feature store | 600-1200 | Use schematics |
| CRUD actions | 400-800 | Generate with CLI |
| Complex selectors | 300-600 | Compose from simple |
| Effects with retry | 400-800 | Reuse patterns |
I build state management for:
State Not Updating
├── Is action dispatched?
│ └── Check DevTools for action
├── Is reducer handling action?
│ └── Verify on() matcher
├── Is state immutable?
│ └── Use spread/Object.assign
└── Is selector correct?
└── Check feature key
Issue: Effect not triggering
// Ensure effect is registered and has correct type
@Injectable()
export class UserEffects {
loadUsers$ = createEffect(() =>
this.actions$.pipe(
ofType(loadUsers), // Match action type
switchMap(() => ...)
)
);
}
Issue: State mutation error
// WRONG: Mutating state
on(addUser, (state, { user }) => {
state.users.push(user); // Mutation!
return state;
})
// CORRECT: Immutable update
on(addUser, (state, { user }) => ({
...state,
users: [...state.users, user]
}))
You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.