.agents/commands/comet/generate-code-review-slack-command.md
Command: cursor generate-code-review-slack-command
Generate a formatted, copiable Slack command for the #code-review channel with PR information, Jira ticket, test environment link, and optional component summaries (FE, BE, Python, TypeScript). Automatically extracts information from the GitHub PR for the current branch and outputs a command that can be copied, edited (to add @ mentions, media links, etc.), and pasted into Slack.
This workflow will:
[OPIK-1234]) or prompted if not foundget_file_contents for comet-ml/opik
If unavailable, respond with: "This command needs GitHub MCP configured. Set MCP config/env, run
make cursor(Cursor) ormake claude(Claude CLI), then retry."
Stop here.
comet-ml/opik"No open PR found for this branch. Please provide the PR link manually:"
Extract Jira ticket from PR title:
[OPIK-\d+] or [issue-\d+] or [NA]OPIK-1234 from [OPIK-1234] [BE] feat(api): add trace request validation endpoint)OPIK-\d+ patternhttps://comet-ml.atlassian.net/browse/{TICKET} (e.g., https://comet-ml.atlassian.net/browse/OPIK-1234)Extract Baz approved status (optional):
Extract test environment link from PR description and comments:
gh api, always use --paginate to ensure all results are fetched:
# Issue comments (general PR comments, including deployment bot messages)
gh api repos/comet-ml/opik/issues/{pr_number}/comments --paginate
# Review comments (inline code comments)
gh api repos/comet-ml/opik/pulls/{pr_number}/comments --paginate
Why pagination is required: GitHub API returns 30 items per page by default. Opik PRs regularly exceed this — 17 CI test group comments + deployment bot comments + reviewer comments can push past 30 total. Without
--paginate, the deployment bot comment with the test environment link may end up on page 2 and get silently missed.
https://pr-XXXX.dev.comet.com or https://test.opik.com)https://pr-*.dev.comet.com, https://test.opik.com, https://*.opik.com, or any https:// URLExtract component summaries from PR description:
FE summary:
[FE] tag in PR descriptionBE summary:
[BE] tag in PR descriptionPython summary:
TypeScript summary:
[TS] tag in PR descriptionStore extracted information: Keep all extracted and prompted values for message formatting
"Would you like to customize the message? (Enter any additional text to prepend/append, or press Enter to use default message):"
Use PR link: Use the PR URL extracted from Step 2 (or provided manually)
Build message text according to the template:
Hi team,
Please review the following PR:
{{user_customization_text_if_provided}}
:jira_epic: jira link: {{Jira_URL}}
:github: pr link: {{PR_link}}
:test_tube: test env link: {{test_env}}
{{baz_approved_status_if_available}}
:react: fe summary (optional): {{description_in_one_line}}
:java: be summary (optional): {{description_in_one_line}}
:python: python summary (optional): {{description_in_one_line}}
:typescript: typescript summary (optional): {{description_in_one_line}}
Message structure:
https://comet-ml.atlassian.net/browse/OPIK-1234)Format example:
Hi team,
Please review the following PR:
:jira_epic: jira link: https://comet-ml.atlassian.net/browse/OPIK-1234
:github: pr link: https://github.com/comet-ml/opik/pull/1234
:test_tube: test env link: https://test.opik.com
:react: fe summary (optional): Added new metrics dashboard UI
:java: be summary (optional): Implemented metrics aggregation endpoint
:typescript: typescript summary (optional): Added TypeScript SDK support for metrics
Format as Slack command: Generate a copiable command that can be pasted directly into Slack
Command format: The output should be formatted as a code block that can be easily copied
Display instructions: Show clear instructions on how to use the generated command:
"📋 Copiable Slack Command Generated\n\nCopy the command below and paste it into the #code-review channel in Slack.\n\nYou can edit it before sending to:\n- Add @ mentions for specific reviewers\n- Add media links or video links\n- Make final proof edits\n- Add any additional context\n\n
\n[FORMATTED_MESSAGE]\n\n\nTo send in Slack:\n1. Open Slack and navigate to #code-review channel\n2. Paste the command above\n3. Edit as needed (add @ mentions, media links, etc.)\n4. Send the message"
Alternative format (if using Slack CLI): If the user prefers, also provide a Slack CLI command format:
slack chat send --channel "#code-review" --text "[FORMATTED_MESSAGE]"
OPIK-1234) and re-promptThe command is successful when:
#code-review channelcursor send-code-review-slack to send the message directly to Slack.# 1. Ensure GitHub MCP is configured (no Slack MCP needed)
# 2. Run command (on a branch with an open PR)
cursor generate-code-review-slack-command
If some information cannot be extracted from PR, the command will prompt:
cursor generate-code-review-slack-command
# Found PR: https://github.com/comet-ml/opik/pull/1234
# Extracted Jira ticket: OPIK-1234
# Test environment link not found in PR. Enter test environment link (e.g., https://test.opik.com): https://test.opik.com
# Frontend summary not found in PR. Enter frontend summary (one line, optional - press Enter to skip): [Enter pressed - skipped]
# Backend summary not found in PR. Enter backend summary (one line, optional - press Enter to skip): Implemented metrics endpoint
# Python summary not found in PR. Enter Python summary (one line, optional - press Enter to skip): [Enter pressed - skipped]
# TypeScript summary not found in PR. Enter TypeScript summary (one line, optional - press Enter to skip): [Enter pressed - skipped]
# Would you like to customize the message? (Enter any additional text to prepend/append, or press Enter to use default message): [Enter pressed - using default]
cursor generate-code-review-slack-command
# ... extraction steps ...
# Would you like to customize the message? (Enter any additional text to prepend/append, or press Enter to use default message): This PR includes important security updates, please review carefully.
#
# Generated command includes the customization:
# Hi team,
#
# Please review the following PR:
#
# This PR includes important security updates, please review carefully.
#
# :jira_epic: jira link: https://comet-ml.atlassian.net/browse/OPIK-1234
# ...
End Command