Skip to content

Angular Development Recipes

Angular’s opinionated structure is a strength when you know how to work with it. These recipes give you prompts that produce Angular code following the framework’s conventions — standalone components, signals for reactivity, dependency injection done right, and RxJS patterns that do not leak subscriptions.

  • Standalone component recipes with signals and new control flow syntax
  • Service and dependency injection patterns with proper typing
  • RxJS recipes for complex async flows without subscription leaks
  • Testing prompts for TestBed, component harnesses, and HTTP mocking

Every recipe below is a tool-agnostic prompt — paste the text from any <Aside type="tip"> into whichever assistant you use. What differs is how you feed it the file context and review the result. Here is the same recipe (Recipe 1, the standalone component) driven through each tool:

Open the target file (or create it), then run the prompt in Agent mode with Cmd/Ctrl+I. Cursor edits product-card.component.ts and its spec in place; review the diff inline and accept hunk-by-hunk. Add @angular/core and your existing Product model to the chat context so it matches your types rather than inventing them. Use a checkpoint before accepting so you can roll back the whole recipe in one click.

The remaining recipes follow the same pattern — adjust only the file path and the framing detail you add to context.


Recipe 1: Standalone Component with Signals

Section titled “Recipe 1: Standalone Component with Signals”

Scenario: You need a product card component using Angular’s latest standalone components and signals API.

Expected output: Component TypeScript file, inline template with new control flow, and spec file.


Recipe 2: Reactive Auth Service with Signals and RxJS

Section titled “Recipe 2: Reactive Auth Service with Signals and RxJS”

Scenario: Your auth service uses BehaviorSubjects and manual subscriptions everywhere. Modernize it with signals while keeping RxJS for HTTP.

Expected output: Refactored service, HTTP interceptor, and comprehensive test file.


Recipe 3: Typed Reactive Form with Cross-Field Validation

Section titled “Recipe 3: Typed Reactive Form with Cross-Field Validation”

Scenario: Your registration form needs cross-field validation, async validation, and conditional fields.

Expected output: Form component, custom validators, ValidationMessage component, and tests with fakeAsync.


Scenario: Your admin section has 8 pages and loads everything upfront. Lazy-load it as standalone routes.

Expected output: Admin routes, layout component, functional guard, route-level providers, and guard tests.


Recipe 5: NgRx SignalStore for State Management

Section titled “Recipe 5: NgRx SignalStore for State Management”

Scenario: Your app needs centralized state but classic NgRx actions/reducers/effects feels heavy. Use SignalStore.

Expected output: SignalStore file, API service, and comprehensive store tests.


Scenario: Your app needs auth tokens, logging, error handling, and caching as HTTP interceptors.

Expected output: Four interceptor files, app config registration, and individual test files.


Recipe 7: Dynamic Form Generator from JSON Schema

Section titled “Recipe 7: Dynamic Form Generator from JSON Schema”

Scenario: Your app renders forms from a backend JSON schema. You need a dynamic form generator.

Expected output: Form config interface, dynamic form component, field components, schema service, and tests.


Recipe 8: Route Resolvers for Data Preloading

Section titled “Recipe 8: Route Resolvers for Data Preloading”

Scenario: Pages show a flash of empty content before data loads. You need resolvers that load data before rendering.

Expected output: Two resolver functions, loading component, error handler, and resolver tests.


Scenario: Your templates repeat the same DOM manipulation. You need custom directives for common behaviors.

Expected output: Six directive files and six test files.


Recipe 10: SSR with Angular Universal and Hydration

Section titled “Recipe 10: SSR with Angular Universal and Hydration”

Scenario: Your Angular app needs SSR for SEO and initial load performance with full hydration.

Expected output: SSR config, platform service, storage service, transfer state integration, and tests.


Recipe 11: Micro-Frontends with Module Federation

Section titled “Recipe 11: Micro-Frontends with Module Federation”

Scenario: Your monolithic Angular app needs to be split into independently deployable micro-frontends.

Expected output: Host and remote configs, loader utility, shared library, fallback component, and tests.


Scenario: Your templates have inline string manipulation everywhere. Extract into reusable pipes.

Expected output: Seven pipe files with edge case tests for each.