mirror of
https://github.com/duthaho/claudekit.git
synced 2026-06-10 12:14:57 +03:00
feat: improved the Claude Kit as a plugin
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
---
|
||||
name: git-workflows
|
||||
argument-hint: "[commit/ship/pr/changelog]"
|
||||
description: >
|
||||
Use when committing code, creating pull requests, shipping changes, or generating changelogs. Trigger for keywords like "commit", "push", "PR", "pull request", "ship", "merge", "changelog", "release notes", "conventional commits", or any git workflow beyond basic status/diff. Also activate when preparing code for review or automating the commit-to-PR pipeline.
|
||||
---
|
||||
|
||||
# Git Workflows
|
||||
|
||||
## When to Use
|
||||
|
||||
- Creating commits with conventional commit messages
|
||||
- Shipping code (commit + review + push + PR)
|
||||
- Creating pull requests with proper descriptions
|
||||
- Generating changelogs from commit history
|
||||
- Preparing code for review or merge
|
||||
|
||||
## When NOT to Use
|
||||
|
||||
- Basic git operations (status, diff, log) — just run them directly
|
||||
- Branch management strategy — use `using-git-worktrees`
|
||||
- Code review content — use `requesting-code-review`
|
||||
|
||||
---
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Workflow | Reference | Key content |
|
||||
|----------|-----------|-------------|
|
||||
| Committing | `references/committing.md` | Conventional commits, message format, pre-commit checks |
|
||||
| Shipping | `references/shipping.md` | Full ship workflow: review → test → commit → push → PR |
|
||||
| Pull Requests | `references/pull-requests.md` | PR creation, description templates, gh CLI patterns |
|
||||
| Changelogs | `references/changelogs.md` | Changelog generation from commits, Keep a Changelog format |
|
||||
|
||||
---
|
||||
|
||||
## Conventional Commit Format
|
||||
|
||||
```
|
||||
type(scope): subject
|
||||
|
||||
body (optional)
|
||||
|
||||
footer (optional)
|
||||
```
|
||||
|
||||
| Type | When |
|
||||
|------|------|
|
||||
| `feat` | New feature |
|
||||
| `fix` | Bug fix |
|
||||
| `docs` | Documentation only |
|
||||
| `refactor` | Code restructuring, no behavior change |
|
||||
| `test` | Adding or fixing tests |
|
||||
| `chore` | Maintenance, dependencies, CI |
|
||||
| `style` | Formatting, whitespace |
|
||||
|
||||
### Subject Line Rules
|
||||
|
||||
- Max 50 characters, imperative mood ("Add" not "Added"), no trailing period
|
||||
|
||||
---
|
||||
|
||||
## Ship Workflow
|
||||
|
||||
```
|
||||
1. Pre-ship checks (secrets, debug statements)
|
||||
2. Self-review (code quality, style)
|
||||
3. Run tests (full suite, coverage check)
|
||||
4. Create commit (conventional format)
|
||||
5. Push to remote
|
||||
6. Create PR (summary, test plan, checklist)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## PR Description Template
|
||||
|
||||
```markdown
|
||||
## Summary
|
||||
- [Change 1]
|
||||
- [Change 2]
|
||||
|
||||
## Test Plan
|
||||
- [ ] Unit tests pass
|
||||
- [ ] Manual testing done
|
||||
|
||||
## Checklist
|
||||
- [ ] No breaking changes
|
||||
- [ ] Tests added/updated
|
||||
- [ ] Documentation updated
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Atomic commits** — one logical change per commit, not one file per commit.
|
||||
2. **Explain why, not what** — the diff shows what changed; the message explains why.
|
||||
3. **Stage specific files** — prefer `git add <file>` over `git add -A` to avoid committing secrets or unrelated changes.
|
||||
4. **Reference issues** — include `Closes #123` or `Fixes #456` in footers.
|
||||
5. **Pre-commit checks** — verify no secrets, debug statements, or commented-out code before committing.
|
||||
6. **PR descriptions matter** — reviewers read the description before the diff; make it count.
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
1. **Committing secrets** — `.env` files, API keys, tokens in staged changes.
|
||||
2. **Vague commit messages** — "fix stuff", "updates", "WIP" provide no context.
|
||||
3. **Giant PRs** — 500+ line PRs get rubber-stamped; split into focused chunks.
|
||||
4. **Amending published commits** — rewriting history others have pulled causes conflicts.
|
||||
5. **Skipping pre-commit hooks** — `--no-verify` hides real issues.
|
||||
6. **Force pushing to shared branches** — can destroy teammates' work.
|
||||
|
||||
---
|
||||
|
||||
## Related Skills
|
||||
|
||||
- `requesting-code-review` — Preparing changes for reviewer feedback
|
||||
- `finishing-a-development-branch` — End-of-branch workflow decisions
|
||||
- `using-git-worktrees` — Isolated branch management
|
||||
@@ -0,0 +1,59 @@
|
||||
# Changelog Generation
|
||||
|
||||
## Keep a Changelog Format
|
||||
|
||||
Based on [keepachangelog.com](https://keepachangelog.com):
|
||||
|
||||
```markdown
|
||||
## [1.2.0] - 2026-04-19
|
||||
|
||||
### Added
|
||||
- Password reset functionality (#123)
|
||||
- Email verification for new accounts
|
||||
|
||||
### Changed
|
||||
- Improved error messages for validation failures
|
||||
- Updated dependencies to latest versions
|
||||
|
||||
### Fixed
|
||||
- Race condition in session handling (#456)
|
||||
- Incorrect timezone in date displays
|
||||
|
||||
### Removed
|
||||
- Legacy v1 API endpoints (deprecated since 1.0)
|
||||
```
|
||||
|
||||
## Generating from Commits
|
||||
|
||||
```bash
|
||||
# Get commits since last tag
|
||||
git log --oneline $(git describe --tags --abbrev=0)..HEAD
|
||||
|
||||
# Group by type
|
||||
git log --oneline --grep="^feat" $(git describe --tags --abbrev=0)..HEAD
|
||||
git log --oneline --grep="^fix" $(git describe --tags --abbrev=0)..HEAD
|
||||
```
|
||||
|
||||
## Category Mapping
|
||||
|
||||
| Commit Type | Changelog Category |
|
||||
|-------------|-------------------|
|
||||
| `feat` | Added |
|
||||
| `fix` | Fixed |
|
||||
| `refactor`, `perf` | Changed |
|
||||
| removal commits | Removed |
|
||||
| `docs` | Usually omitted |
|
||||
| `chore`, `test`, `style` | Usually omitted |
|
||||
|
||||
## User-Friendly Descriptions
|
||||
|
||||
Transform commit messages into user-facing descriptions:
|
||||
|
||||
```
|
||||
BAD: feat(auth): add pwd reset (#123)
|
||||
GOOD: Password reset functionality — users can now reset their password via email (#123)
|
||||
```
|
||||
|
||||
- Write for users, not developers
|
||||
- Include PR/issue references
|
||||
- Explain the user-visible impact
|
||||
@@ -0,0 +1,90 @@
|
||||
# Committing Patterns
|
||||
|
||||
## Pre-Commit Checklist
|
||||
|
||||
Before staging:
|
||||
- [ ] No secrets (`.env`, API keys, tokens)
|
||||
- [ ] No debug statements (`console.log`, `print()`, `debugger`)
|
||||
- [ ] No commented-out code blocks
|
||||
- [ ] Code is formatted (prettier/ruff)
|
||||
|
||||
## Conventional Commit Format
|
||||
|
||||
```
|
||||
type(scope): subject
|
||||
|
||||
body (optional - explain why, not what)
|
||||
|
||||
footer (optional - references, breaking changes)
|
||||
```
|
||||
|
||||
### Types
|
||||
|
||||
| Type | When | Example |
|
||||
|------|------|---------|
|
||||
| `feat` | New feature | `feat(auth): add OAuth2 login` |
|
||||
| `fix` | Bug fix | `fix(api): handle null user in profile` |
|
||||
| `docs` | Documentation | `docs(readme): update install steps` |
|
||||
| `refactor` | Restructure, no behavior change | `refactor(db): extract query builders` |
|
||||
| `test` | Add/fix tests | `test(auth): add login edge cases` |
|
||||
| `chore` | Maintenance | `chore(deps): update React to 19` |
|
||||
| `style` | Formatting | `style: apply prettier` |
|
||||
| `perf` | Performance | `perf(query): add index on user_id` |
|
||||
|
||||
### Subject Line Rules
|
||||
|
||||
- Max 50 characters
|
||||
- Imperative mood: "Add" not "Added" or "Adds"
|
||||
- No trailing period
|
||||
- Capitalize first letter
|
||||
|
||||
### Body Rules
|
||||
|
||||
- Wrap at 72 characters
|
||||
- Explain **why**, not what (the diff shows what)
|
||||
- Use bullet points for multiple changes
|
||||
|
||||
### Footer Patterns
|
||||
|
||||
```
|
||||
Closes #123
|
||||
Fixes #456
|
||||
BREAKING CHANGE: removed legacy auth endpoint
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
```
|
||||
|
||||
## Staging Best Practices
|
||||
|
||||
```bash
|
||||
# Prefer specific files over blanket add
|
||||
git add src/auth/login.ts src/auth/login.test.ts
|
||||
|
||||
# Review what you're committing
|
||||
git diff --staged
|
||||
|
||||
# Never commit these
|
||||
# .env, credentials.json, *.pem, *.key
|
||||
```
|
||||
|
||||
## Commit Command Pattern
|
||||
|
||||
```bash
|
||||
git commit -m "$(cat <<'EOF'
|
||||
feat(auth): add password reset flow
|
||||
|
||||
- Add reset token generation with 1h expiry
|
||||
- Implement email sending via SendGrid
|
||||
- Add rate limiting (3 requests/hour)
|
||||
|
||||
Closes #123
|
||||
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Amending vs New Commit
|
||||
|
||||
- **Amend**: Only for unpushed commits, only when fixing the same logical change
|
||||
- **New commit**: Always for pushed commits, or when adding distinct changes
|
||||
- **Never amend after pre-commit hook failure** — the commit didn't happen, so amend would modify the previous commit
|
||||
@@ -0,0 +1,77 @@
|
||||
# Pull Request Patterns
|
||||
|
||||
## Pre-PR Checklist
|
||||
|
||||
- [ ] All tests passing
|
||||
- [ ] Code self-reviewed
|
||||
- [ ] No merge conflicts with base branch
|
||||
- [ ] Branch pushed to remote
|
||||
- [ ] Commit history is clean (no "WIP" or "fix typo" noise)
|
||||
|
||||
## Creating a PR
|
||||
|
||||
```bash
|
||||
# Check current state
|
||||
git status
|
||||
git diff main...HEAD
|
||||
git log --oneline main..HEAD
|
||||
|
||||
# Push if needed
|
||||
git push -u origin $(git branch --show-current)
|
||||
|
||||
# Create PR
|
||||
gh pr create --title "feat(scope): description" --body "$(cat <<'EOF'
|
||||
## Summary
|
||||
- [Change 1]
|
||||
- [Change 2]
|
||||
|
||||
## Test Plan
|
||||
- [ ] Unit tests added
|
||||
- [ ] Manual testing done
|
||||
- [ ] Edge cases covered
|
||||
|
||||
## Checklist
|
||||
- [ ] No breaking changes
|
||||
- [ ] Tests added/updated
|
||||
- [ ] Documentation updated
|
||||
|
||||
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## PR Title Format
|
||||
|
||||
Follow conventional commits: `type(scope): description`
|
||||
|
||||
- Max 70 characters
|
||||
- Use description/body for details, not the title
|
||||
|
||||
## PR Size Guidelines
|
||||
|
||||
| Size | Lines Changed | Review Time |
|
||||
|------|--------------|-------------|
|
||||
| Small | < 100 | Quick review |
|
||||
| Medium | 100-300 | Thorough review |
|
||||
| Large | 300-500 | Split if possible |
|
||||
| Too Large | > 500 | Must split |
|
||||
|
||||
## Viewing PR Comments
|
||||
|
||||
```bash
|
||||
# View PR comments
|
||||
gh api repos/owner/repo/pulls/123/comments
|
||||
|
||||
# View PR review comments
|
||||
gh pr view 123 --comments
|
||||
```
|
||||
|
||||
## Draft PRs
|
||||
|
||||
```bash
|
||||
# Create as draft for early feedback
|
||||
gh pr create --draft --title "WIP: feature" --body "Early draft for feedback"
|
||||
|
||||
# Mark ready when done
|
||||
gh pr ready 123
|
||||
```
|
||||
@@ -0,0 +1,101 @@
|
||||
# Ship Workflow
|
||||
|
||||
Complete workflow: review → test → commit → push → PR.
|
||||
|
||||
## Phase 1: Pre-Ship Checks
|
||||
|
||||
```bash
|
||||
git status
|
||||
git diff --staged
|
||||
```
|
||||
|
||||
Verify:
|
||||
- [ ] No secrets in staged files
|
||||
- [ ] No debug statements
|
||||
- [ ] No commented-out code
|
||||
- [ ] No unintended files
|
||||
|
||||
## Phase 2: Self-Review
|
||||
|
||||
- Check code quality and style compliance
|
||||
- Verify security (no hardcoded secrets, proper input validation)
|
||||
- Address critical issues before proceeding
|
||||
|
||||
## Phase 3: Run Tests
|
||||
|
||||
```bash
|
||||
# Python
|
||||
pytest -v
|
||||
|
||||
# TypeScript
|
||||
pnpm test
|
||||
```
|
||||
|
||||
- All tests must pass
|
||||
- Coverage should not decrease
|
||||
- No new warnings
|
||||
|
||||
## Phase 4: Create Commit
|
||||
|
||||
```bash
|
||||
# Stage specific files
|
||||
git add src/feature.ts src/feature.test.ts
|
||||
|
||||
# Commit with conventional format
|
||||
git commit -m "$(cat <<'EOF'
|
||||
feat(scope): description
|
||||
|
||||
- Change 1
|
||||
- Change 2
|
||||
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Phase 5: Push and Create PR
|
||||
|
||||
```bash
|
||||
# Push with upstream tracking
|
||||
git push -u origin feature/my-feature
|
||||
|
||||
# Create PR
|
||||
gh pr create --title "feat(scope): description" --body "$(cat <<'EOF'
|
||||
## Summary
|
||||
- Change 1
|
||||
- Change 2
|
||||
|
||||
## Test Plan
|
||||
- [ ] Unit tests pass
|
||||
- [ ] Manual testing done
|
||||
|
||||
Co-Authored-By: Claude <noreply@anthropic.com>
|
||||
EOF
|
||||
)"
|
||||
```
|
||||
|
||||
## Quick Ship Mode
|
||||
|
||||
For small, low-risk changes:
|
||||
1. Skip detailed self-review
|
||||
2. Auto-generate commit message from diff
|
||||
3. Minimal PR description
|
||||
|
||||
## Ship Report Format
|
||||
|
||||
```markdown
|
||||
## Ship Complete
|
||||
|
||||
### Commit
|
||||
**Hash**: `abc1234`
|
||||
**Message**: `feat(auth): add password reset`
|
||||
|
||||
### Checks
|
||||
- [x] Tests passing (42 tests)
|
||||
- [x] Coverage: 85% (+3%)
|
||||
- [x] No security issues
|
||||
|
||||
### Pull Request
|
||||
**URL**: https://github.com/org/repo/pull/123
|
||||
**Status**: Ready for review
|
||||
```
|
||||
Reference in New Issue
Block a user