Skip to content

docs: sync sparkle anti-pattern guidance - #192

Merged
touyou merged 7 commits into
mainfrom
fix/internal-issues-91-92
Mar 23, 2026
Merged

docs: sync sparkle anti-pattern guidance#192
touyou merged 7 commits into
mainfrom
fix/internal-issues-91-92

Conversation

@touyou

@touyou touyou commented Mar 23, 2026

Copy link
Copy Markdown
Member

概要

sparkle-design-internal #91 / #92 に合わせて、公開側の shared skill / reference docs / Card 実装を更新します。

変更内容

  • shared skill の Sparkle CLI 呼び出しを最新化
    • setupnpx --yes / pnpm dlx 併記
    • generate サブコマンド付きに統一
  • anti-pattern docs / JSDoc を sparkle-design-cli の source of truth に同期
  • CardControl に既定レイアウトを追加
  • CardControl 説明の重複を整理
  • AI 向け guard 運用を check --format json / setup ベースに更新

動作確認

  • pnpm exec vitest run src/components/ui/card/index.test.tsx

セルフレビューリスト

  • AIレビューを活用しました
  • shared skill と reference docs の記述を同期しました
  • Card の挙動変更に対してテストを維持しました
  • 今回スコープ外の Storybook / Code Connect 変更は含めていません
  • 動作確認を実行しました

関連 Issue

  • refs goodpatch/sparkle-design-internal#91
  • refs goodpatch/sparkle-design-internal#92

@vercel

vercel Bot commented Mar 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sparkle-design Ready Ready Preview, Comment Mar 23, 2026 2:37am

Request Review

@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@touyou has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro (Legacy)

Run ID: ac551760-6eab-4bd3-a8eb-c1f61721e185

📥 Commits

Reviewing files that changed from the base of the PR and between 4fce407 and 13749c1.

⛔ Files ignored due to path filters (1)
  • package.json is excluded by !**/*.json
📒 Files selected for processing (2)
  • CHANGELOG.md
  • scripts/build-registry-vercel.sh

Walkthrough

Sparkle Design のドキュメントとコンポーネント注釈を更新し、CLI 呼び出しを generate サブコマンドに統一。Button/Card/Input/Icon/IconButton の JSDoc と使用例を拡充し、CardControl にデフォルトのレイアウトクラスを追加。

Changes

Cohort / File(s) Summary
Sparkle Design CLI ドキュメント更新
.claude/skills/add-sparkle-component/SKILL.md, .claude/skills/add-sparkle-component/references/css-structure.md, .claude/skills/add-sparkle-component/references/troubleshooting.md
全ての sparkle-design-cli 実行例を ... generate サブコマンド付きに統一。setup --assistant ワークフローと JSON 出力チェック(lint:sparkle:json / --format json)に関する案内を追加・調整。
デザイン指針・アンチパターン拡張
.claude/skills/add-sparkle-component/references/sparkle-design-features.md
Card のコンテンツ配置方針、省スペース UI のサイズルール、Button/Icon のアンチパターン、CardControl の既定レイアウト等を文書化。asChild の動作やアイコン扱いに関する具体例を追加。
Button ドキュメント更新
src/components/ui/button/index.tsx
asChild 時に prefixIcon/suffixIcon/isLoading が無視されることを明記し、誤用例を置換して正しい asChild の使い方を示す例を追加。
Card 実装・テスト更新
src/components/ui/card/index.tsx, src/components/ui/card/index.test.tsx
CardControl にデフォルトで flex items-center gap-2 を適用。CardDescription の用途を明記し、ヘッダの複数アクション例を追加。テストでクラス適用を検証するアサーションを追加。
Icon / IconButton / Input ドキュメント更新
src/components/ui/icon/index.tsx, src/components/ui/icon-button/index.tsx, src/components/ui/input/index.tsx
Icon:material-symbols-rounded を直書きするアンチパターンを明記。IconButton:アイコンのみ操作には IconButton を推奨する例を追加。Input:デフォルト vs compact(sm)のサイズ整合ルールと isDisabled 推奨を追記。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • goodpatch/sparkle-design-internal#90:ドキュメント内の Sparkle Design Guard/lint/check ワークフローや CLI 呼び出しに関する記述変更で重複性が高い。
  • goodpatch/sparkle-design-internal#87:Card/Input/Button 周りのアンチパターンやガイドライン追加に関するドキュメント変更が類似。
  • chore: update sparkle-design for sparkle-design-cli 1.3.8 #186src/components/ui/card に対する実装変更(Card レイアウト/振る舞い)で今回の CardControl 変更と直接関連。

Poem

🐰✨ ぴょんと揃えたボタンの列
アイコンはちゃんとアイコンボタンへ
Card は flex で穏やかに間を取り
ドキュメントは丁寧に灯をともす
Sparkle の庭、いま一層きらめく


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.claude/skills/add-sparkle-component/references/sparkle-design-features.md (1)

499-500: 軽微な重複があります。

CardControl の既定レイアウト(flex items-center gap-2)についてのガイダンスが Lines 499-500 と Lines 568-569 の2箇所で重複しています。読みやすさの観点から、一方を削除するか、片方を参照リンクにすることを検討してください。

Also applies to: 568-569

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/add-sparkle-component/references/sparkle-design-features.md
around lines 499 - 500, Duplicate guidance about CardControl's default layout
("flex items-center gap-2") appears twice (around the existing CardControl
documentation). Remove one of the repeated sentences or replace the second
occurrence with a short reference/link to the original paragraph so the doc only
describes CardControl's default layout once; update the content that mentions
CardControl to point to the canonical section instead of repeating the same
text.
.claude/skills/add-sparkle-component/references/css-structure.md (1)

324-334: npm/yarn/bun のコマンド例が pnpm と不整合です。

pnpm は generate サブコマンドを使用するよう更新されていますが、他のパッケージマネージャーの例は更新されていません。一貫性のため、すべてのパッケージマネージャーで同じコマンド形式に揃えることを推奨します。

♻️ 提案する修正
 # pnpm
 pnpm dlx sparkle-design-cli generate

 # npm
-npm exec sparkle-design-cli
+npm exec sparkle-design-cli generate

 # yarn
-yarn dlx sparkle-design-cli
+yarn dlx sparkle-design-cli generate

 # bun
-bunx sparkle-design-cli
+bunx sparkle-design-cli generate
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/add-sparkle-component/references/css-structure.md around
lines 324 - 334, The examples are inconsistent: only the pnpm example uses the
generate subcommand ("pnpm dlx sparkle-design-cli generate") while npm/yarn/bun
lines lack it; update the npm, yarn and bun examples to include the same
"generate" subcommand and consistent invocation form so all four examples match
(refer to the existing example strings "pnpm dlx sparkle-design-cli generate",
"npm exec sparkle-design-cli", "yarn dlx sparkle-design-cli", "bunx
sparkle-design-cli" and change the latter three to include "generate" so they
all use e.g. "npm exec sparkle-design-cli generate", "yarn dlx
sparkle-design-cli generate", "bunx sparkle-design-cli generate").
.claude/skills/add-sparkle-component/SKILL.md (1)

333-333: setup 実行コマンドの前提を1行補足してください。

現在の記述だと「sparkle-design-cli がPATHにある前提」に見えるため、pnpm dlx sparkle-design-cli setup ... も併記しておくと実行失敗を減らせます。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/add-sparkle-component/SKILL.md at line 333,
補足として「sparkle-design-cli
がグローバルPATHにない場合の代替実行方法」を1行追記してください:現在の説明で使われているコマンド参照(`sparkle-design-cli setup
--assistant <claude|codex|cursor|generic>`)の直前か直後に、`pnpm dlx sparkle-design-cli
setup --assistant ...` のように pnpm dlx を使った実行例を併記し、「PATH
にない場合はこちらを使う」と短く明記してください(参照箇所の識別子は SKILL.md の setup コマンド説明行)。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/add-sparkle-component/SKILL.md:
- Line 335: Update the documentation sentence that fixes the hard-coded "src"
target: replace the example command `sparkle-design-cli check src --format json`
with a variable/placeholder or auto-detection form such as `sparkle-design-cli
check <detected-target> --format json` (or `sparkle-design-cli check --format
json` with mention that `--target` is auto-detected) so it aligns with the
earlier explanation about omitting `--target`; ensure references to the npm
scripts `lint:sparkle` and `lint:sparkle:json` remain consistent.

---

Nitpick comments:
In @.claude/skills/add-sparkle-component/references/css-structure.md:
- Around line 324-334: The examples are inconsistent: only the pnpm example uses
the generate subcommand ("pnpm dlx sparkle-design-cli generate") while
npm/yarn/bun lines lack it; update the npm, yarn and bun examples to include the
same "generate" subcommand and consistent invocation form so all four examples
match (refer to the existing example strings "pnpm dlx sparkle-design-cli
generate", "npm exec sparkle-design-cli", "yarn dlx sparkle-design-cli", "bunx
sparkle-design-cli" and change the latter three to include "generate" so they
all use e.g. "npm exec sparkle-design-cli generate", "yarn dlx
sparkle-design-cli generate", "bunx sparkle-design-cli generate").

In @.claude/skills/add-sparkle-component/references/sparkle-design-features.md:
- Around line 499-500: Duplicate guidance about CardControl's default layout
("flex items-center gap-2") appears twice (around the existing CardControl
documentation). Remove one of the repeated sentences or replace the second
occurrence with a short reference/link to the original paragraph so the doc only
describes CardControl's default layout once; update the content that mentions
CardControl to point to the canonical section instead of repeating the same
text.

In @.claude/skills/add-sparkle-component/SKILL.md:
- Line 333: 補足として「sparkle-design-cli
がグローバルPATHにない場合の代替実行方法」を1行追記してください:現在の説明で使われているコマンド参照(`sparkle-design-cli setup
--assistant <claude|codex|cursor|generic>`)の直前か直後に、`pnpm dlx sparkle-design-cli
setup --assistant ...` のように pnpm dlx を使った実行例を併記し、「PATH
にない場合はこちらを使う」と短く明記してください(参照箇所の識別子は SKILL.md の setup コマンド説明行)。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro (Legacy)

Run ID: a515d8d4-4a17-4a45-83ac-f9bad58f65e9

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd1ce7 and 2789b6d.

📒 Files selected for processing (9)
  • .claude/skills/add-sparkle-component/SKILL.md
  • .claude/skills/add-sparkle-component/references/css-structure.md
  • .claude/skills/add-sparkle-component/references/sparkle-design-features.md
  • src/components/ui/button/index.tsx
  • src/components/ui/card/index.test.tsx
  • src/components/ui/card/index.tsx
  • src/components/ui/icon-button/index.tsx
  • src/components/ui/icon/index.tsx
  • src/components/ui/input/index.tsx

Comment thread .claude/skills/add-sparkle-component/SKILL.md Outdated

@touyou touyou left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビューコメント

PR 全体として、CLI コマンドの最新化・アンチパターンドキュメントの同期・CardControl への既定レイアウト追加、いずれも方針が明確で良い変更だと思います。以下、気になった点をいくつか共有します。


1. css-structure.md — npm / yarn / bun のコマンドが generate サブコマンド未反映(重要度: 高)

pnpm dlx sparkle-design-cli generate に更新されていますが、同じコードブロック内の npm / yarn / bun の例は旧コマンドのままです。

ファイル: .claude/skills/add-sparkle-component/references/css-structure.md L327 付近

# pnpm
pnpm dlx sparkle-design-cli generate  # ← 更新済み

# npm
npm exec sparkle-design-cli           # ← generate なし
# yarn
yarn dlx sparkle-design-cli           # ← generate なし
# bun
bunx sparkle-design-cli               # ← generate なし

他のパッケージマネージャーでも generate サブコマンドが必要であれば、統一したほうが良さそうです。意図的に省略している場合は無視してください。


2. sparkle-design-features.mdCardControl の説明が重複

CardControl は既定で flex items-center gap-2 を持つ。 という同一の文が L499 と L568 の 2 箇所に存在します。「Badge と Tag を用途で使い分ける」セクション直後(L499)と「CardHeader: CardControl を使う」セクション直後(L568)です。

どちらか一方にまとめるか、片方からもう片方を参照する形にすると読みやすくなると思います。


3. card/index.tsx — CardDescription の JSDoc コメント記法の微小な不整合

L212 の閉じ ``` の直後に空行を挟んで * @param が続いていますが、閉じ */ との間に空の * 行がありません(L211-213 付近)。CardControl の JSDoc(L249-251 付近)も同様のパターンです。動作には影響しませんが、他コンポーネント(CardHeader 等)のブロックと書式を揃えるなら統一すると良いかもしれません。


4. テスト — className の実装詳細への依存について(軽微な指摘)

card/index.test.tsxcontrol.classNameflex, items-center, gap-2 が含まれることを直接アサートしています。Tailwind のクラス名は実装詳細であり、将来リファクタリングした際にテストが壊れやすい面もあります。ただし、今回は「CardControl が既定レイアウトを持つ」ことを保証する意図のテストなので、現時点では妥当だと思います。将来的にはビジュアルリグレッションテストなどで補完できると良さそうです。


まとめ

主要な機能変更(CardControl への flex items-center gap-2 追加)はテスト付きで安心感があります。JSDoc・ドキュメントの同期も丁寧に行われています。上記 1 のコマンド不整合だけ確認いただければ、マージして問題ないと思います。

@touyou
touyou merged commit d2fe14b into main Mar 23, 2026
4 checks passed
@touyou
touyou deleted the fix/internal-issues-91-92 branch March 23, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant