Token导航 LogoToken导航

Agent Skill · 研究检索

build-copilot-sdk-app(构建 GitHub Copilot SDK 应用)

build-copilot-sdk-app 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

build-copilot-sdk-app 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 51,212。

总安装 588周安装 24GitHub Stars 5下载 188核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:build-copilot-sdk-app(构建 GitHub Copilot SDK 应用)
来源仓库:https://github.com/yigitkonur/skills-by-yigitkonur
仓库路径:skills/build-copilot-sdk-app
安装命令:
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-copilot-sdk-app
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-copilot-sdk-app

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

build-copilot-sdk-app 用于构建基于 GitHub Copilot SDK 的应用程序,支持会话管理和自定义工具注册。它通过 JSON-RPC 与 Copilot CLI 通信,提供流式响应处理和权限控制机制。

使用时需初始化项目、设置传输协议(stdio 或 TCP),并定义 prompt 与工具映射关系。安装前请确认仓库权限、维护状态,以及是否会暴露网络接口或处理用户输入流。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/build-copilot-sdk-app

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

build-copilot-sdk-app 怎么安装?

在终端执行 npx skills add https://github.com/yigitkonur/skills-by-yigitkonur --skill build-copilot-sd…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

build-copilot-sdk-app 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

build-copilot-sdk-app 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

build-copilot-sdk-app 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

build-copilot-sdk-app 用的人多吗?

公开数据是累计安装 588 次,近一周安装 24 次,下载 188 次,GitHub 5 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

build-copilot-sdk-app 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
build-copilot-sdk-app

构建 GitHub Copilot SDK 应用 · 本页

5885操作浏览器未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Build Copilot SDK App

Build applications powered by GitHub Copilot using the @github/copilot-sdk TypeScript/Node.js package (protocol v3). The SDK communicates with the Copilot CLI over JSON-RPC (stdio or TCP) and exposes a session-based API for sending prompts, receiving streamed responses, registering custom tools, handling permissions, and managing agent workflows.

Decision tree

What do you need?
│
├── New app from scratch
│   ├── Install & basic example ──────────► Quick start (below) — npm init, ESM setup, first prompt
│   ├── Client options & transport ───────► references/client-and-transport.md — stdio vs TCP, CopilotClient config
│   └── Authentication ──────────────────► references/auth-and-byok.md — OAuth, tokens, BYOK with 5 providers
│
├── Sessions
│   ├── Create / resume / disconnect ────► references/sessions.md — lifecycle, create-or-resume pattern
│   ├── Infinite sessions & compaction ──► references/sessions.md — long conversations, context window mgmt
│   └── Persistence & resumption ────────► references/sessions.md — disk persistence, resumeSession semantics
│
├── Messages & streaming
│   ├── send / sendAndWait ──────────────► Quick start (below) — blocking vs fire-and-forget
│   ├── Streaming deltas ────────────────► references/events-and-streaming.md — incremental content delivery
│   └── All 47 event types ─────────────► references/events-and-streaming.md — full event catalog
│
├── Custom tools
│   ├── defineTool with Zod ─────────────► references/tools-and-schemas.md — Zod schema, handler, auto-JSON-Schema
│   ├── JSON Schema tools ──────────────► references/tools-and-schemas.md — raw schema without Zod
│   └── Override built-in tools ────────► references/tools-and-schemas.md — replace default Copilot tools
│
├── Permissions & user input
│   ├── Permission handler ─────────────► references/permissions-and-user-input.md — approveAll or custom logic
│   ├── ask_user / onUserInputRequest ──► references/permissions-and-user-input.md — programmatic user prompts
│   └── Elicitation (MCP forms) ────────► references/permissions-and-user-input.md — structured input via MCP
│
├── Hooks (lifecycle interceptors)
│   ├── Pre/post tool use ──────────────► references/hooks.md — intercept tool calls, modify args/results
│   ├── Prompt modification ────────────► references/hooks.md — rewrite prompts before send
│   └── Session lifecycle & errors ─────► references/hooks.md — onError, onSessionStart, void return OK
│
├── Agents, MCP & skills
│   ├── Custom agents ──────────────────► references/agents-mcp-skills.md — agent registration & routing
│   ├── MCP server config ─────────────► references/agents-mcp-skills.md — connect external MCP servers
│   ├── Skills system ─────────────────► references/agents-mcp-skills.md — skill discovery & invocation
│   └── CLI extensions (.mjs) ─────────► references/agents-mcp-skills.md — extend Copilot CLI via scripts
│
├── Advanced patterns
│   ├── Plan / autopilot / interactive ─► references/advanced-patterns.md — mode switching workflow
│   ├── Fleet mode ─────────────────────► references/advanced-patterns.md — parallel session orchestration
│   ├── Multi-client architecture ──────► references/advanced-patterns.md — multiple CopilotClient instances
│   ├── Ralph loop (autonomous dev) ───► references/advanced-patterns.md — autonomous code generation loop
│   ├── Steering & queueing ───────────► references/advanced-patterns.md — prompt queueing, backpressure
│   └── System message modes ──────────► references/advanced-patterns.md — system prompt configuration
│
├── Auth & BYOK
│   ├── GitHub OAuth / tokens ──────────► references/auth-and-byok.md — token acquisition flow
│   └── Bring Your Own Key ────────────► references/auth-and-byok.md — OpenAI/Anthropic/Azure/Gemini/Ollama
│
└── Type reference
    └── All interfaces & RPC methods ──► references/types-reference.md — TypeScript interfaces, RPC API

Quick start

Prerequisites

Verify your environment:

node --version   # must be >= 20
copilot --version # Copilot CLI must be installed

Authenticate before you run the examples:

  • Local interactive auth: copilot login
  • Headless auth: set one of COPILOT_GITHUB_TOKEN, GH_TOKEN, or GITHUB_TOKEN
  • In CI or other non-interactive runs, export the token before npm start; do not expect the SDK process to complete browser login for you.

Default file layout and run command

Use this layout unless the repo already has a better convention:

mkdir -p src/lib
npm pkg set scripts.start="tsx src/index.ts"
npm pkg set scripts.dev="tsx watch src/index.ts"
  • Put the main SDK entrypoint in src/index.ts
  • Put reusable local business logic in src/lib/*.ts
  • Run the first build with npm start

Project setup

npm init -y
npm pkg set type=module   # SDK is ESM-only
npm install @github/copilot-sdk tsx zod
ESM required. The SDK only ships ESM exports. Your package.json must have "type": "module".

Common imports

// Core
import { CopilotClient, approveAll } from "@github/copilot-sdk";

// Tools
import { defineTool } from "@github/copilot-sdk";
import { z } from "zod";

// Advanced — hooks, resume, types
import type { SessionConfig, ToolInvocation } from "@github/copilot-sdk";

Minimal example

import { CopilotClient, approveAll } from "@github/copilot-sdk";

const client = new CopilotClient();
const auth = await client.getAuthStatus();

if (!auth.isAuthenticated) {
  throw new Error(
    "Authenticate with `copilot login` or set COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN first."
  );
}

const session = await client.createSession({
  model: "gpt-4.1",
  onPermissionRequest: approveAll,
});

const response = await session.sendAndWait({ prompt: "What is 2 + 2?" });
console.log(response?.data.content);

await session.disconnect();
await client.stop();

Save this as src/index.ts, then run npm start.

If startup does not progress:

  • Check auth.isAuthenticated first and stop there if it is false
  • In headless environments, set COPILOT_GITHUB_TOKEN, GH_TOKEN, or GITHUB_TOKEN before launching Node
  • Re-run with new CopilotClient({logLevel: "debug"}) and follow references/auth-and-byok.md for auth preflight

With streaming

const session = await client.createSession({
  model: "gpt-4.1",
  streaming: true,
  onPermissionRequest: approveAll,
});

session.on("assistant.message_delta", (event) => {
  process.stdout.write(event.data.deltaContent);
});

session.on("session.idle", async () => {
  console.log("\n--- done ---");
  await session.disconnect();
  await client.stop();
});

await session.send({ prompt: "Explain TypeScript generics" });

With a custom tool

Create the imported helper first:

// src/lib/math.ts
export function add(a: number, b: number) {
  return a + b;
}
import { CopilotClient, defineTool, approveAll } from "@github/copilot-sdk";
import { z } from "zod";
import { add } from "./lib/math.ts";

const addNumbers = defineTool("add_numbers", {
  description: "Add two numbers using local business logic",
  parameters: z.object({
    a: z.number().describe("First number"),
    b: z.number().describe("Second number"),
  }),
  handler: async ({ a, b }) => ({ result: add(a, b) }),
});

const client = new CopilotClient();
const session = await client.createSession({
  model: "gpt-4.1",
  tools: [addNumbers],
  onPermissionRequest: approveAll,
});

const response = await session.sendAndWait({
  prompt: "Use the add_numbers tool to add 19 and 23.",
});
console.log(response?.data.content);

await session.disconnect();
await client.stop();

Default convention: keep imported domain helpers under src/lib/ and wire them into tool handlers instead of hard-coding toy data inside the handler. If the real logic lives in another package, import a workspace dependency or package entrypoint that tsx can resolve at runtime instead of a source-only deep path.

Key patterns

Send-and-wait vs fire-and-forget

// Blocking — waits for session.idle, returns last assistant.message
const response = await session.sendAndWait(
  { prompt: "Hello" },
  30_000, // optional timeout in ms
);

// Non-blocking — returns immediately, events arrive via session.on()
await session.send({ prompt: "Start a long task..." });

Event subscription (typed + wildcard)

// Typed — only fires for the specific event type
const unsub = session.on("tool.execution_complete", (event) => {
  console.log(`${event.data.toolName}: ${event.data.success}`);
});

// Wildcard — fires for every event
session.on((event) => {
  if (event.type === "session.error") {
    console.error(event.data.message);
  }
});

unsub(); // unsubscribe

Session persistence

// Create with a stable ID
const session = await client.createSession({
  sessionId: "user-123-conversation",
  model: "gpt-4.1",
  onPermissionRequest: approveAll,
});
await session.sendAndWait({ prompt: "Let's discuss TypeScript" });
await session.disconnect(); // preserves state on disk

// Resume later (same or different client)
const resumed = await client.resumeSession("user-123-conversation", {
  onPermissionRequest: approveAll,
});

Create-or-resume pattern

createSession always starts fresh — only resumeSession restores conversation context. In applications that may revisit a session:

let session;
try {
  session = await client.resumeSession(sessionId, {
    onPermissionRequest: approveAll,
  });
} catch {
  session = await client.createSession({
    sessionId,
    model: "gpt-4.1",
    onPermissionRequest: approveAll,
  });
}

Handling ask_user programmatically

const session = await client.createSession({
  onPermissionRequest: approveAll,
  onUserInputRequest: async (request) => {
    if (request.choices?.length) {
      return { answer: request.choices[0], wasFreeform: false };
    }
    return { answer: "Yes, proceed", wasFreeform: true };
  },
});

Plan / autopilot mode

await session.rpc.mode.set({ mode: "plan" });

session.on("exit_plan_mode.requested", (event) => {
  console.log("Plan ready:", event.data.summary);
  session.rpc.mode.set({ mode: "autopilot" });
});

Abort in-flight work

await session.send({ prompt: "Run sleep 100" });
await session.abort(); // cancels current work; session remains usable

Common pitfalls

PitfallFix
onPermissionRequest missingRequired on every createSession/resumeSession. Use approveAll for unattended operation.
sendAndWait timeoutDefault is 60s. Pass explicit timeout: sendAndWait(opts, 300_000). Timeout does NOT abort in-flight work.
Streaming events not arrivingSet streaming: true in SessionConfig.
cliUrl + useStdioMutually exclusive. cliUrl connects to external server; useStdio spawns child process.
console.log in extensionsstdout is reserved for JSON-RPC. Use session.log() instead.
Tool name collision in extensionsTool names must be globally unique across all extensions.
BYOK without modelmodel is required when using provider config. Session creation succeeds silently, but sendAndWait will fail.
Race condition on event registrationRegister session.on() before calling session.send().

Steering notes for AI agents

These notes are distilled from real-world testing. They address the exact points where an agent following these instructions literally will get stuck.

Project initialization

  • Always run npm init -y then npm pkg set type=module before installing. The SDK is ESM-only and will throw ERR_PACKAGE_PATH_NOT_EXPORTED without this.
  • Always install zod alongside the SDK if you plan to use defineTool. It's not bundled.
  • Verify node --version is >= 20 and copilot --version responds before writing any code.

Session lifecycle

  • createSession always starts fresh — even with the same sessionId. It does NOT restore previous messages.
  • To resume a conversation, use resumeSession(sessionId). If the session doesn't exist, it throws — catch and fall back to createSession.
  • Always call session.disconnect() then client.stop() when done. Without this, streaming processes hang indefinitely because the RPC connection keeps the event loop alive.

Streaming

  • Register all event handlers (session.on(...)) before calling session.send(). Handlers registered after send may miss early events.
  • In the session.idle handler, always include cleanup (disconnect + stop) unless you're building a multi-turn REPL.
  • When the model calls multiple tools in parallel, tool.execution_start and tool.execution_complete events interleave. Use toolCallId to correlate them.

Tools

  • defineTool requires a Zod schema for parameters. The SDK auto-detects Zod and calls toJSONSchema().
  • Tool handler errors are caught and surfaced to the model as error results — they don't crash your process.
  • Tool names must be globally unique across all extensions.

Timeouts and errors

  • sendAndWait timeout does not abort in-flight work. It only stops waiting. Call session.abort() explicitly if you need to cancel.
  • BYOK without model in provider config creates a session successfully but fails silently at send time. Always pair provider with model.

平台分布

Codex

34.86%
按下载量换算66

Claude

29.48%
按下载量换算55

Cursor

20.44%
按下载量换算38

Gemini CLI

9.78%
按下载量换算18

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills