用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/linnefromice/portfolio_two --skill coding-standards命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | coding-standards |
| description | React 19 + TypeScript + Vite SPAのコーディング規約とベストプラクティス。 |
// ✅ 良い例: 説明的な名前
const activeMenuIndex = 0
const isSubMenuVisible = true
// ❌ 悪い例: 不明確な名前
const idx = 0
const flag = true
// ✅ 良い例: 動詞-名詞パターン
function handleDPadRight() { }
function calculateParticlePosition(index: number) { }
function isMenuActive(index: number): boolean { }
// ✅ 常にスプレッド演算子を使用
const updatedState = { ...state, activeMenuIndex: 1 }
const updatedArray = [...items, newItem]
// ❌ 直接変更しない
state.activeMenuIndex = 1 // NG
items.push(newItem) // NG
// ✅ 良い例: 適切な型
interface SkillItem {
name: string
icon: React.ReactNode
}
// ❌ 悪い例: 'any'の使用
function getSkill(id: any): any { }
// ✅ 良い例: 型付き関数コンポーネント
interface DPadProps {
onUp: () => void
onDown: () => void
onLeft: () => void
onRight: () => void
disableUp?: boolean
disableDown?: boolean
}
export function DPad({ onUp, onDown, onLeft, onRight, disableUp, disableDown }: DPadProps) {
return (/* ... */)
}
// ✅ 良い例: 前の状態に基づく場合は関数型更新
setActiveMenuIndex(prev => Math.min(prev + 1, 2))
// ❌ 悪い例: 直接状態参照
setActiveMenuIndex(activeMenuIndex + 1)
// ✅ 良い例: 明確な条件付きレンダリング
{isLoading && <Spinner />}
{error && <ErrorMessage error={error} />}
{data && <DataDisplay data={data} />}
このプロジェクトの構造:
src/
├── main.tsx # エントリポイント
├── App.tsx # ルートコンポーネント(ナビゲーション状態)
├── ui/ # UIコンポーネント
│ ├── Menus.tsx # メインメニュー
│ ├── Buttons/ # D-padコントローラー
│ ├── Account/ # Accountサブメニュー
│ ├── Side/ # Sideプロジェクトサブメニュー
│ └── Content/ # コンテンツページ
└── assets/ # 画像・SVGアセット
components/DPad.tsx # コンポーネントはPascalCase
types.ts # 型定義
constants.tsx # 定数
import { useMemo, useCallback } from 'react'
// ✅ コストの高い計算にuseMemo
const sortedItems = useMemo(() => {
return items.sort((a, b) => a.order - b.order)
}, [items])
// ✅ コールバックをメモ化
const handleNavigate = useCallback((direction: string) => {
// ナビゲーション処理
}, [])
test('D-pad right increases menu index', () => {
// Arrange(準備)
const { result } = renderHook(() => useNavigation())
// Act(実行)
act(() => result.current.handleDPadRight())
// Assert(検証)
expect(result.current.activeMenuIndex).toBe(1)
})
以下のアンチパターンに注意:
覚えておくこと: コード品質は交渉の余地がない。明確で保守性の高いコードは、迅速な開発と自信を持ったリファクタリングを可能にする。