Skip to content
123 changes: 123 additions & 0 deletions .claude/commands/github/commit-smart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: /commit-smart
description: Create smart commit with quality checks and conventional format
---

# Smart Commit with Quality Gates

You are helping the user create a well-formatted commit with pre-commit validation.

## Workflow

1. **Check Staged Changes**
```bash
git status
git diff --cached --stat
```
- Show what files are staged
- If nothing staged, ask user what to add

2. **Pre-Commit Quality Checks**

Run local quality gates before committing:

**Python syntax** (if .py files changed):
```bash
flake8 skill/ --count --select=E9,F63,F7,F82 --show-source
```

**Bash syntax** (if .sh files changed):
```bash
bash -n install.sh
bash -n hooks/pre-commit.sh
```

**Secret scan**:
```bash
git diff --cached | grep -iE "(api_key|api_secret|password|token|AWS_ACCESS)" || echo "No secrets detected"
```

3. **Generate Conventional Commit Message**

Ask user about the change:
- Type: feat, fix, docs, style, refactor, perf, test, build, ci, chore
- Scope: installer, skill, command, agent, docs, ci, workflows
- Description: what changed (imperative mood)
- Why: reason for change (optional body)
- Issue: related issue number

**Format:**
```
<type>(<scope>): <description>

[optional body explaining why]

[optional footer: Closes #123]
```

4. **Validate Message Format**
- Check format matches Conventional Commits
- Ensure subject is imperative mood ("add" not "added")
- Verify no period at end
- Check length < 50 characters for subject

5. **Create Commit**
```bash
git commit -m "<generated message>"
```

6. **Post-Commit Actions**
- Show commit hash
- Show commit in log
- Ask if user wants to push

## Examples

**Feature commit:**
```bash
git commit -m "feat(installer): add Windows PowerShell support

Adds install.ps1 script with equivalent functionality to
install.sh for Windows users.

Closes #42"
```

**Fix commit:**
```bash
git commit -m "fix(skill): correct Python syntax validation

Fix flake8 configuration to properly detect syntax errors.
Previous config was too permissive.

Fixes #156"
```

**Docs commit:**
```bash
git commit -m "docs: update GitHub workflows documentation

Add troubleshooting section and configuration examples."
```

## Quality Gates

Before committing, ensure:
- ✅ No syntax errors
- ✅ No hardcoded secrets
- ✅ Conventional Commits format
- ✅ Related issue linked (for feat/fix)
- ✅ Files staged are relevant to commit message

## Interactive Flow

1. Show staged changes
2. Run quality checks
3. Ask for commit details (type, scope, description)
4. Generate commit message
5. Show preview
6. Confirm with user
7. Execute commit
8. Display result

Use clear prompts and provide the exact commands for the user to run.
184 changes: 184 additions & 0 deletions .claude/commands/github/create-pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
title: /create-pr
description: Create pull request with proper validation
---

# Create Pull Request

You are helping the user create a pull request that follows ClaudeForge conventions.

## Workflow

1. **Detect Current Branch**
```bash
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
```

2. **Determine Target Branch**
- If current branch starts with `feature/`, `fix/`, `hotfix/`, `test/`, `refactor/`, `docs/`:
- Target: `dev`
- If current branch is `dev`:
- Target: `main` (release PR)
- Otherwise: Ask user

3. **Validate Branch Name**
- Check if branch follows convention
- If not, suggest renaming:
```bash
git branch -m feature/new-name
```

4. **Check for Uncommitted Changes**
```bash
git status --short
```
- If changes exist, suggest committing first

5. **Push Branch** (if needed)
```bash
git push -u origin $CURRENT_BRANCH
```

6. **Generate PR Title**
- Based on commits since target branch
- Must follow Conventional Commits format
- Examples:
- `feat(installer): add Windows PowerShell support`
- `fix(skill): correct template selection logic`
- `docs: update installation guide`

7. **Generate PR Description**

Use PR template format:
```markdown
## Description
[Describe changes]

## Type of Change
- [x] [Selected type]

## Related Issues
Closes #[issue number]

## Changes Made
- Change 1
- Change 2

## Testing Performed
- [x] Tested installation
- [x] Tested slash command
...
```

8. **Create PR**
```bash
gh pr create \
--base [target branch] \
--title "[PR title]" \
--body "[PR description]"
```

Or for draft:
```bash
gh pr create --draft \
--base [target branch] \
--title "[PR title]" \
--body "[PR description]"
```

9. **Post-Creation**
- Show PR URL
- Explain what workflows will run:
- For PR to dev: `pr-into-dev.yml`
- For PR to main: `dev-to-main.yml`
- Link to workflow documentation

## Validation Checklist

Before creating PR, verify:
- ✅ Branch name follows convention
- ✅ PR title follows Conventional Commits
- ✅ At least one issue referenced
- ✅ All changes committed and pushed
- ✅ Target branch is correct

## Examples

**Feature PR to dev:**
```bash
gh pr create \
--base dev \
--title "feat(skill): add Rust template support" \
--body "## Description

Adds Rust project template with Cargo.toml detection and
appropriate CLAUDE.md generation.

## Type of Change
- [x] New feature

## Related Issues
Closes #42

## Changes Made
- Add Rust template in skill/examples/
- Update template_selector.py with Rust detection
- Add Rust-specific validation rules

## Testing Performed
- [x] Tested on sample Rust project
- [x] Validated template output
- [x] Python syntax checks pass"
```

**Release PR (dev to main):**
```bash
gh pr create \
--base main \
--title "release: v1.1.0" \
--body "## Description

Release version 1.1.0 with new features and bug fixes.

## Changes in This Release
- feat(skill): Rust template support
- feat(installer): Windows improvements
- fix(skill): Template selection bugs
- docs: Updated installation guide

## Related Issues
Closes #42, #45, #48

## CHANGELOG
See CHANGELOG.md for full details.

## Testing
- [x] All quality gates pass
- [x] Tested installation on macOS, Linux, Windows
- [x] Tested all new features"
```

## Workflow Triggers

**PR to dev:**
- Validates branch name (must be feature/*, fix/*, etc.)
- Validates PR title (Conventional Commits)
- Checks for linked issues
- Runs quality gates (Python, Markdown, Bash, secrets)

**PR to main:**
- Validates source branch (must be dev, release/*, or dependabot/*)
- Checks CHANGELOG.md updated
- Validates production build
- Runs full quality gates

## Success Output

Show user:
1. PR URL
2. Workflow status link
3. Next steps (wait for CI, request review)
4. Link to relevant docs (GITHUB_WORKFLOWS.md, BRANCHING_STRATEGY.md)

Provide clear guidance and actual commands user can run.
Loading
Loading