Skip to content

chore(repo): setup claude code #31380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025

Conversation

FrozenPandaz
Copy link
Collaborator

@FrozenPandaz FrozenPandaz commented May 29, 2025

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 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.

Test Plan

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

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Copy link

vercel bot commented May 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview May 30, 2025 9:34pm

Copy link

nx-cloud bot commented May 29, 2025

View your CI Pipeline Execution ↗ for commit 7916be2.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 42m 52s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 20s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 2s View ↗
nx documentation ✅ Succeeded 56s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-30 22:11:01 UTC

@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch from 1f9f27e to fd9ef50 Compare May 29, 2025 13:33
@FrozenPandaz FrozenPandaz marked this pull request as ready for review May 29, 2025 13:51
@FrozenPandaz FrozenPandaz requested a review from a team as a code owner May 29, 2025 13:51
@FrozenPandaz FrozenPandaz requested a review from Cammisuli May 29, 2025 13:51
Comment on lines 21 to 30
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current permissions configuration only grants read access to repository contents and pull requests, which will limit Claude's ability to respond effectively. For Claude to create comments, make commits, or implement code changes, the workflow needs write permissions for these resources.

Consider updating the permissions block to:

permissions:
  contents: write
  pull-requests: write
  issues: read
  id-token: write

This will allow Claude to fully interact with the repository when responding to requests.

Suggested change
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
permissions:
contents: write
pull-requests: write
issues: read
id-token: write

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@FrozenPandaz FrozenPandaz marked this pull request as draft May 29, 2025 13:57
@FrozenPandaz FrozenPandaz changed the title Add Claude Code GitHub Workflow feat(repo): setup claude code May 29, 2025
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 2 times, most recently from d3f65ce to 00f2d80 Compare May 29, 2025 19:01
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch from 00f2d80 to 62b6d1f Compare May 29, 2025 20:04
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 2 times, most recently from 2e3d964 to 5b9d860 Compare May 29, 2025 20:26
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 3 times, most recently from 29f8f00 to e972ce1 Compare May 29, 2025 21:47
@FrozenPandaz FrozenPandaz requested a review from Copilot May 29, 2025 21:50
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Integrate Claude Code AI assistant capabilities into the Nx repository via GitHub Actions and workspace configuration.

  • Add GitHub Actions workflow to trigger Claude on issue/PR events and configure environment caching
  • Introduce CLAUDE.md, .claude/settings.json, and .mcp.json for Claude usage and MCP integration
  • Update repository config (package.json, CONTRIBUTING.md, CODEOWNERS) to include new dependencies and guidelines

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Add/remove Nx packages, include nx-mcp dependency
CONTRIBUTING.md Extend contribution guide with tech stack and interactive commits
CODEOWNERS Assign ownership for Claude-related files
CLAUDE.md New AI assistant usage and workflow instructions
.mcp.json Model Context Protocol server configuration
.github/workflows/claude.yml New workflow for Claude Code triggers and installation steps
.github/workflows/ci.yml Add pnpm, Rust, and Gradle caching steps to existing CI jobs
.claude/settings.json Claude Code permissions and timeout settings
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

CLAUDE.md:1

  • [nitpick] Add a top-level header (e.g., # Claude Code AI Assistant Guidelines) to clearly introduce this document.
When responding to queries about this repository:

@@ -270,6 +270,7 @@
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
"nx": "21.2.0-beta.1",
"nx-mcp": "^0.0.9",
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The nx-mcp tool is primarily a development utility; consider moving it from dependencies into devDependencies to align with its usage.

Copilot uses AI. Check for mistakes.

Comment on lines +34 to +36
- `docs` - Markdown and configuration files for documentation including tutorials, guides for each supported platform,
and API docs.
- `nx-dev` - Source code for the Nx documentation site which displays the markdown in `docs` and more.
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two docs bullets in this list—consolidate them into a single entry to avoid duplication.

Suggested change
- `docs` - Markdown and configuration files for documentation including tutorials, guides for each supported platform,
and API docs.
- `nx-dev` - Source code for the Nx documentation site which displays the markdown in `docs` and more.
- `docs` and `nx-dev` - The `docs` folder contains markdown and configuration files for documentation, including tutorials, guides for each supported platform, and API docs. The `nx-dev` folder contains the source code for the Nx documentation site, which renders the content from `docs` and provides additional features.

Copilot uses AI. Check for mistakes.

.mcp.json Outdated
"mcpServers": {
"nx": {
"command": "pnpm",
"args": ["nx-mcp", "/home/jason/projects/nx"],
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid hard-coded absolute paths in configuration; make the workspace root path configurable or use a relative path for portability.

Suggested change
"args": ["nx-mcp", "/home/jason/projects/nx"],
"args": ["nx-mcp", "${WORKSPACE_ROOT}/nx"],

Copilot uses AI. Check for mistakes.

@@ -61,11 +61,32 @@ jobs:
version: 9.8.0
run_install: false

- name: Cache pnpm store
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The pnpm/Rust/Gradle caching blocks are duplicated across multiple jobs; consider extracting them into a reusable workflow or composite action to reduce repetition.

Copilot uses AI. Check for mistakes.

@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch from e972ce1 to 3c5dc6f Compare May 29, 2025 21:52
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 4 times, most recently from 0e69b18 to 0cde62f Compare May 30, 2025 19:23
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch from 0cde62f to 9255ed0 Compare May 30, 2025 19:41
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 2 times, most recently from 099b16a to 874ec7d Compare May 30, 2025 20:39
@FrozenPandaz FrozenPandaz requested a review from Copilot May 30, 2025 20:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates Claude Code AI assistant into the Nx repository by adding GitHub Actions workflows and workspace configuration, updating dependencies, and enhancing documentation and contribution guidelines.

  • Added a new GitHub Actions workflow (claude.yml) to trigger Claude Code on issue and PR events, and updated the existing CI workflow (ci.yml) to install pnpm, cache Rust, and unify environment settings.
  • Introduced Claude integration docs (CLAUDE.md), command reference guides under .claude/commands, and Model Context Protocol configuration (.mcp.json).
  • Updated package.json with new AI-related dependencies, enhanced CONTRIBUTING.md with project structure and commit guidelines, and assigned CODEOWNERS for Claude files.

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/nx/src/command-line/affected/command-object.ts Expanded the help description for the affected command to clarify which projects are considered affected.
package.json Added @nx/conformance, @nx/enterprise-cloud, and nx-mcp dependencies and removed duplicate entries.
CONTRIBUTING.md Updated top-level folder list and added detailed commit guidelines and scopes.
CODEOWNERS Assigned ownership of Claude integration files to @FrozenPandaz.
CLAUDE.md New documentation outlining how to use Claude Code within this repo.
.mcp.json Configured the Model Context Protocol server for Nx workspace integration.
.github/workflows/claude.yml Added a workflow to run Claude Code on issue/PR interactions with appropriate permissions.
.github/workflows/ci.yml Updated CI to include pnpm setup, Node 20 caching, Rust caching, and consistent dependency installation.
.claude/settings.json Specified Claude Code permissions, enabled MCP servers, and extended timeouts.
.claude/commands/issue-workflow-guide.md Provided guidance for triggering planning and implementation workflows via Claude.
.claude/commands/gh-issue-plan.md Detailed template and steps for GitHub issue planning and resolution.
.claude/commands/commit.md Defined the automated commit command, validation requirements, and message format.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

.github/workflows/ci.yml:70

  • [nitpick] The Rust caching and setup steps are duplicated across multiple job definitions. Consider extracting them into a reusable workflow or composite action to reduce duplication and simplify maintenance.
-      - name: Cache Rust toolchain and cargo registry

- `packages` - Source code for Nx packages such as Angular, React, Web, NestJS, Next and others including generators and
executors (or builders).
- `e2e` - E2E tests for the Nx packages
- `graph` - Source code for the Nx Graph application which shows the project graph, task graph, project details, and more in the browser.
- `docs` - Markdown and configuration files for documentation including tutorials, guides for each supported platform,
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are duplicate entries for docs and e2e in the top-level folder list. Consider consolidating or removing outdated bullets to avoid confusion.

Copilot uses AI. Check for mistakes.

@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch 3 times, most recently from 23329b7 to 50a1746 Compare May 30, 2025 21:02
@FrozenPandaz FrozenPandaz force-pushed the add-claude-github-actions-1748485119512 branch from 50a1746 to 7916be2 Compare May 30, 2025 21:22
@FrozenPandaz FrozenPandaz marked this pull request as ready for review May 30, 2025 21:30
4. Run appropriate tests and validation
5. If the tests, are not passing, please fix the issues and continue doing this up to 3 more times until the tests pass
6. Once the tests pass, push a branch and then suggest opening a PR which has a description of the changes made, and that
it make sure that it explicitly says "Fixes #ISSUE_NUMBER" to automatically close the issue when the PR is merged.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a grammatical error in this sentence. It should be "make sure that it explicitly says" rather than "it make sure that it explicitly says".

Suggested change
it make sure that it explicitly says "Fixes #ISSUE_NUMBER" to automatically close the issue when the PR is merged.
make sure that it explicitly says "Fixes #ISSUE_NUMBER" to automatically close the issue when the PR is merged.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Collaborator

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not looked yet as a bit late for me, but should be a chore not a feat otherwise it’ll be in the changelog

@FrozenPandaz FrozenPandaz changed the title feat(repo): setup claude code chore(repo): setup claude code May 30, 2025
@FrozenPandaz FrozenPandaz enabled auto-merge (squash) May 30, 2025 21:52
@FrozenPandaz FrozenPandaz disabled auto-merge May 30, 2025 22:13
@FrozenPandaz FrozenPandaz merged commit 8cec6ce into master May 30, 2025
11 checks passed
@FrozenPandaz FrozenPandaz deleted the add-claude-github-actions-1748485119512 branch May 30, 2025 22:14
FrozenPandaz added a commit that referenced this pull request May 31, 2025
## Current Behavior

The Claude Code setup has basic workflow automation but lacks
comprehensive tooling permissions and detailed guidance for issue
management. The workflow documentation contains redundant sections and
some outdated commands.

## Expected Behavior

With these changes, the Claude Code integration will have:
- Enhanced tool permissions for better CI/CD workflow support
- Comprehensive GitHub CLI commands for efficient multi-issue management
- Clear mandatory requirements for PR template completion
- Streamlined documentation with accurate command references

## Related Issue(s)

This PR builds upon the initial Claude Code setup from #31380 by
refining the workflow configuration and improving the developer
experience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants