Skip to content
Back to skills

Close

ASecurity

Closes a reviewed Change - commits work left in the tree, checks the product against the spec in the Change''s issue with spec-conformance on bdk:verifier, pushes the branch, opens a pull request into the base branch (no stacking), records the pull request in the ADRs the issue implements with bdk adr status (their status derived from their issues), and closes the issue with a summary comment naming the pull request through bdk tracker sync. Reports what the diff left behind in the ADRs, modu...

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentsgobashgitdocumentation

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add broneq/bdk --skill close --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Close?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Close
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/broneq-close/badge)](https://www.skillsdirectory.com/skills/broneq-close)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: close
description: 'Closes a reviewed Change - commits work left in the tree, checks the product against the spec in the Change''s issue with spec-conformance on bdk:verifier, pushes the branch, opens a pull request into the base branch (no stacking), records the pull request in the ADRs the issue implements with bdk adr status (their status derived from their issues), and closes the issue with a summary comment naming the pull request through bdk tracker sync. Reports what the diff left behind in the ADRs, module map and glossary. Stops before the push when the product does not match the issue. Resumes from its first missing step. Use when a Change is reviewed and ready to ship, when asked to "close", "finish" or "open the PR for" a Change, or when /bdk:run reaches the close stage.'
argument-hint: "[change-name] [--base <branch>]"
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/bin/bdk *) Bash(git status *) Bash(git symbolic-ref *) Bash(git rev-parse *) Bash(git branch *) Bash(git switch *) Bash(git log *) Bash(git push *) Bash(gh pr view *) Bash(gh pr create *) Read Glob Grep Write Edit Skill Agent
---

Current BDK configuration of this project:

!`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" config show`

Arguments: $ARGUMENTS

# Close

You compose the steps that end a Change: commit, check, push, pull request, ADR status, issue. You never do a block's work: you do not check the spec yourself, write a commit message yourself, or edit the issue's spec or code - not even to make a check pass. You never rebase, reset, amend, force-push or merge. The only files you write are `.bdk/runs/<change>/close/pr-body.md`, `close/comment.md` and `close/pr.md`, and `issue.md` only to merge a body changed on the tracker (step 7); the ADRs change only through `bdk adr status` (step 6). Run each command on its own, without `;`, `&&` or pipes.

The blocks:

- **commit**: call the Skill tool with `bdk:commit` and the arguments this skill gives. It stages by path, follows the project's commit convention and reports the commits.
- **spec-conformance** (it also checks the living documentation: a red `bdk arch check` or `bdk adr check` fails it, and what the diff left behind in the ADRs, module map and glossary it lists as `L` items without failing): start an agent with the Agent tool in the foreground (`run_in_background: false`), `subagent_type: "bdk:verifier"`, prompt `Run the skill bdk:spec-conformance with the arguments: <change> --base <diff base>`, `model` set to `models.verifier.model` and `effort` set to `models.verifier.effort`, each only when the configuration above sets it, where the diff base is `origin/<base>` when `git rev-parse --verify --quiet origin/<base>` prints a commit, else `<base>`: the pull request compares with the remote base, and a local base may already hold the Change's commits. It writes `.bdk/runs/<change>/close/spec-conformance.md` and returns its verdict.

Before each step, tell the user in one line what runs and what it writes, e.g. `Checking the spec: bdk:verifier writes .bdk/runs/add-csv-export/close/spec-conformance.md`.

## 1. Check the configuration and the Change

When the block above says `BDK not configured: run /bdk:setup` or that the configuration is invalid, stop: run nothing else and reply with that line.

- **Change**: the first argument. Without one: the `current` Change of `.bdk/runs/run.json`, else the only directory under `.bdk/runs/` other than `pr-<N>/` holding an `issue.md`. With none or several, name what you found and stop. `R` is `.bdk/runs/<change>/`. Without `R/issue.md`, stop: the Change has no spec to close against; name `/bdk:propose`.
- **Base**: `--base <branch>` when given; else `git symbolic-ref --short refs/remotes/origin/HEAD` without its `origin/` prefix; else `main`.
- **Branch**: `git branch --show-current`. When it prints the base or nothing (detached `HEAD`), run `git switch -c <change>`: every Change gets its own branch, and the base keeps its commits. When that branch exists already, stop: name it, and say that `/bdk:close` runs on the Change's branch.

When `.bdk/runs/run.json` exists and queues the Change, run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" run status --json` and read the Change's entry:

- stage `propose`, `design`, `plan`, `execute` or `auto-review`: stop, run nothing, and name the stage, its reason and its command (`/bdk:<stage> <change>`);
- stage `done`: reply with the first line of `R/close/pr.md` and stop;
- stage `close`: go on.

Without `run.json`, the user's command is the consent to close: go on. When `R/close/pr.md` exists, reply with its first line and stop: the Change is closed.

Done when you hold the Change, the base and the branch, and you are on the branch.

## 2. Find where to start

A close broken off after its pull request resumes at the ADRs: the pushed commit is the one that passed. Check that in order, each command on its own, and stop checking at the first that fails:

1. Read the frontmatter of `R/close/spec-conformance.md`: `verdict: pass`.
2. `git status --porcelain` prints nothing.
3. `git rev-parse HEAD` and `git rev-parse origin/<branch>` print the same commit.
4. `gh pr view <branch> --json url,state` prints an open pull request.

All four hold: go to step 6 with its URL. Otherwise go to step 3: the spec is checked again even when an earlier report passed, since the code may have changed since, and the verifier carries the earlier IDs over. When no commit, issue or scope-log change landed after the last review round and that round's spec check passed, the verifier carries the round's scenario and AC trace over and checks only the E2E results and the living-documentation checks (ADR-0015), so the step is short. A step whose result exists is not redone: the push finds the branch up to date, step 5 reuses an open pull request.

Done when you know the step to start at.

## 3. Commit the work, then check the spec

1. Run `git status --porcelain`. When it lists anything, run **commit** with the arguments `the work of Change <change> left in the tree`: the verifier reads `git diff <base>...HEAD`, so uncommitted work would be invisible to it.
2. Run **spec-conformance** and wait for it. Read the frontmatter of `R/close/spec-conformance.md`.
3. `verdict: pass`: go to step 4. Anything else, or no report: stop here. Commit nothing more, push nothing. Read the report's `## Must address` section and reply with the verdict, the report path, each `Must address` ID with one line on which side it names (the code, or the issue's spec), and that `/bdk:close <change>` runs again after the fix.

Done when the report passes, or you stopped.

## 4. Push

Run `git push -u origin <branch>`, never with `--force` or `--force-with-lease`. When it fails (no `origin`, rejected, no access), stop: quote the error and say that the Change is committed locally, and that `/bdk:close <change>` pushes and opens the pull request once the cause is fixed. Do not rebase or pull to make a push pass: a branch behind its remote is the user's to resolve.

Done when the push succeeded.

## 5. Open the pull request

Run `gh pr view <branch> --json url,state`. When it prints an open pull request, reuse its URL and go to step 6.

Otherwise gather the body from files (Read and Grep, not from memory):

- What the Change does: the Why of `## Proposal` and its `### What changes` in `R/issue.md`, in a few lines.
- `Resolves #<n>`: the issue's number, from `url` in `R/issue.json`, else the Change's `issue` in `.bdk/runs/run.json`. Write it whatever the base: it links the issue only into the default branch, and names it everywhere.
- Spec: the scenario names of `## Acceptance scenarios` (or `None.`), and the spec-conformance verdict (`verdict: pass`).
- E2E: the first line of the latest E2E verdict, the file modified last of `R/e2e/verdict.md` and `R/review/round-*/e2e/verdict.md` (Glob lists the newest first), or `no E2E results`. When that line is `Verdict: FAIL`, add the `E2E:` line of `## Checked` of `close/spec-conformance.md` as written: it names each failed path the review cleared (its judge levelled the finding `not-a-problem`) and why, which is why the check passed.
- Review: the number of `R/review/round-N/` directories, or `no review round ran`.
- Decisions taken without the user, in up to three groups, each only when it has a line: `Proposal:` the bullets under `### Decided without the user` of `issue.md`; `Design:` every line of `## Key decisions` of `issue.md` that starts with `Decided without the user:`; `Review:` every bullet under `## Decisions taken without the user` of `R/review/result.md`, in its order, auto triage lines included. Copy the lines as they are written, never pick among them: the stage that wrote them decided what belongs there. A `- None.` bullet or a missing file adds nothing. With no line in any group, `none`.
- Scope changes: every `## SL-<n>` entry of `R/scope-log.md`, in its order, copied as written (id, stage, AC, before, after, why, `By:` line). Copy, never pick: the user's decisions are what the reviewer checks the scope against. With no entry or no log, `none`.
- Living documentation: every bullet under `## Living documentation` of `R/close/spec-conformance.md`, in its order, as written: what the diff left behind in the ADRs, the module map and the glossary, for the reviewer to weigh. With only `- None.` or no section, leave this part out.
- Deferred: every bullet under `## Deferred` of `R/review/result.md`, in its order, as written (place, summary, level, and the issue when it has one), `nice-to-have` findings without an issue included: they are the review's open ends, and the pull request is where the reviewer weighs them. Copy, never pick or count. With only `- None.` or no file, leave this part out.

Write the body to `R/close/pr-body.md`. The title says what the Change does, in the style of the project's commit subjects (`git log --format=%s -10`). Run:

`gh pr create --base <base> --head <branch> --title "<title>" --body-file .bdk/runs/<change>/close/pr-body.md`

When `gh` fails (not logged in, no repository), stop: quote the error, write no `pr.md`, and say that `/bdk:close <change>` opens the pull request once the cause is fixed.

Done when you hold the pull request URL.

## 6. Record the pull request in the ADRs

The accepted ADRs that list the issue in their `issues` get the pull request in `implemented-by` and a status derived from their issues: `accepted` while none is closed, `partially-implemented`, `implemented` once all are. You never set either by hand. Run:

`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" adr status --issue <the issue's url from R/issue.json> --pr <pull request URL>`

It counts this issue as closed (step 7 closes it) and reads the states of the records' other issues from the tracker in one call.

- `no accepted ADR lists ...; nothing written`: go to step 7.
- `index: ... written`: run `git status --porcelain`; when it lists files, run **commit** with the arguments `the ADR status after <pull request URL>`, then `git push origin <branch>` (never forced). A failed push stops as step 4 says.
- `env/tracker-not-github` or `env/no-tracker`: find the records whose `issues` list the issue (Grep the ADR directory `docs.adr.dir` for its number), read the state of each of their other issues as `tracker.instructions` say, and run `"${CLAUDE_PLUGIN_ROOT}/bin/bdk" adr status ADR-<NNNN> --pr <pull request URL> --closed <this issue> --closed <ref> ... --open <ref> ...` for each record, then commit and push as above.
- Any other error: stop, quote it, write no `pr.md`, and say that the pull request is open and `/bdk:close <change>` records the ADRs and closes the issue once the cause is fixed.

Done when every ADR of the issue holds the pull request and is pushed, or none lists the issue.

## 7. Close the issue

Write `R/close/comment.md`: `Closed by <pull request URL>.`, the spec-conformance verdict, the E2E line and the review line of the body. Run:

`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" tracker sync --run <change> --comment-file .bdk/runs/<change>/close/comment.md --state closed`

It writes the body of `issue.md` when the run changed it, the comment and the closed state in one write, and closes the parent too when this was its last open sub-issue.

- `env/body-changed`: someone edited the issue on the tracker. Merge `R/issue.remote.md` into `issue.md` with Edit (keep the run's edits, take the tracker's other edits), then run the same command again.
- `env/tracker-not-github`: post the comment and close the issue as `tracker.instructions` of the configuration say.
- Any other error: stop, quote it, write no `pr.md`, and say that the pull request is open and `/bdk:close <change>` closes the issue once the cause is fixed.

Done when the issue is closed.

## 8. Record and report

Write `R/close/pr.md` last, because `bdk run status` reads its existence as "PR opened":

```markdown
PR: https://github.com/acme/shop/pull/17
Base: main
Branch: add-csv-export

<the body of the pull request>
```

Reply in a few lines:

- the pull request URL and its base branch;
- the issue closed, each ADR whose status changed (`ADR-<NNNN>: <before> -> <after>`), and each commit this close made (hash and subject, from `git log --oneline <base>..HEAD` or the commit reports);
- the spec-conformance verdict;
- every decision taken without the user, as in the body, with its group;
- every scope change, as in the body;
- the living-documentation items, as in the body, when it has that part;
- the deferred findings, as in the body, when it has a `Deferred` part.

End your turn there. The pull request waits for the user's review; you do not merge it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.