Skip to content
Agentmart
Submit a tool

finalize-task

Commit, squash, push, and create a PR for the current branch.

Skill by TJaenichen

IndexedMIT
Write a review

Chalk Labs

Need help deploying finalize-task?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/tjaenichen-finalize-task

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Commit, squash, push, and create a PR for the current branch.

Use cases: productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/finalize-task

Tools it pre-approves 2

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(git:*),
  • Bash(powershell:*)

What's inside

Skill name
finalize-task
Description
Commit, squash, push, and create a PR for the current branch.
License
MIT
Allowed tools
Bash(git:*),, Bash(powershell:*)
Instructions
100 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Finalize Task

Optional arguments: $ARGUMENTS

## Your task

Complete the current branch by committing all changes, squashing into a single commit, pushing, and creating a pull request.

## Steps

### 1. Gather context (run in parallel)

- `git status` — check for uncommitted changes
- `git log --oneline main..HEAD` — see all commits on this branch
- `git diff --stat main..HEAD` — see all changed files vs main
- `git rev-parse --abbrev-ref HEAD` — get current branch name

### 2. Commit any uncommitted changes

If there are staged or unstaged changes:
1. Stage all relevant changes (be specific with file paths, avoid secrets like `.env`)
2. Generate a concise commit message describing the changes
3. Commit

If the working tree is clean, skip this step.

### 3. Squash commits

If there are **multiple commits** on this branch (vs main):
1. Find the merge base: `git merge-base main HEAD`
2. Soft-reset to the merge base: `git reset --soft <merge-base>`
3. Create a single commit with a message that summarizes ALL the changes across all commits
4. Use a clear, descriptive commit message

If there is only **one commit**, skip this step.

### 4. Push

```bash
git push -u origin <branch> --force-with-lease
```

Use `--force-with-lease` since we may have squashed (safe force push that won't overwrite others' work).

### 5. Create Pull Request

Extract the work item ID from the branch name (format: `feature/<ID>_<ShortName>`).

Use PowerShell to create the PR via Azure DevOps REST API:

```powershell
$repoId = "<REPO_ID>"
$baseUrl = "https://devops.example.com/DefaultCollection/MyProject/_apis/git/repositories/$repoId"

$body = @{
    sourceRefName = "refs/heads/<branch>"
    targetRefName = "refs/heads/main"
    title = "<title>"
    description = "<description>"
} | ConvertTo-Json -Depth 5

Invoke-RestMethod -Uri "$baseUrl/pullrequests?api-version=6.0" -Method Post -Body $body -ContentType "application/json" -UseDefaultCredentials
```

**PR title**: Use `$ARGUMENTS` if provided, otherwise generate from the commit message. Include the work item ID as `(#<ID>)` at the end.

**PR description**: Generate a summary with:
```
## Summary
- bullet points describing the changes

## Test plan
- [ ] relevant test steps
```

### 6. Report success

Display:
- Commit hash and message
- Number of commits squashed (if any)
- PR URL: `https://devops.example.com/DefaultCollection/MyProject/_git/Payments/pullrequest/{id}`

## Edge cases

- **No changes and no commits**: Report that there's nothing to finalize
- **PR already exists for this branch**: Report the existing PR URL instead of creating a duplicate. Find it via:
  ```powershell
  Invoke-RestMethod -Uri "$baseUrl/pullrequests?searchCriteria.sourceRefName=refs/heads/<branch>&api-version=6.0" -UseDefaultCredentials
  ```
- **Branch is `main`**: Refuse and tell the user to work on a feature branch
- **Push fails**: Report the error, do not retry blindly

## Important

- Always use `-UseDefaultCredentials` for Windows auth
- Always use `--force-with-lease` (not `--force`) when pushing after squash
- Use PowerShell `Invoke-RestMethod` for API calls (not curl) — it handles Windows auth natively
- Save PowerShell scripts to temp files if commands get complex, to avoid escaping issues

From TJaenichen/claude-code-harness, MIT.

More from TJaenichen/claude-code-harness

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Aug 16, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from TJaenichen

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get finalize-task running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying finalize-task?

CallGet help
Cite this page

finalize-task skill. Agent Mart. https://agentmart.dev/skills/tjaenichen-finalize-task (last updated 2026-10-24)