New to Claude Skills? Learn how to install them →

github on GitHub

Create TypeSpec API Plugin

OfficialFree

Generate TypeSpec plugins for Microsoft 365 Copilot.

by github37.7k stars on github/awesome-copilot
2 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What Create TypeSpec API Plugin does

The Create TypeSpec API Plugin skill is designed for developers looking to integrate external REST APIs with Microsoft 365 Copilot using TypeSpec. This skill simplifies the process of creating a complete TypeSpec API plugin by generating the necessary TypeSpec files, including agent definitions and API operations. With this skill, you can define the operations your API will support, specify authentication methods, and create rich responses using Adaptive Cards.

The skill provides a structured approach to API development by guiding users through the creation of essential components, such as main.tsp for agent definitions and actions.tsp for API operations. You can customize your API with various authentication options, including no authentication, API key, and OAuth2, ensuring flexibility based on your API's requirements. Additionally, the skill allows for the inclusion of confirmation dialogs and Adaptive Card responses, enhancing user interaction and experience.

This skill is particularly useful for developers who are building applications that require seamless integration with Microsoft 365 Copilot. By leveraging this skill, you can streamline the development process, reduce boilerplate code, and ensure that your API adheres to best practices in RESTful design. The generated code is structured and follows TypeScript conventions, making it easy to understand and maintain.

Whether you are developing a new application or enhancing an existing one, the Create TypeSpec API Plugin skill provides the tools necessary to create robust and interactive APIs for Microsoft 365 Copilot, ultimately improving user engagement and functionality.

When to use it

Use this skill when you need to create a TypeSpec API plugin that integrates with external REST APIs for Microsoft 365 Copilot.

When not to use it

This skill may not be suitable if you are not working with Microsoft 365 Copilot or if you require non-RESTful API integrations.

What you can build with it

Integrating a New API

Use this skill to quickly create a TypeSpec API plugin for a new REST API you want to integrate with Microsoft 365 Copilot.

Enhancing User Interaction

Leverage the Adaptive Cards feature to present data in a visually appealing format within your application.

Implementing Authentication

Utilize the skill to define various authentication methods for your API, ensuring secure access.

How to install Create TypeSpec API Plugin

View source

1. Install with the skills CLI

npx skills add github/awesome-copilot/typespec-create-api-plugin --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by github

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

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

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)

    // No @useAuth decorator needed
    
  2. API Key

    @useAuth(ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">)
    
  3. OAuth2

    @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

    @useAuth(Auth)
    
    @authReferenceId("registration-id-here")
    model Auth is ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">
    

Function Capabilities

Confirmation Dialog

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

Adaptive Card Response

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

Reasoning & Response Instructions

@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

Frequently asked questions about Create TypeSpec API Plugin

Similar skills