Typespec Create API Plugin
GitHubOfficialOriginally contributed by @troystaylor as prompts/typespec-create-api-plugin.prompt.md; moved into a skill by pull request #761Distributed by GitHub
- Skill
- Content generator
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill assists in creating TypeSpec files required to build API plugins for Microsoft 365 Copilot. It provides a structured approach to defining agent instructions, REST API operations, authentication schemes, and rich UI elements like Adaptive Cards. By following the provided templates and best practices, users can generate the necessary code to connect external services to the Copilot ecosystem.
What it does
- Generates main.tsp files for agent definitions and instructions.
- Creates actions.tsp files for defining REST API operations and models.
- Configures authentication methods including API keys and OAuth2.
- Defines Adaptive Card responses for rich visual data presentation.
- Implements confirmation dialogs for destructive API operations.
- Provides best practices for naming, HTTP methods, and parameter definitions.
When to use it
- When you need to build a new API plugin for Microsoft 365 Copilot.
- When you need to define RESTful operations in TypeSpec for AI consumption.
- When you need to secure your API plugin with specific authentication protocols.
- When you want to enhance user interaction with Adaptive Cards and confirmation prompts.
Advantages
- Standardizes the creation of Copilot-compatible API plugins.
- Simplifies the implementation of complex authentication flows.
- Ensures consistent API documentation and model definitions.
- Enables rich, user-friendly responses through Adaptive Cards.
Usage examples
- “Create a TypeSpec plugin for a project management API that uses API key authentication.”
- The agent will prompt for the API base URL and specific CRUD operations, then generate the corresponding main.tsp and actions.tsp files with the correct API key authentication decorator.
- “I need an Adaptive Card for my task list operation in my Copilot plugin.”
- The agent will provide the necessary @card decorator code and structure to map your API response data to an Adaptive Card template.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/github/typespec-create-api-plugin/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip typespec-create-api-plugin.zip -d .agents/skills
Documentation by troystaylor
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:
No Authentication (Public APIs)
// No @useAuth decorator neededAPI 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 definitionComplete
actions.tspwith API operations and modelsOptional
cards/card.jsonif Adaptive Cards are needed
Files
- ATTRIBUTION.mdAdded by AutoGineer1.2 KiB
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md4.0 KiB
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "typespec-create-api-plugin", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 797337f33f73e35d08d82f840e21c4b8c4932d88
Originally contributed by: @troystaylor (https://github.com/troystaylor) as prompts/typespec-create-api-plugin.prompt.md (history: https://github.com/github/awesome-copilot/commits/9efb8cd3885ad3a445e11de2b6cc7ab3abcbdef6/prompts/typespec-create-api-plugin.prompt.md); moved into a skill by pull request #761 (https://github.com/github/awesome-copilot/pull/761)
Publisher: GitHub (https://github.com/github)
Licence: MIT License (https://github.com/github/awesome-copilot/blob/797337f33f73e35d08d82f840e21c4b8c4932d88/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an API key
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Originally contributed by
@troystayloras prompts/typespec-create-api-plugin.prompt.mdmoved into a skill by pull request #761
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/typespec-create-api-plugin · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- troystaylor
AutoGineer is not affiliated with or endorsed by troystaylor or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download typespec-create-api-plugin.zip