본문으로 건너뛰기
cccskills
무료GitHub에 공개

ngrx-signals-store-crud

Generate an NgRx Signal Store with complete CRUD operations (API service, store, tests) for a given entity.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

NgRx Signal Store CRUD Generator

Goal

Generate a complete NgRx Signal Store with CRUD operations for a specified entity, following the project's architecture patterns and best practices.

Prerequisites

Before running this skill, ensure you have:

  1. Entity Definition: The target entity model must be defined and linked in the chat context
  2. Store Name: Specify the desired store name (e.g., UserStore, TaskStore)
  3. Entity Name: Specify the entity name (e.g., User, Task)

Instructions

Step 1: Entity and Service Analysis

  • Analyze the provided entity model to understand its structure and properties
  • Check if an Angular service with HTTP CRUD methods already exists for this entity
  • If no service exists, create one with the following demo endpoints based on the entity structure:
    // Example endpoints for a User entity
    getUsers(): Observable<User[]>
    getUserById(id: string): Observable<User>
    createUser(user: CreateUserRequest): Observable<User>
    updateUser(id: string, updates: Partial<User>): Observable<User>
    deleteUser(id: string): Observable<void>
    

Step 2: Signal Store Generation

Generate a complete NgRx Signal Store with:

Core Structure

export interface [EntityName]State {
  loading: boolean;
  error: string | null;
  selectedId: string | null;
}

const initial[EntityName]State: [EntityName]State = {
  loading: false,
  error: null,
  selectedId: null,
};

const [entityName]EntityConfig = entityConfig({
  entity: type<[EntityName]>(),
  collection: '[entityName]',
  selectId: ([entityName]: [EntityName]) => [entityName].id,
});

export const [EntityName]Store = signalStore(
  { providedIn: 'root' },
  withState(initial[EntityName]State),
  withEntities([entityName]EntityConfig),
  // ... computed properties
  // ... methods
);

Required CRUD Methods

Implement all CRUD operations using rxMethod for Observable-based service calls:

  1. Load All: load[EntityName]s(): void
  2. Load By ID: load[EntityName]ById(id: string): void
  3. Create: create[EntityName]([entityName]: Create[EntityName]Request): void
  4. Update: update[EntityName](id: string, updates: Partial<[EntityName]>): void
  5. Delete: delete[EntityName](id: string): void
  6. Select: select[EntityName](id: string | null): void

Computed Properties

Include these computed signals:

  • selected[EntityName]: The currently selected entity
  • total[EntityName]Count: Total number of entities
  • hasData: Whether any entities are loaded
  • isEmpty: Whether the collection is empty

Error Handling

  • Use tapResponse for proper error handling in all async operations
  • Set loading states appropriately for all operations
  • Clear errors when starting new operations

Step 3: Implementation Details

State Management

  • Use patchState for all state updates
  • Implement proper loading states for each operation
  • Handle errors gracefully with user-friendly messages

Entity Operations

  • Use atomic entity operations: addEntity, updateEntity, removeEntity, setAllEntities
  • Pass entityConfig to all entity updaters for type safety
  • Handle optimistic updates where appropriate

Service Integration

  • Inject the service using inject() within withMethods
  • Use rxMethod for all Observable-based operations
  • Flattening operator: switchMap for loads (a newer request supersedes the old one), concatMap for create/update/delete (switchMap would cancel an in-flight write)
  • HttpClient is provided in root in Angular 22 — no provideHttpClient(); API specs use provideHttpClientTesting() only
  • Never convert Observables to Promises in store methods

Step 4: Integration Guide

Provide example component integration showing:

  • Store injection
  • Signal binding in templates
  • Method calls for CRUD operations
  • Loading and error state handling

File Structure

Create the following files in the appropriate domain folder:

src/app/features/[domain]/
└── data/
    ├── models/
    │   └── [entity-name].model.ts        # Entity interface & DTOs
    ├── infrastructure/
    │   ├── [entity-name]-api.ts          # HttpClient service
    │   └── [entity-name]-api.spec.ts     # Service tests
    └── state/
        ├── [entity-name]-store.ts        # Signal store
        └── [entity-name]-store.spec.ts   # Store tests

References

  • ngrx-signals skill — Signal Store patterns (withEntities, withFeature, withLinkedState, rxMethod) and store testing
  • Architecture conventions (DDD layering under src/app/features/<domain>/) from the project instructions

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Run a structured bug-focused code review for selected files, folders, or the whole workspace.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, naming conventions, or CLI tooling.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

Generate an Angular Signal Forms component with schema validation and dynamic field management for a given entity.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

bdd

무료

Write disciplined Behavior-Driven Development specs and tests with Gherkin / Cucumber. Use whenever the user mentions BDD, Gherkin, Cucumber, .feature files, Given/When/Then, scenarios, Scenario Outline, Background, step definitions, acceptance criteria, executable specifications, living documentation, the Three Amigos, or Example Mapping. Also trigger when the user asks to "write tests in plain English", convert acceptance criteria into tests, design step definitions, refactor an imperative or UI-coupled feature file, or wire up BDD with Vitest (unit/component) or Playwright (end-to-end). Do NOT use for pure unit tests with no business-readable contract, pure performance/load tests, or generic test-framework questions unrelated to behavior specs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

Build, refactor, and architect Angular state with the @ngrx/signals Signal Store. Use whenever the user mentions signalStore, withState, withMethods, withComputed, withHooks, withLinkedState, withFeature, signalStoreFeature, withEntities, rxMethod, signalMethod, patchState, the SignalStore events plugin (withReducer, withEventHandlers), or wants to refactor BehaviorSubject/service-based state to Signal Store. Also use for designing custom store features, request status, optimistic updates, entity collections, and the store/service split in Angular. Do NOT use for @ngrx/store (classic Redux), createReducer/createEffect, or generic RxJS questions unrelated to Signal Store.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

Review the current branch against its base branch: lint, tests, architecture and Angular 22 conventions, reported by severity.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

danielsogl/copilot-workflow-demo392026년 10월 23일 업데이트

danielsogl의 스킬 모두 보기

이 스킬의 문제 신고