agentleFS
TJaenichenTJaenichen/claude-code-harness/skills/project/finalize-task/SKILL.md

finalize-task

Skill0 starsChanged 3 months agoMITView on GitHub

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

  • Reads credentials
  • Commits and pushes

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 8 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If there are staged or unstaged changes:

    line 27
  2. Distinctive:

    If the working tree is clean, skip this step.

    line 32
  3. Distinctive:

    If there are multiple commits on this branch (vs main):

    line 36
  4. Distinctive:

    Create a single commit with a message that summarizes ALL the changes across all commits

    line 39
  5. Distinctive:

    Use a clear, descriptive commit message

    line 40
  6. Distinctive:

    If there is only one commit, skip this step.

    line 42
  7. Very specific:

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

    line 50
  8. Distinctive:

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

    line 56
  9. Very specific:

    PR title: Use $ARGUMENTS if provided, otherwise generate from the commit message.

    line 72
  10. Distinctive:

    Commit hash and message

    line 86
  11. Very specific:

    Always use -UseDefaultCredentials for Windows auth

    line 102
  12. Very specific:

    Always use --force-with-lease (not --force) when pushing after squash

    line 103
  13. Very specific:

    Use PowerShell Invoke-RestMethod for API calls (not curl) — it handles Windows auth natively

    line 104

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

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:

$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:
    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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.