Communitygithub.com

ComeOnOliver/skillshub

최신 Angular UI 패턴을 로딩 상태, 오류 처리, 데이터 표시에 적용합니다. UI 컴포넌트 구축, 비동기 데이터 처리, 컴포넌트 상태 관리 시 사용하세요.

skillshub란 무엇인가요?

이 스킬은 Angular 애플리케이션에서 현대적인 UI 패턴을 구현하기 위한 종합 가이드입니다. 로딩 상태 표시, 오류 처리, 빈 상태, 버튼 상태, 양식 처리, 대화상자 등 주요 UI 패턴을 다루며, 특히 '오래된 UI를 절대 보여주지 않음', '오류를 항상 표시', '낙관적 업데이트', '점진적 공개', '우아한 저하'라는 5가지 핵심 원칙을 강조합니다. Claude Code, Cursor, Codex와 같은 AI 에이전트 도구에서 사용할 수 있으며, Angular의 @if/@else, @for, @defer와 같은 제어 흐름 블록과 Signals 기반 상태 관리를 활용한 구체적인 코드 예제를 제공합니다. 각 패턴은 '올바른 예'와 '잘못된 예'를 함께 제시하여 개발자가 흔히 저지르는 실수를 방지하고, UI 상태 체크리스트를 통해 모든 UI 컴포넌트가 완전한 상태를 갖추도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/sickn33/angular-ui-patterns

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Angular UI 패턴

핵심 원칙

  1. 오래된 UI를 절대 보여주지 않음 - 실제 로딩 중일 때만 로딩 상태 표시
  2. 오류를 항상 표시 - 사용자는 무언가 실패했을 때 반드시 알아야 함
  3. 낙관적 업데이트 - UI를 즉각적으로 느끼게 만듦
  4. 점진적 공개 - @defer를 사용하여 콘텐츠를 사용 가능할 때 표시
  5. 우아한 저하 - 부분적인 데이터가 데이터가 없는 것보다 나음

로딩 상태 패턴

황금률

표시할 데이터가 없을 때만 로딩 표시기를 보여주세요.

@Component({
  template: `
    @if (error()) {
      <app-error-state [error]="error()" (retry)="load()" />
    } @else if (loading() && !items().length) {
      <app-skeleton-list />
    } @else if (!items().length) {
      <app-empty-state message="항목을 찾을 수 없습니다" />
    } @else {
      <app-item-list [items]="items()" />
    }
  `,
})
export class ItemListComponent {
  private store = inject(ItemStore);

  items = this.store.items;
  loading = this.store.loading;
  error = this.store.error;
}

로딩 상태 결정 트리

오류가 있습니까?
  → 예: 재시도 옵션이 있는 오류 상태 표시
  → 아니오: 계속

로딩 중이고 데이터가 없습니까?
  → 예: 로딩 표시기(스피너/스켈레톤) 표시
  → 아니오: 계속

데이터가 있습니까?
  → 예, 항목 있음: 데이터 표시
  → 예, 비어 있음: 빈 상태 표시
  → 아니오: 로딩 표시(폴백)

스켈레톤 vs 스피너

스켈레톤 사용 시기스피너 사용 시기
알려진 콘텐츠 모양알 수 없는 콘텐츠 모양
목록/카드 레이아웃모달 액션
초기 페이지 로드버튼 제출
콘텐츠 플레이스홀더인라인 작업

제어 흐름 패턴

@if/@else를 사용한 조건부 렌더링

@if (user(); as user) {
<span>환영합니다, {{ user.name }}님</span>
} @else if (loading()) {
<app-spinner size="small" />
} @else {
<a routerLink="/login">로그인</a>
}

@for와 Track 사용

@for (item of items(); track item.id) {
<app-item-card [item]="item" (delete)="remove(item.id)" />
} @empty {
<app-empty-state
  icon="inbox"
  message="아직 항목이 없습니다"
  actionLabel="항목 만들기"
  (action)="create()"
/>
}

@defer를 사용한 점진적 로딩

<!-- 중요한 콘텐츠는 즉시 로드 -->
<app-header />
<app-hero-section />

<!-- 중요하지 않은 콘텐츠는 지연 -->
@defer (on viewport) {
<app-comments [postId]="postId()" />
} @placeholder {
<div class="h-32 bg-gray-100 animate-pulse"></div>
} @loading (minimum 200ms) {
<app-spinner />
} @error {
<app-error-state message="댓글을 불러오지 못했습니다" />
}

오류 처리 패턴

오류 처리 계층 구조

1. 인라인 오류(필드 수준) → 양식 유효성 검사 오류
2. 토스트 알림 → 복구 가능한 오류, 사용자가 재시도 가능
3. 오류 배너 → 페이지 수준 오류, 데이터가 부분적으로 사용 가능
4. 전체 오류 화면 → 복구 불가능, 사용자 작업 필요

오류 항상 표시

중요: 절대 오류를 조용히 삼키지 마세요.

// 올바름 - 오류가 항상 사용자에게 표시됨
@Component({...})
export class CreateItemComponent {
  private store = inject(ItemStore);
  private toast = inject(ToastService);

  async create(data: CreateItemDto) {
    try {
      await this.store.create(data);
      this.toast.success('항목이 성공적으로 생성되었습니다');
      this.router.navigate(['/items']);
    } catch (error) {
      console.error('createItem 실패:', error);
      this.toast.error('항목 생성에 실패했습니다. 다시 시도해 주세요.');
    }
  }
}

// 잘못됨 - 오류가 조용히 처리됨
async create(data: CreateItemDto) {
  try {
    await this.store.create(data);
  } catch (error) {
    console.error(error); // 사용자는 아무것도 볼 수 없음!
  }
}

오류 상태 컴포넌트 패턴

@Component({
  selector: "app-error-state",
  standalone: true,
  imports: [NgOptimizedImage],
  template: `
    <div class="error-state">
      <img ngSrc="/assets/error-icon.svg" width="64" height="64" alt="" />
      <h3>{{ title() }}</h3>
      <p>{{ message() }}</p>
      @if (retry.observed) {
        <button (click)="retry.emit()" class="btn-primary">다시 시도</button>
      }
    </div>
  `,
})
export class ErrorStateComponent {
  title = input("문제가 발생했습니다");
  message = input("예기치 않은 오류가 발생했습니다");
  retry = output<void>();
}

버튼 상태 패턴

버튼 로딩 상태

<button
  (click)="handleSubmit()"
  [disabled]="isSubmitting() || !form.valid"
  class="btn-primary"
>
  @if (isSubmitting()) {
  <app-spinner size="small" class="mr-2" />
  저장 중... } @else { 변경 사항 저장 }
</button>

작업 중 비활성화

중요: 비동기 작업 중에는 항상 트리거를 비활성화하세요.

// 올바름 - 로딩 중 버튼 비활성화
@Component({
  template: `
    <button
      [disabled]="saving()"
      (click)="save()"
    >
      @if (saving()) {
        <app-spinner size="sm" /> 저장 중...
      } @else {
        저장
      }
    </button>
  `
})
export class SaveButtonComponent {
  saving = signal(false);

  async save() {
    this.saving.set(true);
    try {
      await this.service.save();
    } finally {
      this.saving.set(false);
    }
  }
}

// 잘못됨 - 사용자가 여러 번 클릭 가능
<button (click)="save()">
  {{ saving() ? '저장 중...' : '저장' }}
</button>

빈 상태

빈 상태 요구 사항

모든 목록/컬렉션에는 반드시 빈 상태가 있어야 합니다:

@for (item of items(); track item.id) {
<app-item-card [item]="item" />
} @empty {
<app-empty-state
  icon="folder-open"
  title="아직 항목이 없습니다"
  description="시작하려면 첫 번째 항목을 만드세요"
  actionLabel="항목 만들기"
  (action)="openCreateDialog()"
/>
}

상황별 빈 상태

@Component({
  selector: "app-empty-state",
  template: `
    <div class="empty-state">
      <span class="icon" [class]="icon()"></span>
      <h3>{{ title() }}</h3>
      <p>{{ description() }}</p>
      @if (actionLabel()) {
        <button (click)="action.emit()" class="btn-primary">
          {{ actionLabel() }}
        </button>
      }
    </div>
  `,
})
export class EmptyStateComponent {
  icon = input("inbox");
  title = input.required<string>();
  description = input("");
  actionLabel = input<string | null>(null);
  action = output<void>();
}

양식 패턴

로딩 및 유효성 검사가 포함된 양식

@Component({
  template: `
    <form [formGroup]="form" (ngSubmit)="onSubmit()">
      <div class="form-field">
        <label for="name">이름</label>
        <input
          id="name"
          formControlName="name"
          [class.error]="isFieldInvalid('name')"
        />
        @if (isFieldInvalid("name")) {
          <span class="error-text">
            {{ getFieldError("name") }}
          </span>
        }
      </div>

      <div class="form-field">
        <label for="email">이메일</label>
        <input id="email" type="email" formControlName="email" />
        @if (isFieldInvalid("email")) {
          <span class="error-text">
            {{ getFieldError("email") }}
          </span>
        }
      </div>

      <button type="submit" [disabled]="form.invalid || submitting()">
        @if (submitting()) {
          <app-spinner size="sm" /> 제출 중...
        } @else {
          제출
        }
      </button>
    </form>
  `,
})
export class UserFormComponent {
  private fb = inject(FormBuilder);

  submitting = signal(false);

  form = this.fb.group({
    name: ["", [Validators.required, Validators.minLength(2)]],
    email: ["", [Validators.required, Validators.email]],
  });

  isFieldInvalid(field: string): boolean {
    const control = this.form.get(field);
    return control ? control.invalid && control.touched : false;
  }

  getFieldError(field: string): string {
    const control = this.form.get(field);
    if (control?.hasError("required")) return "이 필드는 필수입니다";
    if (control?.hasError("email")) return "유효하지 않은 이메일 형식입니다";
    if (control?.hasError("minlength")) return "너무 짧습니다";
    return "";
  }

  async onSubmit() {
    if (this.form.invalid) return;

    this.submitting.set(true);
    try {
      await this.service.submit(this.form.value);
      this.toast.success("성공적으로 제출되었습니다");
    } catch {
      this.toast.error("제출에 실패했습니다");
    } finally {
      this.submitting.set(false);
    }
  }
}

대화상자/모달 패턴

확인 대화상자

// dialog.service.ts
@Injectable({ providedIn: 'root' })
export class DialogService {
  private dialog = inject(Dialog); // CDK Dialog 또는 사용자 정의

  async confirm(options: {
    title: string;
    message: string;
    confirmText?: string;
    cancelText?: string;
  }): Promise<boolean> {
    const dialogRef = this.dialog.open(ConfirmDialogComponent, {
      data: options,
    });

    return await firstValueFrom(dialogRef.closed) ?? false;
  }
}

// 사용법
async deleteItem(item: Item) {
  const confirmed = await this.dialog.confirm({
    title: '항목 삭제',
    message: `"${item.name}"을(를) 삭제하시겠습니까?`,
    confirmText: '삭제',
  });

  if (confirmed) {
    await this.store.delete(item.id);
  }
}

안티 패턴

로딩 상태

// 잘못됨 - 데이터가 있을 때 스피너 표시 (재조회 시 깜빡임 발생)
@if (loading()) {
  <app-spinner />
}

// 올바름 - 데이터 없을 때만 로딩 표시
@if (loading() && !items().length) {
  <app-spinner />
}

오류 처리

// 잘못됨 - 오류가 삼켜짐
try {
  await this.service.save();
} catch (e) {
  console.log(e); // 사용자는 알 수 없음!
}

// 올바름 - 오류가 표시됨
try {
  await this.service.save();
} catch (e) {
  console.error("저장 실패:", e);
  this.toast.error("저장에 실패했습니다. 다시 시도해 주세요.");
}

버튼 상태

<!-- 잘못됨 - 제출 중 버튼이 비활성화되지 않음 -->
<button (click)="submit()">제출</button>

<!-- 올바름 - 비활성화되고 로딩 표시 -->
<button (click)="submit()" [disabled]="loading()">
  @if (loading()) {
  <app-spinner size="sm" />
  } 제출
</button>

UI 상태 체크리스트

UI 컴포넌트를 완료하기 전에 확인하세요:

UI 상태

  • 오류 상태가 처리되고 사용자에게 표시됨
  • 로딩 상태는 데이터가 없을 때만 표시됨
  • 컬렉션에 빈 상태 제공됨 (@empty 블록)
  • 비동기 작업 중 버튼 비활성화됨
  • 버튼에 필요 시 로딩 표시기 표시됨

데이터 및 변경

  • 모든 비동기 작업에 오류 처리 있음
  • 모든 사용자 작업에 피드백 있음 (토스트/시각적)
  • 낙관적 업데이트 실패 시 롤백 처리

접근성

  • 로딩 상태가 스크린 리더에 전달됨
  • 오류 메시지가 양식 필드에 연결됨
  • 상태 변경 후 포커스 관리

다른 스킬과의 통합

  • angular-state-management: 상태에 Signal 저장소 사용
  • angular: 최신 패턴 적용 (Signals, @defer)
  • testing-patterns: 모든 UI 상태 테스트

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

관련 스킬