技能 frontend-dev-guidelines
🎨

frontend-dev-guidelines

安全 🌐 網路存取📁 檔案系統存取⚙️ 外部命令

套用 Next.js 15 前端最佳實踐

也可從以下取得: 0Chan-smc,diet103,Dimon94,BOM-98,BrianDai22,DojoCodingLabs

前端程式碼需要為 Next.js 15 功能(如 Server Components 和 App Router)保持一致的模式。本技能提供 React 19、TypeScript、Shadcn/ui 元件和 Tailwind CSS 的全面指南,以確保應用程式的可維護性和效能。

支援: Claude Codex Code(CC)
📊 70 充足
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「frontend-dev-guidelines」。 Create a product card component that displays an image, title, price, and add-to-cart button using Shadcn/ui components.

預期結果:

  • Server Component with typed props interface
  • Card, CardHeader, CardTitle, CardContent from @/components/ui/card
  • Image optimization with next/image component
  • Button with variant prop from Shadcn/ui
  • Tailwind utility classes for responsive layout
  • TypeScript interface for Product type
  • cn() utility for conditional styling

正在使用「frontend-dev-guidelines」。 Create a page for listing blog posts with data fetching, loading state, and error handling.

預期結果:

  • Page.tsx with async data fetching in Server Component
  • loading.tsx with Suspense fallback and spinner
  • error.tsx with error boundary and reset button
  • Proper directory structure under app/posts/
  • Metadata export for SEO
  • PostList component import from features

安全審計

安全
v3 • 1/16/2026

Pure documentation skill containing only markdown guidelines. No executable code, scripts, network calls, file system access, or environment variable usage. All static findings are false positives from the analyzer misinterpreting markdown code formatting and JSON metadata fields as security issues.

2
已掃描檔案
833
分析行數
3
發現項
3
審計總數

風險因素

🌐 網路存取 (3)
📁 檔案系統存取 (1)
⚙️ 外部命令 (95)
審計者: claude 查看審計歷史 →

品質評分

38
架構
100
可維護性
87
內容
34
社群
100
安全
78
規範符合性

你能建構什麼

建構 Next.js 頁面

使用 Server Components、路由、中繼資料和適當的檔案結構建立新頁面

使用 Shadcn/ui 進行樣式設計

使用 Tailwind CSS 和條件式類別工具應用可存取的 UI 元件

遷移至 Server Components

將客戶端模式轉換為 Server Components 以獲得更好的效能

試試這些提示

建立簡單元件
使用 Shadcn/ui Card 元件建立一個新的 Server Component 來顯示用戶資料,並使用適當的 TypeScript 介面。
建構資料獲取頁面
使用 Server Component 模式建立一個從 API 端點獲取貼文的頁面,並包含 loading.tsx 和 error.tsx 邊界。
使用 actions 實作表單
建立一個包含 Server Action 的表單元件來建立新貼文,包括 zod 驗證和 Shadcn/ui 輸入元件。
最佳化效能
審查並最佳化以下頁面元件:識別使用 Server Components 的機會、添加 Suspense 串流,並實作適當的快取策略。

最佳實務

  • 預設使用 Server Components 進行資料獲取和渲染,以減少套件大小
  • 使用 @/components/ui 中的 Shadcn/ui 元件配合 Tailwind CSS 保持一致的樣式
  • 使用嚴格的 TypeScript,包含明確的屬性類型且不使用隱含的 any

避免

  • 避免不必要地添加 'use client' - 這會增加套件大小並停用 Server Component 的優勢
  • 不要在 Server Components 中使用 useEffect 進行資料獲取 - 應直接進行 fetch
  • 避免使用行內樣式 - 使用 Tailwind CSS 工具類別和 cn() 輔助函式處理條件式類別

常見問題

本技能與較舊的 Next.js 版本相容嗎?
本技能專門針對 Next.js 15。某些模式如 Server Components 和 App Router 可在 Next.js 13+ 中使用,但語法可能有所不同。
Server Component 模式有什麼限制?
Server Components 無法使用 hooks、瀏覽器 API 或事件處理常式。將互動性移至 Client Components 並用 Suspense 包裝。
我可以將本技能與其他 UI 元件函式庫一起使用嗎?
本技能專注於 Shadcn/ui 模式。一般原則也適用於其他函式庫,但匯入路徑和類別名稱會有所不同。
使用 Server Components 時我的資料安全嗎?
可以。Server Components 在您的基礎設施上執行。資料永遠不會離開您的伺服器 - 它會在將 HTML 傳送至客戶端之前獲取和渲染。
為什麼我的元件在客戶端而非伺服器上渲染?
檢查頂部的 'use client' 指示詞。如果沒有,確保沒有使用 hooks、瀏覽器 API 或事件處理常式。移除任何客戶端模式。
本技能與其他前端技能相比如何?
本技能提供詳細的 Next.js 15 模式。結合一般 React 技能用於元件生命週期,或 CSS 技能用於 Tailwind 之外的自訂樣式。