← Back to list

autofix-undeclared-identifier
by hyz0906
⭐ 0🍴 0📅 Jan 19, 2026
SKILL.md
name: autofix-undeclared-identifier description: Fixes 'undeclared identifier' errors by adding missing #include or namespace qualifiers.
Undeclared Identifier Skill
Fixes errors where a symbol is used but not declared in the current scope.
Detection Patterns
use of undeclared identifier 'X''X' was not declared in this scopeerror: 'X' undeclared
Strategy
- Extract Identifier: Get the undeclared symbol name.
- Classify Symbol: Is it a standard library symbol, project symbol, or macro?
- Find Definition: Search the codebase for where this symbol is defined.
- Add Include/Import: Add the necessary #include or using statement.
Instructions
Step 1: Identify the Symbol
Parse the error message to extract the undeclared identifier.
Step 2: Check Standard Library
Common C++ standard library symbols:
| Symbol | Header | Namespace |
|---|---|---|
vector | <vector> | std:: |
string | <string> | std:: |
cout, cin, endl | <iostream> | std:: |
map, unordered_map | <map>, <unordered_map> | std:: |
unique_ptr, shared_ptr | <memory> | std:: |
thread, mutex | <thread>, <mutex> | std:: |
LOG, ALOG* | <android/log.h> | - |
Step 3: Search Project for Definition
If not a standard symbol, search the codebase:
grep -r "class X" --include="*.h"
grep -r "struct X" --include="*.h"
grep -r "#define X" --include="*.h"
Step 4: Apply Fix
Add the appropriate #include at the top of the file:
#include <vector> // For std::vector
#include "project/MyClass.h" // For project symbols
Or add namespace qualifier:
std::vector<int> items; // Instead of: vector<int> items;
Score
Total Score
50/100
Based on repository quality metrics
✓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
Reviews
💬
Reviews coming soon