Agent skill
xcode-pbxproj-file-registration
Use when xcodebuild fails with 'cannot find in scope' after adding a .swift file outside Xcode. Register in 4 pbxproj sections.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/xcode-pbxproj-file-registration
Metadata
Additional technical details for this skill
- author
- shimo4228
- version
- 1.0
- extracted
- 2026-02-11
SKILL.md
Xcode pbxproj Manual File Registration
Extracted: 2026-02-11 Context: Xcode プロジェクト (.xcodeproj) に新規 .swift ファイルを CLI から追加する場合
Problem
GKentei/Views/Quiz/EnhancedExplanationView.swift を作成後、xcodebuild で以下のエラー:
error: cannot find 'EnhancedExplanationView' in scope
ファイルがディスク上に存在しても、project.pbxproj に登録されていないとビルド対象にならない。
Solution
project.pbxproj の 4箇所 に新規エントリを追加する:
1. PBXBuildFile (ビルド対象登録)
UNIQUE_ID_BB /* FileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = UNIQUE_ID_CC /* FileName.swift */; };
2. PBXFileReference (ファイル参照定義)
UNIQUE_ID_CC /* FileName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileName.swift; sourceTree = "<group>"; };
3. PBXGroup children (グループ内ファイル一覧)
UNIQUE_ID_CC /* FileName.swift */,
4. Sources ビルドフェーズ
UNIQUE_ID_BB /* FileName.swift in Sources */,
ID 命名規則
既存ファイルの ID パターンに合わせる。例:
AAAA000011112222BBBB0006(BuildFile)AAAA000011112222CCCC0006(FileReference)
手順
- 既存の同グループファイル(例:
QuizQuestionComponents.swift)をgrepで探す - 4箇所の挿入ポイントを特定
- 既存エントリの直前/直後に新規エントリを追加
xcodebuildで確認
When to Use
- CLI(Claude Code 等)から
.swiftファイルを新規作成した時 xcodebuildで "cannot find ... in scope" エラーが出た時.xcodeprojを使用するプロジェクト(SPM-only プロジェクトでは不要)
Gotcha
.xcodeprojが.gitignoreに入っている場合、pbxproj の変更はコミットされない。Xcode で手動追加が必要xcodebuildでシミュレータ名が重複する場合はid=UUIDで指定する
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?