スキル一覧に戻る
hyz0906

autofix-gn-scope

by hyz0906

0🍴 0📅 2026年1月19日
GitHubで見るManusで実行

SKILL.md


name: autofix-gn-scope description: Fixes scope and variable errors in BUILD.gn files.

GN Scope Skill

Fixes GN build file errors related to undefined variables or scope issues.

Detection Patterns

  • Undefined identifier
  • Assignment had no effect
  • Can't load buildconfig
  • Unknown variable

Strategy

  1. Identify Variable: Find the undefined or misused variable.
  2. Check Scope: Determine if it's a scope or declaration issue.
  3. Fix Definition: Add declaration or fix scope reference.

Instructions

Step 1: Parse the Error

From: Undefined identifier: my_sources Variable: my_sources

Step 2: Common Fixes

Undefined variable - add declaration:

# Before
sources = my_sources  # ERROR: undefined

# After
my_sources = [ "main.cpp" ]
sources = my_sources

Using variable before definition:

# Before (error)
executable("app") {
  sources = common_sources  # ERROR
}
common_sources = [ "util.cpp" ]

# After (move declaration up)
common_sources = [ "util.cpp" ]
executable("app") {
  sources = common_sources
}

Scope issue with inner blocks:

# Variables defined in if blocks may not be visible outside
if (is_debug) {
  debug_flags = [ "-g" ]
}
# debug_flags might be undefined here if is_debug is false

Step 3: GN Best Practices

  • Declare variables before use
  • Use defined() to check optional variables
  • Import shared configs with import("path")

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です