Community编程与开发github.com

alfathafp/portofolio-web-design

当实现完成、所有测试通过,且需要决定如何整合工作时使用。

portofolio-web-design 是什么?

该技能用于在开发分支工作完成后,安全、规范地完成集成决策。它强制要求先运行完整测试套件(如 npm test、cargo test、pytest、go test ./...),仅在测试全部通过后进入下一步。技能自动检测当前环境是普通仓库还是工作树(worktree),并基于Git目录状态呈现两种菜单之一:标准3选项(本地合并、推送创建PR、保持现状)或分离HEAD的2选项(无合并选项)。用户选择后,技能执行相应操作(如合并、推送、保留或丢弃),并在最后清理工作树(仅对属于Superpowers创建的工作树进行清理)。它还包括详细的异常处理(如合并后测试失败、工作树拒绝删除时询问用户)、明确的丢弃确认机制(必须输入'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. 本地合并回 <base-branch>
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 <base-branch>
git pull
git merge <feature-branch>

# 在合并结果上验证测试
<test command>

如果合并结果测试失败:停止,保持工作树和分支不变,并调查——尚未推送任何内容,因此合并是本地且可恢复的。

一旦合并结果测试通过:清理工作树(步骤 6),然后删除分支:

git branch -d <feature-branch>

选项 2:推送并创建 PR

git push -u origin <feature-branch>
# 从分离 HEAD,在远程上命名新分支:
# git push origin HEAD:refs/heads/<new-branch>

然后使用 forge 的工具(如果有 CLI 则使用,或者大多数 forge 在推送时打印的创建 URL)针对 创建拉取/合并请求,遵循仓库的 PR 模板和惯例(如果存在),并向您的人类合作伙伴报告 URL。

保留工作树——人类合作伙伴将在那里迭代 PR 反馈。

选项 3:保持现状

报告:“保持分支 。工作树保留在 。”

如果人类合作伙伴要求丢弃工作

此路径仅作为响应明确要求丢弃工作的请求而存在。先确认:

这将永久删除:
- 分支 <name>
- 所有提交:<commit-list>
- 位于 <path> 的工作树

输入 'discard' 确认。

等待确切的确认。当确认到达时:

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

然后清理工作树(步骤 6)并强制删除分支:

git branch -D <feature-branch>

步骤 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
工作树删除被拒绝——这些文件从未提交:

<file list>

1. 将它们提交到 <branch> 后再清理
2. 将它们移动到 <main repo root>
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.

相关技能