chatbot-component
ChatBotプロジェクトに新しいUIコンポーネントを追加するためのスキル。コンポーネント作成手順、CSS構成ルール、イベントハンドリングパターンを提供します。新しいUIコンポーネントを作成する時、モーダルを追加する時、CSSスタイルを追加する時、UIイベントを処理する時に使用してください。
When & Why to Use This Skill
This Claude skill streamlines the development of UI components for ChatBot projects by providing standardized JavaScript class templates, BEM-compliant CSS structures, and event handling patterns. It ensures architectural consistency and accelerates the implementation of new features like modals, sidebars, and interactive elements while adhering to project-specific coding standards.
Use Cases
- Generating standardized JavaScript component classes using a singleton pattern for consistent state management.
- Implementing UI styles that strictly adhere to project-specific CSS variables and BEM naming conventions.
- Adding complex interactive elements such as modals or sidebars with pre-defined event handling logic.
- Ensuring new UI features are correctly integrated into the existing HTML structure and script loading sequence.
| name | chatbot-component |
|---|---|
| description | ChatBotプロジェクトに新しいUIコンポーネントを追加するためのスキル。コンポーネント作成手順、CSS構成ルール、イベントハンドリングパターンを提供します。新しいUIコンポーネントを作成する時、モーダルを追加する時、CSSスタイルを追加する時、UIイベントを処理する時に使用してください。 |
ChatBot コンポーネント追加スキル
このスキルはChatBotプロジェクトに新しいUIコンポーネントを追加する際のガイダンスを提供します。
コンポーネント作成手順
1. JavaScriptクラスの作成
app/public/js/components/{機能名}/{機能名}.js に配置:
class ComponentName {
static #instance = null;
constructor() {
if (ComponentName.#instance) {
return ComponentName.#instance;
}
ComponentName.#instance = this;
}
static get getInstance() {
if (!ComponentName.#instance) {
ComponentName.#instance = new ComponentName();
}
return ComponentName.#instance;
}
initialize() {
this.#setupEventListeners();
}
#setupEventListeners() {
// イベントリスナーの設定
}
}
2. CSSスタイルの作成
app/public/css/components/{カテゴリ}/{ファイル名}.css に配置:
.component-name {
background: var(--background-secondary);
border-radius: var(--border-radius-md);
padding: var(--spacing-md);
}
.component-name__element {
/* BEM命名規則 */
}
3. HTMLの追加
app/public/index.html の適切な位置に要素を追加。
4. スクリプト読み込み
app/public/index.html の末尾にscriptタグを追加。
CSS変数(必須使用)
色・間隔・サイズはすべてCSS変数で定義:
- 背景色:
--background-primary,--background-secondary,--background-tertiary - テキスト色:
--text-primary,--text-secondary,--text-tertiary - 間隔:
--spacing-xs~--spacing-xl - 角丸:
--border-radius-sm~--border-radius-xl - アニメーション:
--transition-fast,--transition-normal
参考コンポーネント
- チャット系:
chatRenderer.js,chatUI.js - サイドバー:
sidebar.js - モーダル:
apiSettingsModal.js,systemPromptModal.js
参照ファイル
詳細は以下のファイルを参照:
references/component-template.md: コンポーネントテンプレートreferences/css-structure.md: CSS構成ルールreferences/event-handling.md: イベントハンドリングパターン