metadata
name: github-example-search
description: >-
Find working example files in GitHub repositories using path heuristics and
GitHub file search, then read the best candidates.
disable-model-invocation: false
GitHub Example Search
Purpose
Replicate the useful part of ML Intern's GitHub example discovery: find example scripts, tutorials, notebooks, and guides in a target repo, then read the best matches before implementing code.
This skill is intentionally path-first. It is not a semantic code search engine.
Tools
Use the GitHub plugin tools:
search_repositoriesorsearch_installed_repositories_v2to identify the repo if the user did not name it.searchto search files within the target repository.fetch_fileto read the candidate file contents.search_branchesonly if you need to confirm branch names.
Search Strategy
Use prioritized file-path patterns, roughly in this order:
scriptsexamples,examplenotebooks,notebooktutorials,tutorial,quickstart,walkthrough,walkthroughscookbook,recipe,recipesdemos,demo,samples,sampleguides,guide,getting-started,getting_startedplayground,howto,how-touse-cases,usecases,use_casessandbox,showcase
Workflow
- Resolve the repository first.
- If the repository is ambiguous, search repositories by name or organization until you have a strong candidate.
- Search the repo with the highest-priority path patterns first.
- If the user gave a keyword, combine it with the pattern queries.
- Prefer files under
examples/orexample/when there is a tie. - Prefer
scripts/over other example-like directories. - Prefer shallower paths when multiple matches are similar.
- Read the top candidate files with
fetch_file, using line ranges for large files. - Use the exact file path from the search result to continue the investigation.
Practical Query Plan
When looking for a specific method or trainer, search in this order:
<keyword> scripts<keyword> examples<keyword> tutorial<keyword> notebook<keyword> guide
When no keyword is given, search for the directories themselves:
scriptsexamplesexamplenotebookstutorials
Reading Pattern
After finding a candidate file:
- Read the file header and argument parsing.
- Read the model, dataset, and trainer setup.
- Read the training loop or main execution path.
- If the file is long, fetch only the relevant line range.
Output Expectations
Return:
- the best candidate file path
- why it was selected
- the repository it came from
- the exact line range to read next if the file is large
Example
_search(query="grpo scripts", repository_name="huggingface/trl", topn=10)
_fetch_file(repository_full_name="huggingface/trl", ref="main", path="examples/scripts/grpo.py", encoding="utf-8")
Notes
- This is the closest Codex-native replacement for ML Intern's
github_find_examples. - It relies on GitHub repo/file search plus the same path-priority intuition as the upstream tool.
- Once you have a candidate, always read the actual file before implementing.