Communityコーディング&開発github.com

alfathafp/portofolio-web-design

バグ、テスト失敗、予期しない動作に遭遇した時に、修正を提案する前に使用するスキルです。

portofolio-web-design とは?

このスキルは、ソフトウェア開発におけるあらゆる技術的問題に体系的に取り組むためのプロセスを提供します。コア原則は「根本原因を特定する前に決して修正を試みない」ことであり、症状ベースの修正を失敗と見なします。このスキルは、テスト失敗、本番環境のバグ、パフォーマンス問題など、あらゆる種類の技術的問題に適用できます。特に時間的プレッシャーがある状況や、問題が単純に見える場合に有用であり、推測による修正を防止します。ワークフローは4つのフェーズ(根本原因調査→パターン分析→仮説とテスト→実装)で構成され、各フェーズを順に完了する必要があります。また、同じ問題に対して3回以上の修正が失敗した場合は、アーキテクチャ自体の見直しを促す機能も備えています。このスキルはClaude Code、Cursor、CodexなどのAIエージェントで使用することを想定しており、Markdown形式のドキュメントとして提供されています。

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

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

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

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

ドキュメント

体系的なデバッグ

概要

基本原則: 修正を試みる前に常に根本原因を特定すること。症状への対処は失敗です。

このプロセスに違反することは、デバッグの精神に反します。

鉄則

根本原因の調査なしに修正を提案してはいけません

フェーズ1を完了していない場合、修正を提案することはできません。

使用するタイミング

あらゆる技術的問題に使用します:

  • テスト失敗
  • 本番環境のバグ
  • 予期しない動作
  • パフォーマンス問題
  • ビルド失敗
  • 結合問題

特に以下の場合に使用してください:

  • 時間的プレッシャーがある場合(緊急時は推測したくなります)
  • 「ちょっとした簡単な修正」が明らかに思える場合
  • すでに複数の修正を試した場合
  • 以前の修正が効かなかった場合
  • 問題を完全に理解していない場合

以下の場合にスキップしないでください:

  • 問題が単純に見える場合(単純なバグにも根本原因があります)
  • 急いでいる場合(急ぐとやり直しが保証されます)
  • マネージャーが今すぐ修正を求める場合(体系的な方法の方が試行錯誤より速いです)

4つのフェーズ

次のフェーズに進む前に、各フェーズを完了する必要があります。

フェーズ1: 根本原因調査

修正を試みる前に:

  1. エラーメッセージを注意深く読む

    • エラーや警告を見逃さない
    • それらは正確な解決策を含んでいることが多い
    • スタックトレースを完全に読む
    • 行番号、ファイルパス、エラーコードを書き留める
  2. 一貫して再現する

    • 信頼性高くトリガーできますか?
    • 正確な手順は何ですか?
    • 毎回発生しますか?
    • 再現できない場合 → 推測せず、より多くのデータを収集する
  3. 最近の変更を確認する

    • これを引き起こす可能性のある変更は何でしたか?
    • Git diff、最近のコミット
    • 新しい依存関係、設定変更
    • 環境の違い
  4. マルチコンポーネントシステムで証拠を収集する

    システムに複数のコンポーネントがある場合(CI → ビルド → 署名、API → サービス → データベースなど):

    修正を提案する前に、診断用の計装を追加します:

    各コンポーネント境界において:
      - コンポーネントに入るデータをログに記録する
      - コンポーネントから出るデータをログに記録する
      - 環境/設定の伝播を検証する
      - 各層での状態を確認する
    
    証拠を収集するために一度実行し、どこで壊れているかを示す
    次に証拠を分析して、どのコンポーネントが失敗しているかを特定する
    次にその特定のコンポーネントを調査する
    

    例(マルチレイヤーシステム):

    # レイヤー1: ワークフロー
    echo "=== ワークフローで利用可能なシークレット: ==="
    echo "IDENTITY: $([ -n "${IDENTITY:-}" ] && echo SET || echo UNSET)"
    
    # レイヤー2: ビルドスクリプト
    echo "=== ビルドスクリプト内の環境変数: ==="
    printenv IDENTITY >/dev/null 2>&1 && echo "IDENTITYが環境に存在" || echo "IDENTITYが環境に存在しない"
    
    # レイヤー3: 署名スクリプト
    echo "=== キーチェーンの状態: ==="
    security list-keychains
    security find-identity -v
    
    # レイヤー4: 実際の署名
    codesign --sign "$IDENTITY" --verbose=4 "$APP"
    

    これにより明らかになること: どのレイヤーが失敗しているか(シークレット→ワークフロー ✓、ワークフロー→ビルド ✗)

  5. データフローをトレースする

    エラーがコールスタックの深いところにある場合:

    このディレクトリにある root-cause-tracing.md を参照して、完全な逆方向トレース手法を確認してください。

    簡易版:

    • 不正な値の発生源はどこですか?
    • 不正な値でこれを呼び出したものは何ですか?
    • 原因が見つかるまでトレースを続ける
    • 症状ではなく、発生源で修正する

フェーズ2: パターン分析

修正する前にパターンを見つける:

  1. 動作している例を見つける

    • 同じコードベース内で類似の動作コードを見つける
    • 壊れているものと似ていて動作しているものは何ですか?
  2. リファレンスと比較する

    • パターンを実装する場合、リファレンス実装を完全に読む
    • ざっと読まない - すべての行を読む
    • 適用する前にパターンを完全に理解する
  3. 差異を特定する

    • 動作しているものと壊れているものの違いは何ですか?
    • どんなに小さな違いでもすべてリストアップする
    • 「それは重要ではない」と決めつけない
  4. 依存関係を理解する

    • これには他にどのコンポーネントが必要ですか?
    • どのような設定、構成、環境が必要ですか?
    • どのような前提がありますか?

フェーズ3: 仮説とテスト

科学的方法:

  1. 単一の仮説を立てる

    • 明確に述べる: 「Yという理由で、Xが根本原因だと思う」
    • 書き留める
    • 具体的に、曖昧にしない
  2. 最小限にテストする

    • 仮説をテストするために可能な限り小さな変更を行う
    • 一度に一つの変数のみ
    • 複数のことを同時に修正しない
  3. 続行する前に検証する

    • うまくいきましたか? → フェーズ4へ
    • うまくいきませんでしたか? → 新しい仮説を立てる
    • 修正をさらに追加しない
  4. わからない場合

    • 「Xがわかりません」と言う
    • 知っているふりをしない
    • 助けを求める
    • さらに調査する

フェーズ4: 実装

症状ではなく、根本原因を修正する:

  1. 失敗するテストケースを作成する

    • 可能な限り単純な再現
    • 可能であれば自動テスト
    • フレームワークがない場合は、一回限りのテストスクリプト
    • 修正前に必須
    • 適切な失敗テストを作成するには、superpowers:test-driven-development スキルを使用する
  2. 単一の修正を実装する

    • 特定された根本原因に対処する
    • 一度に一つの変更
    • 「ついでに」改善しない
    • リファクタリングをまとめて行わない
  3. 修正を検証する

    • テストは今パスしますか?
    • 他のテストは壊れていませんか?
    • 問題は実際に解決されましたか?
    • 成功を主張する前に、superpowers:verification-before-completion スキルを使用する
  4. 修正がうまくいかない場合

    • 停止する
    • カウントする: これまでに何回の修正を試みましたか?
    • 3回未満の場合: フェーズ1に戻り、新しい情報で再分析する
    • 3回以上の場合: 停止し、アーキテクチャを疑う(以下のステップ5)
    • アーキテクチャの議論なしに修正4を試みない
  5. 3回以上の修正が失敗した場合: アーキテクチャを疑う

    アーキテクチャの問題を示すパターン:

    • 各修正により、異なる場所で新しい共有状態/結合/問題が明らかになる
    • 修正を実装するには「大規模なリファクタリング」が必要
    • 各修正が他の場所で新しい症状を引き起こす

    停止し、基本を疑う:

    • このパターンは根本的に健全ですか?
    • 「惰性でこれに固執している」だけではありませんか?
    • 症状を修正し続けるのではなく、アーキテクチャをリファクタリングすべきですか?

    さらに修正を試みる前に、人間のパートナーと話し合う

    これは仮説の失敗ではありません - これは間違ったアーキテクチャです。

レッドフラグ - 停止してプロセスに従う

以下のような考えが頭をよぎったら:

  • 「今はとりあえず修正して、後で調査する」
  • 「Xを変えてみて、うまくいくか見てみよう」
  • 「複数の変更を追加して、テストを実行する」
  • 「テストはスキップして、手動で確認する」
  • 「おそらくXが原因だ、それを修正しよう」
  • 「完全には理解していないけど、これはうまくいくかもしれない」
  • 「パターンはXを示しているけど、別の方法で適応させよう」
  • 「主な問題は次のとおりです: [調査なしで修正をリストアップ]」
  • データフローのトレース前に解決策を提案する
  • 「もう一度修正を試みる」(すでに2回以上試した場合)
  • 各修正が別の場所で新しい問題を明らかにする

これらはすべて: 停止。フェーズ1に戻ることを意味します。

3回以上の修正が失敗した場合: アーキテクチャを疑う(フェーズ4.5を参照)

人間のパートナーからの「間違っている」シグナル

以下のような方向転換に注意してください:

  • 「それは起こっていない?」 - 確認せずに仮定している
  • 「それを見せてくれますか...?」 - 証拠収集を追加すべきだった
  • 「推測をやめて」 - 理解せずに修正を提案している
  • 「超考えて」 - 症状だけでなく、基本を疑う
  • 「行き詰まっている?」(イライラして) - あなたのアプローチが機能していない

これらを見たら: 停止。フェーズ1に戻る。

よくある正当化

言い訳現実
「問題は単純だから、プロセスは不要」単純な問題にも根本原因はあります。プロセスは単純なバグには高速です。
「緊急だから、プロセスを踏む時間がない」体系的なデバッグは、推測と試行錯誤より高速です。
「とりあえずこれを試して、後で調査する」最初の修正がパターンを決めます。最初から正しく行いましょう。
「修正がうまくいくことを確認してからテストを書く」テストされていない修正は定着しません。テストが最初にそれを証明します。
「一度に複数の修正をすると時間の節約になる」何が効いたのかを切り分けられません。新しいバグの原因になります。
「リファレンスが長すぎるので、パターンを適応させよう」部分的な理解はバグを保証します。完全に読んでください。
「問題が見えたので、修正しましょう」症状を見ること ≠ 根本原因を理解すること。
「もう一度修正を試みる」(2回以上失敗した後)3回以上の失敗 = アーキテクチャの問題。パターンを疑い、再修正しない。

クイックリファレンス

フェーズ主要なアクティビティ成功基準
1. 根本原因エラーを読む、再現する、変更を確認する、証拠を収集するWHAT(何が)とWHY(なぜ)を理解する
2. パターン動作例を見つける、比較する差異を特定する
3. 仮説理論を立てる、最小限にテストする確認された、または新しい仮説
4. 実装テストを作成する、修正する、検証するバグが解決され、テストがパスする

プロセスで「根本原因なし」が明らかになった場合

体系的な調査により、問題が本当に環境依存、タイミング依存、または外部要因であることが明らかになった場合:

  1. プロセスは完了しています
  2. 調査した内容を文書化する
  3. 適切な処理(リトライ、タイムアウト、エラーメッセージ)を実装する
  4. 将来の調査のためにモニタリング/ログを追加する

しかし: 「根本原因なし」のケースの95%は、調査が不完全です。

サポート技術

これらの技術は体系的なデバッグの一部であり、このディレクトリで利用できます:

  • root-cause-tracing.md - コールスタックを逆方向にトレースして、元のトリガーを見つける
  • defense-in-depth.md - 根本原因を見つけた後、複数のレイヤーにバリデーションを追加する
  • condition-based-waiting.md - 任意のタイムアウトを条件ポーリングに置き換える

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.

関連スキル