Find Plugin File
Agent Buildingfind-plugin-fileFind Plugin File is an Agent Skill for agent building published in the closedloop-ai/claude-plugins repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
This skill should be used when needing to locate files within the Claude Code plugins cache directory (~/.claude/plugins/cache). Triggers include finding tool scripts, skill files, or any plugin resource when the hardcoded path is unknown or varies by plugin version. Use when slash commands or orchestrators need to dynamically resolve plugin file paths.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/closedloop-ai/claude-plugins/blob/HEAD/plugins/code/skills/find-plugin-file/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/find-plugin-file, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Find Plugin File
Overview
This skill provides a utility to dynamically locate files within the Claude Code plugins cache directory. Instead of hardcoding plugin-cache paths, use this skill to find files in ~/.claude/plugins/cache/closedloop-ai/ with automatic latest-version resolution.
Quick Start
To find a file in the plugins cache, run the find_plugin_file.py script:
python3 scripts/find_plugin_file.py <file_pattern>
Usage Examples
Find by filename
# Find parse_args.py in any plugin (returns first match)
python3 scripts/find_plugin_file.py parse_args.py
# Find all SKILL.md files across all plugins
python3 scripts/find_plugin_file.py SKILL.md --all
Find by path pattern
# Find a specific file using path pattern
python3 scripts/find_plugin_file.py plan/parse_args.py
# Find tools in a specific subdirectory
python3 scripts/find_plugin_file.py tools/python/plan/parse_args.py
Restrict to specific plugin
# Search only in code plugin
python3 scripts/find_plugin_file.py parse_args.py --plugin code
List available plugins
python3 scripts/find_plugin_file.py --list-plugins
Integration with Slash Commands
To use in a slash command that needs to reference plugin tools, use a two-step approach:
# Step 1: Locate the find_plugin_file.py script (handles multiple plugin versions)
FIND_SCRIPT=`ls ~/.claude/plugins/cache/closedloop-ai/code/*/skills/find-plugin-file/scripts/find_plugin_file.py 2>/dev/null | sort -V | tail -1`
# Step 2: Use the script to find the target file, then derive TOOLS_PATH
TARGET_FILE=`python3 "$FIND_SCRIPT" plan/parse_args.py`
TOOLS_PATH=`dirname \`dirname "$TARGET_FILE"\``
# Step 3: Run with correct PYTHONPATH
PYTHONPATH="$TOOLS_PATH:$PYTHONPATH" python3 "$TARGET_FILE" --help
Important:
- Use backticks (
`) instead of$()for command substitution — Claude Code's Bash tool escapes$()syntax. - The glob pattern
code/*/skills/...can match multiple version directories. Always usels ... | sort -V | tail -1to select the latest version.
Script Arguments
| Argument | Description |
|---|---|
file_pattern | File name or path pattern to find |
--plugin, -p | Restrict search to a specific plugin |
--all, -a | Return all matches instead of just the first |
--list-plugins, -l | List available plugins and their latest versions |
--cache-dir | Override the default cache directory |
Version Resolution
The script automatically selects the latest version of each plugin using semantic versioning comparison. For example, if a plugin has versions 1.6.0, 1.9.1, and 1.10.0, it will search in 1.10.0.
Resources
scripts/
find_plugin_file.py- Main utility script for locating files in the plugins cache