Logo Finalize

Finalize

Cộng đồng
rustyrazorblade
finalize

Finalize a merged issue — close the GitHub issue, remove its lifecycle/coordination labels, close and clean any issue recorded to close with it, and remove the issue's git worktree. Final stage of the flow delivery workflow (see docs/workflow.md). Runs once the FEATURE PR has merged — by the owner's squash-merge by default, or by `implement` itself if the `merge-on-green` label was set or this run's the issue's owner instructions said to auto-merge. Does NOT touch the OpenSpec archive — that's `project-manager`'s job, done in bulk across several issues at once via `/spec-flow:archive`, once enough have piled up. This skill never merges the feature PR and never opens a PR of its own.

Tổng quan

Nhà phát hànhrustyrazorblade
Kho mãskills
Tên kỹ năngfinalize
Sao
44
Bản fork
9
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được rustyrazorblade công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Finalize trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/rustyrazorblade/skills/tree/main/plugins/spec-flow/skills/finalize
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rustyrazorblade/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/plugins/spec-flow/skills/finalize .claude/skills/finalize
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Finalize trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Finalize ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Finalize không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

finalize — close out an issue after merge

You are this issue's issue-manager, running as your own dedicated background session. The PR for issue #N has merged — the owner's squash-merge in GitHub by default, or implement's own auto-merge if merge-on-green was set or this run's the issue's owner instructions said to (see its SKILL.md step 5); either way, by the time this runs the merge has already happened. Close the issue and tear down your worktree — that's the whole job. This skill itself never merges the feature PR — that already happened, by whichever path, before this skill starts — and it never touches the OpenSpec archive either. When this issue committed an openspec/changes/issue-<N> change (every issue except a content-only type:docs one, or any type:tech-debt one — see Docs fast path and Tech-debt fast path in docs/workflow.md, neither of which generates one), it already landed on the default branch as part of the merge; syncing it into canonical specs and moving it under openspec/changes/archive/ is project-manager's job, batched across however many issues have piled up since the last pass (see Bulk spec archiving in docs/workflow.md) — not something any single issue's finalize waits on or does itself.

Input: an issue number #N. You're already running inside this issue's worktree — Claude Code's own background-session isolation put you there, on whatever branch it assigned, so resolve the branch with git rev-parse --abbrev-ref HEAD rather than assuming a name.

Steps

  1. Verify the PR is merged (precondition — do not merge it yourself):

    bash
    BR=$(git rev-parse --abbrev-ref HEAD)
    gh pr list --head "$BR" --state merged --json number,mergedAt

    If it isn't merged, stop — it hasn't happened yet, whether that's the owner's squash-merge in GitHub (default) or implement's own auto-merge (only if this run was instructed to).

  2. Close the issue (a PR with Closes #N usually auto-closes on merge — check state/closed first, and only close/comment/relabel what isn't already done; this step is safe to re-run, but don't post a second "🎉" comment or re-attempt a close that already happened). Remove the lifecycle and coordination labels — closing doesn't drop them on its own, and a stray agent:active on a closed issue would misread as still live. Do this before step 3, not after — gh issue commands have no -C/path override, they infer the repo from wherever you're standing, and step 3 is about to remove that:

    bash
    STATE=$(gh issue view <N> --json state,closed)
    if [[ "$(jq -r .closed <<<"$STATE")" != "true" ]]; then
      # A content-only type:docs issue, or any type:tech-debt issue, committed no
      # openspec/changes/issue-<N> at all (see Docs fast path / Tech-debt fast path in
      # docs/workflow.md) — nothing for a later archive batch to pick up, so say so accurately
      # instead of promising an archive that will never happen.
      if [[ -d "openspec/changes/issue-<N>" ]]; then
        gh issue comment <N> --body "🎉 Merged and closed. Its spec will be archived in a later batch — see /spec-flow:board."
      else
        gh issue comment <N> --body "🎉 Merged and closed."
      fi
      gh issue close <N> 2>/dev/null || true
    fi
    gh issue edit <N> --remove-label status:in-review --remove-label status:addressing \
      --remove-label status:in-progress --remove-label agent:active --remove-label blocked \
      --remove-label merge-on-green --remove-label needs-attention \
      2>/dev/null || true
    # Removing a label the issue doesn't carry is a no-op returning 0 (verified), so naming all
    # seven in one call is safe. A transient auth/network failure is not: the `|| true` swallows it
    # and NONE of the seven come off. Read the result back before trusting it.
    # Two kinds of blocker: the `blocked` label, only for a blocker that is not an issue, and a
    # native GitHub blocked_by link for a dependency on another issue. sweep removes both, so the
    # closed issue is not rendered as blocked in GitHub's own UI.
    ${CLAUDE_PLUGIN_ROOT}/scripts/blocked-dependency.sh sweep <N>
    gh issue view <N> --json labels --jq '[.labels[].name] | map(select(
      . == "agent:active" or . == "blocked" or . == "merge-on-green"
      or . == "needs-attention" or startswith("status:"))) | join(", ")'

    That read-back must print an empty line. If it names any label, the sweep did not take effect. Retry the specific command that owns the surviving label — the gh issue edit above for a status:*, agent:active, merge-on-green or needs-attention label, or blocked-dependency.sh sweep for blocked — then read back again. If it still names a label, STOP and tell the owner which labels survive on which issue. Do not continue to step 3: a closed issue still carrying agent:active makes every future spawn-issue-manager.sh on that number refuse, and step 3 removes the working directory gh issue needs to infer the repo, so you cannot come back and retry afterwards.

    Then close what GitHub left open. The owner may have chosen, at activate, to close other issues when this PR merges. GitHub closes them from the PR body's Closes #M lines, but not always. Close and clean each one, with <PR> the merged PR number from step 1:

    bash
    ${CLAUDE_PLUGIN_ROOT}/scripts/close-on-merge.sh close-merged <N> <PR>

    It acts only for a merged PR. For each recorded issue it closes it if it is still open, never reopens one already closed, removes the same lifecycle labels as above, sweeps its blocked_by links, and reads its labels back. It reports agent:active on a recorded issue and leaves it in place, because another session may own that issue. It prints nothing to close when there are no records. If it exits non-zero, run it once more. If it fails again, STOP before step 3, keep the worktree, and tell the owner which recorded issue is still open and which labels remain, from what it printed — the same stop rule as a surviving label on this issue.

  3. Remove your own worktree and branch — hand off to a script that only acts once verified safe. Only run this once step 2's read-back came back empty and close-merged exited 0. Before running it, note whether this issue had an OpenSpec change — [[ -d "openspec/changes/issue-<N>" ]] — for step 4's report; the worktree (and anywhere you could still run that check) is gone once this script finishes:

    bash
    ${CLAUDE_PLUGIN_ROOT}/scripts/finalize-remove-worktree.sh

    Run it from inside the worktree being removed — it resolves everything from where you're standing; no arguments. It removes the worktree only when HEAD is exactly a merged PR's tip, and only then applies the double --force a session-locked worktree needs — the full reasoning (why exact-SHA, why two forces) lives in the script's own comments; never bypass it with a hand-run git worktree remove --force --force. Safe to re-run: if already removed, it detects the main checkout and exits cleanly.

  4. Report. Confirm: issue closed, labels verified clear, every recorded issue closed and clean (name each one as <number>: <title>, and any agent:active it reported), worktree removed. Report the label sweep from step 2's read-back, not from the edit command's exit status. If step 3's check found openspec/changes/issue-<N>, note it's still sitting on the default branch, unarchived, until project-manager runs a bulk archive pass — this is expected, not something to wait on here. A content-only type:docs issue, or any type:tech-debt issue, has none — nothing pending for either. Suggest /spec-flow:board to see the rest of the pipeline.

Rules

  • Never merge the feature PR. Confirm the owner already did before finalizing (step 1).
  • Never touch the OpenSpec archive. No openspec-sync-specs, no openspec-archive-change, no worktree cut from the default branch for this purpose — that's entirely project-manager's job, batched. Don't wait for it, don't attempt it yourself even if you notice the change is still sitting unarchived.
  • Never open or merge a PR of your own. Nothing in this skill produces a PR at all anymore.
  • Only finalize a merged PR — finalizing an unmerged one would close an issue before its work actually landed.
  • This is where agent:active finally comes off — activate set it, every stage since kept it, this is the one place it's supposed to end. Don't skip step 2's label removal even on an otherwise-uneventful finalize.
  • Never remove a worktree by hand. Step 3's script is the only sanctioned path — it checks before it forces.
  • Safe to re-run at any step. Step 2 only closes/comments/relabels what isn't already done; step 3's script only removes what still exists.
  • When you cite an issue or PR, always write it as <number>: <title>, on its own line with a - prefix — never a bare number, and never several run together inline in a sentence. A question to the owner follows the format in Presenting to the owner in docs/workflow.md.

Câu hỏi thường gặp

Kỹ năng AI Finalize làm được gì?

Finalize a merged issue — close the GitHub issue, remove its lifecycle/coordination labels, close and clean any issue recorded to close with it, and remove the issue's git worktree. Final stage of the flow delivery workflow (see docs/workflow.md). Runs once the FEATURE PR has merged — by the owner's squash-merge by default, or by `implement` itself if the `merge-on-green` label was set or this run's the issue's owner instructions said to auto-merge. Does NOT touch the OpenSpec archive — that's `project-manager`'s job, done in bulk across several issues at once via `/spec-flow:archive`, once...

Vì sao nên dùng Finalize trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Finalize là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Finalize trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/rustyrazorblade/skills/tree/main/plugins/spec-flow/skills/finalize. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Finalize?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Finalize với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Finalize với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Finalize có miễn phí không?

Có. Kỹ năng này được rustyrazorblade phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇