Skip to main content
skill GitHub Copilot official · GitHub

typespec-create-api-plugin — GitHub Copilot skill: setup

Generates a TypeSpec plugin for Microsoft 365 Copilot that calls external REST APIs. Use it when you need API operations, authentication, or Adaptive Cards.

Install into GitHub Copilot · Skills CLI (Vercel) All methods and platforms ↓
npx skills add github/awesome-copilot --skill typespec-create-api-plugin
Open on GitHub

What typespec-create-api-plugin does

The skill asks for the API base URL and purpose, required CRUD operations, authentication method, confirmation needs, and Adaptive Card output. It then creates main.tsp for the agent definition and actions.tsp for routes, HTTP methods, parameters, and response models.

It supports public APIs, API key authentication, OAuth2, and registered auth references. You can add confirmation dialogs for destructive actions and produce card-based results through cards/card.json. Install it for TypeSpec-based Microsoft 365 Copilot API plugins; it is unnecessary for an API with no Copilot plugin planned.

What it helps with

  • define REST operations in actions.tsp
  • generate main.tsp agent definitions
  • configure API key or OAuth2 authentication
  • request confirmation before destructive actions
  • render list results with Adaptive Cards

Example prompts for the agent

  • Create a TypeSpec plugin for my API with a base URL and CRUD operations.
  • Add OAuth2 to `actions.tsp` and define `listProjects` and `createTicket`.
  • Create an Adaptive Card in `cards/card.json` for a list response.

How to install typespec-create-api-plugin

1Skills CLI (Vercel)

npx skills add github/awesome-copilot --skill typespec-create-api-plugin

2GitHub CLI

gh skill install github/awesome-copilot typespec-create-api-plugin

3Manually: put the files in place

.github/skills/typespec-create-api-plugin/SKILL.md

From the same set554

The whole set →
git-commit official github This skill reviews Git changes, stages related files, and creates Conventional Commits. Use it when you want an agent to make one commit or split work into separate commits. GitHub Copilot 47,165installs excalidraw-diagram-generator official github Turn a plain-language description into an Excalidraw diagram. Useful for mapping processes, system structure, and relationships between entities. GitHub Copilot 31,639installs multi-stage-dockerfile official github This skill guides GitHub Copilot in writing multi-stage Dockerfiles for different languages and frameworks. Use it when the final runtime image should contain fewer build dependencies. GitHub Copilot 29,688installs documentation-writer official github Skill that turns the agent into a technical writer following the Diátaxis framework: tutorials, how-to guides, reference, and explanation. Proposes structure before writing. GitHub Copilot 27,757installs prd official github Turns a feature idea into a structured PRD with user stories, technical requirements, and risks. Use it when planning a software feature or an AI-powered one. GitHub Copilot 24,035installs refactor official github This skill reshapes existing code without changing its external behavior. Use it for gradual cleanup of large functions, duplication, weak types, and code smells. GitHub Copilot 22,321installs java-springboot official github Gives GitHub Copilot Spring Boot development practices, from project layout to tests and security. Use it when writing or reviewing Java application code. GitHub Copilot 21,272installs create-readme official github This skill reviews a project and creates a structured README.md. Use it when the repository needs clear documentation based on its actual files and code. GitHub Copilot 19,081installs

Similar

error-handling-patterns Seth Hobson This skill covers exceptions, Result types, error propagation, and graceful degradation. Use it when designing APIs or debugging failures. Claude Code CX Codex Cursor 22,957installs python-design-patterns Seth Hobson Use it to shape Python components, separate responsibilities, and decide when repeated code deserves an abstraction. It fits design and refactoring work. Claude Code CX Codex Cursor 22,842installs memory-leak-debugging ChromeDevTools Finds memory leaks in JavaScript and Node.js with Chrome DevTools MCP. Use it to investigate high memory use, OOM errors, and heap snapshots. Claude Code CX Codex Cursor +1 3,200installs google-analytics-admin-api-basics official google This skill guides agents through Google Analytics Admin API setup and account configuration. Use it to manage properties and integrations from code. Claude Code Gemini CLI CX Codex 7,068installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. Claude Code Claude.ai 130,949installs google-agents-cli-adk-code official Google A reference skill for building ADK agents with tools, callbacks, state, and workflows. Use it when an agent project needs concrete API patterns or code examples. Claude Code CX Codex Cursor +1 511,400installs lark-im larksuite This skill lets an agent work with Lark IM messages, chats, files, and interactive cards. Use it when coding tasks need access to team conversations. Claude Code CX Codex Cursor +1 472,300installs lark-event larksuite Listens to Lark/Feishu events and streams them as NDJSON. Use it for bots, message processing, and long-running subscribers. Claude Code CX Codex Cursor +1 466,200installs

Questions about typespec-create-api-plugin

How do I install typespec-create-api-plugin in GitHub Copilot?

Run npx skills add github/awesome-copilot --skill typespec-create-api-plugin. You can also use gh skill install github/awesome-copilot typespec-create-api-plugin.

What does typespec-create-api-plugin do?

It generates TypeSpec files for a Microsoft 365 Copilot plugin connected to an external REST API. The output includes an agent definition, API operations, and data models.

Which authentication methods does the skill support?

It can generate public API access, API key authentication, OAuth2, or a registered auth reference. Choose the option required by the connected API.

Source text

SKILL.md · MIT
---
name: typespec-create-api-plugin
description: 'Generate a TypeSpec API plugin with REST operations, authentication, and Adaptive Cards for Microsoft 365 Copilot'
---

# Create TypeSpec API Plugin

Create a complete TypeSpec API plugin for Microsoft 365 Copilot that integrates with external REST APIs.

## Requirements

Generate TypeSpec files with:

### main.tsp - Agent Definition
```typescript
import "@typespec/http";
import "@typespec/openapi3";
import "@microsoft/typespec-m365-copilot";
import "./actions.tsp";

using TypeSpec.Http;
using TypeSpec.M365.Copilot.Agents;
using TypeSpec.M365.Copilot.Actions;

@agent({
  name: "[Agent Name]",
  description: "[Description]"
})
@instructions("""
  [Instructions for using the API operations]
""")
namespace [AgentName] {
  // Reference operations from actions.tsp
  op operation1 is [APINamespace].operationName;
}
```

### actions.tsp - API Operations
```typescript
import "@typespec/http";
import "@microsoft/typespec-m365-copilot";

using TypeSpec.Http;
using TypeSpec.M365.Copilot.Actions;

@service
@actions(#{
    nameForHuman: "[API Display Name]",
    descriptionForModel: "[Model description]",
    descriptionForHuman: "[User description]"
})
@server("[API_BASE_URL]", "[API Name]")
@useAuth([AuthType]) // Optional
namespace [APINamespace] {
  
  @route("[/path]")
  @get
  @action
  op operationName(
    @path param1: string,
    @query param2?: string
  ): ResponseModel;

  model ResponseModel {
    // Response structure
  }
}
```

## Authentication Options

Choose based on API requirements:

1. **No Authentication** (Public APIs)
   ```typescript
   // No @useAuth decorator needed
   ```

2. **API Key**
   ```typescript
   @useAuth(ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">)
   ```

3. **OAuth2**
   ```typescript
   @useAuth(OAuth2Auth<[{
     type: OAuth2FlowType.authorizationCode;
     authorizationUrl: "https://oauth.example.com/authorize";
     tokenUrl: "https://oauth.example.com/token";
     refreshUrl: "https://oauth.example.com/token";
     scopes: ["read", "write"];
   }]>)
   ```

4. **Registered Auth Reference**
   ```typescript
   @useAuth(Auth)
   
   @authReferenceId("registration-id-here")
   model Auth is ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">
   ```

## Function Capabilities

### Confirmation Dialog
```typescript
@capabilities(#{
  confirmation: #{
    type: "AdaptiveCard",
    title: "Confirm Action",
    body: """
    Are you sure you want to perform this action?
      * **Parameter**: {{ function.parameters.paramName }}
    """
  }
})
```

### Adaptive Card Response
```typescript
@card(#{
  dataPath: "$.items",
  title: "$.title",
  url: "$.link",
  file: "cards/card.json"
})
```

### Reasoning & Response Instructions
```typescript
@reasoning("""
  Consider user's context when calling this operation.
  Prioritize recent items over older ones.
""")
@responding("""
  Present results in a clear table format with columns: ID, Title, Status.
  Include a summary count at the end.
""")
```

## Best Practices

1. **Operation Names**: Use clear, action-oriented names (listProjects, createTicket)
2. **Models**: Define TypeScript-like models for requests and responses
3. **HTTP Methods**: Use appropriate verbs (@get, @post, @patch, @delete)
4. **Paths**: Use RESTful path conventions with @route
5. **Parameters**: Use @path, @query, @header, @body appropriately
6. **Descriptions**: Provide clear descriptions for model understanding
7. **Confirmations**: Add for destructive operations (delete, update critical data)
8. **Cards**: Use for rich visual responses with multiple data items

## Workflow

Ask the user:
1. What is the API base URL and purpose?
2. What operations are needed (CRUD operations)?
3. What authentication method does the API use?
4. Should confirmations be required for any operations?
5. Do responses need Adaptive Cards?

Then generate:
- Complete `main.tsp` with agent definition
- Complete `actions.tsp` with API operations and models
- Optional `cards/card.json` if Adaptive Cards are needed

© github · MIT · github/awesome-copilot

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor