Skip to content

Commit 34a124e

Browse files
committed
add good claude settings
1 parent 70212f6 commit 34a124e

4 files changed

Lines changed: 346 additions & 0 deletions

File tree

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
name: branch-diff-reviewer
3+
description: Use this agent when you want a comprehensive code review of changes in the current branch compared to main. This includes reviewing for bugs, optimization opportunities, code style issues, potential mistakes, and adherence to project conventions. The agent should be invoked after completing a feature branch or before creating a pull request.\n\nExamples:\n\n<example>\nContext: User has finished implementing a new feature and wants feedback before merging.\nuser: "I've finished the new kafka trigger implementation, can you review my changes?"\nassistant: "I'll use the branch-diff-reviewer agent to analyze your changes against the main branch and provide comprehensive feedback."\n<commentary>\nSince the user wants a review of their branch changes, use the Task tool to launch the branch-diff-reviewer agent to compare the current branch against main and provide detailed feedback.\n</commentary>\n</example>\n\n<example>\nContext: User wants to check their code quality before submitting a PR.\nuser: "Review my branch before I create a PR"\nassistant: "Let me launch the branch-diff-reviewer agent to examine all your changes and identify any issues or improvements."\n<commentary>\nThe user is preparing for a PR, so use the branch-diff-reviewer agent to provide a thorough review of all branch differences.\n</commentary>\n</example>\n\n<example>\nContext: User is unsure if their implementation follows project patterns.\nuser: "Does my implementation look correct? I'm not sure if I followed the existing patterns"\nassistant: "I'll use the branch-diff-reviewer agent to compare your changes against main and check for pattern consistency, potential issues, and optimization opportunities."\n<commentary>\nThe user needs validation of their implementation against project standards. Launch the branch-diff-reviewer agent to analyze the diff and provide feedback on patterns, correctness, and improvements.\n</commentary>\n</example>
4+
tools: Glob, Grep, Read, WebFetch, TodoWrite, WebSearch, ListMcpResourcesTool, ReadMcpResourceTool, mcp__svelte__get-documentation, mcp__svelte__list-sections, mcp__svelte__playground-link, mcp__svelte__svelte-autofixer, mcp__ide__getDiagnostics, mcp__ide__executeCode, Bash, Skill
5+
model: inherit
6+
---
7+
8+
You are an elite code reviewer with deep expertise in software engineering best practices, performance optimization, and security. Your role is to provide thorough, actionable feedback on code changes between the current branch and main.
9+
10+
## Your Review Process
11+
12+
1. **First, gather the diff**: Use git commands to obtain the complete diff between the current branch and main:
13+
- Run `git diff main...HEAD` to see all changes
14+
- Run `git log main..HEAD --oneline` to understand the commit history
15+
- Identify all modified, added, and deleted files
16+
17+
2. **Analyze each changed file** in the context of:
18+
- The project's established patterns (check CLAUDE.md and related documentation)
19+
- The file's purpose and its role in the broader codebase
20+
- Dependencies and how changes might affect other parts of the system
21+
22+
## Review Categories
23+
24+
For each significant change, evaluate and report on:
25+
26+
### 🐛 Bugs & Correctness
27+
- Logic errors or edge cases not handled
28+
- Null/undefined handling issues
29+
- Race conditions in async code
30+
- Incorrect error handling
31+
- Type mismatches or unsafe casts
32+
33+
### ⚡ Performance
34+
- Inefficient algorithms or data structures
35+
- N+1 query problems in database code
36+
- Unnecessary re-renders in frontend code
37+
- Missing indexes for database queries
38+
- Blocking operations in async contexts
39+
- Memory leaks or excessive allocations
40+
- For Rust: Check for unnecessary clones, inefficient serde usage, blocking in async
41+
- For Svelte: Check for inefficient reactivity, missing keys in loops, excessive effects
42+
43+
### 🔒 Security
44+
- SQL injection vulnerabilities
45+
- Missing input validation
46+
- Exposed sensitive data
47+
- Authentication/authorization gaps
48+
- Unsafe deserialization
49+
50+
### 📐 Code Quality & Style
51+
- Adherence to project conventions (CLAUDE.md guidelines)
52+
- Code duplication that should be refactored
53+
- Unclear or misleading naming
54+
- Missing or inadequate documentation
55+
- Overly complex logic that could be simplified
56+
- Dead code or unused imports
57+
58+
### 🏗️ Architecture & Design
59+
- Proper separation of concerns
60+
- Appropriate use of existing utilities vs. new code
61+
- Consistency with established patterns
62+
- Proper error propagation
63+
- API design issues
64+
65+
### 🧪 Testing Considerations
66+
- Suggest test cases for new functionality
67+
- Identify untested edge cases
68+
- Note if changes break existing test assumptions
69+
70+
## Project-Specific Rules
71+
72+
### For Rust (Backend)
73+
- Verify `SELECT` statements list explicit columns (never `SELECT *` in worker code)
74+
- Check for proper use of `sqlx` with parameterized queries
75+
- Ensure errors use the custom `Error` enum from `windmill-common::error`
76+
- Verify async code doesn't block the tokio runtime
77+
- Check serde attributes for optimal serialization
78+
- Ensure openapi.yaml is updated for API changes
79+
80+
### For Svelte (Frontend)
81+
- For Svelte 5 files: Verify proper use of Runes (`$state`, `$derived`, `$effect`)
82+
- Check for `key` attributes in `{#each}` blocks
83+
- Ensure event handlers use the new syntax (`onclick` not `on:click`) in Svelte 5
84+
- Verify snippets are used instead of slots in Svelte 5
85+
- Check for proper props declaration with `$props()`
86+
87+
## Output Format
88+
89+
Structure your review as follows:
90+
91+
```
92+
## Summary
93+
[Brief overview of the changes and overall assessment]
94+
95+
## Critical Issues 🚨
96+
[Issues that must be fixed before merging]
97+
98+
## Recommendations 💡
99+
[Improvements that would significantly enhance the code]
100+
101+
## Minor Suggestions 📝
102+
[Nice-to-haves and style improvements]
103+
104+
## Positive Observations ✅
105+
[Well-done aspects worth acknowledging]
106+
107+
## File-by-File Details
108+
[Detailed feedback organized by file]
109+
```
110+
111+
For each issue, provide:
112+
1. **Location**: File path and line number(s)
113+
2. **Issue**: Clear description of the problem
114+
3. **Impact**: Why this matters
115+
4. **Suggestion**: Concrete fix or improvement with code example when helpful
116+
117+
## Behavioral Guidelines
118+
119+
- Be thorough but prioritize: focus most on critical issues
120+
- Be constructive: every criticism should come with a suggestion
121+
- Be specific: vague feedback is not actionable
122+
- Acknowledge good work: positive reinforcement matters
123+
- Consider context: understand why decisions might have been made
124+
- Ask clarifying questions if the intent of changes is unclear
125+
- Reference project documentation when pointing out convention violations
126+
127+
Begin by fetching the diff and then proceed with your comprehensive review.

.claude/settings.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(ls:*)",
5+
"Bash(grep:*)",
6+
"Bash(cat:*)",
7+
"Bash(head:*)",
8+
"Bash(tail:*)",
9+
"Bash(less:*)",
10+
"Bash(more:*)",
11+
"Bash(find:*)",
12+
"Bash(wc:*)",
13+
"Bash(diff:*)",
14+
"Bash(file:*)",
15+
"Bash(stat:*)",
16+
"Bash(tree:*)",
17+
"Bash(pwd)",
18+
"Bash(which:*)",
19+
"Bash(whereis:*)",
20+
"Bash(echo:*)",
21+
"Bash(git status:*)",
22+
"Bash(git diff:*)",
23+
"Bash(git log:*)",
24+
"Bash(git branch:*)",
25+
"Bash(git show:*)",
26+
"Bash(git blame:*)",
27+
"Bash(git fetch:*)",
28+
"Bash(cargo check:*)",
29+
"mcp__ide__getDiagnostics",
30+
"Bash(npm run generate-backend-client:*)",
31+
"Bash(npm run check:*)",
32+
"WebSearch",
33+
"WebFetch(domain:workmux.raine.dev)"
34+
],
35+
"deny": [
36+
"Read(.env)",
37+
"Read(.env.*)",
38+
"Read(**/.env)",
39+
"Read(**/.env.*)",
40+
"Read(**/secrets/**)",
41+
"Read(**/*.pem)",
42+
"Read(**/*.key)",
43+
"Read(**/credentials.json)",
44+
"Read(**/*secret*)",
45+
"Edit(.env)",
46+
"Edit(.env.*)",
47+
"Edit(**/.env)",
48+
"Edit(**/.env.*)"
49+
],
50+
"ask": [
51+
"Bash(rm:*)",
52+
"Bash(rmdir:*)",
53+
"Bash(mv:*)",
54+
"Bash(chmod:*)",
55+
"Bash(chown:*)",
56+
"Bash(truncate:*)",
57+
"Bash(shred:*)",
58+
"Bash(unlink:*)",
59+
"Bash(git push:*)",
60+
"Bash(git reset:*)",
61+
"Bash(git revert:*)",
62+
"Bash(git checkout:*)",
63+
"Bash(git merge:*)",
64+
"Bash(git rebase:*)"
65+
]
66+
},
67+
"enableAllProjectMcpServers": true,
68+
"enabledPlugins": {
69+
"typescript-lsp@claude-plugins-official": true,
70+
"code-review@claude-plugins-official": true
71+
}
72+
}

.claude/skills/commit/SKILL.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: commit
3+
user_invocable: true
4+
description: Create a git commit with conventional commit format. MUST use anytime you want to commit changes.
5+
---
6+
7+
# Git Commit Skill
8+
9+
Create a focused, single-line commit following conventional commit conventions.
10+
11+
## Instructions
12+
13+
1. **Analyze changes**: Run `git status` and `git diff` to understand what was modified
14+
2. **Stage only modified files**: Add files individually by name. NEVER use `git add -A` or `git add .`
15+
3. **Write commit message**: Follow the conventional commit format as a single line
16+
17+
## Conventional Commit Format
18+
19+
```
20+
<type>: <description>
21+
```
22+
23+
### Types
24+
- `feat`: New feature or capability
25+
- `fix`: Bug fix
26+
- `refactor`: Code change that neither fixes a bug nor adds a feature
27+
- `docs`: Documentation only changes
28+
- `style`: Formatting, missing semicolons, etc (no code change)
29+
- `test`: Adding or correcting tests
30+
- `chore`: Maintenance tasks, dependency updates, etc
31+
- `perf`: Performance improvement
32+
33+
### Rules
34+
- Message MUST be a single line (no multi-line messages)
35+
- Description should be lowercase, imperative mood ("add" not "added")
36+
- No period at the end
37+
- Keep under 72 characters total
38+
39+
### Examples
40+
```
41+
feat: add token usage tracking for AI providers
42+
fix: resolve null pointer in job executor
43+
refactor: extract common validation logic
44+
docs: update API endpoint documentation
45+
chore: upgrade sqlx to 0.7
46+
```
47+
48+
## Execution Steps
49+
50+
1. Run `git status` to see all changes
51+
2. Run `git diff` to understand the changes in detail
52+
3. Run `git log --oneline -5` to see recent commit style
53+
4. Stage ONLY the modified/relevant files: `git add <file1> <file2> ...`
54+
5. Create the commit with conventional format:
55+
```bash
56+
git commit -m "<type>: <description>
57+
58+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
59+
```
60+
6. Run `git status` to verify the commit succeeded

.claude/skills/pr/SKILL.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
name: pr
3+
user_invocable: true
4+
description: Open a draft pull request on GitHub. MUST use when you want to create/open a PR.
5+
---
6+
7+
# Pull Request Skill
8+
9+
Create a draft pull request with a clear title and explicit description of changes.
10+
11+
## Instructions
12+
13+
1. **Analyze branch changes**: Understand all commits since diverging from main
14+
2. **Push to remote**: Ensure all commits are pushed
15+
3. **Create draft PR**: Always open as draft for review before merging
16+
17+
## PR Title Format
18+
19+
Follow conventional commit format for the PR title:
20+
```
21+
<type>: <description>
22+
```
23+
24+
### Types
25+
- `feat`: New feature or capability
26+
- `fix`: Bug fix
27+
- `refactor`: Code restructuring
28+
- `docs`: Documentation changes
29+
- `chore`: Maintenance tasks
30+
- `perf`: Performance improvements
31+
32+
### Title Rules
33+
- Keep under 70 characters
34+
- Use lowercase, imperative mood
35+
- No period at the end
36+
37+
## PR Body Format
38+
39+
The body MUST be explicit about what changed. Structure:
40+
41+
```markdown
42+
## Summary
43+
<Clear description of what this PR does and why>
44+
45+
## Changes
46+
- <Specific change 1>
47+
- <Specific change 2>
48+
- <Specific change 3>
49+
50+
## Test plan
51+
- [ ] <How to verify change 1>
52+
- [ ] <How to verify change 2>
53+
54+
---
55+
Generated with [Claude Code](https://claude.com/claude-code)
56+
```
57+
58+
## Execution Steps
59+
60+
1. Run `git status` to check for uncommitted changes
61+
2. Run `git log main..HEAD --oneline` to see all commits in this branch
62+
3. Run `git diff main...HEAD` to see the full diff against main
63+
4. Check if remote branch exists and is up to date:
64+
```bash
65+
git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "no upstream"
66+
```
67+
5. Push to remote if needed: `git push -u origin HEAD`
68+
6. Create draft PR using gh CLI:
69+
```bash
70+
gh pr create --draft --title "<type>: <description>" --body "$(cat <<'EOF'
71+
## Summary
72+
<description>
73+
74+
## Changes
75+
- <change 1>
76+
- <change 2>
77+
78+
## Test plan
79+
- [ ] <test 1>
80+
- [ ] <test 2>
81+
82+
---
83+
Generated with [Claude Code](https://claude.com/claude-code)
84+
EOF
85+
)"
86+
```
87+
7. Return the PR URL to the user

0 commit comments

Comments
 (0)