Remove unused includes

From chromium/chromium · View interactive version

Remove unused includes is an AI agent skill from the GitHub repository chromium/chromium. Look through a given folder to find and safely remove unused includes specifically for Clang-compiled code (using clang-include-cleaner), verifying that referencing targets compile.

How to use this skill

Skill file

🧹 Remove Unused Includes Skill

This skill provides a workflow and script to look through a given folder,

identify unused includes using clang-include-cleaner, and safely remove them

only if the affected targets continue to compile successfully.

Prerequisites

  1. Compilation Database (compile_commands.json): Ensure your compilation

database is up-to-date. If not, generate a fresh compilation database using:

```bash

python3 tools/clang/scripts/generate_compdb.py -p out/Default -o compile_commands.json

```

Workflow Steps

1. Run the Cleanup Script

Run the automated cleanup script located inside this skill's directory (resolve

the absolute <skill_directory_path> from the skill metadata):

python3 <skill_directory_path>/scripts/remove_unused_includes.py --src-root . --folder <relative_or_absolute_folder_path>

2. Verify Compilation

The script automatically:

3. Review Git Status

Once execution is complete, verify the final changes using git:

git status
git diff
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.