smithery/hyz0906

autofix-gn-scope

Fixes scope and variable errors in BUILD.gn files.

Installation

$ npx skills add smithery/hyz0906 --skill autofix-gn-scope

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/hyz0906.

npx skills add smithery/hyz0906

Browse all from smithery/hyz0906

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,452 B
  • docs SUMMARY.md 74 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

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: mysources Variable: mysources

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")