Community程式設計與開發github.com

alfathafp/portofolio-web-design

當實作完成、所有測試通過,且需要決定如何整合工作時使用。

portofolio-web-design 是什麼?

這個技能提供一個結構化的流程來完成開發分支:從驗證測試開始,然後偵測環境類型(一般儲存庫或工作樹),接著根據環境顯示對應的合併、推送或保留選項選單。它支援一般的 Git 儲存庫、具名分支的工作樹(支援合併和 PR 工作流程),以及分離的 HEAD 狀態(僅限 PR 和保留選項)。這個技能還會自動清理 `.worktrees/` 下的工作樹,並處理「廢棄」確認流程(需要使用者明確輸入 `discard` 才能刪除分支),同時確保在合併失敗或未提交的檔案阻擋清理等邊緣情況時能適當地手動介入。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/finishing-a-development-branch

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

完成開發分支

概述

核心原則: 驗證測試 → 偵測環境 → 提供選項 → 執行選擇 → 清理。

開始時宣告:「我正在使用完成開發分支技能來完成這項工作。」

步驟 1:驗證測試

執行專案的完整測試套件(npm test / cargo test / pytest / go test ./...)。

如果測試失敗,回報失敗並停止 — 選單要在測試全部通過後才會出現:

測試失敗(<N> 個失敗)。必須先修正才能完成:

[顯示失敗]

如果測試通過: 繼續到步驟 2。

步驟 2:偵測環境

GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
# 現在就捕捉,此時還在工作區內 — 步驟 5 會切換目錄
# 在清理(步驟 6)之前需要這個值
WORKTREE_PATH=$(git rev-parse --show-toplevel)

這決定了要顯示哪個選單以及清理的方式:

狀態選單清理
GIT_DIR == GIT_COMMON(一般儲存庫)標準 3 個選項無需清理工作樹
GIT_DIR != GIT_COMMON,具名分支標準 3 個選項基於來源(參見步驟 6)
GIT_DIR != GIT_COMMON,分離的 HEAD精簡 2 個選項(無合併)外部管理 — 維持原樣

步驟 3:確定基礎分支

基礎分支就是這個工作從哪個分支分岔出來的 — 通常是計畫、對話或分支的上游中所提及的。如果尚不清楚,請詢問:「這個分支是從 <你的最佳猜測> 分岔出來的 — 是否正確?」合併前請確認:合併到錯誤的基礎分支代價高昂,難以還原。

步驟 4:提供選項

一般儲存庫和具名分支工作樹 — 提供以下恰好 3 個選項:

實作完成。您想做什麼?

1. 合併回 <基礎分支>(本機)
2. 推送並建立 Pull Request
3. 保留分支原樣(我稍後再處理)

選擇哪個選項?

分離的 HEAD — 提供以下恰好 2 個選項:

實作完成。您處於分離的 HEAD 狀態(外部管理工作區)。

1. 推送為新分支並建立 Pull Request
2. 保留原樣(我稍後再處理)

選擇哪個選項?

請完全按照上述方式呈現選單 — 簡潔明瞭,每個選項都來自上面的列表。廢棄工作只發生在您的人類夥伴明確要求時(請參閱下方的「如果您的人類夥伴要求廢棄工作」)。等待他們的回答;整合決策屬於他們。

步驟 5:執行選擇

選項 1:本機合併

# 取得主要儲存庫根目錄以確保 CWD 安全
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"

# 先合併 — 在移除任何東西前先驗證成功
git checkout <基礎分支>
git pull
git merge <功能分支>

# 在合併結果上驗證測試
<測試指令>

如果合併後的測試失敗:停止,保留工作樹和分支,並進行調查 — 尚未推送任何內容,因此合併只是本機操作,可以復原。

一旦合併結果測試通過:清理工作樹(步驟 6),然後刪除分支:

git branch -d <功能分支>

選項 2:推送並建立 PR

git push -u origin <功能分支>
# 從分離的 HEAD 狀態,在遠端命名新分支:
# git push origin HEAD:refs/heads/<新分支>

然後使用 forge 的工具針對 <基礎分支> 建立 pull/merge request — 如果有 CLI 工具則使用 CLI,否則使用大多數 forge 在推送時列印的建立 URL — 遵循儲存庫的 PR 範本和慣例(如果有的話),並將 URL 回報給您的人類夥伴。

保留工作樹 — 您的人類夥伴會在那裡根據 PR 回饋進行迭代。

選項 3:保留原樣

回報:「保留分支 <名稱>。工作樹保留在 <路徑>。」

如果您的人類夥伴要求廢棄工作

此路徑僅作為回應明確要求拋棄工作的請求而存在。請先確認:

這將會永久刪除:
- 分支 <名稱>
- 所有提交:<提交列表>
- <路徑> 的工作樹

請輸入 'discard' 以確認。

等待那個確切的確認。當確認到達時:

MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"

然後清理工作樹(步驟 6)並強制刪除分支:

git branch -D <功能分支>

步驟 6:清理工作區

適用於選項 1 和已確認的廢棄。 選項 2 和 3 始終保留工作樹。兩個呼叫者都已經將目錄切換到主要儲存庫根目錄 — 工作樹移除必須從工作樹外部執行 — 並且使用在步驟 2 中捕捉到的 GIT_DIR/GIT_COMMON/WORKTREE_PATH 值(在目錄切換之前)。

如果 GIT_DIR == GIT_COMMON: 一般儲存庫,無需清理工作樹。完成。

如果 WORKTREE_PATH 位於 .worktrees/ 或 worktrees/ 下: Superpowers 建立了這個工作樹 — 我們負責清理:

git worktree remove "$WORKTREE_PATH"
git worktree prune  # 自我修復:清理任何過時的註冊

如果移除被拒絕(contains modified or untracked files):工作樹包含存在於其他任何地方的檔案 — 未提交的計畫、筆記或草稿。永遠不要主動使用 --force。向您的人類夥伴展示風險所在並詢問:

git -C "$WORKTREE_PATH" status --porcelain -uall
工作樹移除被拒絕 — 這些檔案從未被提交:

<檔案列表>

1. 將它們提交到 <分支> 後再清理
2. 將它們移動到 <主要儲存庫根目錄>
3. 刪除它們(無法復原)

選擇哪一個?

執行選擇,然後移除工作樹。

否則: 宿主環境擁有這個工作區 — 維持原樣。如果您的平台提供了工作區退出工具,請使用它。

快速參考

選項合併推送保留工作樹清理分支
1. 本機合併是--是
2. 建立 PR-是是-
3. 保留原樣--是-
廢棄(僅限明確要求)---是(強制)

常見合理化藉口

藉口現實
「這次工作階段稍早測試通過了」在你即將整合的樹上執行測試套件。測試通過只證明它所執行的樹是好的。
「他們顯然想要合併」整合是你人類夥伴的決定。提供選單並等待。
「他們似乎完成了這個功能 — 我會提議廢棄它」選單已經完整如上所述。廢棄只在你的人類夥伴以明確措辭要求時才會發生。
「『好,把它刪掉』算確認」只有輸入的單字 discard 才能授權刪除。
「PR 已經提交了,所以工作樹現在是垃圾」PR 回饋會在那個工作樹中修復。它會一直保留到工作完成。
「這個其他工作樹看起來很舊了 — 我也會清理它」只清理 .worktrees/ 或 worktrees/ 下的工作樹。其他所有東西都屬於宿主。
「移除被拒絕 — --force 只是完成清理」拒絕意味著檔案只存在於那個工作樹中。--force 會永久銷毀它們。向您的人類夥伴展示並詢問。
「合併結果失敗可能只是不穩定」合併結果失敗會停止所有事情。分支和工作樹保持原樣,等待調查。
「基礎分支顯然是 main」確認分岔點或詢問。合併到錯誤的基礎分支代價高昂。
「推送被拒絕了 — 強制推送可以解決」推送被拒絕意味著遠端有變動。調查;僅在你的人類夥伴明確要求時才強制推送。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

alfathafp/portofolio-web-design

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

alfathafp/portofolio-web-design

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

alfathafp/portofolio-web-design

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

alfathafp/portofolio-web-design

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

alfathafp/portofolio-web-design

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

alfathafp/portofolio-web-design

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

alfathafp/portofolio-web-design

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

alfathafp/portofolio-web-design

Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.

alfathafp/portofolio-web-design

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

alfathafp/portofolio-web-design

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.

alfathafp/portofolio-web-design

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

alfathafp/portofolio-web-design

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

alfathafp/portofolio-web-design

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

alfathafp/portofolio-web-design

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.

alfathafp/portofolio-web-design

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

alfathafp/portofolio-web-design

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

alfathafp/portofolio-web-design

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

alfathafp/portofolio-web-design

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

alfathafp/portofolio-web-design

Delivers changes incrementally in thin, verifiable slices. Use when implementing any feature or change that touches more than one file, or when picking up the next task from a plan. Use when rolling a change out behind a feature flag, when you're about to write a large amount of code at once, or when a task feels too big to land in one step.

alfathafp/portofolio-web-design

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

相關技能