docs(skills): Add shell command patterns for Claude Code reliability
This commit is contained in:
@@ -353,6 +353,60 @@ Posting summary comment with explanations...
|
||||
- `APPROVE` - Approving the changes
|
||||
- `REQUEST_CHANGES` - Requesting changes before merge
|
||||
|
||||
## Shell Command Patterns
|
||||
|
||||
Claude Code's bash execution has quirks. Use these patterns for reliability:
|
||||
|
||||
### curl requests
|
||||
|
||||
**DO** - Use single quotes for URL and header separately:
|
||||
```bash
|
||||
curl -s 'https://git.example.com/api/v1/repos/owner/repo/pulls/1/reviews' \
|
||||
-H 'Authorization: token YOUR_TOKEN_HERE' | jq .
|
||||
```
|
||||
|
||||
**DON'T** - Variable expansion in `-H` flag often fails:
|
||||
```bash
|
||||
# This may fail with "blank argument" errors
|
||||
curl -s -H "Authorization: token $TOKEN" "$URL"
|
||||
```
|
||||
|
||||
### Iterating over reviews
|
||||
|
||||
**DO** - Run separate commands for each review ID:
|
||||
```bash
|
||||
echo "=== Review 4 ===" && curl -s 'URL/reviews/4/comments' -H 'Authorization: token ...' | jq .
|
||||
echo "=== Review 5 ===" && curl -s 'URL/reviews/5/comments' -H 'Authorization: token ...' | jq .
|
||||
```
|
||||
|
||||
**DON'T** - For loops with multiline bodies often fail:
|
||||
```bash
|
||||
# This may cause syntax errors
|
||||
for id in 4 5 6; do
|
||||
curl -s "URL/reviews/$id/comments"
|
||||
done
|
||||
```
|
||||
|
||||
### tea comment
|
||||
|
||||
**DO** - Use single-quoted string for comment body:
|
||||
```bash
|
||||
tea comment 26 '## Summary
|
||||
|
||||
Changes made:
|
||||
- Item 1
|
||||
- Item 2'
|
||||
```
|
||||
|
||||
**DON'T** - Heredocs may hang or timeout:
|
||||
```bash
|
||||
# This may hang indefinitely
|
||||
tea comment 26 "$(cat <<'EOF'
|
||||
...
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
1. **Thread replies**: Gitea API doesn't support inline thread replies. We post a single summary comment instead.
|
||||
|
||||
Reference in New Issue
Block a user