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

conversion-phases.md
# Conversion Phases 1–3: Source Reading, Scaffold, Frontmatter

See also: `conversion-body.md` (phase 4) · `conversion-output.md` (phases 5–7)

---

## Phase 1: Read All Source Files → `{output_folder}/1-source-context.md`

### 1.1 Read the agent

Read `{agent_file}`. Extract:

- `name` → set `{agent_name}`
- `description`, `model`, `skills:` list, `memory:`, `isolation:`
- Full body: phases, error handling, return format, ALWAYS_DO/NEVER_DO rules

### 1.2 Read the command

Read `{command_file}`. Extract:

- `name` — the `/command-name` trigger
- `description` — trigger phrases and usage examples
- `argument-hint` — what `$ARGUMENTS` the user passes
- The `Task()` call — what prompt it sends to the agent

If `{command_file}` was not provided, ask the user for it before continuing.

### 1.3 Read each skill

For each skill name in the agent's `skills:` frontmatter list:

```bash
ls ~/.claude/skills/{skill-name}/SKILL.md
ls .claude/skills/{skill-name}/SKILL.md
find ~/.claude/skills/{skill-name} -type f | sort
```

For each skill: read `SKILL.md` fully; list all files in `references/`, `examples/`, `scripts/`, `trees/`.

### 1.4 Read agent memory (if any)

```bash
ls ~/.claude/agent-memory/{agent_name}/ 2>/dev/null || ls .claude/agent-memory/{agent_name}/ 2>/dev/null
```

### 1.5 Write source context

Write `{output_folder}/1-source-context.md`:

```markdown
# Source Context

## Agent: {agent_file}

- Name: {agent_name} | Model: {model} | Skills: {skill list} | Memory: yes/no

## Command: {command_file}

- Trigger: /{command_name} | Argument-hint: {value}
- Key trigger phrases: [list from description]

## Skills

| Skill  | Location | Classification | Files  |
| ------ | -------- | -------------- | ------ |
| {name} | {path}   | context/trees  | {list} |

## Memory files

{list or "none"}
```

---

## Phase 2: Scaffold Output Directories

```bash
mkdir -p .github/agents
mkdir -p .copilot_utils/{agent_name}/context
mkdir -p .copilot_utils/{agent_name}/trees
mkdir -p {output_folder}
```

Copy skill content to correct subdirectory:

```bash
# Decision trees (if/else logic):
cp ~/.claude/skills/{skill}/SKILL.md .copilot_utils/{agent_name}/trees/{skill}.md

# Knowledge/reference:
cp ~/.claude/skills/{skill}/SKILL.md .copilot_utils/{agent_name}/context/{skill}.md

# Templates from skill references/:
cp ~/.claude/skills/{skill}/references/*template*.md .copilot_utils/{agent_name}/context/{skill}-templates.md

# Examples:
cp ~/.claude/skills/{skill}/examples/*.md .copilot_utils/{agent_name}/context/{skill}-examples.md

# Trees subdirectory in skill:
cp ~/.claude/skills/{skill}/trees/*.md .copilot_utils/{agent_name}/trees/
```

**When a skill has both types:** copy full SKILL.md to `context/`, extract decision sections to `trees/`.

**Scripts:** copy to project `scripts/` dir or keep as inline bash in the agent body.

**Large skill:** break into many small focused files in a subdirectory:

```bash
mkdir -p .copilot_utils/{agent_name}/context/{skill}
cp ~/.claude/skills/{skill}/references/*.md .copilot_utils/{agent_name}/context/{skill}/
```

---

## Phase 3: Build Agent Frontmatter → `{output_folder}/3-frontmatter.md`

```yaml
---
name: '{agent_name}'
description: '{MERGED description — see below}'
tools: ['{mapped tools — see tool-mapping.md}']
model: '{expanded model — see SKILL.md § Model Expansion}'
target: 'vscode'
argument-hint: "{from command's argument-hint}"
---
```

### Merging the description

1. Start with the agent's `description` field
2. Append "Use when someone says..." with trigger phrases from the command's `description`
3. Append the `argument-hint` context if helpful

**Example:**

```yaml
description: "Reviews a GitHub pull request end to end — triages the changed files by risk,
    checks them against the project's conventions, and posts one review report.
    Use when someone says 'review PR 123', 'review this PR', 'check my pull request',
    or pastes a GitHub PR URL."
argument-hint: 'PR number or GitHub PR URL'
```

### Tool mapping

| Claude                              | Copilot                  |
| ----------------------------------- | ------------------------ |
| Read                                | `"read"`                 |
| Write / Edit                        | `"edit"`                 |
| Bash(git:_) / Bash(gh:_) / Bash(\*) | `"execute"`              |
| Grep / Glob / ListFiles             | `"search"`               |
| TaskCreate / TaskUpdate / TaskGet   | `"todo"`                 |
| WebSearch / WebFetch                | `"web"` ⚠️ NOT `"fetch"` |
| mcp\_\_\* tools                     | list by full name as-is  |

Write the intermediate frontmatter block to `{output_folder}/3-frontmatter.md`.