关于 Powerplatform
Powerplatform 是一项根据自然语言请求和导出的连接器架构生成 Power Automate 流程的技能。它利用模板并将结果打包为解决方案 ZIP,供用户导入。
主要功能
- 01根据自然语言生成流程
- 02检查已导出的连接器
- 03使用模板和连接器架构
- 04将流程打包为解决方案 ZIP
适用场景
- 01创建邮件或 Teams 通知
- 02构建文档审批流程
- 03安排定期报告
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ robdtaylor/ personal-ai-infrastructure --skill powerplatform安装后在 Claude Code 中输入/powerplatform确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
examples/weekly-report.jsonurgent-email-teams-notification.jsonsharepoint-item-approval.jsonreference/triggers.mdexpressions.mdactions.mdtemplates/email-attachment-handler.jsonnotification-flow.jsonscheduled-report.jsonapproval-flow.jsontools/package-solution.sh详细介绍
PowerPlatform - 流生成技能
使用从工作环境导出的连接器架构,根据自然语言描述生成 Power Automate 流。
工作流路由
Power Platform 没有 Workflows/ 目录——每个请求都会路由到 templates/ 中的一个起始模板(根据连接器架构进行定制),然后通过 tools/package-solution.sh 打包。examples/ 中的参考示例展示了已完成的流。
| 触发短语 | 起始模板 | 参考示例 |
|---|---|---|
| "notify", "send a message when", "alert on new email/item" | templates/notification-flow.json | examples/urgent-email-teams-notification.json |
| "approval", "route for sign-off", "approve/reject" | templates/approval-flow.json | examples/sharepoint-item-approval.json |
| "scheduled report", "every week/day send", "recurring summary" | templates/scheduled-report.json | examples/weekly-report.json |
| "save attachments", "process incoming email files" | templates/email-attachment-handler.json | reference/actions.md |
| 其他情况/从头构建 | 根据架构内联构建 | reference/expressions.md、reference/triggers.md、reference/actions.md |
生成前务必先读取 ~/Projects/work/scripts/power-platform/manifest.json,确认所需连接器可用。
示例
示例 1:紧急邮件的 Teams 通知
User: "When an urgent email arrives in my work inbox, post it to the Ops Teams channel"
-> Reads manifest.json → confirms shared_office365 + shared_teams available
-> Starts from templates/notification-flow.json
-> Trigger: When_a_new_email_arrives (Office365), condition on importance = high
-> Action: Post_message_in_a_chat_or_channel (Teams)
-> Packages via tools/package-solution.sh
-> Saves to ~/Projects/work/scripts/power-platform/generated/urgent-email-notify.zip
示例 2:文档审批工作流
User: "Make a flow for document approval - when a file is added to SharePoint, start an approval, then move to approved/rejected folder"
-> Starts from templates/approval-flow.json
-> Trigger: When_a_file_is_created (SharePoint)
-> Action: Start_and_wait_for_an_approval (Approvals)
-> Condition branches on outcome → Update_item to move to approved/rejected library
-> Outputs deployable solution ZIP for import at work
示例 3:每周定期报告
User: "Every Monday at 8am, pull last week's list items and email me a summary"
-> Starts from templates/scheduled-report.json
-> Trigger: Recurrence (Schedule), weekly on Monday 08:00
-> Action: Get_items (SharePoint) + Apply_to_each to build HTML table
-> Action: Send_an_email (Office365) with @{length(body('Get_items')?['value'])} count
-> Saves to generated/ as weekly-report.zip
架构
Work Repo (schemas) PAI (this skill)
~/Projects/work/scripts/ ~/.claude/skills/PowerPlatform/
power-platform/
├── connectors/ ──reads──> ├── SKILL.md
│ ├── shared_teams.json ├── templates/
│ ├── shared_outlook.json ├── reference/
│ └── ... └── examples/
├── manifest.json
└── generated/ <──writes── [Solution ZIPs]
工作流
1. 检查可用连接器
生成前,读取清单以查看有哪些连接器可用:
cat ~/Projects/work/scripts/power-platform/manifest.json
如果 manifest.json 不存在或已过时,请告知用户在工作环境中运行导出脚本。
2. 解析用户请求
从自然语言中提取:
- 触发器:什么会启动流(收到邮件、创建文件、定时、手动)
- 操作:流要执行什么(发送消息、创建项目、更新记录)
- 条件:任何分支逻辑(if/then、switch)
- 数据流:步骤之间传递哪些数据
3. 生成流定义
按照 Power Automate 架构创建流 JSON。关键结构:
{
"properties": {
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"triggers": { ... },
"actions": { ... }
},
"connectionReferences": { ... }
}
}
4. 打包为解决方案
封装到解决方案结构中以供导入:
solution/
├── [Content_Types].xml
├── customizations.xml
├── solution.xml
└── Workflows/
└── {flow-guid}-{flow-name}.json
5. 输出
保存到:~/Projects/work/scripts/power-platform/generated/
连接引用
流使用连接引用,将其映射到目标环境中的实际连接。使用导入时会解析的占位符 ID:
"connectionReferences": {
"shared_teams": {
"connectionName": "shared_teams",
"source": "Embedded",
"id": "/providers/Microsoft.PowerApps/apis/shared_teams",
"tier": "NotSpecified"
}
}
导入时,Power Platform 会提示用户将这些引用映射到实际连接。
表达式语法
Power Automate 使用专用的表达式语言。常见模式:
动态内容引用
@{triggerOutputs()?['body/subject']} # Email subject from trigger
@{body('Get_item')?['Title']} # Field from previous action
@{items('Apply_to_each')?['name']} # Current item in loop
函数
@{utcNow()} # Current timestamp
@{concat('Hello ', triggerBody()?['name'])} # String concatenation
@{if(equals(1,1),'yes','no')} # Conditional
@{length(body('Get_items')?['value'])} # Array length
@{formatDateTime(utcNow(),'yyyy-MM-dd')} # Date formatting
条件
"expression": {
"and": [
{ "contains": ["@triggerOutputs()?['body/subject']", "urgent"] },
{ "equals": ["@triggerOutputs()?['body/importance']", "high"] }
]
}
完整语法指南请参阅 reference/expressions.md。
常见触发器
| 触发器 | 连接器 | 用例 |
|---|---|---|
When_a_new_email_arrives | Office365 | 邮件自动化 |
When_a_file_is_created | SharePoint | 文档工作流 |
When_an_item_is_created | SharePoint | 列表自动化 |
When_a_row_is_added | Dataverse | 数据库触发器 |
Recurrence | Schedule | 定时任务 |
manual | Manual | 按钮触发 |
When_a_HTTP_request_is_received | HTTP | Webhook/API 触发器 |
常见操作
| 操作 | 连接器 | 用例 |
|---|---|---|
Send_an_email | Office365 | 邮件通知 |
Post_message_in_a_chat_or_channel | Teams | 团队通知 |
Create_item | SharePoint | 添加列表项目 |
Update_item | SharePoint | 修改列表项目 |
Start_and_wait_for_an_approval | Approvals | 审批工作流 |
Create_a_row | Dataverse | 数据库写入 |
HTTP | HTTP | 外部 API 调用 |
模板
templates/ 中的预构建模式:
approval-flow.json- 标准审批工作流notification-flow.json- 事件触发的通知scheduled-report.json- 定时数据收集form-processing.json- 表单响应处理file-sync.json- 跨系统文件操作
生成流程
收到创建流程的请求时:
-
读取可用架构:
ls ~/Projects/work/scripts/power-platform/connectors/ cat ~/Projects/work/scripts/power-platform/manifest.json -
加载相关连接器架构,以支持请求的功能
-
选择合适的模板,或从头构建
-
生成流程 JSON,包括:
- 流程的唯一 GUID
- 正确的触发器配置
- 使用正确操作 ID 的操作序列
- 所有已使用连接器的连接引用
- 动态内容的表达式语法
-
使用
tools/package-solution.sh创建解决方案包 -
保存到 generated 文件夹并告知用户
限制
- 无法直接部署 - 用户必须在工作环境中导入
- 需要映射连接 - 用户在导入时映射连接
- 高级连接器 - 部分连接器需要高级许可证
- 自定义连接器 - 不导出架构则不受支持
- 架构时效性 - 取决于工作环境中的导出频率
文件参考
| 文件 | 用途 |
|---|---|
templates/*.json | 预构建流程模式 |
reference/expressions.md | 表达式语法指南 |
reference/triggers.md | 触发器配置 |
reference/actions.md | 操作配置 |
examples/*.json | 可用的流程示例 |
tools/package-solution.sh | 解决方案打包脚本 |