From genflow-teams
Draft a Teams message from context, AI review (Copilot CLI / Codex, fail-closed), then send to self via Teams MCP SendMessageToSelf. Outputs recipient, message (HTML), and reason.
How this skill is triggered — by the user, by Claude, or both
Slash command
/genflow-teams:teams-sendThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
A lightweight 3-step flow: draft a Teams message from user context, pass it through a fail-closed AI review gate (Copilot CLI preferred, Codex fallback), and send the approved message to the user's own "Notes to Self" chat via Teams MCP.
A lightweight 3-step flow: draft a Teams message from user context, pass it through a fail-closed AI review gate (Copilot CLI preferred, Codex fallback), and send the approved message to the user's own "Notes to Self" chat via Teams MCP.
v1 is self-send only. The user reviews the message in their Teams and manually forwards it to the intended recipient.
SendMessageToSelf tool)flowchart TD
BEGIN([User invokes skill with context]) --> VALIDATE{Context non-empty?}
VALIDATE -->|No| ASK[Ask user for context]
ASK --> VALIDATE
VALIDATE -->|Yes| DRAFT[Draft structured message:<br/>recipient, message_html,<br/>reason, tone, urgency]
DRAFT --> SAVE[Save draft to<br/>.genflow/teams/drafts/]
SAVE --> REVIEW[AI review gate<br/>bash scripts/review-message.sh]
REVIEW --> PARSE{Parse review output<br/>first token only}
PARSE -->|APPROVED| AUDIT_PRE[Write audit JSON<br/>status=sending]
AUDIT_PRE --> SEND[SendMessageToSelf<br/>contentType=html]
SEND --> SEND_OK{Send succeeded?}
SEND_OK -->|Yes| AUDIT_SENT[Update audit: status=sent<br/>teams_message_id]
SEND_OK -->|No| AUDIT_ERR[Update audit: status=error]
AUDIT_ERR --> REPORT_ERR[Report error to user]
REPORT_ERR --> END_ERR([END - Error])
AUDIT_SENT --> REPORT_OK[Report: ✅ Sent to self]
REPORT_OK --> END_OK([END - Sent])
PARSE -->|REVISION_NEEDED| RETRY{Retry count < 2?}
RETRY -->|Yes| FIX[Apply review suggestions<br/>Update draft]
FIX --> REVIEW
RETRY -->|No| AUDIT_FAIL[Write audit: status=revision_exhausted]
AUDIT_FAIL --> REPORT_FAIL[Report: max revisions reached]
REPORT_FAIL --> END_FAIL([END - Not sent])
PARSE -->|REJECT| AUDIT_REJ[Write audit: status=rejected]
AUDIT_REJ --> REPORT_REJ[Report rejection reason]
REPORT_REJ --> END_REJ([END - Rejected])
PARSE -->|Invalid/Error| AUDIT_GATE[Write audit: status=review_error]
AUDIT_GATE --> REPORT_GATE[Report: review gate failure]
REPORT_GATE --> END_GATE([END - Gate Error])
Parse the user's free-text context and produce a structured message draft.
Write the draft to .genflow/teams/drafts/draft-YYYYMMDD-HHMMSS.md:
# Teams Message Draft
## Recipient
<intended recipient name — who this message is ultimately for>
## Message (HTML)
<p>HTML formatted message content</p>
## Reason
<why this message is being sent>
## Tone
casual-professional
## Urgency
normal
<p>, <b>, <i>, <ul>, <li>, <ol>, <table>, <tr>, <td>, <br>, <h3>**bold**, - list items, |---| tables, `backticks`< and > in non-HTML content to prevent injectionRun the review script:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/review-message.sh" \
--recipient "<name>" \
--reason "<why>" \
--message-file "<path-to-draft>"
The script outputs exactly one of three tokens on the first line:
APPROVED — message is safe to sendREVISION_NEEDED: <suggestions> — must revise and re-review (max 2 retries)REJECT: <reason> — do NOT sendAny other output (including empty, error messages, or variant formats) means the gate FAILED. Do NOT send.
| Situation | Behavior |
|---|---|
| Neither Copilot CLI nor Codex installed | Script exits non-zero → STOP, report error |
| Review backend times out | Script exits non-zero → STOP, report error. Note: Copilot (preferred) gets the full timeout budget. Codex fallback only runs if Copilot fails quickly (crash/error), with remaining time. If Copilot consumes the full timeout, Codex does not run — this is by design (Copilot is preferred). |
| Review returns empty output | Script exits non-zero → STOP, report error |
| Review returns unparseable output | Script exits non-zero → STOP, report error |
| Script itself fails | STOP, report error |
There is NO auto-approve path. If review fails for any reason, the message is NOT sent.
If REVISION_NEEDED is returned, revise the draft and re-run review. Maximum 2 revision attempts. After 2 failed revisions, stop and report to user.
After APPROVED, send the message to the user's own chat:
status: "sending" BEFORE the send attemptSendMessageToSelf with:
content: HTML message with header prefixcontentType: "html"Message format sent to Teams:
<b>📧 To:</b> {recipient}<br>
<b>💡 Why:</b> {reason}<br>
<hr>
{message_html}
status: "sent" and teams_message_idstatus: "error" and error fieldEvery invocation produces a JSON file in .genflow/teams/history/YYYYMMDD-HHMMSS_{run_id}.json:
{
"run_id": "<uuid>",
"timestamp": "2026-04-26T01:00:00-07:00",
"intended_recipient": "Alice Smith",
"message_html": "<p>...</p>",
"reason": "会议冲突需要改时间",
"tone": "casual-professional",
"urgency": "normal",
"review_result": "APPROVED",
"review_raw": "APPROVED",
"status": "sent",
"teams_message_id": "123456789",
"error": null,
"draft_path": ".genflow/teams/drafts/draft-20260426-010000.md"
}
Status values: sending | sent | rejected | revision_exhausted | review_error | error
Guides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Synthesizes the current conversation into a structured spec (PRD) and publishes it to the project issue tracker with a ready-for-agent label, without interviewing the user.
npx claudepluginhub ianliuy/skill-gen-flow-teams