copilot-studio
Copilot Studio Development
Expert guidance for building custom copilots with Microsoft Copilot Studio, including topics, actions, knowledge sources, and channel publishing.
Triggers
Use this skill when you see:
- copilot studio, custom copilot, power virtual agents
- topic design, trigger phrases, conversation flow
- knowledge source, generative answers, generative ai
- copilot actions, connector actions, ai builder
- copilot teams, copilot publish, direct line
Instructions
Copilot Architecture
┌─────────────────────────────────────────────────┐
│ Custom Copilot │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Topics │ │ Knowledge │ │ Actions │ │
│ │ (Dialog │ │ Sources │ │ (Power │ │
│ │ flows) │ │ (Gen AI) │ │ Automate) │ │
│ └───────────┘ └───────────┘ └───────────┘ │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ │
│ │ Entities │ │ Variables │ │ Channels │ │
│ │ (Slot │ │ (Global/ │ │ (Teams, │ │
│ │ filling) │ │ Topic) │ │ Web, etc.)│ │
│ └───────────┘ └───────────┘ └───────────┘ │
└─────────────────────────────────────────────────┘
Topic Design
Topics are the building blocks of a copilot conversation. Each topic handles a specific user intent.
Topic Structure
- Trigger phrases: 5-10 example phrases that activate the topic
- Question nodes: Gather information from the user
- Condition nodes: Branch logic based on variable values
- Message nodes: Display responses to the user
- Action nodes: Call flows, connectors, or AI Builder prompts
- Redirect nodes: Transfer to another topic or escalate
Example Topic Flow: Order Status
Trigger Phrases:
- "Where is my order?"
- "Check order status"
- "Track my delivery"
- "Order tracking"
- "When will my order arrive?"
Flow:
1. Question: "What is your order number?" -> Save to Topic.OrderNumber
- Entity: Custom regex pattern [A-Z]{2}\d{6}
- Reprompt: "Please enter a valid order number (e.g., AB123456)"
2. Action: Call Power Automate flow "Get Order Status"
- Input: Topic.OrderNumber
- Output: Topic.OrderStatus, Topic.EstimatedDelivery
3. Condition: Topic.OrderStatus
- "Shipped" ->
Message: "Your order {Topic.OrderNumber} has shipped!
Estimated delivery: {Topic.EstimatedDelivery}"
- "Processing" ->
Message: "Your order {Topic.OrderNumber} is being processed.
You'll receive a tracking number once it ships."
- "Delivered" ->
Message: "Your order {Topic.OrderNumber} was delivered on {Topic.EstimatedDelivery}."
- Else ->
Message: "I couldn't find order {Topic.OrderNumber}. Let me connect you with support."
Redirect: Escalate topic
Knowledge Sources
Knowledge sources enable generative AI answers from your organizational content.
Supported Sources
- SharePoint sites: Point to site URLs; copilot indexes pages and documents
- Public websites: Crawl up to 4 levels deep from a URL
- Uploaded files: PDF, Word, Excel, PowerPoint, text files
- Dataverse: Tables configured as knowledge sources
Configuration
Knowledge Source Setup:
1. Navigate to copilot > Knowledge
2. Add source type (SharePoint, Website, Files)
3. Configure:
- SharePoint: Enter site URL(s), select libraries
- Website: Enter root URL, set crawl depth (1-4)
- Files: Upload documents (max 3MB each, 100MB total)
4. Set description for AI to understand when to use this source
5. Test with sample questions in Test Copilot pane
Generative Answers Configuration
- Content moderation: Set strictness level (Low/Medium/High)
- Citation style: Inline or footnote citations
- No-answer behavior: Fallback to topic or escalate
- Data sources: Select which knowledge sources to query
Actions
Actions extend copilot capabilities by connecting to external systems.
Power Automate Flow Actions
Action Setup:
1. Create a Power Automate cloud flow
2. Trigger: "When Power Virtual Agents calls a flow" (now "Run a flow from Copilot")
3. Define input parameters (from copilot variables)
4. Add flow logic (Dataverse, HTTP, connectors)
5. Return output parameters (back to copilot variables)
6. In Copilot Studio: Add Action node > select the flow
Connector Actions
1. In topic, add Action node > "Call a connector action"
2. Select connector (e.g., Outlook, SharePoint, Dataverse)
3. Map input parameters from topic variables
4. Map output to topic variables for use in messages
AI Builder Prompt Actions
1. Create an AI Builder custom prompt
2. Define prompt template with placeholders
3. In Copilot Studio: Add Action node > "AI Builder prompt"
4. Map topic variables to prompt placeholders
5. Use prompt output in subsequent message nodes
ALM for Copilots
Copilots are Dataverse solution components and follow standard Power Platform ALM.
# Copilots live inside Dataverse solutions
pac solution export --name CopilotSolution --path ./copilot-solution.zip --managed false
# Unpack for source control
pac solution unpack --zipfile ./copilot-solution.zip --folder ./src/CopilotSolution
# Solution includes:
# - Chatbot component (copilot definition)
# - Chatbot subcomponents (topics, entities, variables)
# - Related Power Automate flows
# - Knowledge source configurations
Channel Publishing
Microsoft Teams
1. Go to copilot > Channels > Microsoft Teams
2. Click "Turn on Teams"
3. Options:
- Share link directly with users
- Submit to Teams admin for org-wide deployment
- Add to Teams app catalog
4. Users find copilot in Teams chat or app bar
Power Apps Embedding
1. Go to copilot > Channels > Custom website
2. Copy the embed snippet (iframe or webchat script)
3. Add to canvas app HTML text control or custom page
Website (Direct Line)
<!-- Embed via Direct Line -->
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
<script>
window.WebChat.renderWebChat({
directLine: window.WebChat.createDirectLine({
token: 'YOUR_DIRECT_LINE_TOKEN'
}),
userID: 'user123'
}, document.getElementById('webchat'));
</script>
<div id="webchat" role="main" style="height: 600px; width: 400px;"></div>
Best Practices
| Practice | Description |
|---|---|
| Trigger phrases | Use 5-10 diverse phrases per topic; avoid overlapping triggers |
| Fallback topic | Customize the fallback to gracefully handle unrecognized input |
| Entity validation | Use entity types and reprompt messages for data quality |
| Knowledge scope | Add descriptions to knowledge sources so AI picks the right one |
| Testing | Test every conversation path in the Test pane before publishing |
| Topic naming | Use descriptive names: "Order Status Lookup" not "Topic 1" |
| Variables | Prefer topic-scoped variables; use global only for cross-topic state |
| Escalation | Always provide a path to a human agent for complex issues |
Common Workflows
Build a New Copilot
- Create copilot in Copilot Studio with description
- Add knowledge sources (SharePoint, websites, files)
- Create custom topics for specific intents
- Connect Power Automate flows for data operations
- Test in the Test Copilot pane
- Publish to channels (Teams, website)
Topic Design Process
- Identify user intent and expected outcomes
- Write 5-10 trigger phrases with natural variation
- Design question flow with entity validation
- Add conditions for branching logic
- Connect actions for external data
- Add message responses with variable interpolation
- Test edge cases and fallback paths
Copilot Deployment
- Develop and test in Dev environment
- Add copilot to Dataverse solution
- Export solution (managed) for deployment
- Import to Test environment, validate conversation flows
- Import to Prod, publish to channels
- Monitor analytics in Copilot Studio dashboard
More from housegarofalo/claude-code-base
mqtt-iot
Configure MQTT brokers (Mosquitto, EMQX) for IoT messaging, device communication, and smart home integration. Manage topics, QoS levels, authentication, and bridging. Use when setting up IoT messaging, smart home communication, or device-to-cloud connectivity. (project)
22devops-engineer-agent
Infrastructure and DevOps specialist. Manages Docker, Kubernetes, CI/CD pipelines, and cloud deployments. Expert in GitHub Actions, Azure DevOps, Terraform, and container orchestration. Use for deployment automation, infrastructure setup, or CI/CD optimization.
6postgresql
Design, optimize, and manage PostgreSQL databases. Covers indexing, pgvector for AI embeddings, JSON operations, full-text search, and query optimization. Use when working with PostgreSQL, database design, or building data-intensive applications.
6home-assistant
Ultimate Home Assistant skill - complete administration, wireless protocols (Zigbee/ZHA/Z2M, Z-Wave JS, Thread, Matter), ESPHome device building, advanced troubleshooting, performance optimization, security hardening, custom integration development, and professional dashboard design. Covers configuration, REST API, automation debugging, database optimization, SSL/TLS, Jinja2 templating, and HACS custom cards. Use for any HA task.
6testing
Comprehensive testing skill covering unit, integration, and E2E testing with pytest, Jest, Cypress, and Playwright. Use for writing tests, improving coverage, debugging test failures, and setting up testing infrastructure.
5react-typescript
Build modern React applications with TypeScript. Covers React 18+ patterns, hooks, component architecture, state management (Zustand, Redux Toolkit), server components, and best practices. Use for React development, TypeScript integration, component design, and frontend architecture.
5