Loading...
Loading...
This skill provides guidance for creating agents and applications with the GitHub Copilot SDK. It should be used when the user wants to create, modify, or work on software that uses the GitHub Copilot SDK in TypeScript, Python, Go, or .NET. The skill covers SDK usage patterns, CLI configuration, custom tools, MCP servers, and custom agents.
npx skill4agent add doggy8088/agent-skills copilot-sdkcopilot --version| Language | Command |
|---|---|
| TypeScript/Node.js | |
| Python | |
| Go | |
| .NET | |
Application → SDK Client → JSON-RPC → Copilot CLI (server mode)cliUrlcli_urlimport { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
await client.start();
const session = await client.createSession({ model: "gpt-5" });
// Register handler BEFORE send()
session.on((event) => {
if (event.type === "assistant.message") {
console.log(event.data.content);
}
});
await session.send({ prompt: "What is 2 + 2?" });
await session.destroy();
await client.stop();send()references/working-examples.mdstart()stop()createSession()resumeSession()cliPathcliUrlportuseStdioautoStartautoRestartsend()sendAndWait()on()abort()getMessages()destroy()modelstreamingtoolssystemMessage| Event | Purpose |
|---|---|
| Complete response |
| Streaming chunk |
| Ready for next prompt |
| Tool invocations |
references/event-system.mdstreaming: falsestreaming: trueassistant.message_deltaassistant.message| Provider | Model ID | Notes |
|---|---|---|
| OpenAI | | Included |
| OpenAI | | Premium |
| Anthropic | | Premium (CLI default) |
| Anthropic | | Premium (3× multiplier) |
| Premium |
const tool = defineTool("lookup_issue", {
description: "Fetch issue details",
parameters: z.object({ id: z.string() }),
handler: async ({ id }) => fetchIssue(id),
});@define_tool(description="Fetch issue details")
async def lookup_issue(params: IssueParams) -> dict:
return fetch_issue(params.id)references/working-examples.md| Concept | TypeScript | Python | Go | .NET |
|---|---|---|---|---|
| Create session | | | | |
| Delta content | | | | |
references/event-system.md~/.copilot/config.jsonmcp-config.jsonreferences/cli-agents-mcp.md| Problem | Solution |
|---|---|
| Events fire but content empty | Use |
| Handler never fires | Register before |
| Python enum issues | Use |
| Go nil pointer | Check |
references/troubleshooting.mdreferences/working-examples.mdreferences/event-system.mdreferences/troubleshooting.mdreferences/cli-agents-mcp.md