new-component
建立新的 govtw-* Lit 元件(scaffolder-backed)
Install / Use
npx skills add reidevbx/govtwInstalls into whichever agent you are using.
Claude Commands
Claude Code slash commands
Quality Score
Category
DesignSupported Platforms
Skill content
View source on GitHubdescription: 建立新的 govtw-* Lit 元件(scaffolder-backed)
/new-component <name> [options]
建立 gov.tw Design System 的新 Lit 元件。務必使用 scaffolder,不要手動建檔。
使用流程
-
先建任務文件(守則一):
tasks/features/YYYY-MM-DD-<name>-component.md- 填寫 問題分析 / 需求定義 / 實作計劃 / 影響範圍
- 用 TaskCreate 列出步驟
-
跑 scaffolder:
pnpm new:component <name> [--type=basic|form|layout] [--zh-name=中文名]basic:一般互動元件(如 button、link)form:表單元件(含formAssociated、attachInternals、setFormValue、formResetCallback)layout:佈局原語(含styleMap+ token)
-
填寫 TODO:
- 元件
.ts:屬性宣告、樣式、render 內容 - 文件
.md:屬性表、事件表、無障礙段落、設計指引 - preview
.html:示範內容
- 元件
-
驗證:
pnpm build # 編譯 + 同步 public pnpm check:components # 稽核完整性 -
補任務文件的總結(守則七)。
品質檢查清單(實作時對照)
- [ ]
@customElement('govtw-<name>')tag 正確 - [ ]
declare global HTMLElementTagNameMap宣告已在檔尾 - [ ] 有可聚焦子元素時
delegatesFocus: true - [ ] 表單元件:
static formAssociated = true+attachInternals() - [ ] CSS 只引用 Component-level token(不加 fallback)
- [ ] Focus ring 用
box-shadow,:host加outline: none !important - [ ] 錯誤狀態加
aria-invalid - [ ]
target="_blank"時自動補rel="noopener noreferrer" - [ ]
updated()用PropertyValues<this>型別 - [ ] 文件頁有:概述 / 互動範例 / 狀態展示 / 使用方式 / 屬性 / 事件 / 無障礙 / 設計指引
- [ ] preview HTML 載入
/tokens.css與/gov-tw.iife.js
參考
- 既有最佳實踐範例:
packages/web-components/src/govtw-button.ts(basic)、govtw-text-input.ts(form)、govtw-stack.ts(layout) - 完整工作守則:
CLAUDE.md的「工作守則」區段 - 任務文件規範:
tasks/README.md
Related Skills
caveman
107.2k🪨 why use many token when few token do trick. Viral skill + proxy for coding agents that cuts 65% of tokens by talking like a caveman.
claude-mem
94.4kPersistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Agent-Reach
84.5kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
Understand-Anything
83.6kGraphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
Security Score
Audited on Invalid Date
