
Create TypeSpec API Plugin
OfficialFreeGenerate TypeSpec plugins for Microsoft 365 Copilot.
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 source1. Install with the skills CLI
npx skills add github/awesome-copilot/typespec-create-api-plugin --agent claude-code2. 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 githubCreate 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:
-
No Authentication (Public APIs)
// No @useAuth decorator needed -
API Key
@useAuth(ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">) -
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"]; }]>) -
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
- Operation Names: Use clear, action-oriented names (listProjects, createTicket)
- Models: Define TypeScript-like models for requests and responses
- HTTP Methods: Use appropriate verbs (@get, @post, @patch, @delete)
- Paths: Use RESTful path conventions with @route
- Parameters: Use @path, @query, @header, @body appropriately
- Descriptions: Provide clear descriptions for model understanding
- Confirmations: Add for destructive operations (delete, update critical data)
- Cards: Use for rich visual responses with multiple data items
Workflow
Ask the user:
- What is the API base URL and purpose?
- What operations are needed (CRUD operations)?
- What authentication method does the API use?
- Should confirmations be required for any operations?
- Do responses need Adaptive Cards?
Then generate:
- Complete
main.tspwith agent definition - Complete
actions.tspwith API operations and models - Optional
cards/card.jsonif Adaptive Cards are needed
Frequently asked questions about Create TypeSpec API Plugin
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
