Analyze a GitHub repository and apply relevant topic labels under repository details. Use when user says /repo-topics, 'add topics', 'add labels to repo', 'tag the repo', or asks to set GitHub repository topics.
Analyze a GitHub repository's content, tech stack, and purpose, then apply relevant topic labels via the GitHub API.
gh CLI authenticated with repo access/repo-topics [owner/repo]
owner/repo is provided, use that.gh repo view --json nameWithOwner -q .nameWithOwnerREPO="${1:-$(gh repo view --json nameWithOwner -q .nameWithOwner)}"
If detection fails, ask the user for the repository.
gh api repos/$REPO/topics -q '.names[]'
Report current topics (if any) to the user.
Gather signals to determine relevant topics:
gh api repos/$REPO/languages -q 'keys[]'gh repo view $REPO --json description -q .descriptionCargo.toml → rustpackage.json → nodejs, javascript or typescriptpyproject.toml / setup.py / requirements.txt → pythongo.mod → golangDockerfile / docker-compose.yml → dockerkubernetes/ / k8s/ / helm/ → kubernetes.github/workflows/ → github-actions, ci-cdterraform/ / *.tf → terraform, infrastructure-as-codeSKILL.md / skills directory → ai-agents, skillsyarli.toml → orchestrationcli.py, main.rs, bin/) → cli-toolsmachine-learningapiweb, framework namedatabasesecuritytestingautomationdevopsai, llm, relevant termsCombine signals into a deduplicated, sorted list of topic slugs. Topics must:
code or project)Present the proposed topics to the user as a table:
Current topics: (none)
Proposed topics (14):
ai-agents, automation, cli-tools, claude-code, developer-tools,
devops, git-hooks, multi-agent, openai-codex, prompt-engineering,
python, shell-scripts, skills, workflow-automation
New: 14 topics to add
Kept: 0 existing topics preserved
Removed: 0 existing topics dropped
Ask the user to approve, edit, or cancel. Do NOT apply without confirmation.
gh api repos/$REPO/topics -X PUT \
-f "names[]=topic-1" \
-f "names[]=topic-2" \
...
Report the final applied topics.