gn-deps-debugging
できること
このスキルは、AIがGNのビルド依存関係のエラーを見つけて直す手助けをします。大きなプロジェクトのビルド中に、インクルードファイルや依存関係のチェックのエラーが出る開発者向けです。
使う場面
- ✓ビルドがGNの依存関係やインクルードの可視性のエラーで失敗したとき。
- ✓gn checkが、あるターゲットからヘッダーファイルを許可しないと報告したとき。
- ✓ビルドのターゲット間の循環依存を直す必要があるとき。
スキルのリンク
https://github.com/chromium/chromium/blob/main/agents/skills/gn-deps-debugging/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ビルドで、あるヘッダーが自分のターゲットから見えないと出ています。正しい依存関係を見つけて直してもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIは正確なエラーを読み、そのファイルを持つビルドのターゲットと、ヘッダーを持つターゲットを見つけ、最小限の正しい依存関係を追加します。プラットフォームのルールはそのまま保ちます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
GN Dependency Debugging
Fix Chromium GN dependency metadata, include visibility, and DEPS rule failures by correcting the dependency graph accurately, not by adding broad dependencies that only make errors disappear.
Core principles
- Read the exact error first. Identify the including source file, the included header, the failing target, and the diagnostic category before editing.
- Find both owning targets. Determine which GN target owns the including file and which GN target owns the included header.
- Prefer the narrowest dependency. Add the dependency to the smallest target that needs it, not a parent or aggregate target.
- Preserve platform conditions. If the failing include is in a
platform-specific file such as
*_win.cc, add the dependency inside the matching platform block such asif (is_win). - Use
depsfor implementation-only dependencies. If a symbol is used only in.ccfiles, keep the dependency private. - Use
public_depsonly for public API exposure. If a public header exposes a type from another target in its declarations or inline code, downstream consumers may need that dependency transitively. - Prefer forward declarations in headers. If a header only needs a pointer,
reference, or return type declaration, forward declare and move the include
to the
.ccfile when possible. - Do not paper over architecture issues. Circular dependencies usually indicate the need to split an interface target, move shared abstractions, or invert dependencies.
- Avoid
// nogncheck. Use it only for known GN limitations with conditional includes, and include the required bug reference if the local codebase already documents one.
Workflow
Capture the failing command and output.
- If the user provided a truncated error, ask for or rerun the relevant
gn checkor build command when an output directory and target are known. - Do not start a broad build just to reproduce unless the output directory and target are established.
- If the user provided a truncated error, ask for or rerun the relevant
Classify the failure.
- Read common-errors.md and map the diagnostic to one of the supported categories.
- Extract the including file, included header, and target names from the diagnostic.
Find the target that owns the including file.
- Inspect nearby
BUILD.gnfiles first. - Use GN queries when an output directory is known:
gn refs out/Default //path/to/file.cc --all - Prefer the most specific non-aggregate target that directly lists the file or owns the source set containing it.
- Check whether the file is platform-specific, such as
*_win.cc,*_mac.mm,*_linux.cc,*_android.cc, or*_ios.mm. Platform-specific files usually require platform-specific dependencies.
- Inspect nearby
Find the target that owns the included header.
- Search for the header in
BUILD.gnsources lists. - If several targets list it, prefer the public/interface target intended for consumers.
- Check whether the header belongs to a generated target, a
publicvariable, or a private implementation target.
- Search for the header in
Choose the correct fix.
- Read dependency-patterns.md for
depsvspublic_deps, forward declaration, DEPS, and cycle handling rules. - If the include appears only in
.cc, add a privatedepsentry. - If the include appears only in a platform-specific source file, add the
private
depsentry inside the matching platform condition, for exampleif (is_win). - If the include appears in a public header, first try to remove the include
using a forward declaration. If the header must expose the dependency, add
or promote the dependency to
public_deps. - If a
DEPSfile blocks the include, verify whether the dependency direction is allowed by the architecture before adding include rules. - If adding the dependency creates a cycle, stop and redesign the dependency
boundary instead of adding broader deps. When an output directory is known,
use
gn path <out_dir> //target_a //target_bto inspect the dependency chain that connects the targets.
- Read dependency-patterns.md for
Validate the narrow change.
- Run
git cl formatifBUILD.gnorDEPSfiles were edited. - Re-run the smallest relevant
gn checkor build command that reproduced the issue. - If
- Run
よくある質問
このスキルはコードを変更しますか?
変更は、依存関係とインクルードのエラーに限られます。そのため、コードの変更は最小限になります。
エラーを消すために大きな依存関係を足すべきではないのですか?
はい。広い依存関係は、本当の問題を隠し、ビルドを遅くすることがあります。このスキルは最も狭い修正を求めます。
どのような場合にこのスキルを使うべきではありませんか?
依存関係とインクルードのエラー向けです。コンパイル、リンク、実行時の失敗には、別のアプローチのほうが適しています。
詳細
作者による元の説明
Diagnose Chromium GN dependency and include-visibility failures, including BUILD.gn deps/public_deps, DEPS include rules, private headers, and circular dependencies. Use for build or gn check dependency errors, not C++/link/runtime/test failures.
repo: chromium/chromium
人気
- GitHubのスター
- 25k
- ランキング
- #10058
- ライセンス
- BSD-3-Clause
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
fuzzing
25kエージェントが、多くのランダムな入力をコードに与えてクラッシュやバグを見つけるファジングテストを、C++のコードで書けるよう支援します。
java-memory-leaks
25kエージェントが、LeakCanaryのリークレポートを読んで、Androidアプリの Javaのメモリリークを見つけ、修正できるよう支援します。
jni-type-conversion
25kエージェントが、Androidのコードで、手作業によるJavaからC++への変換のコードを、より簡単な@JniTypeアノテーションに置き換えられるよう支援します。
loadline
25kエージェントが、AndroidとデスクトップのChromeで、Webページの読み込みの速さを測るLoadLineのベンチマークを実行できるよう支援します。
似ているスキル
openclaw-update
394k既存のOpenClaw Gatewayを更新するようエージェントを支援します。インストール方法に合った更新方法を選び、セッションを動かし続けます。
diagnose-gateway
394k設定、チャンネル、ポートを確認して、OpenClaw Gatewayが失敗している理由を、何も変更せずに突き止めるようエージェントを支援します。
crabbox-apps
394k一時的なクラウドマシン上でアプリを開いて実行し、そのビューをチャットのサイドパネルに表示するようエージェントを支援します。