nx/.claude/commands/gh-issue-plan.md
Jason Jean 8cec6ceebb
chore(repo): setup claude code (#31380)
## Summary

This PR integrates Claude Code AI assistant capabilities into the Nx
repository through GitHub Actions and workspace configuration.

## Changes Made

### 🤖 GitHub Actions Integration
- **Added `.github/workflows/claude.yml`**: GitHub Actions workflow that
triggers Claude Code on:
  - Issue comments containing `@claude`
  - Pull request review comments containing `@claude` 
  - Pull request reviews containing `@claude`
  - New issues with `@claude` in title or body
- Configured appropriate permissions for repository access and PR/issue
management
- See [Claude Code GitHub Actions
documentation](https://docs.anthropic.com/en/docs/claude-code/cli-usage#github-actions)
for usage details

### 📝 Project Documentation & Configuration
- **Added `CLAUDE.md`**: Comprehensive instructions for Claude Code
including:
  - Repository-specific guidance and best practices
  - Essential commands for development workflow
- Testing procedures (individual projects → affected projects → e2e
tests)
  - GitHub issue resolution workflow
  - Pre-push validation requirements
- **Added `.claude/settings.json`**: Claude Code permissions and
environment configuration
- **Added `.mcp.json`**: Model Context Protocol server configuration for
Nx workspace integration

### 🔧 Workspace Setup
- **Updated `package.json`**: Added `nx-mcp` dependency for enhanced
workspace integration
- **Updated `pnpm-lock.yaml`**: Lock file changes for new dependency
- **Updated `.gitignore`**: Added Claude-specific ignore patterns
- **Updated `CODEOWNERS`**: Assigned ownership of Claude-related files
to @FrozenPandaz
- **Updated `CONTRIBUTING.md`**: Enhanced contribution guidelines with
technology stack information

## Benefits

- Enables AI-assisted development and issue resolution through GitHub
- Provides Claude with deep understanding of Nx workspace structure via
MCP
- Establishes clear development workflows and validation procedures
- Maintains security through configured permissions and environment
settings

## Usage

After this PR is merged, team members and contributors can:
1. Comment `@claude` in issues or PRs to get AI assistance
2. Use Claude Code locally with enhanced Nx workspace understanding
3. Follow established workflows for testing and validation

For more information, see the [Claude Code
documentation](https://docs.anthropic.com/en/docs/claude-code).

## Test Plan

- [x] Verify GitHub Actions workflow syntax is valid
- [x] Confirm Claude Code configuration files are properly structured
- [x] Validate new dependency integration
- [x] Test workflow triggers on issue/PR interactions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-30 18:14:11 -04:00

3.8 KiB

GitHub Issue Planning and Resolution

This command provides guidance for both automated and manual GitHub issue workflows.

Automated Workflow (GitHub Actions)

The automated workflow consists of two phases:

Phase 1: Planning (@claude plan or claude:plan label)

  • Claude analyzes the issue and creates a detailed implementation plan
  • Plan is posted as a comment on the issue
  • Issue is labeled with claude:planned

Phase 2: Implementation (@claude implement or claude:implement label)

  • Claude implements the solution based on the plan
  • Runs validation tests and creates a feature branch
  • Suggests opening a PR with proper formatting

Planning Phase Template

When creating a plan (either automated or manual), include these sections:

Problem Analysis

  • Root cause identification
  • Impact assessment
  • Related components or systems affected

Proposed Solution

  • High-level approach
  • Alternative solutions considered
  • Trade-offs and rationale

Implementation Details

  • Files that need to be modified
  • Key changes required
  • Dependencies or prerequisites

Testing Strategy

  • Unit tests to add/modify
  • Integration tests needed
  • E2E test considerations

Validation Steps

# Test specific affected projects
nx run-many -t test,build,lint -p PROJECT_NAME

# Test all affected projects
nx affected -t build,test,lint

# Run affected e2e tests
nx affected -t e2e-local

# Format code
npx nx prettier -- FILES

# Final validation
pnpm nx prepush

Risks and Considerations

  • Breaking changes
  • Performance implications
  • Migration requirements

Manual Workflow

When working on a GitHub issue manually, follow this systematic approach:

1. Get Issue Details

# Get issue details using GitHub CLI (replace ISSUE_NUMBER with actual number)
gh issue view ISSUE_NUMBER

When cloning reproduction repos, please clone within ./tmp/claude/repro-ISSUE_NUMBER

2. Analyze the Plan

  • Look for a plan or implementation details in the issue description
  • Check comments for additional context or clarification
  • Identify affected projects and components

3. Implement the Solution

  • Follow the plan outlined in the issue
  • Make focused changes that address the specific problem
  • Ensure code follows existing patterns and conventions

4. Run Full Validation

# Test specific affected projects first
nx run-many -t test,build,lint -p PROJECT_NAME

# Test all affected projects
nx affected -t build,test,lint

# Run affected e2e tests
nx affected -t e2e-local

# Final pre-push validation
pnpm nx prepush

5. Submit Pull Request

  • Create a descriptive PR title that references the issue
  • Include "Fixes #ISSUE_NUMBER" in the PR description
  • Provide a clear summary of changes made
  • Request appropriate reviewers

Pull Request Template

When creating a pull request, follow the template found in .github/PULL_REQUEST_TEMPLATE.md. The template includes:

Required Sections

  1. Current Behavior: Describe the behavior we have today
  2. Expected Behavior: Describe the behavior we should expect with the changes in this PR
  3. Related Issue(s): Link the issue being fixed so it gets closed when the PR is merged

Template Format

## Current Behavior

<!-- This is the behavior we have today -->

## Expected Behavior

<!-- This is the behavior we should expect with the changes in this PR -->

## Related Issue(s)

<!-- Please link the issue being fixed so it gets closed when this is merged. -->

Fixes #ISSUE_NUMBER

Guidelines

  • Ensure your commit message follows the conventional commit format (use pnpm commit)
  • Read the submission guidelines in CONTRIBUTING.md before posting
  • For complex changes, you can request a dedicated Nx release by mentioning the Nx team
  • Always link the related issue using "Fixes #ISSUE_NUMBER" to automatically close it when merged