Skill git workflow

From benbrastmckie/nvim · View interactive version

Skill git workflow is an AI agent skill from the GitHub repository benbrastmckie/nvim. Create scoped git commits for task operations. Invoke after task status changes or artifact creation.

How to use this skill

Skill file

Git Workflow Skill

Create properly scoped git commits for task operations.

Context Loading

Load context on-demand when needed:

Trigger Conditions

This skill activates when:

Commit Message Formats

Task Operations

| Operation | Format | CI Triggered |

|-----------|--------|--------------|

| Create task | task {N}: create {title} | No |

| Complete research | task {N}: complete research | No |

| Create plan | task {N}: create implementation plan | No |

| Complete phase | task {N} phase {P}: {phase_name} | No |

| Complete task | task {N}: complete implementation | No |

| Complete task (with CI) | task {N}: complete implementation [ci] | Yes |

| Revise plan | task {N}: revise plan (v{V}) | No |

System Operations

| Operation | Format |

|-----------|--------|

| Archive tasks | todo: archive {N} completed tasks |

| Error fixes | errors: create fix plan for {N} errors |

| Code review | review: {scope} code review |

| State sync | sync: reconcile TODO.md and state.json |

Execution Flow

1. Receive commit request:
   - operation_type
   - task_number (if applicable)
   - scope (files to include)
   - message_template

2. Stage appropriate files:
   - git add {scope}

3. Create commit:
   - Format message
   - Add co-author
   - Execute commit

4. Verify success:
   - Check exit code
   - Log result

5. Return result

Commit Scope Rules

Task-Specific Commits

Include only task-related files:

specs/TODO.md
specs/state.json
specs/{NNN}_{SLUG}/**

Implementation Commits

Include source files modified:

Logos/**/*.lean  (for Lean tasks)
src/**/*         (for general tasks)

Phase Commits

Scope to phase changes only:

Files modified in that phase
Updated plan with phase status

Safety Checks

Before Commit

1. git status - verify staged files
2. Check no sensitive files staged (.env, credentials)
3. Verify commit message format

Never Run

Message Template

{scope}: {action} {description}

CI Triggering

Overview

CI is skipped by default on push events. To trigger CI, add [ci] marker to the commit message.

trigger_ci Parameter

When creating commits, the trigger_ci parameter controls whether CI runs:

| Value | Behavior | Use Case |

|-------|----------|----------|

| false (default) | No CI marker added | Routine commits, research, planning |

| true | Append [ci] to message | Lean changes, implementation completion |

CI Decision Criteria

Trigger CI (trigger_ci: true) when:

Skip CI (default) when:

Commit Message with CI Marker

task {N}: complete implementation [ci]

When CI Always Runs

CI runs regardless of marker on:

Execution Commands

Standard Commit

git add {files}
git commit -m "$(cat <<'EOF'
{message}
EOF
)"

Task Commit

git add specs/
git commit -m "$(cat <<'EOF'
task {N}: {action}
EOF
)"

Return Format

{
  "status": "completed|failed",
  "summary": "Created commit: {short_message}",
  "commit_hash": "abc123",
  "files_committed": [
    "path/to/file1",
    "path/to/file2"
  ],
  "message": "Full commit message",
  "ci_triggered": true|false
}

Error Handling

Nothing to Commit

{
  "status": "committed",
  "summary": "No changes to commit",
  "commit_hash": null
}

Pre-Commit Hook Failure

{
  "status": "failed",
  "error": "Pre-commit hook failed",
  "recovery": "Fix issues and retry (do not use --no-verify)"
}

Git Error

{
  "status": "failed",
  "error": "Git command failed: {error}",
  "recovery": "Check git status and resolve manually"
}

Non-Blocking Behavior

Git failures should NOT block task operations:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.