Git
Use this skill to perform repository operations in a safe, auditable way. The skill must only call operations listed in allowedOperations; if a requested operation is not permitted the agent should inform the user and request configuration changes.
Principles
- Safety first: Prompt for confirmation before any destructive action (
reset --hard, push --force, branch -D, revert), unless requireConfirmationForDestructiveOps is false and the user explicitly allowed the operation.
- Least privilege: Only perform operations in
allowedOperations.
- Explicit context: Always resolve
repositoryPath before running commands, and refuse to act if the path is not a git repository.
- Auditability: Return both machine-readable results and a short human summary describing what was done.
Supported operations (examples)
status — show git status --porcelain and a human summary of staged/unstaged/untracked files.
add — stage files. Params: paths (array) or paths: ["."] to add all.
commit — create a commit. Params: message, author (optional), sign (optional).
push — push to remote. Params: remote (default defaultRemote), branch, force (boolean).
pull — pull from remote. Params: remote, branch, rebase (boolean).
fetch — fetch updates.
branch — create/list/delete branches. Params for create: name, startPoint.
checkout — switch branches or restore files. Params: branch, paths.
merge — merge a branch into current. Params: source, noFastForward.
rebase — rebase current branch onto another. Use carefully.
log — show commits. Params: maxCount, format.
diff — show diffs. Params: paths, commitRange.
stash — push/pop/list stashes.
tag — create/list/delete tags.
reset — soft/mixed/hard reset. Destructive when --hard.
revert — create a revert commit for a specified commit.
Process
- Parse
goal to determine the operation and parameters.
- Verify the requested operation exists in
allowedOperations.
- Resolve
repositoryPath (use defaultRepositoryPath if unset) and ensure it contains a git repository.
- If operation is destructive and
requireConfirmationForDestructiveOps is true, present a short explanation and ask for confirmation before proceeding.
- Run the operation using a safe runtime helper (prefer a
git tool or the shell tool exposed by the runtime). Capture stdout/stderr and exit code.
- Return
result with relevant fields (e.g. commit id, branch name, pushed refs) and summary explaining the outcome.
Examples
- Commit staged changes with message:
Goal: "Commit staged changes with message 'Fix validation bug'"
Operation: commit
Params: { "message": "Fix validation bug" }
- Create and push a branch:
Goal: "Create branch feature/auth and push to remote"
Operation: branch
Params: { "name": "feature/auth", "startPoint": "main" }
Then: push with params { "branch": "feature/auth" }
Operation: log
Params: { "maxCount": 5 }
Safety notes
- Never expose secret credentials or tokens in command outputs. If the runtime returns environment or config values, redact secrets before returning them.
- Avoid running repository-altering commands on the wrong path — always confirm the repo root and current branch before destructive operations.
- If a command fails with merge conflicts, return the conflict details and suggest next steps rather than attempting automatic resolution.
Integration guidance
- The runtime should expose a
git tool or shell tool to execute commands. Prefer a language-native git library when available for parseable results.
- Map skill
allowedOperations to tool-level permission gates where possible.
1---2name: git3description: Perform common Git repository operations: status, add, commit, branch, checkout, merge, push, pull, fetch, log, diff, stash, tag and safe resets.4---56# Git78Use this skill to perform repository operations in a safe, auditable way. The skill must only call operations listed in `allowedOperations`; if a requested operation is not permitted the agent should inform the user and request configuration changes.910## Principles1112- Safety first: Prompt for confirmation before any destructive action (`reset --hard`, `push --force`, `branch -D`, `revert`), unless `requireConfirmationForDestructiveOps` is false and the user explicitly allowed the operation.13- Least privilege: Only perform operations in `allowedOperations`.14- Explicit context: Always resolve `repositoryPath` before running commands, and refuse to act if the path is not a git repository.15- Auditability: Return both machine-readable results and a short human summary describing what was done.1617## Supported operations (examples)1819- `status` — show `git status --porcelain` and a human summary of staged/unstaged/untracked files.20- `add` — stage files. Params: `paths` (array) or `paths: ["."]` to add all.21- `commit` — create a commit. Params: `message`, `author` (optional), `sign` (optional).22- `push` — push to remote. Params: `remote` (default `defaultRemote`), `branch`, `force` (boolean).23- `pull` — pull from remote. Params: `remote`, `branch`, `rebase` (boolean).24- `fetch` — fetch updates.25- `branch` — create/list/delete branches. Params for create: `name`, `startPoint`.26- `checkout` — switch branches or restore files. Params: `branch`, `paths`.27- `merge` — merge a branch into current. Params: `source`, `noFastForward`.28- `rebase` — rebase current branch onto another. Use carefully.29- `log` — show commits. Params: `maxCount`, `format`.30- `diff` — show diffs. Params: `paths`, `commitRange`.31- `stash` — push/pop/list stashes.32- `tag` — create/list/delete tags.33- `reset` — soft/mixed/hard reset. Destructive when `--hard`.34- `revert` — create a revert commit for a specified commit.3536## Process37381. Parse `goal` to determine the operation and parameters.392. Verify the requested operation exists in `allowedOperations`.403. Resolve `repositoryPath` (use `defaultRepositoryPath` if unset) and ensure it contains a git repository.414. If operation is destructive and `requireConfirmationForDestructiveOps` is true, present a short explanation and ask for confirmation before proceeding.425. Run the operation using a safe runtime helper (prefer a `git` tool or the `shell` tool exposed by the runtime). Capture stdout/stderr and exit code.436. Return `result` with relevant fields (e.g. commit id, branch name, pushed refs) and `summary` explaining the outcome.4445## Examples4647- Commit staged changes with message:4849```50Goal: "Commit staged changes with message 'Fix validation bug'"51Operation: commit52Params: { "message": "Fix validation bug" }53```5455- Create and push a branch:5657```58Goal: "Create branch feature/auth and push to remote"59Operation: branch60Params: { "name": "feature/auth", "startPoint": "main" }61Then: push with params { "branch": "feature/auth" }62```6364- Show last 5 commits:6566```67Operation: log68Params: { "maxCount": 5 }69```7071## Safety notes7273- Never expose secret credentials or tokens in command outputs. If the runtime returns environment or config values, redact secrets before returning them.74- Avoid running repository-altering commands on the wrong path — always confirm the repo root and current branch before destructive operations.75- If a command fails with merge conflicts, return the conflict details and suggest next steps rather than attempting automatic resolution.7677## Integration guidance7879- The runtime should expose a `git` tool or `shell` tool to execute commands. Prefer a language-native git library when available for parseable results.80- Map skill `allowedOperations` to tool-level permission gates where possible.81