/typespec-m365-copilot:typespec-create-api-pluginfrom typespec-m365-copilot
Generates TypeSpec API plugins for Microsoft 365 Copilot, producing main.tsp, actions.tsp, and optional Adaptive Card templates with REST operations, authentication, and response instructions.
Ships in typespec-m365-copilot. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create a complete Microsoft 365 Copilot API plugin from API requirements by producing main.tsp, actions.tsp, optional cards/card.json, and implementation notes for operations, authentication, confirmations, and response shaping.
Use the user's API description as the source of truth. Capture API base URL, purpose, operations, request and response schema, authentication method, destructive operations that need confirmation, and whether responses need Adaptive Cards.
| File | Required content |
|---|---|
main.tsp | Imports @typespec/http, @typespec/openapi3, @microsoft/typespec-m365-copilot, and ./actions.tsp; defines @agent, @instructions, namespace, and operation references. |
actions.tsp | Imports @typespec/http and @microsoft/typespec-m365-copilot; defines @service, @actions, @server("[API_BASE_URL]", "[API Name]"), optional @useAuth, REST operations, and models. |
cards/card.json | Optional Adaptive Card template referenced by @card when rich visual responses are required. |
Use these skeletons as the minimum shape:
// main.tsp
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] {
op operation1 is [APINamespace].operationName;
}
// actions.tsp
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])
namespace [APINamespace] {
@route("[/path]")
@get
@action
op operationName(@path param1: string, @query param2?: string): ResponseModel;
model ResponseModel {
// Response structure
}
}
| API requirement | TypeSpec pattern |
|---|---|
| Public API | Omit @useAuth; do not create placeholder auth models. |
| API key in header | @useAuth(ApiKeyAuth<ApiKeyLocation.header, "X-API-Key">) |
| OAuth2 authorization code | @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 | Define @authReferenceId("registration-id-here") model Auth is ApiKeyAuth<ApiKeyLocation.header, "X-API-Key"> and call @useAuth(Auth). |
| Area | Rule |
|---|---|
| Operation names | Use clear action-oriented names such as listProjects or createTicket. |
| Models | Define TypeScript-like request and response models instead of anonymous blobs. |
| HTTP methods | Use @get, @post, @patch, and @delete to match the API contract. |
| Routes | Use RESTful paths with @route; bind variables with @path, @query, @header, and @body. |
| Descriptions | Fill nameForHuman, descriptionForModel, and descriptionForHuman with concrete language for model understanding. |
| Confirmations | Add confirmation dialogs for delete, critical update, payment, or irreversible operations. |
| Cards | Use @card for rich visual responses with multiple data items. |
@capabilities(#{
confirmation: #{
type: "AdaptiveCard",
title: "Confirm Action",
body: """
Are you sure you want to perform this action?
* **Parameter**: {{ function.parameters.paramName }}
"""
}
})
@card(#{
dataPath: "$.items",
title: "$.title",
url: "$.link",
file: "cards/card.json"
})
@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.
""")
main.tsp with the agent definition and operation references.actions.tsp with service metadata, server, auth, routes, parameters, and request/response models.cards/card.json only when the response design uses @card.[API_BASE_URL] unresolved in final code unless the user explicitly asks for a template.@useAuth for public APIs; placeholder auth breaks plugin setup.@capabilities confirmation.object when fields are known; TypeSpec models improve action planning and OpenAPI output.## TypeSpec API plugin
**Status:** complete | needs input | blocked
**Agent:** <agent name>
**API base URL:** <base URL or unresolved placeholder>
### Files
- `main.tsp`: <summary>
- `actions.tsp`: <summary>
- `cards/card.json`: <created | not needed>
### Operations
| Operation | Method | Route | Auth | Confirmation | Response |
| --- | --- | --- | --- | --- | --- |
| `<operationName>` | `<GET|POST|PATCH|DELETE>` | `<route>` | `<auth>` | `<yes|no>` | `<model/card>` |
### Validation
- Placeholder review: <pass|fail and evidence>
- Auth mapping: <pass|fail and evidence>
- Adaptive Card mapping: <pass|not applicable and evidence>
main.tsp imports required TypeSpec and Microsoft 365 Copilot libraries and references operations from actions.tsp.actions.tsp defines @service, @actions, @server, operations, models, and only the needed @useAuth pattern.@route, parameter decorators, and a typed response model.@card, @reasoning, and @responding are used only when they add concrete behavior.[AgentName] or [API_BASE_URL] is intentional and reported.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin typespec-m365-copilot3 skills in this plugin
/typespec-api-operationsAdd RESTful GET, POST, PATCH, and DELETE operations to a TypeSpec API plugin for Microsoft 365 plugin for GitHub Copilot with routing, parameters, models, confirmations, adaptive cards, and testing prompts. Use when asked to add TypeSpec API operations, CRUD endpoints, @route/@get/@post/@patch/@delete handlers, or GitHub Copilot plugin actions./typespec-create-agentGenerate a complete TypeSpec declarative agent for Microsoft 365 Copilot with agent metadata, instructions, capabilities, and conversation starters. Use when the user asks to create a TypeSpec declarative agent, main.tsp, Microsoft 365 Copilot agent, or TypeSpec M365 capability scaffold.Other plugins' skills for the same job