You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/compound-engineering/skills/git-commit-push-pr/SKILL.md
+68-76Lines changed: 68 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,36 +37,57 @@ Interpret the result this way:
37
37
38
38
---
39
39
40
-
## Description Update workflow
40
+
## Context
41
41
42
-
### DU-1: Confirm intent
42
+
**If you are not Claude Code**, skip to the "Context fallback" section below and run the command there to gather context.
43
43
44
-
Ask the user to confirm: "Update the PR description for this branch?" Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the question and wait for the user's reply.
44
+
**If you are Claude Code**, the six labeled sections below (Git status, Working tree diff, Current branch, Recent commits, Remote default branch, Existing PR check) contain pre-populated data. Use them directly throughout this skill -- do not re-run these commands.
45
45
46
-
If the user declines, stop.
46
+
**Git status:**
47
+
!`git status`
47
48
48
-
### DU-2: Find the PR
49
+
**Working tree diff:**
50
+
!`git diff HEAD`
49
51
50
-
Run these commands to identify the branch and locate the PR:
Interpret the result using the Reusable PR probe rules above:
74
+
Interpret the PR check result using the Reusable PR probe rules above.
75
+
76
+
---
77
+
78
+
## Description Update workflow
79
+
80
+
### DU-1: Confirm intent
81
+
82
+
Ask the user to confirm: "Update the PR description for this branch?" Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the question and wait for the user's reply.
83
+
84
+
If the user declines, stop.
85
+
86
+
### DU-2: Find the PR
87
+
88
+
Use the current branch and existing PR check from the context above. If the current branch is empty (detached HEAD), report that there is no branch to update and stop.
89
+
90
+
Interpret the PR check result using the Reusable PR probe rules above:
70
91
71
92
- If it returns PR data with `state: OPEN`, an open PR exists for the current branch.
72
93
- If it returns PR data with a non-OPEN state (CLOSED, MERGED), treat this as "no open PR." Report that no open PR exists for this branch and stop.
@@ -102,35 +123,25 @@ Report the PR URL.
102
123
103
124
### Step 1: Gather context
104
125
105
-
Run these commands.
106
-
107
-
```bash
108
-
git status
109
-
git diff HEAD
110
-
git branch --show-current
111
-
git log --oneline -10
112
-
git rev-parse --abbrev-ref origin/HEAD
113
-
```
126
+
Use the context above (git status, working tree diff, current branch, recent commits, remote default branch, and existing PR check). All data needed for this step and Step 3 is already available -- do not re-run those commands.
114
127
115
-
The last command returns the remote default branch (e.g., `origin/main`). Strip the `origin/` prefix to get the branch name. If the command fails or returns a bare `HEAD`, try:
128
+
The remote default branch value returns something like `origin/main`. Strip the `origin/` prefix to get the branch name. If it returned `__DEFAULT_BRANCH_UNRESOLVED__` or a bare `HEAD`, try:
Run `git branch --show-current`. If it returns an empty result, the repository is in detached HEAD state. Explain that a branch is required before committing and pushing. Ask whether to create a feature branch now. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply.
136
+
If the current branch from the context above is empty, the repository is in detached HEAD state. Explain that a branch is required before committing and pushing. Ask whether to create a feature branch now. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply.
124
137
125
138
- If the user agrees, derive a descriptive branch name from the change content, create it with `git checkout -b <branch-name>`, then run `git branch --show-current` again and use that result as the current branch name for the rest of the workflow.
126
139
- If the user declines, stop.
127
140
128
-
If the `git status` result from this step shows a clean working tree (no staged, modified, or untracked files), check whether there are unpushed commits or a missing PR before stopping:
141
+
If the git statusfrom the context above shows a clean working tree (no staged, modified, or untracked files), check whether there are unpushed commits or a missing PR before stopping. The current branch and existing PR check are already available from the context above. Additionally:
129
142
130
-
1. Run `git branch --show-current` to get the current branch name.
131
-
2. Run `git rev-parse --abbrev-ref --symbolic-full-name @{u}` to check whether an upstream is configured.
132
-
3. If the command succeeds, run `git log <upstream>..HEAD --oneline` using the upstream name from the previous command.
133
-
4. If an upstream is configured, check for an existing PR using the method in Step 3.
143
+
1. Run `git rev-parse --abbrev-ref --symbolic-full-name @{u}` to check whether an upstream is configured.
144
+
2. If the command succeeds, run `git log <upstream>..HEAD --oneline` using the upstream name from the previous command.
134
145
135
146
- If the current branch is `main`, `master`, or the resolved default branch from Step 1 and there is **no upstream** or there are **unpushed commits**, explain that pushing now would use the default branch directly. Ask whether to create a feature branch first. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply.
136
147
- If the user agrees, derive a descriptive branch name from the change content, create it with `git checkout -b <branch-name>`, then continue from Step 5 (push).
@@ -151,20 +162,9 @@ Follow this priority order for commit messages *and* PR titles:
151
162
152
163
### Step 3: Check for existing PR
153
164
154
-
Run `git branch --show-current` to get the current branch name. If it returns an empty result here, report that the workflow is still in detached HEAD state and stop.
155
-
156
-
Then check for an existing open PR:
157
-
158
-
```bash
159
-
if PR_VIEW_OUTPUT=$(gh pr view --json url,title,state 2>&1);then
Use the current branch and existing PR check from the context above. If the current branch is empty, report that the workflow is in detached HEAD state and stop.
166
166
167
-
Interpret the result using the Reusable PR probe rules above:
167
+
Interpret the PR check result using the Reusable PR probe rules:
168
168
169
169
- If it **returns PR data with `state: OPEN`**, an open PR exists for the current branch. Note the URL and continue to Step 4 (commit) and Step 5 (push). Then skip to Step 7 (existing PR flow) instead of creating a new PR.
170
170
- If it **returns PR data with a non-OPEN state** (CLOSED, MERGED), treat this the same as "no PR exists" -- the previous PR is done and a new one is needed. Continue to Step 4 through Step 8 as normal.
@@ -173,10 +173,15 @@ Interpret the result using the Reusable PR probe rules above:
173
173
174
174
### Step 4: Branch, stage, and commit
175
175
176
-
1.Run `git branch --show-current`. If it returns`main`, `master`, or the resolved default branch from Step 1, create a descriptive feature branch first with `git checkout -b <branch-name>`. Derive the branch name from the change content.
176
+
1.If the current branch from the context above is`main`, `master`, or the resolved default branch from Step 1, create a descriptive feature branch first with `git checkout -b <branch-name>`. Derive the branch name from the change content.
177
177
2. Before staging everything together, scan the changed files for naturally distinct concerns. If modified files clearly group into separate logical changes (e.g., a refactor in one set of files and a new feature in another), create separate commits for each group. Keep this lightweight -- group at the **file level only** (no `git add -p`), split only when obvious, and aim for two or three logical commits at most. If it's ambiguous, one commit is fine.
178
-
3. Stage relevant files by name. Avoid `git add -A` or `git add .` to prevent accidentally including sensitive files.
179
-
4. Commit following the conventions from Step 2. Use a heredoc for the message.
178
+
3. For each commit group, stage and commit in a single call. Avoid `git add -A` or `git add .` to prevent accidentally including sensitive files. Follow the conventions from Step 2. Use a heredoc for the message:
@@ -203,11 +208,7 @@ Use this fallback chain. Stop at the first that succeeds:
203
208
git remote -v
204
209
```
205
210
Match the `owner/repo` from the PR URL against the fetch URLs. Use the matching remote as the base remote. If no remote matches, fall back to `origin`.
Strip the `origin/` prefix from the result. Use `origin` as the base remote.
211
+
2. **Remote default branch from context above:** If the remote default branch resolved (not `__DEFAULT_BRANCH_UNRESOLVED__`), strip the `origin/` prefix and use that. Use `origin` as the base remote.
Copy file name to clipboardExpand all lines: plugins/compound-engineering/skills/git-commit/SKILL.md
+39-16Lines changed: 39 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,31 +7,56 @@ description: Create a git commit with a clear, value-communicating message. Use
7
7
8
8
Create a single, well-crafted git commit from the current working tree changes.
9
9
10
-
## Workflow
10
+
## Context
11
11
12
-
### Step 1: Gather context
12
+
**If you are not Claude Code**, skip to the "Context fallback" section below and run the command there to gather context.
13
+
14
+
**If you are Claude Code**, the five labeled sections below (Git status, Working tree diff, Current branch, Recent commits, Remote default branch) contain pre-populated data. Use them directly throughout this skill -- do not re-run these commands.
The last command returns the remote default branch (e.g., `origin/main`). Strip the `origin/` prefix to get the branch name. If the command fails or returns a bare `HEAD`, try:
41
+
---
42
+
43
+
## Workflow
44
+
45
+
### Step 1: Gather context
46
+
47
+
Use the context above (git status, working tree diff, current branch, recent commits, remote default branch). All data needed for this step is already available -- do not re-run those commands.
48
+
49
+
The remote default branch value returns something like `origin/main`. Strip the `origin/` prefix to get the branch name. If it returned `__DEFAULT_BRANCH_UNRESOLVED__` or a bare `HEAD`, try:
If the `git status` result from this step shows a clean working tree (no staged, modified, or untracked files), report that there is nothing to commit and stop.
57
+
If the git statusfrom the context above shows a clean working tree (no staged, modified, or untracked files), report that there is nothing to commit and stop.
33
58
34
-
Run `git branch --show-current`. If it returns an empty result, the repository is in detached HEAD state. Explain that a branch is required before committing if the user wants this work attached to a branch. Ask whether to create a feature branch now. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply before proceeding.
59
+
If the current branch from the context above is empty, the repository is in detached HEAD state. Explain that a branch is required before committing if the user wants this work attached to a branch. Ask whether to create a feature branch now. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply before proceeding.
35
60
36
61
- If the user chooses to create a branch, derive the name from the change content, create it with `git checkout -b <branch-name>`, then run `git branch --show-current` again and use that result as the current branch name for the rest of the workflow.
37
62
- If the user declines, continue with the detached HEAD commit.
@@ -55,18 +80,16 @@ Keep this lightweight:
55
80
56
81
### Step 4: Stage and commit
57
82
58
-
Run `git branch --show-current`. If it returns `main`, `master`, or the resolved default branch from Step 1, warn the user and ask whether to continue committing here or create a feature branch first. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply before proceeding. If the user chooses to create a branch, derive the name from the change content, create it with `git checkout -b <branch-name>`, then run `git branch --show-current` again and use that result as the current branch name for the rest of the workflow.
59
-
60
-
Stage the relevant files. Prefer staging specific files by name over `git add -A` or `git add .` to avoid accidentally including sensitive files (.env, credentials) or unrelated changes.
83
+
If the current branch from the context above is `main`, `master`, or the resolved default branch from Step 1, warn the user and ask whether to continue committing here or create a feature branch first. Use the platform's blocking question tool (`AskUserQuestion` in Claude Code, `request_user_input` in Codex, `ask_user` in Gemini). If no question tool is available, present the options and wait for the user's reply before proceeding. If the user chooses to create a branch, derive the name from the change content, create it with `git checkout -b <branch-name>`, then continue.
61
84
62
85
Write the commit message:
63
86
-**Subject line**: Concise, imperative mood, focused on *why* not *what*. Follow the convention determined in Step 2.
64
87
-**Body** (when needed): Add a body separated by a blank line for non-trivial changes. Explain motivation, trade-offs, or anything a future reader would need. Omit the body for obvious single-purpose changes.
65
88
66
-
Use a heredoc to preserve formatting:
89
+
For each commit group, stage and commit in a single call. Prefer staging specific files by name over `git add -A` or `git add .` to avoid accidentally including sensitive files (.env, credentials) or unrelated changes. Use a heredoc to preserve formatting:
0 commit comments