Community编程与开发github.com

shadcn-first

一套严格遵循 shadcn/ui 最佳实践的前端开发规则,帮助开发者优先使用官方库组件而非手写 UI,保证代码长期可维护。

shadcn-first 是什么?

shadcn-first 是一条面向 AI 编程助手(如 Claude Code、Cursor)的开发纪律规则,旨在阻止开发者手写重复的 UI 样式,强制优先使用 shadcn/ui 官方库。它定义了清晰的步骤:先尝试 Block、再选组件、然后组合、最后才手写,且每次手写都必须注明原因。工具层面,它区分了 `shadcn-official`(项目感知,用于组件的增删查改和审计)和 `shadcn`(全局仓库,用于 Block 和主题)两个 MCP 服务器。该规则还提供了常见被手写组件的清单(如 sidebar、command、table 等)、快捷键约定、以及完成标准:必须运行审计检查表并报告手写代码移除量、组件安装数、`style={{}}` 残留等量化指标。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/getedgehq/skills/tree/main/shadcn-first

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

shadcn-first 是做什么的?

在你之后,有人会维护这段代码。每一个手写的 div 配上自定义 class 以及每一个 style={{}} 都成为必须维护的负担,并且会逐渐偏移。手写 UI 还会悄然丢失库免费提供的工艺:焦点环、悬停和激活状态、键盘导航、骨架屏、空状态、ARIA。

顺序。不要跳过任何步骤。

  1. Block。 ui.shadcn.com/blocks 提供了完整的侧边栏、仪表盘、登录页、数据表格。安装 Block。
  2. 组件。 如果 Block 不合适,则使用 registry 中的组件。
  3. 组合两个或三个组件。
  4. 自己手写。 只有在这里才动手写,并且提交信息必须说明评估了哪个 Block 或组件以及它为什么不合适。

调整设计去适配组件,而不是反过来调整组件去适配设计。品牌和视觉语言通过一个主题中的主题变量来实现,永远不要在组件旁边写 per-screen 的 CSS。

工具,以及用哪个

配置了两个 MCP 服务器。它们各司其职。

shadcn-official(npx shadcn@latest mcp)是项目感知的:它读取仓库的 components.json。实际工作用这个。

工具用途
get_project_registries确认项目已初始化
search_items_in_registries模糊查找适合当前任务的组件
list_items_in_registries查看所有可用组件
view_items_in_registries使用前查看组件的实际源码和依赖
get_item_examples_from_registries复制真实使用示例,而不是猜测 API
get_add_command_for_items获取准确的 npx shadcn add … 命令并执行
get_audit_checklist写代码后运行。 这是关卡。

shadcn(@jpisnice/shadcn-ui-mcp-server)是全局仓库,了解 Block 和主题:list_blocks、get_block、list_themes、get_theme、get_component_demo。用于第 1 步和主题设置。

如果项目没有 components.json,官方工具会报错。先运行 npx shadcn@latest init,然后再继续。

对于 AI 聊天界面,请使用 prompt-kit(prompt-kit.com,兼容 shadcn):chat-container、message、prompt-input、scroll-button、markdown、code-block、loader。遵循相同规则,安装而不是重写。

人们常手写而不是安装的组件

sidebar(可折叠,带页脚用户菜单)、command(Cmd+K 搜索面板)、table + TanStack 数据表格 Block、tabs、sheet、dialog、alert-dialog、popover、tooltip、skeleton、sonner(通知)、form(react-hook-form + zod)、breadcrumb、resizable、scroll-area、avatar、badge、separator、dropdown-menu、select、collapsible、chart。

如果你发现自己手写这些中的任何一个,停下来安装它。

键盘快捷键

使用 Cmd+K 打开命令面板;这是 command 组件内置的 cmdk 惯例。Cmd+L 被浏览器保留用于地址栏,在 Chrome 中无法可靠拦截。如果有人要求 Cmd+L,绑定 Cmd+K,再机会主义地添加 Cmd+L,并说明原因。

完成意味着可度量,而不是声称

在报告完成之前,运行 get_audit_checklist 并报告以下数字:

  • 移除的自定义 UI 代码行数
  • 安装的 Block 和组件数
  • 剩余的 style={{}} 出现次数(grep -rc 'style={{' src/)
  • 每个页面:来自 components/ui/ 的元素 vs 手写元素

任何仍然手写的内容都必须有一句声明原因,不能忽视。截图证明页面渲染效果;计数证明规则已被遵守。两者必须齐备,否则不算完成。

禁止

  • UI 中不使用表情符号。使用真实 SVG 图标(Lucide 随 shadcn 提供)。
  • 品牌 logo 不使用文字加圆形。来源真实 SVG 路径:SimpleIcons > svgl.app > gilbarbara/logos > favicon。
  • 最多一种或两种强调色。卡片上不使用彩色左边框。每个元素上不使用渐变。
  • 不要为了改变颜色而分叉组件。修改主题变量。

Individual skills in this repo

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

getedgehq/agent-evals

Build evals for an AI agent that already does real work. Use when someone asks "how do I know my agent is right", wants to test an agent before trusting it, compare models on cost versus quality, or turn production failures into tests. Walks from first tasks and yes/no verifiers, to isolated environments, to a trace-driven improvement loop.

getedgehq/cli-ux-review

Audit a command-line tool for user-friendliness — clear situation / next-step / options in every output, colour-highlighted runnable commands, no raw jargon, no silent hangs. Invoke for "CLI UX audit", "review my CLI", "is this CLI intuitive", or before any CLI release.

getedgehq/generate-image

Generate images with OpenAI GPT Image 2 via the Codex CLI, billed through the user's ChatGPT Plus subscription (no OpenAI API key, no per-image API cost). Use when the user asks to create, generate, or make an image, picture, illustration, icon, hero graphic, or concept art from a text prompt.

getedgehq/harness-first

Diagnose and fix an unreliable, expensive, or unsafe LLM agent by auditing its harness (golden set, judge, cost caps, data layer, action approvals, tracing) before blaming or swapping the model. Use when someone says an agent is "burning tokens", "hallucinating", "brittle", gives inconsistent answers, asks whether to switch to a cheaper/better model, or wants to ship an agent or prompt change to customers.

getedgehq/http-error-triage

Run before concluding anything from an HTTP error on a third-party API. Separates a real credential/entitlement problem from a CDN or WAF block, a wrong endpoint, or a client-signature ban. Use whenever an API returns 401/403/402/429 and you are about to say "the key is dead", "credits are exhausted", "the plan lacks access", or "we are rate limited".

getedgehq/linkedin-media-prep

Convert, crop, resize, and compress images and videos for optimal LinkedIn upload quality and file size. Use when the user wants to prepare a photo, image, or video for LinkedIn (profile picture, cover photo, post image, article featured image, post video, or video ad), optimize file size for LinkedIn, crop and resize for LinkedIn dimensions, convert HEIC/RAW/PNG/MOV to LinkedIn-ready JPEG or MP4, or mentions LinkedIn media requirements, specs, or limits.

getedgehq/monid

>-

getedgehq/opendraft

An 18-agent pipeline that turns one topic line into a drafted

getedgehq/people-search

Find and rank professional people for recruiting, partnerships, sales, or research from user-provided data, public web sources, an authenticated search session, or a connected provider. Use for people discovery, LinkedIn or Sales Navigator search design, profile-list ranking, or provider filter translation.

getedgehq/rocketlist

Turn a CV into a shortlist of live startup roles from Rocketlist's public job board, including adjacent job titles the person would never have searched for, each with its published salary, the evidence for the fit, and a direct apply link. Use for "find roles I would be a strong fit for", career pivots, remote or VC-backed job hunts, and salary-visible role discovery.

getedgehq/security-audit-checklist

Run a comprehensive security audit across application code, cloud infrastructure, containers, CI/CD pipelines, and infrastructure-as-code. Covers privacy compliance, OWASP basics, secret leakage, API security, IAM misconfigurations, storage exposure, Kubernetes hardening, and network security. Use when the user asks to audit, review, or harden app or cloud security, check for secrets, scan for XSS/SQLi, verify security headers, review Terraform/CloudFormation, audit AWS/GCP/Azure configs, or perform any security-focused review.

getedgehq/skills

Develop or review a branded long-form YouTube channel using Simon Kaiser's public creator-led approach: audience fit, recurring formats, natural brand integration, Time with Brand, and an organic, paid, and Shorts strategy. Use for channel strategy, format briefs, and pilots.

getedgehq/skills

Build a YouTube strategy, evidence-backed idea slate, and title plus thumbnail package using Paddy Galloway's public method. Use when planning a channel, choosing concepts, or preparing a video before filming.

getedgehq/skills

Build or review a buyer-centered strategic narrative using Andy Raskin's public method. Use for sales or investor deck stories, homepage positioning, keynotes, launch narratives, and why-now messaging.

getedgehq/skills

Turn a product URL, launch brief, or approved script into a production-ready launch video. Use for product reveals, feature announcements, SaaS launches, and narrated product films; not for generic explainers or editing existing footage.

getedgehq/strip-image-ai-metadata

Strip C2PA and AI-generation metadata from images (PNG, JPEG, WebP) to remove "Generated by AI" / "ChatGPT" / "DALL-E" labels that platforms like LinkedIn, Instagram, and X display. Use when the user wants to clean AI-generated images before posting, remove AI attribution from photos, strip C2PA manifests, sanitize image metadata for professional use, or verify whether an image contains C2PA data.

getedgehq/top-down-comms

>-

getedgehq/workplan

Create, update, or close work plans for multi-step tasks. Use when starting refactors, bug lists, feature work, migrations, or any task with 2+ steps. Also use after auto-compaction to re-orient. Triggers: "workplan", "work plan", "create a plan", "what's the plan", "where was I", or when Claude detects

相关技能