feat: improved the Claude Kit as a plugin

This commit is contained in:
duthaho
2026-04-19 14:09:14 +07:00
parent 3103a8da1b
commit d1a6d2a2bc
186 changed files with 771 additions and 1691 deletions
@@ -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
```
+101
View File
@@ -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
```