Skip to content

Commit c0aa063

Browse files
hyochanclaude
andcommitted
docs: add /commit and /review-pr skills
- Add commit skill for structured commit workflow - Add review-pr skill for addressing PR comments - Update .gitignore to track .claude/commands/ Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 743c43c commit c0aa063

File tree

4 files changed

+394
-1
lines changed

4 files changed

+394
-1
lines changed

.claude/commands/commit.md

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
# Commit Changes
2+
3+
Complete workflow: branch check → pre-commit checks → commit → push → PR
4+
5+
## Usage
6+
7+
```
8+
/commit [options]
9+
```
10+
11+
**Options:**
12+
- `--push` or `-p`: Push to remote after commit
13+
- `--pr`: Create PR after push
14+
- `--all` or `-a`: Commit all changes at once
15+
- `<path>`: Commit only specific path (e.g., `lib/`)
16+
17+
## Examples
18+
19+
```bash
20+
# Full workflow: commit lib changes, push, create PR
21+
/commit lib/ --pr
22+
23+
# Commit all and create PR
24+
/commit --all --pr
25+
26+
# Just commit specific path
27+
/commit android/
28+
29+
# Push to remote after commit
30+
/commit --push
31+
```
32+
33+
## Complete Workflow
34+
35+
### 1. Check Branch
36+
37+
```bash
38+
# Check current branch
39+
git branch --show-current
40+
```
41+
42+
**If on `main`** -> Create a feature branch first:
43+
```bash
44+
git checkout -b feat/<feature-name>
45+
```
46+
47+
**If NOT on `main`** -> Proceed with commits directly.
48+
49+
**Branch naming conventions:**
50+
- `feat/<feature-name>` - New features
51+
- `fix/<bug-description>` - Bug fixes
52+
- `docs/<doc-update>` - Documentation only
53+
- `chore/<task>` - Maintenance tasks
54+
55+
### 2. Check Current Status
56+
57+
```bash
58+
git status
59+
git diff --name-only
60+
```
61+
62+
### 3. Run Pre-Commit Checks (CRITICAL)
63+
64+
**Before committing, ALL checks must pass:**
65+
66+
```bash
67+
# 1. Format check (skip generated types.dart)
68+
git ls-files '*.dart' | grep -v '^lib/types.dart$' | xargs dart format --page-width 80 --output=none --set-exit-if-changed
69+
70+
# 2. Lint check
71+
flutter analyze
72+
73+
# 3. Test validation
74+
flutter test
75+
```
76+
77+
**If format check fails:**
78+
```bash
79+
# Auto-format and retry
80+
git ls-files '*.dart' | grep -v '^lib/types.dart$' | xargs dart format --page-width 80
81+
```
82+
83+
**Alternative:** Run `./scripts/pre-commit-checks.sh` for all checks at once.
84+
85+
### 4. Stage Changes
86+
87+
**Specific path:**
88+
```bash
89+
git add <path>
90+
```
91+
92+
**All changes:**
93+
```bash
94+
git add .
95+
```
96+
97+
### 5. Review Staged Changes
98+
99+
```bash
100+
git diff --cached --stat
101+
git diff --cached --name-only
102+
```
103+
104+
### 6. Create Commit
105+
106+
Follow conventional commit format:
107+
108+
```bash
109+
git commit -m "$(cat <<'EOF'
110+
<type>: <description>
111+
112+
<body - what changed and why>
113+
114+
Co-Authored-By: Claude Opus 4.5 <[email protected]>
115+
EOF
116+
)"
117+
```
118+
119+
**Commit Types:**
120+
| Type | Description |
121+
|------|-------------|
122+
| `feat` | New feature |
123+
| `fix` | Bug fix |
124+
| `docs` | Documentation only |
125+
| `refactor` | Code refactoring |
126+
| `chore` | Maintenance tasks |
127+
| `test` | Adding/updating tests |
128+
129+
### 7. Push to Remote
130+
131+
```bash
132+
git push -u origin <branch-name>
133+
```
134+
135+
### 8. Create Pull Request
136+
137+
```bash
138+
gh pr create --title "<type>: <description>" --body "$(cat <<'EOF'
139+
## Summary
140+
141+
<1-3 bullet points describing changes>
142+
143+
## Changes
144+
145+
- Change 1
146+
- Change 2
147+
148+
## Test plan
149+
150+
- [ ] `dart format --set-exit-if-changed .` passes
151+
- [ ] `flutter analyze` passes
152+
- [ ] `flutter test` passes
153+
154+
Generated with [Claude Code](https://claude.ai/code)
155+
EOF
156+
)"
157+
```
158+
159+
---
160+
161+
## Commit Order (For Cross-Platform Changes)
162+
163+
When making changes across platforms, commit in this order:
164+
165+
| Order | Path | Description |
166+
|-------|------|-------------|
167+
| 1 | `lib/` | Dart library code (excluding types.dart) |
168+
| 2 | `android/` | Android implementation |
169+
| 3 | `ios/` | iOS implementation |
170+
| 4 | `example/` | Example app changes |
171+
| 5 | `test/` | Test updates |
172+
| 6 | Root files | pubspec.yaml, README.md, etc. |
173+
174+
**IMPORTANT - Never edit `lib/types.dart`:**
175+
This file is auto-generated. Regenerate via `./scripts/generate-type.sh`.
176+
177+
---
178+
179+
## Example Commit Messages
180+
181+
**New feature:**
182+
```
183+
feat: add subscription offer support
184+
185+
- Add SubscriptionOfferIOS for iOS promotional offers
186+
- Add SubscriptionOfferAndroid for Android offers
187+
- Update fetchProducts to include offer details
188+
189+
Co-Authored-By: Claude Opus 4.5 <[email protected]>
190+
```
191+
192+
**Bug fix:**
193+
```
194+
fix: resolve purchase validation error on iOS
195+
196+
- Handle edge case where transaction ID is null
197+
- Add proper error handling for StoreKit exceptions
198+
199+
Co-Authored-By: Claude Opus 4.5 <[email protected]>
200+
```
201+
202+
**Documentation:**
203+
```
204+
docs: update API documentation for getAvailablePurchases
205+
206+
- Add PurchaseOptions parameter documentation
207+
- Include iOS-specific behavior notes
208+
209+
Co-Authored-By: Claude Opus 4.5 <[email protected]>
210+
```
211+
212+
**Chore:**
213+
```
214+
chore: bump version to 8.2.6
215+
216+
Co-Authored-By: Claude Opus 4.5 <[email protected]>
217+
```
218+
219+
---
220+
221+
## Example PR Body
222+
223+
```markdown
224+
## Summary
225+
226+
- Add win-back offer support for iOS 18+
227+
- Improve error handling for Android purchase flow
228+
- Update documentation with new API examples
229+
230+
## Changes
231+
232+
### Dart Library (lib/)
233+
- Add `WinBackOfferIOS` type
234+
- Update `requestPurchase` to support offers
235+
236+
### iOS (ios/)
237+
- Implement StoreKit 2 win-back offer handling
238+
- Add offer eligibility checking
239+
240+
### Android (android/)
241+
- Improve BillingClient error mapping
242+
- Add retry logic for transient failures
243+
244+
## Test plan
245+
246+
- [x] `dart format --set-exit-if-changed .` passes
247+
- [x] `flutter analyze` passes
248+
- [x] `flutter test` passes
249+
250+
Generated with [Claude Code](https://claude.ai/code)
251+
```
252+
253+
---
254+
255+
## Quick Reference
256+
257+
```bash
258+
# Full workflow from main
259+
git checkout -b feat/my-feature
260+
261+
# Run pre-commit checks
262+
./scripts/pre-commit-checks.sh
263+
264+
# Stage and commit
265+
git add lib/
266+
git commit -m "feat: add new feature"
267+
268+
git add android/ ios/
269+
git commit -m "feat: implement native support"
270+
271+
git add test/
272+
git commit -m "test: add unit tests"
273+
274+
# Push and create PR
275+
git push -u origin feat/my-feature
276+
gh pr create --title "feat: add new feature" --body "..."
277+
```

.claude/commands/review-pr.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Review PR Comments
2+
3+
Review and address PR review comments for this repository.
4+
5+
> **Note:** This extends the global `/review-pr` command with project-specific checks.
6+
7+
## Arguments
8+
9+
- `$ARGUMENTS` - PR number (e.g., `123`) or PR URL
10+
11+
## Project-Specific Build Commands
12+
13+
Based on changed files, run these checks BEFORE committing:
14+
15+
| Changed Files | Commands |
16+
|---------------|----------|
17+
| `lib/*.dart` (except types.dart) | `git ls-files '*.dart' \| grep -v '^lib/types.dart$' \| xargs dart format --page-width 80 --output=none --set-exit-if-changed && flutter analyze && flutter test` |
18+
| `android/` | `cd example && flutter build apk --debug` |
19+
| `ios/` | `cd example && flutter build ios --no-codesign --debug` |
20+
| `test/` | `flutter test` |
21+
22+
**Quick check script:** `./scripts/pre-commit-checks.sh`
23+
24+
## Project Conventions
25+
26+
When reviewing, check these project-specific rules:
27+
28+
- **iOS-related code**: Use `IOS` suffix (e.g., `PurchaseIOS`, `SubscriptionOfferIOS`)
29+
- **Android-related code**: Use `Android` suffix (e.g., `PurchaseAndroid`)
30+
- **ID convention**: Use `Id` consistently (e.g., `productId`, `transactionId`)
31+
- **Generated files**: Do NOT edit `lib/types.dart` - regenerate via `./scripts/generate-type.sh`
32+
- **API naming**: Use `request` prefix for event-dependent functions (e.g., `requestPurchase`)
33+
34+
See [CLAUDE.md](../../CLAUDE.md) for full conventions.
35+
36+
## Reply Format Rules (CRITICAL)
37+
38+
When replying to PR comments:
39+
40+
### Commit Hash Formatting
41+
42+
**NEVER wrap commit hashes in backticks or code blocks.** GitHub only auto-links plain text commit hashes.
43+
44+
| Format | Example | Result |
45+
|--------|---------|--------|
46+
| CORRECT | `Fixed in f3b5fec.` | Clickable link to commit |
47+
| WRONG | `Fixed in \`f3b5fec\`.` | Plain text, no link |
48+
49+
**Examples of correct replies:**
50+
51+
```text
52+
Fixed in f3b5fec.
53+
54+
**Changes:**
55+
- Updated error handling for iOS purchases
56+
```
57+
58+
```text
59+
Fixed in abc1234 along with other review items.
60+
```
61+
62+
**Do NOT use backticks around the commit hash** - this breaks GitHub's auto-linking feature.
63+
64+
## Workflow
65+
66+
1. Fetch unresolved PR review threads using `gh api`
67+
2. For each comment:
68+
- **Valid issue** -> Fix the code
69+
- **Invalid/wrong** -> Reply with explanation (don't resolve)
70+
3. Run pre-commit checks (format, analyze, test)
71+
4. If all pass -> Commit and push
72+
5. Resolve fixed threads with reply containing commit hash

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pubspec.lock
77

88
.build/
99
build/
10-
.claude/
10+
.claude/settings.local.json
1111

1212
.idea/
1313
!.idea/runConfigurations/

0 commit comments

Comments
 (0)