From 1886f1ed23da90234fe0a3d5a98ca829f18462f8 Mon Sep 17 00:00:00 2001 From: Stephan Kieburg Date: Sat, 21 Feb 2026 17:18:17 +0100 Subject: [PATCH] Add Claude Code integration (CLAUDE.md + GitHub Action) - CLAUDE.md: project context for Claude Code CLI usage - claude.yml: GitHub Action for @claude mentions and automatic PR review Co-Authored-By: Claude Opus 4.6 --- .github/workflows/claude.yml | 66 ++++++++++++++++++++++++++++++++++++ CLAUDE.md | 42 +++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/claude.yml create mode 100644 CLAUDE.md diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..b402dd5 --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,66 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + pull_request: + types: [opened, synchronize] + +jobs: + claude-interactive: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + claude-auto-review: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code Review + uses: anthropics/claude-code-action@v1 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + prompt: | + Please review this pull request for: + - Code quality and Python best practices + - Potential bugs or issues + - Test coverage + - Type hint correctness + + Use inline comments for specific issues and a summary comment for overall feedback. + claude_args: | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..bee17be --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,42 @@ +# PythonChess + +Minimal chess program with a pygame GUI. Originally a ninth-grade school assignment, extended with additional features. + +## Project Structure + +- `PythonChess.py` - Main entry point (pygame GUI app) +- `ChessBoard.py` - Core board logic, move generation, FEN support +- `ChessPiece.py` - Piece data structures +- `GameManager.py` - Game flow and move execution +- `SpecialMoves.py` - En passant, castling, promotion +- `BoardRenderer.py` - Pygame-based visual rendering +- `Tests/` - pytest test suite +- `Figuren/` - Chess piece PNG images + +## Tech Stack + +- Python 3.11+ +- pygame for GUI +- pytest for tests +- Type hints and dataclasses throughout + +## Commands + +```bash +# Run the app +python PythonChess.py + +# Run tests +pytest Tests/ + +# Run tests with verbose output +pytest Tests/ -v +``` + +## Conventions + +- Standard Python naming: snake_case for functions/variables, PascalCase for classes +- Type hints used throughout +- One module per logical concern (board, pieces, rendering, game management, special moves) +- Tests in `Tests/` directory using pytest fixtures +- Default branch is `master`