Communitygithub.com

ComeOnOliver/skillshub

Guessimate Angular UI 的前端编码规范、组件模式和设计系统。在编写或审查前端代码时参考。

skillshub 是什么?

该技能为 Guessimate Angular 前端应用提供了全面的编码规范、架构模式和设计系统参考。它定义了基于特性的项目结构、命名约定(如 kebab-case 文件、PascalCase 类、`$` 后缀的 Observable)、以及使用 Angular 20+、Tailwind CSS 4、Angular Signals 和 RxJS 的技术栈。技能强调独立组件、内联模板和依赖注入的 `inject()` 函数,并推荐使用内置控制流语法。设计系统部分详细说明了语义化颜色调色板(支持明/暗模式)及其在 Tailwind CSS 中的实现,以及常见组件模式(如卡片、标题排版)。开发者在编写或审查前端代码时,可将其作为统一的风格指南和最佳实践参考。

兼容平台~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. 项目结构

我们遵循基于特性的目录结构。代码按领域特性而非技术类型组织。

src/app/
├── core/            # 全局单例 (Guards, Interceptors, Global Services)
├── layout/          # 布局组件 (Navigation, Footer, Shell)
├── features/        # 特性模块 (领域逻辑)
│   ├── home/
│   ├── session/
│   │   ├── components/  # 无状态/展示组件
│   │   ├── pages/       # 智能/容器组件 (路由)
│   │   ├── services/    # 特性特定的状态/逻辑
│   │   └── models/      # 特性特定的类型
│   └── ...
├── websocket/       # WebSocket 基础设施
└── shared/          # 共享工具 (Pipes, Directives, Generic UI)

命名约定

  • 文件: Kebab-case (例如 session-page.component.ts, auth.service.ts)
  • 类: PascalCase (例如 SessionPageComponent, AuthService)
  • 选择器: app- 前缀, kebab-case (例如 app-user-profile)
  • Signals: 无后缀, 使用描述性名词/动词 (例如 user(), isLoading())
  • Observables: $ 后缀 (例如 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 (基于 Signals 的服务),在适当级别(根级或组件级)提供
  • 响应式数据: 使用 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

相关技能