Resolve the correct repository for a task — detect VCS platform, match ticket to repo, clone if missing. Run this in a sub-agent to avoid filling main context.
62
72%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Advisory
Suggest reviewing before use
Optimize this skill with Tessl
npx tessl skill review --optimize ./skills/resolve-repo/SKILL.mdYou are resolving which repository a task should be worked on. This skill handles VCS platform detection, scoped repo discovery, and cloning when needed.
IMPORTANT: This skill is designed to run inside a sub-agent (via the Agent tool) to keep the main session context clean. Return a concise result — do NOT explore repo contents or read large files.
This skill must stay lightweight:
package.json name/description fields, and git remote URLs as local signalsYou will receive these as context when invoked:
WORKSPACE_DIR — the parent directory containing multiple repos (e.g., ~/dev/aircall)TICKET_TITLE — the Jira/Linear/GitHub issue titleTICKET_DESCRIPTION — the issue description or acceptance criteria (keep only first ~200 chars for matching)TICKET_LABELS — labels/components from the ticket (if any)TICKET_ID — the ticket ID (e.g., MES-3716)Scan WORKSPACE_DIR for git repos — collect only lightweight metadata:
for dir in "$WORKSPACE_DIR"/*/; do
if [ -d "$dir/.git" ] || git -C "$dir" rev-parse --git-dir &>/dev/null; then
NAME=$(basename "$dir")
REMOTE=$(git -C "$dir" remote get-url origin 2>/dev/null)
PKG_NAME=$(jq -r '.name // empty' "$dir/package.json" 2>/dev/null)
PKG_DESC=$(jq -r '.description // empty' "$dir/package.json" 2>/dev/null)
echo "$NAME|$PKG_NAME|$PKG_DESC|$REMOTE"
fi
doneFrom the remote URLs, extract:
github.com → github, gitlab.com or gitlab. → gitlab, etc.git@gitlab.com:aircall/messaging/repo.git → aircall/messaginghttps://github.com/aircall-org/repo.git → aircall-orgaircall/messaging as a prefix, scope to that — not to aircall (which could have thousands of repos).If no local repos exist, ask the user for the platform and group.
Always try local repos before going remote. Score each local repo against the ticket:
MES in MES-3716 → match against repo names containing "mes" or "messaging" (case-insensitive)package.json description. Ignore stop words.If a local repo scores HIGH (clear winner) → skip remote lookup entirely and return it. Done.
If ambiguous or no confident match → proceed to step 3.
Only reach this step if no local repo matched confidently.
Fetch repos only from the same group/subgroup as the local repos — never the whole company org:
# Scoped to the specific group — NOT the top-level org
glab api "groups/<url-encoded-group>/projects?per_page=50&simple=true&order_by=name" 2>/dev/null \
| jq -r '.[] | "\(.path)|\(.description // "")"'# Scoped to the org derived from local repos
gh repo list "<org>" --limit 50 --json name,description --jq '.[] | "\(.name)|\(.description // "")"'Key constraints:
Merge local and remote lists. For repos that exist both locally and remotely, prefer the local entry.
Score using the same signals from step 2. Present a concise ranked list:
## Repo Match Results
### Local (no cloning needed)
1. **messaging** — HIGH: prefix "MES", keyword "messaging" [LOCAL]
2. **internal-api** — LOW: keyword "api" [LOCAL]
### Remote (would need cloning)
3. **messaging-webhooks** — MEDIUM: keyword "messaging", "webhook" [REMOTE]If top match is LOCAL → return it directly.
If top match is REMOTE → confirm with the user before cloning:
<WORKSPACE_DIR>/<repo-name>?"git clone <remote-url> (construct URL from platform + group + repo name)cd "$WORKSPACE_DIR/<repo>"
[ -f "package.json" ] && echo "Run: npm install / yarn"
[ -f "Makefile" ] && echo "Run: make install"
[ -f ".env.example" ] && echo "Copy .env.example → .env"If ambiguous → return top 3 candidates and let the caller ask the user.
If no match → ask the user which repo, or if they need a different group/subgroup.
## Resolved Repository
**Repo:** <repo-name>
**Path:** <full-path>
**VCS Platform:** <github | gitlab | bitbucket | azure | unknown>
**VCS Group:** <group/subgroup used for scoping>
**Remote:** <remote-url>
**Cloned:** <yes (just now) | no (already existed)>
**Setup needed:** <list if just cloned, or "none">glab/gh is not installed, provide install instructions and a manual clone URL.$ARGUMENTS
b0b1bb6
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.