From 810614a1cca90d3401b2513f0b42f74c9ea53a27 Mon Sep 17 00:00:00 2001 From: hikahana <22.h.hanada.nutfes@gmail.com> Date: Wed, 16 Jul 2025 13:51:28 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E3=81=A6=E3=81=8D=E3=81=A8?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BD=9C=E3=81=A3=E3=81=9Fcusor=20rule?= =?UTF-8?q?=E3=82=92=E5=85=B1=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cursor/rules/development-testing.mdc | 61 +++++++++++++ .cursor/rules/github-pr-creation.mdc | 120 ++++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 .cursor/rules/development-testing.mdc create mode 100644 .cursor/rules/github-pr-creation.mdc diff --git a/.cursor/rules/development-testing.mdc b/.cursor/rules/development-testing.mdc new file mode 100644 index 00000000..b2d2c49e --- /dev/null +++ b/.cursor/rules/development-testing.mdc @@ -0,0 +1,61 @@ +--- +alwaysApply: true +--- + +# 動作検証とテスト手順 + +## 基本的な動作検証手順 + +### 1. Make コマンドを使用した動作検証 + +このプロジェクトでは、動作検証には必ず Make コマンドを使用してください: + +```bash +# Wire生成(新規APIを作成し、routerなどに変更がある場合のみ) +make wire-gen + +# データベース起動 +make run-db + +# アプリケーション起動 +make run +``` + +### 2. Air ホットリロードの活用 + +- **Air によるホットリロード**が設定されているため、基本的に`docker build`や手動`reload`は不要 +- `make wire-gen`実行後、Air が自動的にリビルドを検出して再起動する +- 手動での Docker コンテナ再起動やリビルドは避ける + +### 3. 動作確認のタイミング + +- コード変更後、**数秒待ってから**動作検証を行う +- Air のホットリロードが完了するまで少し時間がかかる +- 急いでテストせず、ログでリロード完了を確認してから検証する + +### 4. ヘルスチェックによる動作確認 + +```bash +# 基本的なヘルスチェック +curl -s http://localhost:1323/ + +# 期待される応答 +# healthcheck: ok + +# アプリケーション起動中の場合 +curl -s http://localhost:1323/ || echo "アプリケーション起動中..." +``` + +### 5. 検証の流れ + +1. `make wire-gen` (新規 API を作成し、router などに変更がある場合のみ) +2. 数秒待つ (Air のホットリロード完了を待つ) +3. `curl -s http://localhost:1323/` で動作確認 +4. 必要に応じて他のエンドポイントをテスト + +## 注意事項 + +- Docker build やコンテナの手動再起動は基本的に不要 +- Air のホットリロードを信頼し、自動リビルドを活用する +- 動作確認は常に curl コマンドで行う +- Wire 生成後は必ず Air の自動リビルドを待つ diff --git a/.cursor/rules/github-pr-creation.mdc b/.cursor/rules/github-pr-creation.mdc new file mode 100644 index 00000000..cfe34382 --- /dev/null +++ b/.cursor/rules/github-pr-creation.mdc @@ -0,0 +1,120 @@ +--- +alwaysApply: true +description: GitHub MCPを使用したPR作成方法とテンプレート活用のガイド +--- + +# GitHub MCP を使用した PR 作成方法 + +## 基本的な PR 作成の流れ + +### 1. 事前準備 + +- 現在のブランチとベースブランチを確認 +- 変更内容を把握するための git 操作を実行 +- プロジェクトの詳細情報を確認 + +### 2. GitHub MCP ツールの使用 + +#### 必要な情報収集 + +```bash +# ブランチ状況確認 +git status + +# 変更ファイル一覧取得 +git diff develop --name-only + +# コミット履歴確認 +git log --oneline develop..HEAD +``` + +#### PR 作成コマンド + +```javascript +mcp_github - + remote_create_pull_request({ + owner: "NUTFes", + repo: "FinanSu", + title: "feat: 機能名の説明", + head: "現在のブランチ名", + base: "develop", + body: "PRテンプレートに従った本文", + }); +``` + +### 3. PR テンプレートの活用 + +PR 作成時は必ず [.github/pull_request_template.md](mdc:.github/pull_request_template.md) の内容に従って以下の項目を埋める: + +#### 必須項目 + +- **対応 Issue**: `resolve #番号` または `resolve #0` +- **概要**: 開発内容の概要説明 +- **画面スクリーンショット等**: 変更がある場合のみ +- **テスト項目**: 検証すべき内容 +- **備考**: 追加情報 + +#### 項目記載例 + +```markdown +# 対応 Issue + +resolve #123 + +# 概要 + +Google Wire を使った依存性注入システムを導入し、従来の手動による依存性注入を自動化しました。 + +## 主な変更点 + +- 機能 A の追加 +- 機能 B の修正 +- 設定ファイルの更新 + +# テスト項目 + +- 機能 A が正常に動作すること +- 既存機能に影響がないこと +- エラーハンドリングが適切に動作すること + +# 備考 + +- 特別な注意点があれば記載 +``` + +### 4. 動作確認の実行 + +PR 作成後は必ず以下の手順で動作確認を実施: + +```bash +# Wire生成(新規APIがある場合) +make wire-gen + +# アプリケーション起動確認 +make run + +# 基本的な動作確認 +curl -s http://localhost:1323/ +``` + +### 5. 注意事項 + +- **ブランチ命名**: `feat/username/feature-name` 形式を推奨 +- **ベースブランチ**: 基本的に `develop` ブランチを使用 +- **コミット履歴**: 意味のある単位でコミットを分割 +- **テンプレート遵守**: 必ず `.github/pull_request_template.md` に従う +- **動作確認**: PR 作成前に必ず動作確認を実施 + +## エラー対応 + +### よくある問題と対処法 + +1. **ブランチが存在しない**: `git checkout -b ブランチ名` で作成 +2. **merge conflict**: ベースブランチの最新を取得して解決 +3. **API エラー**: repository owner/name が正しいか確認 + +### 動作確認での注意点 + +- **Air ホットリロード**: 変更後数秒待ってからテスト +- **Wire 生成**: 新規 API がある場合のみ `make wire-gen` を実行 +- **Docker**: 基本的に手動での build/restart は不要 From 2b3369b8f1dac79625c16c7b1e551e3ec3020eb1 Mon Sep 17 00:00:00 2001 From: hikahana <22.h.hanada.nutfes@gmail.com> Date: Wed, 16 Jul 2025 13:51:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20manual=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cursor/rules/github-pr-creation.mdc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.cursor/rules/github-pr-creation.mdc b/.cursor/rules/github-pr-creation.mdc index cfe34382..0fa3359c 100644 --- a/.cursor/rules/github-pr-creation.mdc +++ b/.cursor/rules/github-pr-creation.mdc @@ -1,8 +1,6 @@ --- -alwaysApply: true -description: GitHub MCPを使用したPR作成方法とテンプレート活用のガイド +alwaysApply: false --- - # GitHub MCP を使用した PR 作成方法 ## 基本的な PR 作成の流れ