From 1e27045fc0d037d91071d3a80058f5c21079bfd3 Mon Sep 17 00:00:00 2001 From: UtakataKyosui Date: Fri, 26 Sep 2025 20:21:23 +0900 Subject: [PATCH 1/2] feat: extends action that claude code action with spec-kit --- .github/workflows/claude-code-review.yml | 5 +- .github/workflows/claude-docs.yml | 190 ++++++++++++++++++ .../workflows/claude-project-management.yml | 183 +++++++++++++++++ .github/workflows/claude-project.yml | 178 ++++++++++++++++ .github/workflows/claude-spec.yml | 170 ++++++++++++++++ CLAUDE.md | 32 +-- docs/COMMANDS.md | 68 +++---- 7 files changed, 774 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/claude-docs.yml create mode 100644 .github/workflows/claude-project-management.yml create mode 100644 .github/workflows/claude-project.yml create mode 100644 .github/workflows/claude-spec.yml diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 675b0a3..38a8492 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -36,6 +36,7 @@ jobs: uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} prompt: | Please review this pull request and provide feedback on: - Code quality and best practices @@ -43,11 +44,11 @@ jobs: - Performance considerations - Security concerns - Test coverage - + Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback. Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR. - + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md # or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' diff --git a/.github/workflows/claude-docs.yml b/.github/workflows/claude-docs.yml new file mode 100644 index 0000000..5c667a5 --- /dev/null +++ b/.github/workflows/claude-docs.yml @@ -0,0 +1,190 @@ +name: Claude Code Documentation + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude-docs: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude docs')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude docs')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude docs')) || + (github.event_name == 'issues' && ( + contains(github.event.issue.body, '@claude docs') || + contains(github.event.issue.title, '@claude docs') + )) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + actions: read + statuses: write + repository-projects: write + id-token: write + env: + TZ: Asia/Tokyo + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install uv CLI + uses: astral-sh/setup-uv@v4 + + - name: Setup Git configuration + run: | + git config --global user.name "Claude Code Docs" + git config --global user.email "claude-code-docs@anthropic.com" + git config --global init.defaultBranch main + + - name: Get PR info (only if PR) + if: ${{ github.event.issue.pull_request }} + run: | + if ! gh pr view ${{ github.event.issue.number }} --json number,title,body,baseRefName,headRefName > pr_info.json; then + echo "Failed to get PR info, creating empty file" + echo '{}' > pr_info.json + fi + + - name: Export PR info + if: ${{ github.event.issue.pull_request }} + run: | + if [ -s pr_info.json ] && [ "$(jq -r .title pr_info.json)" != "null" ]; then + jq -r .title pr_info.json | tr -d '\r' | while IFS= read -r line; do + echo "PR_TITLE=$line" >> $GITHUB_ENV + done + + pr_body=$(jq -r .body pr_info.json | tr -d '\r') + echo "PR_BODY<> $GITHUB_ENV + echo "$pr_body" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + echo "PR_BASE=$(jq -r .baseRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + echo "PR_HEAD=$(jq -r .headRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + else + echo "PR_TITLE=" >> $GITHUB_ENV + echo "PR_BODY=" >> $GITHUB_ENV + echo "PR_BASE=" >> $GITHUB_ENV + echo "PR_HEAD=" >> $GITHUB_ENV + fi + + - name: Load documentation prompt + run: | + if [ -f docs/docs-prompt.md ]; then + PROMPT_CONTENT="$(cat docs/docs-prompt.md)" + else + PROMPT_CONTENT="# ドキュメント生成・改善支援 + + ## ドキュメント生成コマンド利用可能 + + 以下のスラッシュコマンドを適切に判断して実行してください: + + - \`/documentation:docs-gen\` - 自動ドキュメント生成 + + ## 生成可能なドキュメント + + ### API仕様書 + - OpenAPI/Swagger仕様書 + - GraphQL スキーマドキュメント + - REST API エンドポイント一覧 + - 認証・認可方式の説明 + + ### README・ガイド + - プロジェクトREADME + - インストール・セットアップガイド + - 使用方法・チュートリアル + - 貢献者向けガイド + + ### コード仕様書 + - モジュール・クラス仕様書 + - 関数・メソッドリファレンス + - アーキテクチャ設計書 + - データベーススキーマ + + ### その他ドキュメント + - CHANGELOG・リリースノート + - ライセンス・著作権情報 + - FAQ・トラブルシューティング + - デプロイメント手順 + + ## 実行ガイドライン + + 1. **プロジェクト構造**を分析してドキュメント種別を判断 + 2. **既存ドキュメント**を確認して更新・改善 + 3. **ターゲット読者**に応じた適切な詳細レベル + 4. **多言語対応**(日本語・英語) + + コメント内容から必要なドキュメント種別を判断し、適切な生成・更新を実行してください。" + fi + { + echo 'DOCS_PROMPT<> $GITHUB_ENV + + - name: Run Claude Code Documentation + id: claude-docs + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + settings: ".claude/settings.json" + track_progress: true + branch_prefix: docs/ + use_sticky_comment: true + additional_permissions: | + actions: read + contents: write + pull-requests: write + issues: write + statuses: write + repository-projects: write + id-token: write + prompt: | + # Claude Code ドキュメント生成・改善支援 + + ## GitHub コンテキスト + リポジトリ: ${{ github.repository }} + 実行ユーザー: ${{ github.actor }} + + ### PR / Issue 情報 + - PR番号: ${{ github.event.issue.number }} + - PRタイトル: ${{ env.PR_TITLE }} + - PR本文: | + ${{ env.PR_BODY }} + - コメント本文: | + ${{ github.event.comment.body }} + + ### ブランチ情報 + - Baseブランチ: ${{ env.PR_BASE }} + - Headブランチ: ${{ env.PR_HEAD }} + - Baseブランチ (GitHub): ${{ github.base_ref }} + - Headブランチ (GitHub): ${{ github.head_ref }} + + ${{ env.DOCS_PROMPT }} + + - name: Post completion status + if: success() + run: | + echo "✅ Claude Code Documentation completed successfully" + + - name: Post failure status + if: failure() + run: | + echo "❌ Claude Code Documentation failed" + exit 1 \ No newline at end of file diff --git a/.github/workflows/claude-project-management.yml b/.github/workflows/claude-project-management.yml new file mode 100644 index 0000000..693380c --- /dev/null +++ b/.github/workflows/claude-project-management.yml @@ -0,0 +1,183 @@ +name: Claude Code Project Management + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude-project-management: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude spec')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude spec')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude spec')) || + (github.event_name == 'issues' && ( + contains(github.event.issue.body, '@claude spec') || + contains(github.event.issue.title, '@claude spec') + )) + runs-on: ubuntu-latest + permissions: + # リポジトリのコードやファイルへのアクセス権を付与 + contents: write + # Pull Request周りの権限の付与 + pull-requests: write + # Issue の作成や更新の権限を付与 + issues: write + # 他のワークフローの実行状態やログの閲覧権限 + actions: read + # commit や PR にステータスを付与する権限の付与 + statuses: write + # リポジトリの Projects(旧プロジェクトボード)を操作する権限 + repository-projects: write + id-token: write + env: + TZ: Asia/Tokyo + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 👈 GH_TOKEN を追加して .mcp.json と一致させる + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install uv CLI + uses: astral-sh/setup-uv@v4 + + - name: Setup Git configuration + run: | + git config --global user.name "Claude Code PM" + git config --global user.email "claude-code-pm@anthropic.com" + git config --global init.defaultBranch main + + - name: Get PR info (only if PR) + if: ${{ github.event.issue.pull_request }} + run: | + if ! gh pr view ${{ github.event.issue.number }} --json number,title,body,baseRefName,headRefName > pr_info.json; then + echo "Failed to get PR info, creating empty file" + echo '{}' > pr_info.json + fi + + - name: Export PR info + if: ${{ github.event.issue.pull_request }} + run: | + if [ -s pr_info.json ] && [ "$(jq -r .title pr_info.json)" != "null" ]; then + # PR_TITLE + jq -r .title pr_info.json | tr -d '\r' | while IFS= read -r line; do + echo "PR_TITLE=$line" >> $GITHUB_ENV + done + + # PR_BODY + pr_body=$(jq -r .body pr_info.json | tr -d '\r') + echo "PR_BODY<> $GITHUB_ENV + echo "$pr_body" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + echo "PR_BASE=$(jq -r .baseRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + echo "PR_HEAD=$(jq -r .headRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + else + echo "PR_TITLE=" >> $GITHUB_ENV + echo "PR_BODY=" >> $GITHUB_ENV + echo "PR_BASE=" >> $GITHUB_ENV + echo "PR_HEAD=" >> $GITHUB_ENV + fi + + - name: Load project management prompt from file + run: | + if [ -f docs/project-management-prompt.md ]; then + PROMPT_CONTENT="$(cat docs/project-management-prompt.md)" + else + PROMPT_CONTENT="# プロジェクト管理・仕様定義用 Claude Code + + ## 実行可能なコマンド + + ### Spec Kit統合コマンド(仕様駆動開発) + - \\`/spec-kit:specify\\` - 自然言語から仕様作成 + - \\`/spec-kit:plan\\` - 仕様から実装計画作成 + - \\`/spec-kit:clarify\\` - 仕様の対話的明確化 + - \\`/spec-kit:tasks\\` - TDD準拠のタスクリスト生成 + - \\`/spec-kit:implement\\` - TDDサイクルでの実装 + - \\`/spec-kit:analyze\\` - 既存仕様の分析 + - \\`/spec-kit:constitution\\` - プロジェクト憲法管理 + + ### プロジェクト管理 + - \\`/project-management:setup-project\\` - プロジェクトの初期セットアップ + + ### ドキュメント生成 + - \\`/documentation:docs-gen\\` - ドキュメント生成 + + ## 実行ガイドライン + + 1. **TDD統合開発フロー**: 仕様駆動開発とテスト駆動開発を組み合わせたワークフロー + 2. **Issue Driven開発**: すべての開発はIssueから開始し、Issueに紐づけて進める + 3. **プロジェクト憲法遵守**: 開発原則の一貫した適用と品質ゲートの実行 + 4. **MCPツール優先使用**: 開発作業では基本的にMCPツールを使用する + + プロジェクトのREADME.mdとCLAUDE.mdを参照して、仕様定義、計画、実装を進めてください。" + fi + { + echo 'PM_PROMPT<> $GITHUB_ENV + + - name: Run Claude Code Project Management + id: claude-pm + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + settings: ".claude/settings.json" + track_progress: true + branch_prefix: feature/spec- + use_sticky_comment: true + additional_permissions: | + actions: read + contents: write + pull-requests: write + issues: write + statuses: write + repository-projects: write + id-token: write + prompt: | + # Claude Code Project Management Prompt + + ## GitHub コンテキスト + リポジトリ: ${{ github.repository }} + 実行ユーザー: ${{ github.actor }} + + ### PR / Issue 情報 + - PR番号: ${{ github.event.issue.number }} + - PRタイトル: ${{ env.PR_TITLE }} + - PR本文: | + ${{ env.PR_BODY }} + - コメント本文: | + ${{ github.event.comment.body }} + + ### ブランチ情報 + - Baseブランチ: ${{ env.PR_BASE }} + - Headブランチ: ${{ env.PR_HEAD }} + - Baseブランチ (GitHub): ${{ github.base_ref }} + - Headブランチ (GitHub): ${{ github.head_ref }} + + ${{ env.PM_PROMPT }} + + - name: Post completion status + if: success() + run: | + echo "✅ Claude Code Project Management completed successfully" + + - name: Post failure status + if: failure() + run: | + echo "❌ Claude Code Project Management failed" + exit 1 \ No newline at end of file diff --git a/.github/workflows/claude-project.yml b/.github/workflows/claude-project.yml new file mode 100644 index 0000000..aa8f3a5 --- /dev/null +++ b/.github/workflows/claude-project.yml @@ -0,0 +1,178 @@ +name: Claude Code Project Setup + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude-project: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude setup')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude setup')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude setup')) || + (github.event_name == 'issues' && ( + contains(github.event.issue.body, '@claude setup') || + contains(github.event.issue.title, '@claude setup') + )) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + actions: read + statuses: write + repository-projects: write + id-token: write + env: + TZ: Asia/Tokyo + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install uv CLI + uses: astral-sh/setup-uv@v4 + + - name: Setup Git configuration + run: | + git config --global user.name "Claude Code Project" + git config --global user.email "claude-code-project@anthropic.com" + git config --global init.defaultBranch main + + - name: Get PR info (only if PR) + if: ${{ github.event.issue.pull_request }} + run: | + if ! gh pr view ${{ github.event.issue.number }} --json number,title,body,baseRefName,headRefName > pr_info.json; then + echo "Failed to get PR info, creating empty file" + echo '{}' > pr_info.json + fi + + - name: Export PR info + if: ${{ github.event.issue.pull_request }} + run: | + if [ -s pr_info.json ] && [ "$(jq -r .title pr_info.json)" != "null" ]; then + jq -r .title pr_info.json | tr -d '\r' | while IFS= read -r line; do + echo "PR_TITLE=$line" >> $GITHUB_ENV + done + + pr_body=$(jq -r .body pr_info.json | tr -d '\r') + echo "PR_BODY<> $GITHUB_ENV + echo "$pr_body" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + echo "PR_BASE=$(jq -r .baseRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + echo "PR_HEAD=$(jq -r .headRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + else + echo "PR_TITLE=" >> $GITHUB_ENV + echo "PR_BODY=" >> $GITHUB_ENV + echo "PR_BASE=" >> $GITHUB_ENV + echo "PR_HEAD=" >> $GITHUB_ENV + fi + + - name: Load project management prompt + run: | + if [ -f docs/project-prompt.md ]; then + PROMPT_CONTENT="$(cat docs/project-prompt.md)" + else + PROMPT_CONTENT="# プロジェクト管理・初期セットアップ支援 + + ## プロジェクト管理コマンド利用可能 + + 以下のスラッシュコマンドを適切に判断して実行してください: + + - \`/project-management:setup-project\` - プロジェクトの初期セットアップ + + ## 実行内容 + + ### プロジェクト初期セットアップ + - プロジェクト構造の分析・作成 + - 設定ファイルの確認・生成 + - 依存関係の解決 + - 開発環境の初期化 + - CI/CD設定の確認 + + ### 対象環境 + - Rust、Node.js、Python、Go、Java/Kotlin等 + - Web開発、モバイル開発、デスクトップ開発 + - 各種フレームワーク・ライブラリに対応 + + ## 実行ガイドライン + + 1. **プロジェクト構造の確認**から開始 + 2. **READMEとCLAUDE.md**を参照して適切なセットアップを実行 + 3. **MCPツール**を優先使用 + 4. **開発環境の一貫性**を保持 + + コメント内容からプロジェクトのニーズを判断し、適切なセットアップを実行してください。" + fi + { + echo 'PROJECT_PROMPT<> $GITHUB_ENV + + - name: Run Claude Code Project Management + id: claude-project + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + settings: ".claude/settings.json" + track_progress: true + branch_prefix: setup/ + use_sticky_comment: true + additional_permissions: | + actions: read + contents: write + pull-requests: write + issues: write + statuses: write + repository-projects: write + id-token: write + prompt: | + # Claude Code プロジェクト管理・初期セットアップ支援 + + ## GitHub コンテキスト + リポジトリ: ${{ github.repository }} + 実行ユーザー: ${{ github.actor }} + + ### PR / Issue 情報 + - PR番号: ${{ github.event.issue.number }} + - PRタイトル: ${{ env.PR_TITLE }} + - PR本文: | + ${{ env.PR_BODY }} + - コメント本文: | + ${{ github.event.comment.body }} + + ### ブランチ情報 + - Baseブランチ: ${{ env.PR_BASE }} + - Headブランチ: ${{ env.PR_HEAD }} + - Baseブランチ (GitHub): ${{ github.base_ref }} + - Headブランチ (GitHub): ${{ github.head_ref }} + + ${{ env.PROJECT_PROMPT }} + + - name: Post completion status + if: success() + run: | + echo "✅ Claude Code Project Management completed successfully" + + - name: Post failure status + if: failure() + run: | + echo "❌ Claude Code Project Management failed" + exit 1 \ No newline at end of file diff --git a/.github/workflows/claude-spec.yml b/.github/workflows/claude-spec.yml new file mode 100644 index 0000000..949aaaf --- /dev/null +++ b/.github/workflows/claude-spec.yml @@ -0,0 +1,170 @@ +name: Claude Code Specification + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude-spec: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude plan')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude plan')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude plan')) || + (github.event_name == 'issues' && ( + contains(github.event.issue.body, '@claude plan') || + contains(github.event.issue.title, '@claude plan') + )) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + actions: read + statuses: write + repository-projects: write + id-token: write + env: + TZ: Asia/Tokyo + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install uv CLI + uses: astral-sh/setup-uv@v4 + + - name: Setup Git configuration + run: | + git config --global user.name "Claude Code Spec" + git config --global user.email "claude-code-spec@anthropic.com" + git config --global init.defaultBranch main + + - name: Get PR info (only if PR) + if: ${{ github.event.issue.pull_request }} + run: | + if ! gh pr view ${{ github.event.issue.number }} --json number,title,body,baseRefName,headRefName > pr_info.json; then + echo "Failed to get PR info, creating empty file" + echo '{}' > pr_info.json + fi + + - name: Export PR info + if: ${{ github.event.issue.pull_request }} + run: | + if [ -s pr_info.json ] && [ "$(jq -r .title pr_info.json)" != "null" ]; then + jq -r .title pr_info.json | tr -d '\r' | while IFS= read -r line; do + echo "PR_TITLE=$line" >> $GITHUB_ENV + done + + pr_body=$(jq -r .body pr_info.json | tr -d '\r') + echo "PR_BODY<> $GITHUB_ENV + echo "$pr_body" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + echo "PR_BASE=$(jq -r .baseRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + echo "PR_HEAD=$(jq -r .headRefName pr_info.json | tr -d '\r')" >> $GITHUB_ENV + else + echo "PR_TITLE=" >> $GITHUB_ENV + echo "PR_BODY=" >> $GITHUB_ENV + echo "PR_BASE=" >> $GITHUB_ENV + echo "PR_HEAD=" >> $GITHUB_ENV + fi + + - name: Load specification prompt + run: | + if [ -f docs/spec-prompt.md ]; then + PROMPT_CONTENT="$(cat docs/spec-prompt.md)" + else + PROMPT_CONTENT="# 仕様定義・計画・実装支援 + + ## Spec Kit統合コマンド利用可能 + + 以下のスラッシュコマンドを適切に判断して実行してください: + + - \`/spec-kit:specify\` - 自然言語から正式な仕様を作成 + - \`/spec-kit:plan\` - 仕様から具体的な実装計画を生成 + - \`/spec-kit:clarify\` - 仕様の曖昧な点を対話的に明確化 + - \`/spec-kit:tasks\` - 実装計画からTDD準拠のタスクリストを生成 + - \`/spec-kit:implement\` - TDDサイクルに従った機能実装 + - \`/spec-kit:analyze\` - 既存仕様の分析と評価 + - \`/spec-kit:constitution\` - プロジェクト憲法の作成・更新 + + ## 実行ガイドライン + + 1. **Spec Kit + TDD統合開発フロー**を採用 + 2. **Issue Driven開発**でIssueに紐づけて進める + 3. **MCPツール**を優先使用 + 4. **プロジェクト憲法**への準拠を確認 + + コメント内容から適切な作業を判断し、必要に応じて複数のスラッシュコマンドを組み合わせて実行してください。" + fi + { + echo 'SPEC_PROMPT<> $GITHUB_ENV + + - name: Run Claude Code Specification + id: claude-spec + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + settings: ".claude/settings.json" + track_progress: true + branch_prefix: feature/spec- + use_sticky_comment: true + additional_permissions: | + actions: read + contents: write + pull-requests: write + issues: write + statuses: write + repository-projects: write + id-token: write + prompt: | + # Claude Code 仕様定義・計画・実装支援 + + ## GitHub コンテキスト + リポジトリ: ${{ github.repository }} + 実行ユーザー: ${{ github.actor }} + + ### PR / Issue 情報 + - PR番号: ${{ github.event.issue.number }} + - PRタイトル: ${{ env.PR_TITLE }} + - PR本文: | + ${{ env.PR_BODY }} + - コメント本文: | + ${{ github.event.comment.body }} + + ### ブランチ情報 + - Baseブランチ: ${{ env.PR_BASE }} + - Headブランチ: ${{ env.PR_HEAD }} + - Baseブランチ (GitHub): ${{ github.base_ref }} + - Headブランチ (GitHub): ${{ github.head_ref }} + + ${{ env.SPEC_PROMPT }} + + - name: Post completion status + if: success() + run: | + echo "✅ Claude Code Specification completed successfully" + + - name: Post failure status + if: failure() + run: | + echo "❌ Claude Code Specification failed" + exit 1 \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 1e04a60..a1652b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -43,23 +43,23 @@ 以下のスラッシュコマンドが利用可能です: ### プロジェクト管理 -- `/setup-project` - プロジェクトの初期セットアップ +- `/project-management:setup-project` - プロジェクトの初期セットアップ ### Spec Kit統合コマンド(仕様駆動開発) -- `/specify` - 自然言語から仕様作成 -- `/plan` - 仕様から実装計画作成 -- `/clarify` - 仕様の対話的明確化 -- `/tasks` - TDD準拠のタスクリスト生成 -- `/implement` - TDDサイクルでの実装 -- `/analyze` - 既存仕様の分析 -- `/constitution` - プロジェクト憲法管理 +- `/spec-kit:specify` - 自然言語から仕様作成 +- `/spec-kit:plan` - 仕様から実装計画作成 +- `/spec-kit:clarify` - 仕様の対話的明確化 +- `/spec-kit:tasks` - TDD準拠のタスクリスト生成 +- `/spec-kit:implement` - TDDサイクルでの実装 +- `/spec-kit:analyze` - 既存仕様の分析 +- `/spec-kit:constitution` - プロジェクト憲法管理 ### 開発支援 -- `/code-review` - コード品質分析とレビュー -- `/debug-help` - デバッグ支援とエラー分析 -- `/refactor` - コードリファクタリングと改善 -- `/test-gen` - テストコード生成 -- `/docs-gen` - ドキュメント生成 +- `/development:code-review` - コード品質分析とレビュー +- `/development:debug-help` - デバッグ支援とエラー分析 +- `/development:refactor` - コードリファクタリングと改善 +- `/development:test-gen` - テストコード生成 +- `/documentation:docs-gen` - ドキュメント生成 ## 専門サブエージェント 専門分野に特化したサブエージェントが利用可能です: @@ -73,9 +73,9 @@ ## 使用方法 ### スラッシュコマンドの使用 ``` -@claude /setup-project -@claude /code-review src/main.rs -@claude /test-gen --unit --integration +@claude /project-management:setup-project +@claude /development:code-review src/main.rs +@claude /development:test-gen --unit --integration ``` ### サブエージェントの呼び出し diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index 0292b2e..b48513e 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -36,11 +36,11 @@ ### プロジェクト管理コマンド -#### `/setup-project` - プロジェクト初期セットアップ +#### `/project-management:setup-project` - プロジェクト初期セットアップ **概要**: 新規プロジェクトの初期セットアップを自動実行 **使用例**: ```bash -@claude /setup-project +@claude /project-management:setup-project ``` **実行内容**: - プロジェクト構造の分析・作成 @@ -55,24 +55,24 @@ ### Spec Kit統合コマンド(仕様駆動開発) -#### `/specify` - 仕様作成 +#### `/spec-kit:specify` - 仕様作成 **概要**: 自然言語の機能説明から正式な仕様を作成 **使用例**: ```bash -@claude /specify ユーザー登録機能を実装したい。メールとパスワードで登録し、重複チェックも行う +@claude /spec-kit:specify ユーザー登録機能を実装したい。メールとパスワードで登録し、重複チェックも行う ``` **出力**: - 専用ブランチ作成 - 仕様ファイル(`.specify/specs/[###-feature]/spec.md`) - 機能要求・受入条件の明確化 -#### `/plan` - 実装計画作成 +#### `/spec-kit:plan` - 実装計画作成 **概要**: 仕様から具体的な実装計画を生成 **使用例**: ```bash -@claude /plan +@claude /spec-kit:plan ``` -**前提条件**: 仕様ファイル(`/specify`の実行後) +**前提条件**: 仕様ファイル(`/spec-kit:specify`の実行後) **出力**: - `plan.md` - 全体設計・技術選定 - `research.md` - 技術調査結果 @@ -80,52 +80,52 @@ - `contracts/` - API契約定義 - `quickstart.md` - 検証手順 -#### `/clarify` - 仕様明確化 +#### `/spec-kit:clarify` - 仕様明確化 **概要**: 仕様の曖昧な点を対話的に明確化 **使用例**: ```bash -@claude /clarify パスワード要件とメール認証の必要性について +@claude /spec-kit:clarify パスワード要件とメール認証の必要性について ``` **機能**: インタラクティブな質疑応答で仕様を改善 -#### `/tasks` - タスク生成 +#### `/spec-kit:tasks` - タスク生成 **概要**: 実装計画からTDD準拠のタスクリストを生成 **使用例**: ```bash -@claude /tasks +@claude /spec-kit:tasks ``` -**前提条件**: 実装計画(`/plan`の実行後) +**前提条件**: 実装計画(`/spec-kit:plan`の実行後) **出力**: - TDD順序のタスクリスト - 並列実行可能タスクのマーク `[P]` - 依存関係の明確化 - 具体的ファイルパス指定 -#### `/implement` - TDD実装 +#### `/spec-kit:implement` - TDD実装 **概要**: TDDサイクルに従った機能実装 **使用例**: ```bash -@claude /implement +@claude /spec-kit:implement ``` -**前提条件**: タスクリスト(`/tasks`の実行後) +**前提条件**: タスクリスト(`/spec-kit:tasks`の実行後) **実装サイクル**: 1. Red: テスト作成(失敗) 2. Green: 最小限実装 3. Refactor: コード改善 -#### `/analyze` - 仕様解析 +#### `/spec-kit:analyze` - 仕様解析 **概要**: 既存仕様の分析と評価 **使用例**: ```bash -@claude /analyze spec.md +@claude /spec-kit:analyze spec.md ``` **機能**: 仕様の完全性・一貫性チェック -#### `/constitution` - プロジェクト憲法管理 +#### `/spec-kit:constitution` - プロジェクト憲法管理 **概要**: 開発原則の作成・更新と準拠確認 **使用例**: ```bash -@claude /constitution +@claude /spec-kit:constitution ``` **機能**: - プロジェクト憲法の作成・更新 @@ -136,12 +136,12 @@ ### 開発支援コマンド -#### `/code-review` - コード品質分析 +#### `/development:code-review` - コード品質分析 **概要**: コードの品質分析とレビュー実行 **使用例**: ```bash -@claude /code-review src/main.rs -@claude /code-review src/ +@claude /development:code-review src/main.rs +@claude /development:code-review src/ ``` **分析項目**: - バグ・セキュリティ問題 @@ -149,12 +149,12 @@ - 可読性・保守性 - ベストプラクティス準拠 -#### `/debug-help` - デバッグ支援 +#### `/development:debug-help` - デバッグ支援 **概要**: エラー分析とデバッグ支援 **使用例**: ```bash -@claude /debug-help テストが失敗している -@claude /debug-help --error-log error.log +@claude /development:debug-help テストが失敗している +@claude /development:debug-help --error-log error.log ``` **機能**: - エラー原因分析 @@ -162,12 +162,12 @@ - ログ解析 - デバッグ戦略提案 -#### `/refactor` - リファクタリング +#### `/development:refactor` - リファクタリング **概要**: コードのリファクタリングと改善 **使用例**: ```bash -@claude /refactor src/services/ -@claude /refactor --extract-function complex_method +@claude /development:refactor src/services/ +@claude /development:refactor --extract-function complex_method ``` **実行内容**: - コード構造改善 @@ -175,24 +175,24 @@ - 設計パターン適用 - パフォーマンス最適化 -#### `/test-gen` - テストコード生成 +#### `/development:test-gen` - テストコード生成 **概要**: 自動テストコード生成 **使用例**: ```bash -@claude /test-gen --unit --integration -@claude /test-gen src/models/user.rs +@claude /development:test-gen --unit --integration +@claude /development:test-gen src/models/user.rs ``` **テスト種類**: - 単体テスト(unit) - 統合テスト(integration) - 契約テスト(contract) -#### `/docs-gen` - ドキュメント生成 +#### `/documentation:docs-gen` - ドキュメント生成 **概要**: 自動ドキュメント生成 **使用例**: ```bash -@claude /docs-gen -@claude /docs-gen --api --readme +@claude /documentation:docs-gen +@claude /documentation:docs-gen --api --readme ``` **生成内容**: - API仕様書 From 02658c0e2a3d996aedf9b5b5416593390e1b7da3 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:28:19 +0900 Subject: [PATCH 2/2] fix: correct command naming for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change /development:test-gen to /testing:test-gen to match directory structure - Reorganize CLAUDE.md sections to separate Testing and Documentation commands - Create dedicated Documentation section in docs/COMMANDS.md - Update all usage examples with correct command names Co-authored-by: ウタカタキョウスイ --- CLAUDE.md | 8 ++++++-- docs/COMMANDS.md | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a1652b9..c7dfdb4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,11 @@ - `/development:code-review` - コード品質分析とレビュー - `/development:debug-help` - デバッグ支援とエラー分析 - `/development:refactor` - コードリファクタリングと改善 -- `/development:test-gen` - テストコード生成 + +### テスト +- `/testing:test-gen` - テストコード生成 + +### ドキュメンテーション - `/documentation:docs-gen` - ドキュメント生成 ## 専門サブエージェント @@ -75,7 +79,7 @@ ``` @claude /project-management:setup-project @claude /development:code-review src/main.rs -@claude /development:test-gen --unit --integration +@claude /testing:test-gen --unit --integration ``` ### サブエージェントの呼び出し diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index b48513e..7d9740a 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -175,18 +175,22 @@ - 設計パターン適用 - パフォーマンス最適化 -#### `/development:test-gen` - テストコード生成 +#### `/testing:test-gen` - テストコード生成 **概要**: 自動テストコード生成 **使用例**: ```bash -@claude /development:test-gen --unit --integration -@claude /development:test-gen src/models/user.rs +@claude /testing:test-gen --unit --integration +@claude /testing:test-gen src/models/user.rs ``` **テスト種類**: - 単体テスト(unit) - 統合テスト(integration) - 契約テスト(contract) +--- + +### ドキュメンテーションコマンド + #### `/documentation:docs-gen` - ドキュメント生成 **概要**: 自動ドキュメント生成 **使用例**: