Communitygithub.com

alfathafp/portofolio-web-design

新しい機能開発の開始時や実装計画の実行前に使用します(ネイティブツールまたはgit worktreeフォールバックにより、現在のワークスペースから隔離された作業環境を確保します)。

portofolio-web-design とは?

このスキルは、Gitワークツリーを使用して隔離された作業環境を自動的にセットアップするためのものです。主にAIエージェント(Claude Code、Cursor、Codexなど)が、既存のブランチに影響を与えずに新しい機能開発を安全に行えるように設計されています。スキルは、最初に既存の隔離状態を検出し、次にプラットフォーム固有のネイティブワークツリーツールを優先して使用し、それらが利用できない場合にのみGitワークツリーコマンドにフォールバックします。これにより、ハーネスとツールの整合性が保たれ、ファントム状態の発生を防ぎます。スキルは、Node.js、Rust、Python、Goなどの一般的なプロジェクトの自動セットアップとベースラインテストの実行も行います。主なユースケースは、バグ修正、新機能の開発、リファクタリングなど、作業の分離が必要な場面です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/using-git-worktrees

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Gitワークツリーの使用

概要

作業が隔離されたワークスペースで行われるようにします。可能な限り、プラットフォーム固有のネイティブワークツリーツールを優先して使用してください。ネイティブツールが利用できない場合にのみ、手動のGitワークツリーにフォールバックします。

基本原則: まず既存の隔離状態を検出します。次にネイティブツールを使用します。最後にGitにフォールバックします。決してハーネスと戦わないでください。

開始時に宣言: 「using-git-worktreesスキルを使用して、隔離されたワークスペースをセットアップしています。」

ステップ0: 既存の隔離状態を検出

作成を行う前に、既に隔離されたワークスペース内にいるかどうかを確認します。

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)
BRANCH=$(git branch --show-current)

サブモジュールガード: GIT_DIR != GIT_COMMON は、Gitサブモジュール内でも真になります。「既にワークツリー内にいる」と結論する前に、サブモジュール内にいないことを確認してください:

# パスが返された場合、サブモジュール内にいます — 通常のリポジトリとして扱います
git rev-parse --show-superproject-working-tree 2>/dev/null

GIT_DIR != GIT_COMMON の場合(かつサブモジュール内ではない場合): あなたは既にリンクされたワークツリー内にいます。ステップ2(プロジェクトセットアップ)に進んでください。別のワークツリーを作成しないでください。

ブランチ状態を報告します:

  • ブランチ上: 「既に隔離されたワークスペース <パス> のブランチ <名前> にいます。」
  • Detached HEAD: 「既に隔離されたワークスペース <パス> にいます(Detached HEAD、外部管理)。完了時にブランチ作成が必要です。」

GIT_DIR == GIT_COMMON の場合(またはサブモジュール内の場合): あなたは通常のリポジトリチェックアウト内にいます。

ユーザーは既にあなたの指示の中でワークツリーの設定を指定していますか? そうでない場合、ワークツリーを作成する前に同意を求めてください:

「隔離されたワークツリーをセットアップしましょうか? 現在のブランチを変更から保護します。」

既に宣言された設定があれば、尋ねずにそれを尊重します。ユーザーが同意を拒否した場合、その場で作業を行い、ステップ2にスキップします。

ステップ1: 隔離されたワークスペースを作成

2つのメカニズムがあります。この順序で試してください。

1a. ネイティブワークツリーツール(優先)

ユーザーが隔離されたワークスペースを要求しました(ステップ0の同意)。ワークツリーを作成する方法は既にありますか? EnterWorktree、WorktreeCreate、/worktree コマンド、--worktree フラグなどのツールかもしれません。ある場合はそれを使用し、ステップ2にスキップしてください。

ネイティブツールは、ディレクトリの配置、ブランチの作成、クリーンアップを自動的に処理します。ネイティブツールがあるのに git worktree add を使用すると、ハーネスが認識または管理できないファントム状態が作成されます。

ネイティブワークツリーツールが利用できない場合にのみ、ステップ1bに進んでください。

1b. Gitワークツリーフォールバック

ステップ1aが適用されない場合のみ使用 — ネイティブワークツリーツールが利用できません。Gitを使用して手動でワークツリーを作成します。

ディレクトリ選択

以下の優先順位に従います。明示的なユーザー設定は、観測されたファイルシステムの状態よりも常に優先されます。

  1. ワークツリーディレクトリの設定があなたの指示に記述されているか確認します。 ユーザーが既に指定している場合、尋ねずにそれを使用します。

  2. 既存のプロジェクトローカルのワークツリーディレクトリを確認します:

    ls -d .worktrees 2>/dev/null     # 推奨(隠しディレクトリ)
    ls -d worktrees 2>/dev/null      # 代替
    

    見つかった場合はそれを使用します。両方存在する場合は .worktrees が優先されます。

  3. 他にガイダンスがない場合、プロジェクトルートの .worktrees/ をデフォルトとして使用します。

安全性確認(プロジェクトローカルディレクトリのみ)

ワークツリーを作成する前に、ディレクトリが無視されていることを確認する必要があります:

git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

無視されていない場合: .gitignore に追加し、変更をコミットしてから続行します。

なぜ重要か: ワークツリーの内容を誤ってリポジトリにコミットするのを防ぎます。

ワークツリーを作成

# 選択した場所に基づいてパスを決定
path="$LOCATION/$BRANCH_NAME"

git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

サンドボックスフォールバック: git worktree add が権限エラー(サンドボックス拒否)で失敗した場合、ユーザーにサンドボックスがワークツリー作成をブロックしたため、代わりにカレントディレクトリで作業することを伝えます。その後、その場でセットアップとベースラインテストを実行します。

ステップ2: プロジェクトセットアップ

適切なセットアップを自動検出して実行します:

# Node.js
if [ -f package.json ]; then npm install; fi

# Rust
if [ -f Cargo.toml ]; then cargo build; fi

# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi

# Go
if [ -f go.mod ]; then go mod download; fi

ステップ3: クリーンベースラインを確認

ワークスペースがクリーンな状態で開始されることを確認するため、テストを実行します:

# プロジェクトに適したコマンドを使用
npm test / cargo test / pytest / go test ./...

テストが失敗した場合: 失敗を報告し、続行するか調査するかを尋ねます。

テストが成功した場合: 準備完了を報告します。

報告

ワークツリー準備完了: <フルパス>
テスト成功(<N> テスト、0 失敗)
<機能名> の実装準備完了

クイックリファレンス

状況アクション
既にリンクされたワークツリー内作成をスキップ(ステップ0)
サブモジュール内通常のリポジトリとして扱う(ステップ0ガード)
ネイティブワークツリーツールが利用可能それを使用(ステップ1a)
ネイティブツールがないGitワークツリーフォールバック(ステップ1b)
.worktrees/ が存在するそれを使用(無視されているか確認)
worktrees/ が存在するそれを使用(無視されているか確認)
両方存在する.worktrees/ を使用
どちらも存在しない指示ファイルを確認し、デフォルトの .worktrees/ を使用
ディレクトリが無視されていない.gitignore に追加 + コミット
作成時の権限エラーサンドボックスフォールバック、その場で作業
ベースラインでテストが失敗失敗を報告 + 尋ねる
package.json / Cargo.toml がない依存関係のインストールをスキップ

よくある言い訳

言い訳現実
「明らかにワークツリー内にいない — 確認する必要はない」ステップ0を実行してください。ハーネスが作成した隔離環境とサブモジュールの両方が目視チェックを欺きます。検出コマンドがそれを解決します。
「git worktree add の方が、ネイティブツールを探すより速い」ネイティブツール(例:EnterWorktree)は、配置、ブランチ作成、クリーンアップを管理します。それをバイパスすることは#1のミスです — ハーネスが認識または管理できないファントム状態を作成します。
「ワークツリーディレクトリは確実に無視されている」git check-ignore を実行してください。無視されていないワークツリーディレクトリは、ツリー全体をリポジトリにコミットしてしまいます。
「どんなディレクトリ名でも機能する」明示的な指示が既存のプロジェクトローカルディレクトリに勝り、それが .worktrees/ デフォルトに勝ります。
「ワークスペースは新鮮だ — ベースラインテストは後でいい」汚れたベースラインは、後続のすべての失敗を曖昧にします。今テストを実行してください。失敗を越えて進むことは、あなたの人間のパートナーの判断です。

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

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

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

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.

関連スキル