refactor: extract skills from commands across 8 plugins

Refactored commands to extract reusable skills following the
Commands → Skills separation pattern. Each command is now <50 lines
and references skill files for detailed knowledge.

Plugins refactored:
- claude-config-maintainer: 5 commands → 7 skills
- code-sentinel: 3 commands → 2 skills
- contract-validator: 5 commands → 6 skills
- data-platform: 10 commands → 6 skills
- doc-guardian: 5 commands → 6 skills (replaced nested dir)
- git-flow: 8 commands → 7 skills

Skills contain: workflows, validation rules, conventions,
reference data, tool documentation

Commands now contain: YAML frontmatter, agent assignment,
skills list, brief workflow steps, parameters

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 17:32:24 -05:00
parent aad02ef2d9
commit 7c8a20c804
71 changed files with 3896 additions and 3690 deletions

View File

@@ -0,0 +1,97 @@
# Branch Naming
## Purpose
Defines branch naming conventions and validation rules for consistent repository organization.
## When to Use
- Creating new branches with `/branch-start`
- Validating branch names
- Converting descriptions to branch names
## Branch Name Format
```
<type>/<description>
```
## Branch Types
| Type | Purpose | Example |
|------|---------|---------|
| `feat` | New feature | `feat/user-authentication` |
| `fix` | Bug fix | `fix/login-timeout` |
| `chore` | Maintenance | `chore/update-deps` |
| `docs` | Documentation | `docs/api-reference` |
| `refactor` | Code restructure | `refactor/auth-module` |
| `test` | Test additions | `test/auth-coverage` |
| `perf` | Performance | `perf/query-optimization` |
| `debug` | Debugging work | `debug/memory-leak` |
## Naming Rules
1. **Lowercase only** - Never use uppercase
2. **Hyphens for spaces** - Use `-` not `_` or ` `
3. **No special characters** - Alphanumeric and hyphens only
4. **Descriptive** - 2-4 words recommended
5. **Max 50 characters** - Keep concise
## Conversion Algorithm
```
Input: "Add User Authentication"
Output: "feat/add-user-authentication"
Steps:
1. Lowercase: "add user authentication"
2. Replace spaces: "add-user-authentication"
3. Remove special chars: (none to remove)
4. Add prefix: "feat/add-user-authentication"
5. Truncate if > 50: (not needed)
```
## Validation Checks
```
Branch name validation:
[x] Lowercase
[x] Valid prefix (feat/)
[x] Descriptive (3+ words recommended)
[ ] Too long (52 chars, max 50)
Suggested: feat/add-user-auth
```
## Examples
**Valid:**
```
feat/add-password-reset
fix/null-pointer-login
chore/upgrade-typescript-5
docs/update-readme
refactor/simplify-auth
```
**Invalid:**
```
Feature/Add_Password_Reset (wrong case, underscores)
fix-bug (too vague, no prefix)
my-branch (no type prefix)
feat/add-new-super-amazing-feature-for-users (too long)
```
## Issue-Linked Branches
When working on issues, include issue number:
```
feat/123-add-password-reset
fix/456-login-timeout
```
## Related Skills
- skills/commit-conventions.md
- skills/git-safety.md
- skills/workflow-patterns/branching-strategies.md

View File

@@ -0,0 +1,95 @@
# Commit Conventions
## Purpose
Defines conventional commit message format for consistent, parseable commit history.
## When to Use
- Generating commit messages in `/commit`
- Validating user-provided commit messages
- Explaining commit format to users
## Message Format
```
<type>(<scope>): <description>
[optional body]
[optional footer]
```
## Commit Types
| Type | Purpose | Example Scope |
|------|---------|---------------|
| `feat` | New feature | `auth`, `api`, `ui` |
| `fix` | Bug fix | `login`, `validation` |
| `docs` | Documentation only | `readme`, `api-docs` |
| `style` | Formatting, whitespace | `lint`, `format` |
| `refactor` | Code change (no bug fix, no feature) | `auth-module` |
| `perf` | Performance improvement | `query`, `cache` |
| `test` | Adding/updating tests | `unit`, `e2e` |
| `chore` | Maintenance tasks | `deps`, `build` |
| `build` | Build system or dependencies | `webpack`, `npm` |
| `ci` | CI configuration | `github-actions` |
## Scope Detection
Derive scope from changed files:
- `src/auth/*` -> `auth`
- `src/api/*` -> `api`
- `tests/*` -> `test`
- `docs/*` -> `docs`
- Multiple directories -> most significant or omit
## Examples
**Feature commit:**
```
feat(auth): add password reset flow
Implement forgot password with email verification.
Includes rate limiting (5 attempts/hour) and 24h token expiration.
Closes #123
```
**Bug fix:**
```
fix(ui): resolve button alignment on mobile
The submit button was misaligned on screens < 768px.
Added responsive flex rules.
```
**Maintenance:**
```
chore(deps): update dependencies
- typescript 5.3 -> 5.4
- react 18.2 -> 18.3
- node 18 -> 20 (LTS)
```
## Footer Conventions
| Footer | Purpose |
|--------|---------|
| `Closes #123` | Auto-close issue |
| `Refs #123` | Reference without closing |
| `BREAKING CHANGE:` | Breaking change description |
| `Co-Authored-By:` | Credit co-author |
## Co-Author Footer
When Claude assists with commits:
```
Co-Authored-By: Claude <noreply@anthropic.com>
```
## Related Skills
- skills/branch-naming.md
- skills/git-safety.md

View File

@@ -0,0 +1,92 @@
# Environment Variables
## Purpose
Centralized reference for all git-flow environment variables and their defaults.
## When to Use
- Configuring git-flow behavior in `/git-config`
- Documenting available options to users
- Setting up project-specific overrides
## Core Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `GIT_DEFAULT_BASE` | `development` | Base branch for new branches and merges |
| `GIT_PROTECTED_BRANCHES` | `main,master,development,staging,production` | Comma-separated list of protected branches |
| `GIT_WORKFLOW_STYLE` | `feature-branch` | Workflow: simple, feature-branch, pr-required, trunk-based |
## Commit Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `GIT_COMMIT_STYLE` | `conventional` | Message style: conventional, simple, detailed |
| `GIT_SIGN_COMMITS` | `false` | Use GPG signing |
| `GIT_CO_AUTHOR` | `true` | Include Claude co-author footer |
## Push/Sync Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `GIT_AUTO_PUSH` | `false` | Auto-push after commit |
| `GIT_PUSH_STRATEGY` | `rebase` | Handle diverged branches: rebase, merge |
| `GIT_SYNC_STRATEGY` | `rebase` | Incorporate upstream changes: rebase, merge |
| `GIT_AUTO_PRUNE` | `true` | Auto-prune stale remote refs on sync |
## Branch Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `GIT_BRANCH_PREFIX` | `true` | Use type/ prefix for branches |
| `GIT_AUTO_DELETE_MERGED` | `true` | Auto-delete merged branches |
| `GIT_AUTO_DELETE_REMOTE` | `false` | Auto-delete remote branches |
| `GIT_CLEANUP_STALE` | `true` | Include stale branches in cleanup |
## Workflow Styles
### simple
- Direct commits to main/development
- No feature branches required
- Best for: Solo projects, small scripts
### feature-branch (Default)
- Feature branches from development
- Merge when complete
- Best for: Small teams
### pr-required
- Feature branches from development
- Requires PR for merge
- Best for: Code review workflows
### trunk-based
- Short-lived branches (< 1 day)
- Frequent integration
- Best for: CI/CD heavy workflows
## Storage Locations
| Scope | Location | Priority |
|-------|----------|----------|
| Project | `.env` or `.claude/settings.json` | Highest |
| User | `~/.config/claude/git-flow.env` | Lower |
Project settings override user settings.
## Example Configuration
**.env file:**
```bash
GIT_DEFAULT_BASE=main
GIT_WORKFLOW_STYLE=pr-required
GIT_AUTO_DELETE_MERGED=true
GIT_COMMIT_STYLE=conventional
GIT_PROTECTED_BRANCHES=main,staging,production
```
## Related Skills
- skills/git-safety.md
- skills/commit-conventions.md

View File

@@ -0,0 +1,105 @@
# Git Safety
## Purpose
Defines protected branches, destructive command warnings, and safety checks to prevent accidental data loss.
## When to Use
- Before any commit, push, or merge operation
- When user attempts to work on protected branches
- Before executing destructive commands
## Protected Branches
Default protected branches (configurable via `GIT_PROTECTED_BRANCHES`):
- `main`
- `master`
- `development`
- `staging`
- `production`
## Protection Rules
| Action | Behavior |
|--------|----------|
| Direct commit | Warn and offer to create feature branch |
| Force push | Require explicit confirmation |
| Deletion | Block completely |
| Merge into | Allow with standard workflow |
## Protected Branch Warning
When committing on protected branch:
```
You are on a protected branch: development
Protected branches typically have push restrictions that will prevent
direct commits from being pushed to the remote.
Options:
1. Create a feature branch and continue (Recommended)
2. Continue on this branch anyway (may fail on push)
3. Cancel
```
## Destructive Commands
Commands requiring extra confirmation:
| Command | Risk | Mitigation |
|---------|------|------------|
| `git push --force` | Overwrites remote history | Use `--force-with-lease` |
| `git reset --hard` | Loses uncommitted changes | Warn about unsaved work |
| `git branch -D` | Deletes unmerged branch | Confirm branch name |
| `git clean -fd` | Deletes untracked files | List files first |
## Safe Alternatives
| Risky | Safe Alternative |
|-------|------------------|
| `git push --force` | `git push --force-with-lease` |
| `git branch -D` | `git branch -d` (merged only) |
| `git reset --hard` | `git stash` first |
| `git checkout .` | Review changes first |
## Branch Deletion Safety
**Merged branches (`-d`):**
```bash
git branch -d feat/old-feature # Safe: only deletes if merged
```
**Unmerged branches (`-D`):**
```bash
# Requires confirmation
git branch -D feat/abandoned # Force: deletes regardless
```
## Push Rejection Handling
When push fails on protected branch:
```
Push rejected: Remote protection rules prevent direct push to development.
Options:
1. Create a pull request instead (Recommended)
2. Review branch protection settings
3. Cancel
```
## Stale Branch Detection
Branches with deleted remotes:
```bash
git branch -vv | grep ': gone]'
```
These are safe to delete locally with `-D` after confirmation.
## Related Skills
- skills/branch-naming.md
- skills/merge-workflow.md

View File

@@ -0,0 +1,124 @@
# Merge Workflow
## Purpose
Defines merge strategies, conflict resolution approaches, and post-merge cleanup procedures.
## When to Use
- Merging feature branches in `/commit-merge`
- Resolving conflicts during sync operations
- Cleaning up after successful merges
## Merge Strategies
### 1. Merge Commit (Default)
```bash
git merge <branch> --no-ff
```
- **Preserves history** - All commits visible
- **Creates merge commit** - Clear merge point
- **Best for:** Feature branches, team workflows
### 2. Squash and Merge
```bash
git merge <branch> --squash
git commit -m "feat: complete feature"
```
- **Single commit** - Clean main branch history
- **Loses individual commits** - Combined into one
- **Best for:** PR workflows, many small commits
### 3. Rebase
```bash
git checkout <branch>
git rebase <target>
git checkout <target>
git merge <branch> --ff-only
```
- **Linear history** - No merge commits
- **Rewrites history** - Changes commit hashes
- **Best for:** Personal branches, clean history
## Standard Merge Procedure
```bash
# 1. Switch to target branch
git checkout <target>
# 2. Pull latest changes
git pull origin <target>
# 3. Merge feature branch
git merge <feature-branch> [--squash] [--no-ff]
# 4. Push merged result
git push origin <target>
```
## Conflict Resolution
When conflicts occur:
```
Conflicts detected while merging.
Conflicting files:
- src/auth/login.ts
- src/auth/types.ts
Options:
1. Open conflict resolution (guided)
2. Abort merge (keep local state)
3. Accept all theirs (loses your changes in conflicts)
4. Accept all ours (ignores upstream in conflicts)
```
### Manual Resolution Steps
1. Open conflicting file
2. Find conflict markers: `<<<<<<<`, `=======`, `>>>>>>>`
3. Edit to desired state
4. Remove markers
5. Stage resolved file: `git add <file>`
6. Continue: `git merge --continue` or `git rebase --continue`
## Post-Merge Cleanup
After successful merge:
```
Merge complete. Delete the feature branch?
1. Yes, delete local and remote (Recommended)
2. Delete local only
3. Keep the branch
```
### Cleanup Commands
```bash
# Delete local branch
git branch -d <branch>
# Delete remote branch
git push origin --delete <branch>
```
## Pre-Merge Checks
Before merging:
1. **Verify target exists** - `git branch -a | grep <target>`
2. **Check for uncommitted changes** - `git status`
3. **Preview conflicts** - `git merge --no-commit --no-ff <branch>`
4. **Abort preview** - `git merge --abort`
## Related Skills
- skills/git-safety.md
- skills/sync-workflow.md

View File

@@ -0,0 +1,146 @@
# Sync Workflow
## Purpose
Defines push/pull patterns, rebase strategies, upstream tracking, and stale branch detection.
## When to Use
- Pushing commits in `/commit-push`
- Full sync operations in `/commit-sync`
- Detecting and reporting stale branches
## Push Workflow
### First Push (No Upstream)
```bash
git push -u origin <branch>
```
Sets upstream tracking for future pushes.
### Subsequent Pushes
```bash
git push
```
Pushes to tracked upstream.
### Push After Rebase
```bash
git push --force-with-lease
```
Safe force push - fails if remote has new commits.
## Sync with Base Branch
```bash
# 1. Fetch all with prune
git fetch --all --prune
# 2. Rebase on base branch
git rebase origin/<base-branch>
# 3. Push (force if rebased)
git push --force-with-lease
```
## Push Conflict Handling
When push fails due to diverged history:
```
Remote has changes not in your local branch.
Options:
1. Pull and rebase, then push (Recommended)
2. Pull and merge, then push
3. Force push (destructive - requires confirmation)
4. Cancel and review manually
```
### Rebase Resolution
```bash
git pull --rebase origin <branch>
git push
```
### Merge Resolution
```bash
git pull origin <branch>
git push
```
## Stale Branch Detection
Find local branches tracking deleted remotes:
```bash
git branch -vv | grep ': gone]'
```
### Report Format
```
Stale local branches (remote deleted):
- feat/old-feature (was tracking origin/feat/old-feature)
- fix/merged-bugfix (was tracking origin/fix/merged-bugfix)
Run /branch-cleanup to remove these branches.
```
## Remote Pruning
Remove stale remote-tracking references:
```bash
git fetch --prune
```
Or fetch all remotes:
```bash
git fetch --all --prune
```
## Sync Status Report
```
Sync complete:
Local: feat/password-reset @ abc1234
Remote: origin/feat/password-reset @ abc1234
Base: development @ xyz7890 (synced)
Your branch is up-to-date with development.
No conflicts detected.
Cleanup:
Remote refs pruned: 2
Stale local branches: 2 (run /branch-cleanup to remove)
```
## Tracking Setup
Check tracking status:
```bash
git branch -vv
```
Set upstream:
```bash
git branch --set-upstream-to=origin/<branch> <branch>
```
## Related Skills
- skills/git-safety.md
- skills/merge-workflow.md

View File

@@ -0,0 +1,84 @@
# Visual Header
## Purpose
Standard header format for consistent visual output across all git-flow commands.
## When to Use
- At the start of every git-flow command execution
- Displaying command identity to user
## Header Format
```
+----------------------------------------------------------------------+
| GIT-FLOW [Command Name] |
+----------------------------------------------------------------------+
```
## Command Headers
### /commit
```
+----------------------------------------------------------------------+
| GIT-FLOW Smart Commit |
+----------------------------------------------------------------------+
```
### /commit-push
```
+----------------------------------------------------------------------+
| GIT-FLOW Commit & Push |
+----------------------------------------------------------------------+
```
### /commit-sync
```
+----------------------------------------------------------------------+
| GIT-FLOW Commit Sync |
+----------------------------------------------------------------------+
```
### /commit-merge
```
+----------------------------------------------------------------------+
| GIT-FLOW Commit & Merge |
+----------------------------------------------------------------------+
```
### /branch-start
```
+----------------------------------------------------------------------+
| GIT-FLOW Branch Start |
+----------------------------------------------------------------------+
```
### /branch-cleanup
```
+----------------------------------------------------------------------+
| GIT-FLOW Branch Cleanup |
+----------------------------------------------------------------------+
```
### /git-status
```
+----------------------------------------------------------------------+
| GIT-FLOW Status |
+----------------------------------------------------------------------+
```
### /git-config
```
+----------------------------------------------------------------------+
| GIT-FLOW Configuration |
+----------------------------------------------------------------------+
```
## Usage
Display header immediately after command invocation, before any workflow steps.
## Related Skills
- None (standalone utility)