Communitygithub.com

ComeOnOliver/skillshub

前端編碼標準、元件模式及 Guessimate Angular UI 的設計系統。在撰寫或審查前端程式碼時請參考此文件。

skillshub 是什麼?

此技能定義了 Guessimate Angular 專案的完整前端開發規範,包含程式碼標準、架構模式與設計系統。技術棧採用 Angular 20+、Tailwind CSS 4、Angular Signals 與 RxJS,並遵循基於功能的目錄結構。元件方面強制使用獨⽴元件、內嵌模板與 Tailwind 工具類別,依賴注入則優先以 `inject()` 函式實現。狀態管理透過 Signal Stores 處理共享狀態及衍生資料,並使用 `computed()` 與 `effect()` 管理反應式邏輯。設計系統提供語意化顏色調色盤,涵蓋主色、輔助色、成功、警告與危險狀態,並支援深色模式。此技能適用於 Claude Code、Cursor、Codex 等 AI 編碼助手,開發人員在撰寫或審查程式碼時可參考,以確保專案一致性與最佳實務。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/davidopdebeeck/ui-style-guide

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

前端風格指南與編碼慣例

本文件定義了 Guessimate Angular 前端專案的編碼標準、架構模式以及設計系統。

1. 技術棧

  • 框架: Angular 20+
  • 樣式: Tailwind CSS 4
  • 狀態管理: Angular Signals 與 RxJS
  • 建置系統: Angular CLI (Esbuild)

2. 專案結構

我們採用基於功能(Feature-Based) 的目錄結構。程式碼按照領域功能而非技術類型組織。

src/app/
├── core/            # 全域單例 (Guards、Interceptors、全域服務)
├── layout/          # 佈局元件 (導航列、頁尾、外殼)
├── features/        # 功能模組 (領域邏輯)
│   ├── home/
│   ├── session/
│   │   ├── components/  # 無狀態/展現元件
│   │   ├── pages/       # 智慧/容器元件 (路由化)
│   │   ├── services/    # 功能專屬的狀態/邏輯
│   │   └── models/      # 功能專屬的型別
│   └── ...
├── websocket/       # WebSocket 基礎設施
└── shared/          # 共用工具 (Pipe、Directive、通用 UI)

命名慣例

  • 檔案: 短橫線式 (kebab-case) (例如 session-page.component.ts、auth.service.ts)。
  • 類別: 大駝峰式 (PascalCase) (例如 SessionPageComponent、AuthService)。
  • 選擇器: 以 app- 為前綴,短橫線式 (例如 app-user-profile)。
  • Signal: 無後綴,使用描述性的名詞/動詞 (例如 user()、isLoading())。
  • Observable: 使用 $ 後綴 (例如 user$)。

3. 元件標準

定義

  • 使用獨立元件 (standalone: true 在 v19+ 中為預設值)。
  • 對大多數元件偏好內嵌模板,讓邏輯與視圖放在一起。
  • 避免使用外部 CSS 檔案;直接在模板中使用 Tailwind CSS 工具類別。

@Component({
    selector: 'app-example',
    imports: [CommonModule, RouterLink], // 明確匯入
    template: `
    <div class="p-4 bg-surface-100 rounded-lg">
      <h1 class="text-2xl font-bold text-gray-900">{{ title() }}</h1>
    </div>
  `
})
export class ExampleComponent {
    title = signal('Hello World');
}

控制流程

使用 Angular 新的內建控制流程語法。

<!-- 好的寫法 -->
@if (isLoading()) {
<app-spinner/>
} @else {
@for (item of items(); track item.id) {
<app-item [data]="item"/>
}
}

依賴注入

偏好使用 inject() 函式而非建構子注入,以獲得更好的型別推斷和更簡潔的程式碼。

// 好的寫法
private readonly
route = inject(ActivatedRoute);
private readonly
store = inject(SessionStore);

// 盡量避免
constructor(private
route: ActivatedRoute
)
{
}

4. 狀態管理

  • 本地狀態: 對原始型別狀態使用 signal()。
  • 共用狀態: 使用 Signal Stores (使用 Signal 的服務),並在適當層級 (根層級或元件層級) 提供。
  • 反應式資料: 對衍生狀態使用 computed(),並節制地使用 effect() 處理副作用。

@Injectable()
export class SessionStore {
    // 狀態
    private readonly _state = signal<SessionState>(initialState);

    // 選擇器
    readonly lobby = computed(() => this._state().lobby);
    readonly connection = computed(() => this._state().connection);

    // 動作
    setLobby(lobby: Lobby) {
        this._state.update(s => ({...s, lobby}));
    }
}

5. 樣式與設計系統

我們使用 Tailwind CSS 4,並在 styles.css 中定義語意化的顏色調色盤。

使用規則

  1. 工具優先: 直接在 HTML 中編寫類別。
  2. 不使用魔術數字: 使用主題值 (例如 p-4 而非 p-[16px])。
  3. 深色模式: 對所有顏色相關的類別使用 dark: 修飾符。

顏色調色盤

此應用程式使用語意化命名慣例,對應到 Tailwind 顏色。

核心顏色

分類語意名稱淺色模式深色模式用途
背景backgroundgray-50gray-950主應用程式背景
表面surfacewhitegray-900卡片、模態框、區段
替代表面surface-altgray-100gray-800次要背景、輸入欄位
主色brandblue-600blue-600主要操作、按鈕、重點強調
主色柔和brand-mutedblue-50blue-900/30選中狀態、輕度強調
成功successemerald-500emerald-600成功狀態、確認
成功柔和success-mutedemerald-50emerald-900/30成功背景
危險dangerred-600red-600錯誤、破壞性操作
危險柔和danger-mutedred-50red-900/30錯誤背景
警告warningamber-500amber-600警告、待處理狀態
警告柔和warning-mutedamber-50amber-900/30警告背景

字體排版與邊框

分類淺色模式深色模式用途
主要gray-900white主要標題與正文文字
次要gray-500gray-400副標題、標籤、次要資訊
柔和gray-400gray-500禁用文字、佔位符
邊框gray-200gray-800標準分隔線與卡片邊框

在 styles.css 中的實作

顏色在 @theme 區塊中使用 CSS 變數定義:

@theme {
    --color-brand-600: var(--color-blue-600);
    --color-surface-100: var(--color-stone-100);
    /* ... */
}

6. 常見元件模式

卡片與容器

內容容器 (例如估算卡片、列表) 的標準樣式:


<div class="flex flex-col bg-surface-100/60 border border-surface-200 dark:bg-gray-900/40 dark:border-gray-800/60 rounded-md shadow-sm">
    <!-- 內容 -->
</div>
  • 背景: bg-surface-100/60 (淺色) / dark:bg-gray-900/40 (深色)
  • 邊框: border border-surface-200 (淺色) / dark:border-gray-800/60 (深色)
  • 圓角: rounded-md (標準)
  • 分隔線: divide-y divide-surface-300 dark:divide-gray-800

字體排版標題


<div class="flex flex-col gap-1">
    <h2 class="text-2xl font-semibold leading-none text-gray-900 dark:text-white">標題</h2>
    <span class="text-sm font-normal text-gray-600 dark:text-gray-400">副標題描述</span>
</div>

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

相關技能