Skip to content

Commit bbf6a17

Browse files
committed
feat(ci): convert Claude prompts to reusable slash commands
- Create .github/slash-commands/ with link-review, model-check, notebook-review - Update GitHub Actions to use slash commands instead of inline prompts - Add symlinks in .claude/commands/ for local development - Document slash commands in CONTRIBUTING.md - Use claude-code-action@v1 instead of beta This allows developers to run the same CI validations locally using Claude Code slash commands before pushing changes.
1 parent 7938498 commit bbf6a17

File tree

10 files changed

+120
-83
lines changed

10 files changed

+120
-83
lines changed

.claude/commands/link-review.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.github/slash-commands/link-review.md

.claude/commands/model-check.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.github/slash-commands/model-check.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.github/slash-commands/notebook-review.md
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
description: Review links in changed files for quality and security issues
3+
---
4+
5+
Review the links in the changed files and check for potential issues:
6+
7+
## Link Quality Checks
8+
1. **Broken Links**: Identify any links that might be broken or malformed
9+
2. **Outdated Links**: Check for links to deprecated resources or old documentation
10+
3. **Security**: Ensure no links to suspicious or potentially harmful sites
11+
4. **Best Practices**:
12+
- Links should use HTTPS where possible
13+
- Internal links should use relative paths
14+
- External links should be to stable, reputable sources
15+
16+
## Specific Checks for Anthropic Content
17+
- Links to Claude documentation should point to the latest versions
18+
- API documentation links should be current
19+
- Model documentation should reference current models, not deprecated ones
20+
- GitHub links should use the correct repository paths
21+
22+
## Report Format
23+
Provide a clear summary with:
24+
- ✅ Valid and well-formed links
25+
- ⚠️ Links that might need attention (e.g., HTTP instead of HTTPS)
26+
- ❌ Broken or problematic links that must be fixed
27+
28+
If all links look good, provide a brief confirmation.
29+
30+
Format your response as a helpful PR review comment.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
description: Validate Claude model usage against current public models
3+
---
4+
5+
Review the changed files for Claude model usage.
6+
7+
First, fetch the current list of allowed models from:
8+
https://docs.anthropic.com/en/docs/about-claude/models/overview.md
9+
10+
Then check:
11+
1. All model references are from the current public models list
12+
2. Flag any deprecated models (older Sonnet 3.5, Opus 3 versions)
13+
3. Flag any internal/non-public model names
14+
4. Suggest using aliases ending in -latest for better maintainability
15+
16+
Provide clear, actionable feedback on any issues found.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
description: Comprehensive review of Jupyter notebooks and Python scripts
3+
---
4+
5+
Review the changes to Jupyter notebooks and Python scripts in this PR. Please check for:
6+
7+
## Model Usage
8+
Verify all Claude model references against the current list at:
9+
https://docs.anthropic.com/en/docs/about-claude/models/overview.md
10+
- Flag any deprecated models (older Sonnet 3.5, Opus 3 versions)
11+
- Flag any internal/non-public model names
12+
- Suggest current alternatives when issues found
13+
- Recommend aliases ending in -latest for stability
14+
15+
## Code Quality
16+
- Python code follows PEP 8 conventions
17+
- Proper error handling
18+
- Clear variable names and documentation
19+
- No hardcoded API keys (use os.getenv("ANTHROPIC_API_KEY"))
20+
21+
## Notebook Structure
22+
- Clear introduction explaining what the notebook demonstrates and why it's useful
23+
- Configuration instructions (how to set up API keys, install dependencies, etc.)
24+
- Connecting explanations between cells that help users understand the flow
25+
- Clear markdown explanations between code cells
26+
- Logical flow from simple to complex
27+
- Outputs preserved for educational value
28+
- Dependencies properly imported
29+
30+
## Security
31+
- Check for any hardcoded API keys or secrets (not just Anthropic keys)
32+
- Ensure all sensitive credentials use environment variables (os.environ, getenv, etc.)
33+
- Flag any potential secret patterns (tokens, passwords, private keys)
34+
- Note: Educational examples showing "what not to do" are acceptable if clearly marked
35+
- Safe handling of user inputs
36+
- Appropriate use of environment variables
37+
38+
Provide a clear summary with:
39+
- ✅ What looks good
40+
- ⚠️ Suggestions for improvement
41+
- ❌ Critical issues that must be fixed
42+
43+
Format your response as a helpful PR review comment.

.github/workflows/claude-link-review.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,12 @@ jobs:
2323
fetch-depth: 0
2424

2525
- name: Run Claude Link Review
26-
uses: anthropics/claude-code-action@beta
26+
uses: anthropics/claude-code-action@v1
2727
with:
2828
use_sticky_comment: true
2929
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3030
github_token: ${{ secrets.GITHUB_TOKEN }}
3131
timeout_minutes: "30"
3232
allowed_bots: "*"
33-
direct_prompt: |
34-
Review the links in the changed files and check for potential issues:
35-
36-
## Link Quality Checks
37-
1. **Broken Links**: Identify any links that might be broken or malformed
38-
2. **Outdated Links**: Check for links to deprecated resources or old documentation
39-
3. **Security**: Ensure no links to suspicious or potentially harmful sites
40-
4. **Best Practices**:
41-
- Links should use HTTPS where possible
42-
- Internal links should use relative paths
43-
- External links should be to stable, reputable sources
44-
45-
## Specific Checks for Anthropic Content
46-
- Links to Claude documentation should point to the latest versions
47-
- API documentation links should be current
48-
- Model documentation should reference current models, not deprecated ones
49-
- GitHub links should use the correct repository paths
50-
51-
## Report Format
52-
Provide a clear summary with:
53-
- ✅ Valid and well-formed links
54-
- ⚠️ Links that might need attention (e.g., HTTP instead of HTTPS)
55-
- ❌ Broken or problematic links that must be fixed
56-
57-
If all links look good, provide a brief confirmation.
58-
59-
Format your response as a helpful PR review comment.
33+
experimental_slash_commands_dir: ${{ github.workspace }}/.github/slash-commands
34+
prompt: "/link-review"

.github/workflows/claude-model-check.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,11 @@ jobs:
2222
fetch-depth: 0
2323

2424
- name: Claude Model Validation
25-
uses: anthropics/claude-code-action@beta
25+
uses: anthropics/claude-code-action@v1
2626
with:
2727
use_sticky_comment: true
2828
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
2929
github_token: ${{ secrets.GITHUB_TOKEN }}
3030
timeout_minutes: "5"
31-
direct_prompt: |
32-
Review the changed files for Claude model usage.
33-
34-
First, fetch the current list of allowed models from:
35-
https://docs.anthropic.com/en/docs/about-claude/models/overview.md
36-
37-
Then check:
38-
1. All model references are from the current public models list
39-
2. Flag any deprecated models (older Sonnet 3.5, Opus 3 versions)
40-
3. Flag any internal/non-public model names
41-
4. Suggest using aliases ending in -latest for better maintainability
42-
43-
Provide clear, actionable feedback on any issues found.
31+
experimental_slash_commands_dir: ${{ github.workspace }}/.github/slash-commands
32+
prompt: "/model-check"

.github/workflows/claude-notebook-review.yml

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,50 +23,12 @@ jobs:
2323
fetch-depth: 0
2424

2525
- name: Run Claude Notebook Review
26-
uses: anthropics/claude-code-action@beta
26+
uses: anthropics/claude-code-action@v1
2727
with:
2828
use_sticky_comment: true
2929
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3030
github_token: ${{ secrets.GITHUB_TOKEN }}
3131
timeout_minutes: "30"
3232
allowed_bots: "*"
33-
direct_prompt: |
34-
Review the changes to Jupyter notebooks and Python scripts in this PR. Please check for:
35-
36-
## Model Usage
37-
Verify all Claude model references against the current list at:
38-
https://docs.anthropic.com/en/docs/about-claude/models/overview.md
39-
- Flag any deprecated models (older Sonnet 3.5, Opus 3 versions)
40-
- Flag any internal/non-public model names
41-
- Suggest current alternatives when issues found
42-
- Recommend aliases ending in -latest for stability
43-
44-
## Code Quality
45-
- Python code follows PEP 8 conventions
46-
- Proper error handling
47-
- Clear variable names and documentation
48-
- No hardcoded API keys (use os.getenv("ANTHROPIC_API_KEY"))
49-
50-
## Notebook Structure
51-
- Clear introduction explaining what the notebook demonstrates and why it's useful
52-
- Configuration instructions (how to set up API keys, install dependencies, etc.)
53-
- Connecting explanations between cells that help users understand the flow
54-
- Clear markdown explanations between code cells
55-
- Logical flow from simple to complex
56-
- Outputs preserved for educational value
57-
- Dependencies properly imported
58-
59-
## Security
60-
- Check for any hardcoded API keys or secrets (not just Anthropic keys)
61-
- Ensure all sensitive credentials use environment variables (os.environ, getenv, etc.)
62-
- Flag any potential secret patterns (tokens, passwords, private keys)
63-
- Note: Educational examples showing "what not to do" are acceptable if clearly marked
64-
- Safe handling of user inputs
65-
- Appropriate use of environment variables
66-
67-
Provide a clear summary with:
68-
- ✅ What looks good
69-
- ⚠️ Suggestions for improvement
70-
- ❌ Critical issues that must be fixed
71-
72-
Format your response as a helpful PR review comment.
33+
experimental_slash_commands_dir: ${{ github.workspace }}/.github/slash-commands
34+
prompt: "/notebook-review"

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ This repository uses automated tools to maintain code quality:
6060

6161
**Note**: Notebook outputs are intentionally kept in this repository as they demonstrate expected results for users.
6262

63+
### Claude Code Slash Commands
64+
65+
This repository includes slash commands that work in both Claude Code (for local development) and GitHub Actions CI. These commands are automatically available when you work in this repository with Claude Code.
66+
67+
**Available Commands**:
68+
- `/link-review` - Validate links in markdown and notebooks
69+
- `/model-check` - Verify Claude model usage is current
70+
- `/notebook-review` - Comprehensive notebook quality check
71+
72+
**Usage in Claude Code**:
73+
```bash
74+
# Run the same validations that CI will run
75+
/notebook-review skills/my-notebook.ipynb
76+
/model-check
77+
/link-review README.md
78+
```
79+
80+
These commands use the exact same validation logic as our CI pipeline, helping you catch issues before pushing. The command definitions are stored in `.github/slash-commands/` and symlinked to `.claude/commands/` for local use.
81+
6382
### Before Committing
6483

6584
1. **Run quality checks**:

0 commit comments

Comments
 (0)