agentleFS
hugobatistahugobatista/agent-skills/skills/forge/forge-detect/SKILL.md

forge-detect

Skill1 starsChanged 54 days agoMITView on GitHub

Detect the forge type from the current repo's git remote. Sets $FORGE_CLI, $FORGE_TYPE, and $FORGE_HOST. Provides per-forge command templates for PR and issue operations.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run git remote get-url origin and parse the host:

    line 23
  2. Very specific:

    If $FORGE_TYPE == "forgejo", load forgejo-pr and forgejo-issue now.

    line 36
  3. Very specific:

    If $FORGE_TYPE == "github" or "gitlab", no extra skills needed.

    line 40
  4. Very specific:

    All operations below use $ID for the PR/issue number and <path> for file arguments.

    line 45
  5. Very specific:

    If the repo requires a template, add --template <key> or --no-template (run fj issue templates --remote origin first to list templates).

    line 89
  6. Very specific:

    Before creating an issue, read the repo's templates and use their conventions.

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Forge Detect

Load this skill at the start of any workflow that needs to interact with pull requests or issues on GitHub, Forgejo, or GitLab.

Setup

  • The repo must have a remote named origin
  • The forge CLI must be installed and authenticated (gh for GitHub, fj for Forgejo, glab for GitLab)

Detection

Run git remote get-url origin and parse the host:

Remote host$FORGE_TYPE$FORGE_CLI
github.comgithubgh
codeberg.orgforgejofj
gitlab.com or *.gitlab.*gitlabglab
Otherunsupported — abort—

Also set $FORGE_HOST to the detected hostname.

Load forge-specific skills

If $FORGE_TYPE == "forgejo", load forgejo-pr and forgejo-issue now. They are the authoritative reference for all fj subcommands, flags, and patterns.

If $FORGE_TYPE == "github" or "gitlab", no extra skills needed. Refer to gh or glab CLI documentation for detailed usage.

Command templates

All operations below use $ID for the PR/issue number and <path> for file arguments.

PR view (title, body, metadata)

$FORGE_TYPECommand
githubgh pr view $ID --json title,body,changedFiles,headRefName,baseRefName,additions,deletions
forgejofj pr view $ID
gitlabglab mr view $ID

PR diff

$FORGE_TYPECommand
githubgh pr diff $ID
forgejofj pr view $ID diff
gitlabglab mr diff $ID

PR files

$FORGE_TYPECommand
githubgh pr view $ID --json files --jq '.files[].path'
forgejofj pr view $ID files
gitlabglab mr view $ID --json files --jq '.files[].path'

PR comment

$FORGE_TYPECommand
githubgh pr comment $ID --body-file <path>
forgejofj pr comment $ID --body-file <path>
gitlabglab mr note $ID --message "$(cat <path>)"

Issue create

$FORGE_TYPECommand
githubgh issue create --title "<title>" --body-file <path>
forgejofj issue create --remote origin "<title>" --body-file <path>
gitlabglab issue create --title "<title>" --description "$(cat <path>)"

For Forgejo, the title is a positional argument (not a --title flag). If the repo requires a template, add --template <key> or --no-template (run fj issue templates --remote origin first to list templates).

Issue template conventions

Before creating an issue, read the repo's templates and use their conventions. For each template, parse the YAML front-matter (title: prefix, labels:, about:/name:) and the ## body headings. Pick the template whose description best matches the issue type, use its title: prefix and labels, and fill its ## sections. For types without a matching template, reuse the nearest one and override the prefix/label.

Issue edit labels

$FORGE_TYPECommand
githubgh issue edit $ID --add-label <label>
forgejofj issue edit $ID labels --add <label> --remote origin
gitlabNot supported — skip label management by glab

Issue search by labels

$FORGE_TYPECommand
githubgh issue list --state open --label <label> --json number,title
forgejofj issue search --remote origin --labels <label> --state open
gitlabglab issue list --state opened --label <label>

Issue close

$FORGE_TYPECommand
githubgh issue close $ID
forgejofj issue close $ID --remote origin
gitlabglab issue close $ID

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.