Back to Brain Lab Skill · Convert to Copilot · convert-to-copilot/
Skill Claude

Convert to Copilot

convert-to-copilot/

4 views 0 downloads

Port a Claude Code agent, with its command and skills, to one GitHub Copilot agent. Maps tools, models and sub-agent calls, validates the result and ships scripts for both directions.

Convert to Copilot: Brain Lab skill for Claude Code

Port a Claude Code agent, with its command and skills, to one GitHub Copilot agent that works the same way.

Why use it

  • Your team uses both Claude Code and GitHub Copilot, and every agent has to be written twice.
  • Copilot has no skills or commands: a straight copy loses the knowledge and the triggers the agent depends on.
  • Hand-ported agents drift, wrong tool aliases (fetch instead of web), dead file paths, task tracking that fails silently.

What it does

  • Merges the agent + its launch command into one .github/agents/{name}.agent.md, with the command's trigger phrases in the description.
  • Splits every skill into .copilot_utils/{name}/context/ (what to use) and trees/ (how to decide), and rewrites each skill reference to a file path.
  • Maps tools, models and frontmatter: WebFetch → web, TaskCreate → manage_todo_list, opus → Claude Opus 4.5, drops color / memory / isolation / skills / allowed-tools.
  • Converts sub-agent calls to handoffs (VS Code) or runSubagent() (GitHub Copilot).
  • Validates the result, every referenced path exists, aliases are correct, body under 30,000 characters, and prints a conversion report.
  • Ships scaffold scripts for both directions (claude-to-copilot, copilot-to-claude) and a full worked example.

Benefits

  • Write the agent once. Claude Code stays the source; Copilot gets a faithful port.
  • No lost knowledge. Skills become referenced context files, not a pasted wall of text.
  • Correct on the first run. The tool and model tables catch the aliases that break Copilot agents.
  • Reviewable. Each phase writes its output to .copilot-convert-results/, so you can see every decision.

Install

Download this skill and copy the convert-to-copilot folder to .claude/skills/convert-to-copilot/ in your project, or to ~/.claude/skills/convert-to-copilot/ to use it in every project. Claude Code finds it on its own; you can also call it with /convert-to-copilot.

Part of the Agent Engineering bundle. To get the whole set as a Claude Code plugin: /plugin marketplace add endorphin-ai/hasbrains-agent-kit, then /plugin install agent-engineering@hasbrains-agent-kit.

Source: endorphin-ai/hasbrains-agent-kit. License: MIT.

Files (17)

Files

#!/usr/bin/env bash
# lib-extract.sh — shared helpers for convert-agents.sh
# Source this file before calling any conversion function.

G='\033[0;32m'; Y='\033[0;33m'; B='\033[0;34m'; R='\033[0;31m'; NC='\033[0m'

norm() {
  echo "$1" | tr '[:upper:]' '[:lower:]' | tr ' _' '-' | sed 's/[^a-z0-9._-]//g'
}

# extract_fm <file> <key> — read a scalar value from YAML frontmatter
extract_fm() {
  sed -n '/^---$/,/^---$/p' "$1" \
    | grep "^${2}:" | head -1 \
    | sed "s/^${2}:[[:space:]]*//" | tr -d '"' | tr -d "'"
}

# extract_skills <file> — print one skill name per line from skills: list
extract_skills() {
  local in_skills=false
  while IFS= read -r line; do
    if [[ "$line" =~ ^skills: ]]; then in_skills=true; continue; fi
    if $in_skills; then
      if [[ "$line" =~ ^[[:space:]]*-[[:space:]]+(.*) ]]; then
        echo "${BASH_REMATCH[1]}" | tr -d '"' | tr -d "'" | xargs
      else
        break
      fi
    fi
  done < "$1"
}

# map_model_to_copilot <alias> — expand Claude alias to full Copilot model name
map_model_to_copilot() {
  local m; m=$(echo "$1" | tr '[:upper:]' '[:lower:]')
  case "$m" in
    *opus*)   echo "Claude Opus 4.5" ;;
    *sonnet*) echo "Claude Sonnet 4.5" ;;
    *haiku*)  echo "Claude Haiku 4.5" ;;
    *)        echo "" ;;  # omit — let Copilot choose
  esac
}

# classify_skill <file> — returns "trees" or "context"
classify_skill() {
  if grep -qiE 'decision.tree|classification|diagnosis|if.*then|when.*see|category.*map' "$1" 2>/dev/null; then
    echo "trees"
  else
    echo "context"
  fi
}

# short_name <agent-name> — derive command short name (last two words reversed)
# pr-code-reviewer → reviewer-code
short_name() {
  local parts=()
  IFS='-' read -ra parts <<< "$1"
  local n=${#parts[@]}
  if [[ $n -ge 2 ]]; then
    echo "${parts[$((n-1))]}-${parts[$((n-2))]}"
  else
    echo "$1"
  fi
}