Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .claude/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This directory contains pre-configured commands that provide automated workflows
| | `/config-base-sync-update` | DevContainer を最新に更新して PR 作成 |
| **Setup** | `/setup-new-repo` | 新規リポジトリのセットアップ |
| | `/setup-ci` | CI/CD ワークフローのセットアップ |
| | `/setup-tests` | テスト基盤のセットアップ(21種類、5レベル) |
| | `/setup-husky` | Git hooks (Husky) のセットアップ |
| | `/setup-team-protection` | GitHub リポジトリ保護ルールの設定 |
| **Documentation** | [docs/setup/](../../docs/setup/README.md) | プロジェクト種別ごとのセットアップガイド |
Expand Down Expand Up @@ -234,6 +235,42 @@ This directory contains pre-configured commands that provide automated workflows
| standard | Lint + Test + Build + Security Audit |
| comprehensive | All + E2E + CodeQL + Claude Review + Scheduled Scan |

#### `setup-tests.md`

**Purpose**: Setup comprehensive testing infrastructure for Next.js projects (21 test types, 5 levels)
**Features**:

- Test configuration templates from cyber_ace_1on1
- Jest + Playwright setup with polyfills
- Unit, Component, Integration, E2E, API tests
- Regression, Smoke, Contract, Scenario tests
- Visual, A11y, Property-based, Mutation tests
- Performance, Load, Security, Database tests
- Edge Functions, i18n, SSR/Hydration tests

**Usage**:

```
/setup-tests # Standard level (default)
/setup-tests --level minimal # Unit + Component + Snapshot
/setup-tests --level comprehensive # + Regression + Smoke + Contract
/setup-tests --level full # + Visual + A11y + Scenario
/setup-tests --level enterprise # All 21 test types
/setup-tests --coverage-threshold 80 # Custom coverage requirement
```

**Levels**:

| Level | Test Types |
| ------------- | ------------------------------------------------------------------ |
| minimal | Unit, Component, Snapshot |
| standard | + Integration, E2E, API |
| comprehensive | + Regression, Smoke, Contract |
| full | + Visual, A11y, Scenario, Property-based |
| enterprise | + Performance, Load, Security, Database, Edge, i18n, SSR, Mutation |

See [templates/testing/README.md](../../templates/testing/README.md) for detailed documentation.

#### `container-health.md`

**Purpose**: Verify DevContainer environment health and configuration
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ It includes settings for various tools, such as the shell (Zsh), Git, npm, and V
- `credentials/`: Contains templates and scripts for secure credential management using 1Password CLI integration.
- `docs/`: Documentation directory containing setup guides, usage instructions, and reference materials. The `setup/` subdirectory provides project-type-specific setup guides (Next.js, React+Vite, npm libraries, Flutter, Android, Desktop extensions). See [docs/setup/README.md](docs/setup/README.md) for the complete list.
- `eslint/`: Contains recommended ESLint complexity rules template and documentation to prevent technical debt accumulation. See [eslint/README.md](eslint/README.md) for usage guidelines.
- `templates/`: Project templates including testing configuration templates for Next.js projects. The `testing/` subdirectory provides comprehensive test setup (21 test types, 5 levels: minimal → standard → comprehensive → full → enterprise). Use `/setup-tests` command or see [templates/testing/README.md](templates/testing/README.md) for details.
- `dot/`: Directory for dotfiles and configuration files that are typically placed in the home directory, including Zsh configuration with comprehensive aliases, functions, and environment setup.
- `git/`: Contains Git configuration files including gitconfig, gitignore, commitlint configuration with i18n support, and modular configuration files in the `gitconfig.d/` subdirectory. See [git/README.md](git/README.md) for details.
- `npm/`: Contains npm global package configuration.
Expand Down Expand Up @@ -525,6 +526,24 @@ For setting up a complete CI/CD pipeline in a new repository, use the `/setup-ci
- Husky Git hooks setup
- Troubleshooting guidance

#### Test Configuration Setup

For comprehensive test setup in Next.js projects, use the `/setup-tests` Claude command. It provides 21 test types across 5 levels:

- **Minimal**: Unit, Component, Snapshot tests
- **Standard**: + Integration, E2E, API tests
- **Comprehensive**: + Regression, Smoke, Contract tests
- **Full**: + Visual, A11y, Scenario, Property-based tests
- **Enterprise**: + Performance, Load, Security, Database, Edge Functions, i18n, SSR, Mutation tests

```bash
/setup-tests # Standard level (default)
/setup-tests --level comprehensive # More test types
/setup-tests --coverage-threshold 80 # Custom coverage
```

See [templates/testing/README.md](templates/testing/README.md) for detailed documentation.

#### GitHub Actions Workflows

- **CI Pipeline** (`.github/workflows/ci.yml`): Automated testing, linting, and quality checks (uses Node.js 22)
Expand Down Expand Up @@ -702,6 +721,12 @@ The repository includes automated Slack notifications for development workflow e
- **Visual Studio Code**: A free source-code editor made by Microsoft for Windows, Linux, and macOS.
- **Zsh**: An extended Unix shell with advanced features for interactive use and scripting.
- **envsubst**: GNU gettext utility that substitutes environment variables in shell format strings (e.g., `${VARIABLE}`).
- **Gitleaks**: Secret scanning tool that detects hardcoded secrets, API keys, and passwords in Git repositories.
- **Jest**: JavaScript testing framework with a focus on simplicity, supporting unit tests, component tests, and snapshot testing.
- **ni (@antfu/ni)**: Universal package manager wrapper that automatically detects and uses the correct package manager (npm, pnpm, yarn, bun).
- **Playwright**: End-to-end testing framework for web applications, supporting cross-browser testing with Chromium, Firefox, and WebKit.
- **pnpm**: Fast, disk space efficient package manager for Node.js with strict dependency management and built-in security features.
- **Testing Library**: Family of packages for testing UI components in a user-centric way, encouraging best practices and accessibility.

## Disclaimer

Expand Down
26 changes: 20 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
| [setup/mobile-android.md](./setup/mobile-android.md) | Android ネイティブアプリ |
| [setup/desktop-extension-ts.md](./setup/desktop-extension-ts.md) | デスクトップ拡張(TypeScript) |

### テストテンプレート

| ドキュメント | 説明 |
| ---------------------------------------------------------------- | ----------------------------------------------- |
| [../templates/testing/README.md](../templates/testing/README.md) | 包括的テスト設定テンプレート(21種類、5レベル) |

### DevContainer / 開発環境

| ドキュメント | 説明 |
Expand All @@ -42,12 +48,13 @@

### Claude Code コマンドとの連携

| コマンド | 関連ドキュメント |
| -------------------------- | ---------------------------------------------------------- |
| `/setup-new-repo` | [setup/README.md](./setup/README.md) |
| `/setup-ci` | [setup/README.md](./setup/README.md) |
| `/config-base-sync-update` | [using-config-base-image.md](./using-config-base-image.md) |
| `/repo-maintenance` | [tool-catalog.md](./tool-catalog.md) |
| コマンド | 関連ドキュメント |
| -------------------------- | ---------------------------------------------------------------- |
| `/setup-new-repo` | [setup/README.md](./setup/README.md) |
| `/setup-ci` | [setup/README.md](./setup/README.md) |
| `/setup-tests` | [../templates/testing/README.md](../templates/testing/README.md) |
| `/config-base-sync-update` | [using-config-base-image.md](./using-config-base-image.md) |
| `/repo-maintenance` | [tool-catalog.md](./tool-catalog.md) |

## ディレクトリ構造

Expand All @@ -66,6 +73,13 @@ docs/
├── mcp-servers-guide.md # MCP サーバー設定
├── sentry-setup-guide.md # Sentry セットアップ
└── tool-catalog.md # ツールカタログ

templates/
├── testing/ # テスト設定テンプレート
│ ├── README.md # テストテンプレートガイド(21種類)
│ ├── jest.config.js # Jest 基本設定
│ ├── playwright.config.ts # Playwright E2E 設定
│ └── examples/ # 各テスト種別のサンプルコード
```

## 関連リソース
Expand Down
2 changes: 2 additions & 0 deletions docs/setup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ jobs:

| コマンド | 用途 |
| --------------------------- | ----------------------------------------------- |
| `/setup-tests` | テスト基盤のセットアップ(21種類、5レベル) |
| `/setup-husky` | husky + lint-staged + commitlint の最小構成導入 |
| `/setup-ci` | CI/CD ワークフローの雛形作成 |
| `/setup-new-repo` | 新規リポジトリの初期セットアップ一式 |
Expand All @@ -399,6 +400,7 @@ jobs:

| ドキュメント | 説明 |
| -------------------------------------------------------------------------- | ------------------------------------------------- |
| [テストテンプレート](../../templates/testing/README.md) | 包括的テスト設定(21種類、5レベル) |
| [project-presets.json](../../.devcontainer/templates/project-presets.json) | プロジェクトタイプ別の推奨設定マスター |
| [ツールカタログ](../tool-catalog.md) | 環境×ツールのマトリクス(何がどこで使えるか一覧) |
| [config-base イメージ](../using-config-base-image.md) | DevContainer ベースイメージの詳細 |
Expand Down
45 changes: 37 additions & 8 deletions docs/tool-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,43 +182,72 @@ Layer 1: ベースイメージ (ghcr.io/keito4/config-base)
| Python | `ms-python.python`, `ms-python.vscode-pylance`, `ms-python.isort` |
| Ruby | `shopify.ruby-lsp`, `rebornix.ruby` |

## 6. 所見・改善提案
## 6. テストツール(templates/testing)

### 6.1 ベースイメージバージョンの乖離
`/setup-tests` コマンドで導入可能な包括的テスト基盤。

### 6.1 テストフレームワーク

| ツール | バージョン目安 | 用途 |
| --------------- | -------------- | -------------------------- |
| Jest | 29.x | Unit / Component テスト |
| Playwright | 1.52.x | E2E / Visual / A11y テスト |
| Testing Library | 16.x | コンポーネントテスト |
| fast-check | 3.x | Property-based テスト |
| Stryker | 9.x | Mutation テスト |
| axe-core | 4.x | アクセシビリティ検証 |
| k6 / Artillery | 最新 | 負荷テスト |
| Lighthouse | 12.x | Core Web Vitals |

### 6.2 テストレベル

| レベル | テスト種別数 | 主な対象 |
| ------------- | ------------ | ------------------------------------------ |
| minimal | 3 | Unit, Component, Snapshot |
| standard | 6 | + Integration, E2E, API |
| comprehensive | 9 | + Regression, Smoke, Contract |
| full | 13 | + Visual, A11y, Scenario, Property-based |
| enterprise | 21 | + Performance, Load, Security, DB, i18n 等 |

> **推奨**: 新規プロジェクトは `standard` レベル(70%+ カバレッジ必須)から開始し、プロダクション前に `comprehensive` へ昇格。

## 7. 所見・改善提案

### 7.1 ベースイメージバージョンの乖離

4 リポジトリ(npm ライブラリ、SPA、モバイル Flutter、モバイル Android)が **1.0.13** のまま。
最新は **1.81.1** であり、AI CLI やセキュリティパッチが大幅に遅れている。

> **推奨**: `/config-base-sync-update` コマンドで一括更新、または Dependabot/Renovate で自動化。

### 6.2 Features の重複
### 7.2 Features の重複

Web アプリ、デスクトップ拡張で `pnpm`, `gh`, `jq` などベースイメージに含まれるツールを Features で再インストールしている。
ベースイメージ更新後は Features の棚卸しが必要。

### 6.3 テスト未設定のリポジトリ
### 7.3 テスト未設定のリポジトリ

| 種別 | 状態 |
| --------------------- | ---------------------------------------------- |
| SPA (React + Vite) | Unit / E2E ともに未設定 |
| デスクトップ拡張 (TS) | テストスクリプトなし(Raycast 固有の制約あり) |
| モバイル (Android) | テスト未設定 |

> **推奨**: TDD ベースライン(70%+ カバレッジ)に合わせ、最低限 Unit テストを追加
> **推奨**: `/setup-tests` コマンドで包括的なテスト基盤を導入。21種類のテスト(Unit, Component, E2E, Regression, Visual, A11y, Performance 等)を5段階のレベルで段階的に追加可能。詳細は [templates/testing/README.md](../templates/testing/README.md) を参照

### 6.4 リンター/フォーマッター未設定
### 7.4 リンター/フォーマッター未設定

SPA (React + Vite) とモバイル (Android) は lint / format スクリプトが未定義。
コード品質の最低保証が欠けている。

### 6.5 Brewfile の肥大化
### 7.5 Brewfile の肥大化

`MacOSBrewfile` は **232 行**に達しており、使用頻度の低いツールが混在。
`categories.json` による分類は存在するが、定期的な棚卸しルールがない。

> **推奨**: 四半期ごとに `brew uses --installed` で利用状況を確認し、不要パッケージを削除。

### 6.6 Git hooks の統一
### 7.6 Git hooks の統一

共通基盤、Web アプリ、npm ライブラリは husky + commitlint を使用しているが、
SPA、モバイル (Flutter/Android) では Git hooks が未設定。
Expand Down