npx claudepluginhub sgaunet/claude-plugins --plugin software-engineeringWant just this skill?
Then install: npx claudepluginhub u/[userId]/[slug]
Detect repository hosting service (GitHub/GitLab) from git remote and extract owner/repo/project_path. Internal utility skill used by commands that need platform-aware routing.
This skill is limited to using the following tools:
Detect Repository Host Skill
Detect the repository hosting service from git remote configuration and extract structured metadata for platform-aware command routing.
Overview
Many commands need to determine whether the current repository is hosted on GitHub or GitLab to route MCP calls correctly. This skill centralizes that detection logic so commands can invoke it via the Skill tool instead of duplicating git remote -v parsing.
When to Use
- Before calling GitHub or GitLab MCP tools that require
owner/repoorproject_path - When a command needs to branch logic based on hosting platform
- Any workflow requiring platform-aware routing
Workflow
Step 1: Read Git Remotes
git remote -v
Parse the output to find the origin remote (or the first available remote if origin is not set).
Step 2: Parse Remote URL
Support both SSH and HTTPS URL formats:
SSH formats:
git@github.com:owner/repo.git
git@gitlab.com:group/subgroup/project.git
git@gitlab.self-hosted.example.com:group/project.git
HTTPS formats:
https://github.com/owner/repo.git
https://gitlab.com/group/subgroup/project.git
https://gitlab.self-hosted.example.com/group/project.git
Parsing rules:
- Strip trailing
.gitsuffix if present - Extract hostname from URL
- Extract path segments after hostname
Step 3: Detect Platform
| Hostname Pattern | Platform |
|---|---|
github.com | GitHub |
gitlab.com | GitLab |
| Other hostnames | Assume GitLab (self-hosted instances are common) |
Step 4: Extract Metadata
For GitHub (github.com):
owner: First path segment (user or organization)repo: Second path segment (repository name)project_path:owner/repo
For GitLab (gitlab.com or self-hosted):
project_path: Full path after hostname (supports nested groups, e.g.,group/subgroup/project)owner: First path segment (top-level group)repo: Last path segment (project name)
Output
Return the following structured information:
| Field | Description | Example (GitHub) | Example (GitLab) |
|---|---|---|---|
platform | Hosting service | github | gitlab |
owner | User/org/group | sgaunet | myorg |
repo | Repository name | claude-plugins | myproject |
project_path | Full path | sgaunet/claude-plugins | myorg/team/myproject |
remote_url | Raw remote URL | git@github.com:sgaunet/claude-plugins.git | https://gitlab.com/myorg/team/myproject.git |
Error Handling
| Condition | Action |
|---|---|
| Not a git repository | Abort: "Not a git repository. Initialize with git init first." |
| No remotes configured | Abort: "No git remotes found. Add a remote with git remote add origin <url>." |
No origin remote | Fall back to first available remote, warn user |
| URL format unrecognized | Abort: "Could not parse remote URL: <url>. Expected GitHub or GitLab format." |
Examples
GitHub SSH
$ git remote -v
origin git@github.com:sgaunet/claude-plugins.git (fetch)
→ platform: github
→ owner: sgaunet
→ repo: claude-plugins
→ project_path: sgaunet/claude-plugins
→ remote_url: git@github.com:sgaunet/claude-plugins.git
GitLab HTTPS with Subgroups
$ git remote -v
origin https://gitlab.com/myorg/backend/api-service.git (fetch)
→ platform: gitlab
→ owner: myorg
→ repo: api-service
→ project_path: myorg/backend/api-service
→ remote_url: https://gitlab.com/myorg/backend/api-service.git
Self-Hosted GitLab
$ git remote -v
origin git@gitlab.company.internal:devteam/infra.git (fetch)
→ platform: gitlab
→ owner: devteam
→ repo: infra
→ project_path: devteam/infra
→ remote_url: git@gitlab.company.internal:devteam/infra.git
Similar Skills
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.