Use when the user asks to finish, close out or open the pull request for a work item in project/work-items/{NN}-{name}/, or when sdd:spec-maintenance or a bugfix implementation hands over. Checks that every gate has passed, commits the gate reports the pipeline left uncommitted, runs the AGENTS.md build and test commands, writes pr.md in the work item, and opens the pull request with gh or glab when one is available. Never merges and never force-pushes.
Close out a work item: check that it is complete and committed, write pr.md in its folder, and open the pull request.
Workflow Position: Step 12 of the feature pipeline, AFTER sdd:spec-maintenance. Step 3 of the bugfix pipeline, AFTER the implementation. See sdd:spec-workflow.
The work item lives in project/work-items/{NN}-{name}/. When any check below fails, stop, say what is missing, name the step to run, and change nothing.
1. Find the Work Item
Section titled “1. Find the Work Item”The work item is the folder the user or the previous step names. A folder with requirements.md is a feature. A folder with bugfix.md is a bugfix. A folder with neither is not a work item: stop and say so.
2. Check the Work Item Is Complete
Section titled “2. Check the Work Item Is Complete”A gate passes only on its exact **Status:** line. Read the one line that starts with **Status:**, ignore a trailing carriage return, and compare the rest with the values below. A missing file, a missing line, a template placeholder such as [PASSED | FAILED, set in review mode], or any other value is a gap.
Feature:
| File | Passes when **Status:** is |
When it fails, run |
|---|---|---|
design.md |
the file exists | sdd:spec-generator |
design-review-summary.md |
APPROVED or APPROVED WITH ISSUES |
sdd:spec-design-review |
tasks.md |
the file exists | sdd:spec-generator Phase 3 |
task-review-summary.md |
APPROVED or APPROVED WITH ISSUES |
sdd:spec-task-review |
implementation-audit.md |
PASSED |
sdd:spec-implementation-audit, or fix its findings and run it again |
test-plan.md |
PASSED |
sdd:spec-qa-review review mode |
spec-maintenance-report.md |
PASSED, or the file is absent and no peer exists |
sdd:spec-maintenance |
A peer is another folder in project/work-items/ that holds an implementation-audit.md with **Status:** PASSED. This is the rule sdd:spec-maintenance uses to decide that it has nothing to do, and that skip writes no file. So when spec-maintenance-report.md is absent, look for peers now. When one exists, name it, and name sdd:spec-maintenance as the step to run.
Bugfix: bugfix.md, design.md and tasks.md exist. A bugfix has no gates.
3. Check the Branch and Commit the Reports
Section titled “3. Check the Branch and Commit the Reports”- Find the default branch: the target of
origin/HEADwhen it is set, elsemain, elsemaster. When the current branch is the default branch, stop and ask the user to create a branch for the work item. - Run
git status --porcelain. The gate skills write their reports and do not commit them, so a dirty tree is normal here. Sort each listed file:- Pipeline files: a file in the work-item folder, or a modified
tasks.md,design.mdorrequirements.mdin a folder thatspec-maintenance-report.mdlists as annotated. - Other files: every other file, including a file in another work-item folder that the report does not list.
- Pipeline files: a file in the work-item folder, or a modified
- When there is any other file, stop and list it, and change nothing. It would be left out of the pull request, or it belongs to other work.
- Otherwise commit the pipeline files in one commit:
docs(spec-{NN}): add gate reports, or follow the commit conventions inAGENTS.md. The gate reports then reach the default branch with the code.
4. Run the Build and Tests
Section titled “4. Run the Build and Tests”Run the build command and the test command from AGENTS.md. When AGENTS.md names no build or test command, stop and name sdd:spec-setup. When a command fails, stop and paste its output. Keep the summary line of the test output, such as the count of tests run, for pr.md.
5. Write pr.md
Section titled “5. Write pr.md”Write project/work-items/{NN}-{name}/pr.md. It is the pull request description. Use these sections:
- Title line:
# spec {NN}: {name}, with{NN}and{name}from the folder name, for example# spec 07: export-archive. Do not use the heading ofrequirements.md: the template heading is the same in every work item. - Summary: two or three sentences on what the change does and why, from
requirements.mdorbugfix.md. - Spec: relative links to
requirements.mdorbugfix.md,design.mdandtasks.md. - Gates (feature only): a table with the columns Gate, Status and Report, one row per gate file in step 2, with a relative link to each. For a maintenance skip, write
skipped, no peerin the Status column. - Evidence: the test summary line from step 4, the commit SHA the tests ran on (
git rev-parse --short HEAD), and for a feature the finding counts fromimplementation-audit.md. - Review first: what a reviewer looks at first. List the MAJOR findings of a gate whose status is
APPROVED WITH ISSUES, the open gaps in thetest-plan.mdgap log, and for a bugfix any task intasks.mdthat is not ticked. WriteNothing open.when the list is empty.
The links are relative to pr.md, so they work where the file is committed. Step 6 changes them for the pull request body.
When pr.md already exists, replace it. Commit it on its own: docs(spec-{NN}): add pr.md, or follow the commit conventions in AGENTS.md.
6. Open the Pull Request
Section titled “6. Open the Pull Request”Never merge, never force-push and never push to the default branch.
- Read the URL of the
originremote. When there is no remote, tell the user wherepr.mdis and stop. - Make the body: the text of
pr.mdwith each relative link changed to the full URL of the file on the branch. On GitHub that ishttps://github.com/{owner}/{repo}/blob/{branch}/project/work-items/{NN}-{name}/{file}, and on GitLabhttps://{host}/{group}/{project}/-/blob/{branch}/project/work-items/{NN}-{name}/{file}. A relative link in a pull request body resolves against the pull request page and does not work. - Pass the body on standard input, in a quoted heredoc: the create command ends with
<<'EOF', the body follows on its own lines, andEOFis the last line. Do not write the body to a file, and do not pass it in a quoted argument. A multi-line argument that holds#headings needs an extra approval in some agents. - When the URL is on GitHub and
gh auth statussucceeds, rungit push -u origin HEAD, thengh pr create --base <default branch> --title "<title line without #>" --body-file - <<'EOF'. - When the URL is on GitLab and
glab auth statussucceeds, rungit push -u origin HEAD, thenglab mr create --yes --target-branch <default branch> --title "<title line without #>" --description-file - <<'EOF'. - Otherwise, or when a push or a create command fails, stop. Tell the user where
pr.mdis, and paste the output of the command that failed.
When a pull request for the branch already exists, the create command fails. Then push, and tell the user to update the description from pr.md.
Report the pull request URL. The work item is done when the pull request merges.
See this skill’s row on the Evals page.
The story behind this skill
Section titled “The story behind this skill”No post yet.
See it in the worked example
Section titled “See it in the worked example”Spec 38 was finished before this skill existed.
The worked example walks through every artefact.