Cpp-Language-Service-Tools
Cpp-Language-Service-Tools是一款code方向的AI技能,核心价值是You are an expert at using C++ language service tools (GetSymbolReferences_CppTools, GetSymbolInfo_CppTools, GetSymbolCallHierarchy_CppTools),可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
You are an expert at using C++ language service tools (GetSymbolReferences_CppTools, GetSymbolInfo_CppTools, GetSymbolCallHierarchy_CppTools). Instructions for calling C++ Tools for Copilot. When work
mkdir -p ./skills/cpp-language-service-tools && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/cpp-language-service-tools/SKILL.md -o ./skills/cpp-language-service-tools/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
Available C++ Tools
You have access to three specialized C++ tools:
1. **`GetSymbolInfo_CppTools`** - Find symbol definitions and get type details
2. **`GetSymbolReferences_CppTools`** - Find ALL references to a symbol
3. **`GetSymbolCallHierarchy_CppTools`** - Analyze function call relationships
---
Mandatory Tool Usage Rules
Rule 1: ALWAYS Use GetSymbolReferences_CppTools for Symbol Usages
**NEVER** rely on manual code inspection, `vscode_listCodeUsages`, `grep_search`, or `read_file` to find where a symbol is used.
**ALWAYS** call `GetSymbolReferences_CppTools` when:
- Renaming any symbol (function, variable, class, method, etc.)
- Changing function signatures
- Refactoring code
- Understanding symbol impact
- Finding all call sites
- Identifying usage patterns
- Any task involving "find all uses/usages/references/calls"
**Why**: `GetSymbolReferences_CppTools` uses C++ IntelliSense and understands:
- Overloaded functions
- Template instantiations
- Qualified vs unqualified names
- Member function calls
- Inherited member usage
- Preprocessor-conditional code
Text search tools will miss these or produce false positives.
Rule 2: ALWAYS Use GetSymbolCallHierarchy_CppTools for Function Changes
Before modifying any function signature, **ALWAYS** call `GetSymbolCallHierarchy_CppTools` with `callsFrom=false` to find all callers.
**Examples**:
- Adding/removing function parameters
- Changing parameter types
- Changing return types
- Making functions virtual
- Converting to template functions
**Why**: This ensures you update ALL call sites, not just the ones you can see.
Rule 3: ALWAYS Use GetSymbolInfo_CppTools to Understand Symbols
Before working with unfamiliar code, **ALWAYS** call `GetSymbolInfo_CppTools` to:
- Find where a symbol is defined
- Understand class/struct memory layout
- Get type information
- Locate declarations
**NEVER** assume you know what a symbol is without checking.
---
Parameter Usage Guidelines
Symbol Names
- **ALWAYS REQUIRED**: Provide the symbol name
- Can be unqualified (`MyFunction`), partially qualified (`MyClass::MyMethod`), or fully qualified (`MyNamespace::MyClass::MyMethod`)
- If you have a line number, the symbol should match what appears on that line
File Paths
- **STRONGLY PREFERRED**: Always provide absolute file paths when available
- ✅ Good: `C:\Users\Project\src\main.cpp`
- ❌ Avoid: `src\main.cpp` (requires resolution, may fail)
- If you have access to a file path, include it
- If working with user-specified files, use their exact path
Line Numbers
- **CRITICAL**: Line numbers are 1-based, NOT 0-based
- **MANDATORY WORKFLOW** when you need a line number:
1. First call `read_file` to search for the symbol
2. Locate the symbol in the output
3. Note the EXACT line number from the output
4. VERIFY the line contains the symbol
5. Only then call the C++ tool with that line number
- **NEVER** guess or estimate line numbers
- If you don't have a line number, omit it - the tools will find the symbol
Minimal Information Strategy
Start with minimal information and add more only if needed:
1. **First attempt**: Symbol name only
2. **If ambiguous**: Symbol name + file path
3. **If still ambiguous**: Symbol name + file path + line number (after using `read_file`)
---
Common Workflows
Renaming a Symbol
CORRECT workflow:
1. Call GetSymbolReferences_CppTools with symbol name (and file path if available)
2. Review ALL references returned
3. Update symbol at definition location
4. Update symbol at ALL reference locations
INCORRECT workflow:
❌ Using vscode_listCodeUsages or grep_search to find usages
❌ Manually inspecting a few files
❌ Assuming you know all the usagesChanging a Function Signature
CORRECT workflow:
1. Call GetSymbolInfo_CppTools to locate the function definition
2. Call GetSymbolCallHierarchy_CppTools with callsFrom=false to find all callers
3. Call GetSymbolReferences_CppTools to ca🎯 Best For
- Claude users
- GitHub Copilot users
- Software engineers
- Development teams
- Tech leads
💡 Use Cases
- Code quality improvement
- Best practice enforcement
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply Cpp-Language-Service-Tools to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Is Cpp-Language-Service-Tools compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for Cpp-Language-Service-Tools?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install Cpp-Language-Service-Tools?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/cpp-language-service-tools/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.