5 changed files with 348 additions and 2 deletions
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
# Claude Code Configuration |
||||
|
||||
This directory contains Claude Code configuration files for the gh-actions repository. |
||||
|
||||
## Directory Structure |
||||
|
||||
``` |
||||
.claude/ |
||||
├── CLAUDE.md # General project context and guidelines |
||||
├── commands/ # Custom slash commands |
||||
│ └── review-pr.md # /review-pr command for PR reviews |
||||
└── prompts/ # Workflow-specific prompts |
||||
└── review-code.md # Used by review-code.yml workflow |
||||
``` |
||||
|
||||
## Custom Commands |
||||
|
||||
### `/review-pr` - Pull Request Review |
||||
|
||||
Triggers a comprehensive PR code review in your current Claude Code session. |
||||
|
||||
**Usage:** |
||||
|
||||
1. Open Claude Code in this repository |
||||
2. Check out the PR branch you want to review |
||||
3. Tag @claude and type `/review-pr` |
||||
|
||||
**What it does:** |
||||
|
||||
- Analyzes code quality and best practices |
||||
- Checks for security vulnerabilities |
||||
- Validates workflow linter compliance |
||||
- Reviews performance and efficiency |
||||
- Provides structured feedback with action items |
||||
|
||||
**Example:** |
||||
|
||||
``` |
||||
@claude /review-pr |
||||
``` |
||||
|
||||
## Automated Workflow Reviews |
||||
|
||||
The `review-code.yml` workflow uses the `.claude/prompts/review-code.md` to automatically review PRs via GitHub Actions in each Bitwarden repo. The `review-code.md` is used as a gate to execute the `review-code.yml` workflow. Repos without this file will not see Claude code reviews performed on each pull request. |
||||
|
||||
**How it works:** |
||||
|
||||
1. Workflow triggers on non-draft PRs |
||||
2. Reads `.claude/prompts/review-code.md` from the PR's branch |
||||
3. Posts review as a sticky comment |
||||
4. Updates comment on new commits |
||||
|
||||
**To enable in our repos:** |
||||
|
||||
1. Create `.claude/prompts/review-code.md` with review criteria |
||||
2. Workflow runs automatically on subsequent pull requests |
||||
|
||||
## Best Practices |
||||
|
||||
- **Commands** (`.claude/commands/`): For interactive Claude Code sessions |
||||
- **Prompts** (`.claude/prompts/`): For automated GitHub Actions workflows |
||||
- **CLAUDE.md**: General project context available in all Claude interactions |
||||
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
--- |
||||
description: Review the current pull request with comprehensive code analysis |
||||
--- |
||||
|
||||
You are conducting a thorough pull request code review for the Bitwarden gh-actions repository. |
||||
|
||||
## Current Context |
||||
- Repository: bitwarden/gh-actions |
||||
- This is a collection of reusable GitHub Actions workflows and custom actions |
||||
- The code must follow Bitwarden's workflow linter rules |
||||
- Security and reliability are paramount |
||||
|
||||
## Review Instructions |
||||
|
||||
Perform a comprehensive review of the current PR with focus on: |
||||
|
||||
### 1. **Code Quality & Best Practices** |
||||
- Adherence to GitHub Actions best practices |
||||
- Proper error handling and validation |
||||
- Code maintainability and clarity |
||||
- Appropriate use of GitHub Actions syntax |
||||
|
||||
### 2. **Security Implications** |
||||
- No hardcoded secrets or credentials |
||||
- Proper permission scoping |
||||
- Input validation and sanitization |
||||
- Protection against command injection |
||||
- Safe handling of user-provided data |
||||
|
||||
### 3. **Workflow Linter Compliance** |
||||
Verify compliance with Bitwarden workflow linter rules: |
||||
- Actions pinned to commit SHA with version comment |
||||
- Permissions explicitly defined |
||||
- Runner versions pinned (e.g., ubuntu-24.04) |
||||
- Proper naming conventions (capitalized) |
||||
- Only approved actions are used |
||||
|
||||
### 4. **Performance & Efficiency** |
||||
- Appropriate caching strategies |
||||
- Parallel job execution where possible |
||||
- Minimal redundant operations |
||||
- Efficient use of GitHub Actions resources |
||||
|
||||
### 5. **Testing & Validation** |
||||
- Adequate test coverage for new features |
||||
- Test workflows follow established patterns |
||||
- Integration with existing test infrastructure |
||||
|
||||
## Output Format |
||||
|
||||
Provide a structured review with: |
||||
|
||||
1. **Summary of Changes** |
||||
- High-level overview of what this PR accomplishes |
||||
- Key files modified and their impact |
||||
|
||||
2. **Critical Issues** (if any) |
||||
- Security vulnerabilities |
||||
- Breaking changes |
||||
- Non-compliant code that must be fixed |
||||
|
||||
3. **Suggested Improvements** |
||||
- Optimization opportunities |
||||
- Better patterns or approaches |
||||
- Documentation enhancements |
||||
|
||||
4. **Good Practices Observed** |
||||
- Notable positive aspects (be concise) |
||||
- Correct security implementations |
||||
- Well-structured code |
||||
|
||||
5. **Action Items** |
||||
- Specific tasks for the author |
||||
- Priority level (Critical/High/Medium/Low) |
||||
|
||||
Use collapsible `<details>` sections for lengthy explanations to keep the review readable. |
||||
|
||||
**Important**: Focus on being thorough about issues and improvements. For good practices, be brief and just note what was done well. |
||||
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
Please review this pull request with a focus on: |
||||
- Code quality and best practices |
||||
- Potential bugs or issues |
||||
- Security implications |
||||
- Performance considerations |
||||
|
||||
Note: The PR branch is already checked out in the current working directory. |
||||
|
||||
Provide a comprehensive review including: |
||||
- Summary of changes since last review |
||||
- Critical issues found (be thorough) |
||||
- Suggested improvements (be thorough) |
||||
- Good practices observed (be concise - list only the most notable items without elaboration) |
||||
- Action items for the author |
||||
- Leverage collapsible <details> sections where appropriate for lengthy explanations or code snippets to enhance human readability |
||||
|
||||
When reviewing subsequent commits: |
||||
- Track status of previously identified issues (fixed/unfixed/reopened) |
||||
- Identify NEW problems introduced since last review |
||||
- Note if fixes introduced new issues |
||||
|
||||
IMPORTANT: Be comprehensive about issues and improvements. For good practices, be brief - just note what was done well without explaining why or praising excessively. |
||||
Loading…
Reference in new issue