home / skills / jjuidev / jss / git

git skill

/.claude/skills/git

This skill streamlines git workflows with conventional commits, auto-splitting by type/scope and performing security checks before committing.

npx playbooks add skill jjuidev/jss --skill git

Review the files below or copy the command above to add this skill to your agents.

Files (9)
SKILL.md
3.0 KB
---
name: git
description: Git operations with conventional commits. Use for staging, committing, pushing, PRs, merges. Auto-splits commits by type/scope. Security scans for secrets.
version: 1.0.0
---

# Git Operations

Execute git workflows via `git-manager` subagent to isolate verbose output.
Activate `context-engineering` skill.

**IMPORTANT:**
- Sacrifice grammar for the sake of concision.
- Ensure token efficiency while maintaining high quality.
- Pass these rules to subagents.

## Arguments
- `cm`: Stage files & create commits
- `cp`: Stage files, create commits and push
- `pr`: Create Pull Request [to-branch] [from-branch]
  - `to-branch`: Target branch (default: main)
  - `from-branch`: Source branch (default: current branch)
- `merge`: Merge [to-branch] [from-branch]
  - `to-branch`: Target branch (default: main)
  - `from-branch`: Source branch (default: current branch)

## Quick Reference

| Task | Reference |
|------|-----------|
| Commit | `references/workflow-commit.md` |
| Push | `references/workflow-push.md` |
| Pull Request | `references/workflow-pr.md` |
| Merge | `references/workflow-merge.md` |
| Standards | `references/commit-standards.md` |
| Safety | `references/safety-protocols.md` |
| Branches | `references/branch-management.md` |
| GitHub CLI | `references/gh-cli-guide.md` |

## Core Workflow

### Step 1: Stage + Analyze
```bash
git add -A && git diff --cached --stat && git diff --cached --name-only
```

### Step 2: Security Check
Scan for secrets before commit:
```bash
git diff --cached | grep -iE "(api[_-]?key|token|password|secret|credential)"
```
**If secrets found:** STOP, warn user, suggest `.gitignore`.

### Step 3: Split Decision

**NOTE:**
- Search for related issues on GitHub and add to body.
- Only use `feat`, `fix`, or `perf` prefixes for files in `.claude` directory (do not use `docs`).

**Split commits if:**
- Different types mixed (feat + fix, code + docs)
- Multiple scopes (auth + payments)
- Config/deps + code mixed
- FILES > 10 unrelated

**Single commit if:**
- Same type/scope, FILES ≤ 3, LINES ≤ 50

### Step 4: Commit
```bash
git commit -m "type(scope): description"
```

## Output Format
```
✓ staged: N files (+X/-Y lines)
✓ security: passed
✓ commit: HASH type(scope): description
✓ pushed: yes/no
```

## Error Handling

| Error | Action |
|-------|--------|
| Secrets detected | Block commit, show files |
| No changes | Exit cleanly |
| Push rejected | Suggest `git pull --rebase` |
| Merge conflicts | Suggest manual resolution |

## References

- `references/workflow-commit.md` - Commit workflow with split logic
- `references/workflow-push.md` - Push workflow with error handling
- `references/workflow-pr.md` - PR creation with remote diff analysis
- `references/workflow-merge.md` - Branch merge workflow
- `references/commit-standards.md` - Conventional commit format rules
- `references/safety-protocols.md` - Secret detection, branch protection
- `references/branch-management.md` - Naming, lifecycle, strategies
- `references/gh-cli-guide.md` - GitHub CLI commands reference

Overview

This skill automates Git operations with conventional commits, splitting and labeling commits by type and scope, and running security scans for secrets. Use it to stage, commit, push, create PRs, and perform merges with concise output and clear error handling. It focuses on predictable commit structure and safe delivery.

How this skill works

It stages changes, inspects the staged diff, runs a light secrets scan, and decides whether to split or combine commits based on type, scope, file count and line changes. Commits are formatted to conventional-commit rules (type(scope): description). It can push, open PRs, or merge and reports status lines for staged files, security, commit hash, and push status.

When to use it

  • When preparing a local change for a clean history using conventional commits
  • When multiple unrelated changes exist and you need automatic commit-splitting
  • Before pushing to catch secrets and avoid accidental leaks
  • When creating pull requests or merging branches with standardized messages
  • When you want concise machine-readable output for CI or tooling

Best practices

  • Stage only intended files (git add -A only when deliberate)
  • Fix secrets before committing; skill blocks commits if secrets found
  • Split commits when types/scopes differ or many unrelated files changed
  • Use clear scope names for modules or features to aid split logic
  • Pull and rebase if push is rejected to reduce merge conflicts

Example use cases

  • Create a commit set from staged changes with automatic split into feat/fix/docs as needed
  • Commit + push changes and receive formatted status output for CI
  • Open a pull request from current branch to main with remote diff check
  • Merge a feature branch into main with basic conflict guidance
  • Run a quick pre-commit security scan to detect API keys or tokens

FAQ

What triggers automatic commit splitting?

Mix of different conventional types, multiple unrelated scopes, config/deps mixed with code, or many unrelated files (>10) triggers splitting.

What happens if a secret is detected?

Commit is blocked, files with suspected secrets are listed, and you are prompted to remove them or add to .gitignore before proceeding.