Skip to content

Commit 529c0bf

Browse files
balzssclaude
andcommitted
chore: refactor slash commands to address PR review feedback
Split /ticket and /slack commands to better handle different use cases: - Add /slack command for interactive Slack thread handling - Analyzes threads and asks user: create ticket or generate response - Prevents automatic ticket creation for questions (addresses review feedback) - Update /ticket to support multiple input types - Slack thread URLs (via inst-ai) - GitHub issue URLs (via gh CLI) - Plain text descriptions - Fix /pr command heredoc example with complete template - Update .gitignore to track /slack command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 69ef68a commit 529c0bf

File tree

4 files changed

+242
-70
lines changed

4 files changed

+242
-70
lines changed

.claude/commands/pr.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ All PRs must include:
3939
- Present the analysis to user
4040
- Draft a single comprehensive commit message covering all changes
4141
- Ask for confirmation before squashing
42-
- Squash with: `git reset --soft master && git commit -m "$(cat <<'EOF'...EOF)"`
42+
- Squash with: `git reset --soft master && git commit -m "$(cat <<'EOF'
43+
chore: add new feature
44+
45+
Add comprehensive feature implementation with tests and documentation.
46+
47+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
48+
49+
Co-Authored-By: Claude <noreply@anthropic.com>
50+
EOF
51+
)"`
4352

4453
3. Run `git status` to check current branch and remote tracking
4554
4. Run `git log master..HEAD` to see all commits that will be in the PR

.claude/commands/slack.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
description: Analyze Slack support threads and optionally create tickets or generate responses
3+
---
4+
5+
Handle Slack support threads interactively - fetch thread content, analyze it, and ask the user whether to create a Jira ticket or generate a response.
6+
7+
## Requirements
8+
9+
- Slack thread URL is required as argument
10+
- inst-ai tool must be installed globally (`npm install -g github:instructure/inst-ai-tool`)
11+
- Configuration must be set up (see inst-ai documentation)
12+
13+
## Process
14+
15+
1. **Extract Slack conversation**:
16+
- Run `inst-ai slack "<slack-url>" --format xml --include-metadata --include-codesandbox`
17+
- This extracts the conversation in LLM-friendly XML format with full context
18+
19+
2. **Analyze the conversation**:
20+
- Parse the Slack conversation to understand:
21+
- The core topic or question
22+
- Whether it's a support request, bug report, feature request, or general question
23+
- Relevant technical details and context
24+
- Any mentioned components or file paths
25+
- User expectations and requirements
26+
- Screenshots or CodeSandbox links
27+
28+
3. **Present analysis to user**:
29+
- Show a summary of the Slack thread:
30+
- Main topic/question
31+
- Type of conversation (question, bug, feature request, etc.)
32+
- Key participants and dates
33+
- Important technical details
34+
- Display relevant excerpts from the conversation
35+
36+
4. **Ask user for action**:
37+
- Present two options:
38+
1. **Create Jira ticket** - If this is an actionable item (bug, feature request, task)
39+
2. **Generate response** - If this is a question or discussion that needs a reply
40+
- Use the AskUserQuestion tool to get the user's choice
41+
42+
5. **Execute chosen action**:
43+
44+
### If user chooses "Create Jira ticket":
45+
- Draft a Jira ticket:
46+
- **Summary**: Brief, clear title (max 100 chars)
47+
- **Description**: Include:
48+
- What: Clear description of the issue/feature
49+
- Why: Context from the Slack conversation
50+
- Where: Affected components/files (if identified)
51+
- How to reproduce: Steps if it's a bug
52+
- Expected behavior: What should happen
53+
- Link to original Slack thread
54+
- **Issue Type**: Determine type (Bug, Task, or Story)
55+
- Show draft to user for confirmation
56+
- **DO NOT create ticket without explicit user confirmation**
57+
- Create ticket using `inst-ai jira create`
58+
- Return the created Jira ticket URL
59+
60+
### If user chooses "Generate response":
61+
- Analyze the question/discussion thoroughly
62+
- Research the codebase if needed to provide accurate information
63+
- Generate a helpful, accurate response that:
64+
- Directly addresses the question or discussion point
65+
- Includes relevant code examples if applicable
66+
- References appropriate documentation
67+
- Provides clear next steps or recommendations
68+
- Present the response to the user
69+
- User can then copy/paste to Slack or ask for modifications
70+
71+
## Important Notes
72+
73+
- **Detect conversation type** - Questions shouldn't automatically become tickets
74+
- **Always analyze the full thread** - Don't miss context from replies
75+
- **Include Slack URL in tickets** - For traceability
76+
- **Research before responding** - Use codebase knowledge for accurate answers
77+
- **Ask for clarification** - If conversation is unclear, ask user for guidance
78+
79+
## Example Workflow
80+
81+
```bash
82+
# Extract Slack conversation
83+
inst-ai slack "https://instructure.slack.com/archives/C123/p456" --format xml --include-metadata --include-codesandbox
84+
85+
# Based on analysis, either:
86+
87+
# Option 1: Create ticket (after user confirms)
88+
inst-ai jira create --summary "Button: Click handler not firing on mobile" \
89+
--description "Issue reported in Slack: ..." \
90+
--type Bug
91+
92+
# Option 2: Generate response for user to post
93+
# (Claude generates response based on analysis and codebase research)
94+
```
95+
96+
## Error Handling
97+
98+
- If Slack URL is invalid or inaccessible, inform user and ask for correct URL
99+
- If inst-ai is not installed, provide installation instructions
100+
- If configuration is missing, direct user to run `inst-ai config validate`
101+
- If ticket creation fails, show error and suggest troubleshooting steps

.claude/commands/ticket.md

Lines changed: 130 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,157 @@
11
---
2-
description: Create Jira ticket from Slack thread URL using inst-ai
2+
description: Create Jira ticket from Slack thread, GitHub issue, or text description
33
---
44

5-
Create a Jira ticket from a Slack conversation using inst-ai tool with InstUI conventions.
5+
Create a Jira ticket from multiple sources using inst-ai tool with InstUI conventions.
66

77
## Requirements
88

9-
- Slack thread URL is required as argument
9+
- Input source is required as argument:
10+
- Slack thread URL (e.g., `https://instructure.slack.com/archives/C123/p456`)
11+
- GitHub issue URL (e.g., `https://github.com/instructure/instructure-ui/issues/123`)
12+
- Textual description (plain text describing the issue)
1013
- inst-ai tool must be installed globally (`npm install -g github:instructure/inst-ai-tool`)
14+
- GitHub CLI (`gh`) must be installed for GitHub issue fetching
1115
- Configuration must be set up (see inst-ai documentation)
1216

1317
## Process
1418

15-
1. **Extract Slack conversation**:
16-
- Run `inst-ai slack "<slack-url>" --format xml --include-metadata --include-codesandbox`
17-
- This extracts the conversation in LLM-friendly XML format with full context
18-
19-
2. **Analyze the conversation**:
20-
- Parse the Slack conversation to identify:
21-
- The core issue or request
22-
- Relevant technical details
23-
- Any mentioned components or file paths
24-
- User expectations and requirements
25-
- Screenshots or CodeSandbox links
26-
27-
3. **Draft Jira ticket**:
28-
- **Summary**: Brief, clear title describing the issue (max 100 chars)
29-
- **Description**: Detailed description including:
30-
- What: Clear description of the issue/feature
31-
- Why: Context from the Slack conversation
32-
- Where: Affected components/files (if identified)
33-
- How to reproduce: Steps if it's a bug
34-
- Expected behavior: What should happen
35-
- Additional context: Links to Slack thread, screenshots, etc.
36-
- **Issue Type**: Determine appropriate type:
37-
- `Bug`: Something is broken or not working as intended
38-
- `Task`: Work that needs to be done (improvements, updates)
39-
- `Story`: New feature or functionality
40-
- **Component Detection**:
41-
- Analyze conversation for component mentions (e.g., "Button", "Select", "Modal")
42-
- Map to package paths (e.g., ui-button, ui-select)
43-
- Include in ticket description
44-
45-
4. **Use inst-ai templates**:
46-
- Templates are located in `.inst-ai/templates/jira` (configured in inst-ai.config.mjs)
47-
- Common templates: `bugReport`, `featureRequest`
48-
- Use `--template <name>` flag when appropriate
49-
- Templates ensure consistent ticket formatting
50-
51-
5. **Present draft to user**:
52-
- Show the complete ticket draft
53-
- Display summary, description, issue type, components
54-
- Ask user to confirm or request modifications
55-
- **DO NOT create ticket without explicit user confirmation**
56-
57-
6. **Create ticket**:
58-
- Once confirmed, use `inst-ai jira create` with the drafted content
59-
- If using a template: `inst-ai jira create --template bugReport --content '<json-data>'`
60-
- If custom: `inst-ai jira create --summary "..." --description "..." --type Bug`
61-
- Include link to original Slack thread in description
62-
63-
7. **Return ticket URL**:
64-
- Display the created Jira ticket URL
65-
- Confirm successful creation
19+
### 1. Determine Input Type
20+
21+
Analyze the input to determine its type:
22+
- **Slack URL**: Contains `slack.com/archives/`
23+
- **GitHub URL**: Contains `github.com/.../issues/`
24+
- **Text description**: Everything else
25+
26+
### 2. Extract Content Based on Type
27+
28+
#### For Slack URLs:
29+
- Run `inst-ai slack "<slack-url>" --format xml --include-metadata --include-codesandbox`
30+
- This extracts the conversation in LLM-friendly XML format with full context
31+
32+
#### For GitHub URLs:
33+
- Extract owner, repo, and issue number from URL
34+
- Use `gh issue view <number> --repo <owner>/<repo> --json title,body,labels,comments`
35+
- Parse the JSON response to get issue details
36+
37+
#### For Text Descriptions:
38+
- Use the provided text directly as the issue description
39+
- No fetching needed
40+
41+
### 3. Analyze the Content
42+
43+
Parse the extracted content to identify:
44+
- The core issue or request
45+
- Relevant technical details
46+
- Any mentioned components or file paths
47+
- User expectations and requirements
48+
- Screenshots, CodeSandbox links, or other attachments
49+
- For GitHub issues: existing labels and comments
50+
51+
### 4. Draft Jira Ticket
52+
53+
- **Summary**: Brief, clear title describing the issue (max 100 chars)
54+
- For GitHub issues: Use the original issue title or adapt it
55+
- For Slack/text: Create a concise, descriptive title
56+
57+
- **Description**: Detailed description including:
58+
- What: Clear description of the issue/feature
59+
- Why: Context from the source (Slack conversation, GitHub discussion, or provided text)
60+
- Where: Affected components/files (if identified)
61+
- How to reproduce: Steps if it's a bug
62+
- Expected behavior: What should happen
63+
- Additional context: Links to source (Slack thread, GitHub issue), screenshots, etc.
64+
65+
- **Issue Type**: Determine appropriate type:
66+
- `Bug`: Something is broken or not working as intended
67+
- `Task`: Work that needs to be done (improvements, updates)
68+
- `Story`: New feature or functionality
69+
- For GitHub issues: Consider existing labels to determine type
70+
71+
- **Component Detection**:
72+
- Analyze content for component mentions (e.g., "Button", "Select", "Modal")
73+
- Map to package paths (e.g., ui-button, ui-select)
74+
- Include in ticket description
75+
76+
### 5. Use inst-ai Templates (Optional)
77+
78+
- Templates are located in `.inst-ai/templates/jira` (configured in inst-ai.config.mjs)
79+
- Common templates: `bugReport`, `featureRequest`
80+
- Use `--template <name>` flag when appropriate
81+
- Templates ensure consistent ticket formatting
82+
83+
### 6. Present Draft to User
84+
85+
- Show the complete ticket draft
86+
- Display summary, description, issue type, components
87+
- Show the source (Slack URL, GitHub issue URL, or text)
88+
- Ask user to confirm or request modifications
89+
- **DO NOT create ticket without explicit user confirmation**
90+
91+
### 7. Create Ticket
92+
93+
Once confirmed, use `inst-ai jira create` with the drafted content:
94+
- If using a template: `inst-ai jira create --template bugReport --content '<json-data>'`
95+
- If custom: `inst-ai jira create --summary "..." --description "..." --type Bug`
96+
- **Always include link to original source in description** (Slack thread or GitHub issue)
97+
98+
### 8. Return Ticket URL
99+
100+
- Display the created Jira ticket URL
101+
- Confirm successful creation
102+
- Show the mapping: source → Jira ticket
66103

67104
## Important Notes
68105

69-
- **Always analyze the full Slack thread** - don't miss important context from replies
70-
- **Include Slack thread URL in ticket** - for future reference and traceability
71-
- **Component detection is optional** - skip with `--no-component-detection` for non-code issues
72-
- **Use dry-run for testing** - `inst-ai ticket "<url>" --dry-run-jira` previews without creating
73-
- **Handle CodeSandbox content** - if conversation includes CodeSandbox, extract and reference it
74-
- **Ask for clarification** - if conversation is unclear, ask user before creating ticket
106+
- **Always analyze full content** - For Slack threads: don't miss context from replies. For GitHub: include comments.
107+
- **Include source URL in ticket** - Always link back to Slack thread or GitHub issue for traceability
108+
- **Component detection is optional** - Skip for non-code issues
109+
- **Use dry-run for testing** - `inst-ai jira create --dry-run` previews without creating
110+
- **Handle attachments** - Extract and reference CodeSandbox links, screenshots, etc.
111+
- **Ask for clarification** - If content is unclear or ambiguous, ask user before creating ticket
112+
- **Detect input type automatically** - Parse the input to determine if it's Slack, GitHub, or text
113+
114+
## Example Workflows
75115

76-
## Example Workflow
116+
### From Slack Thread
77117

78118
```bash
79119
# Extract Slack conversation
80120
inst-ai slack "https://instructure.slack.com/archives/C123/p456" --format xml --include-metadata --include-codesandbox
81121

82-
# After analysis, create ticket with confirmation
122+
# After analysis, create ticket
83123
inst-ai jira create --summary "Button: Click handler not firing on mobile" \
84-
--description "Issue reported in Slack thread..." \
124+
--description "Issue reported in Slack: https://instructure.slack.com/archives/C123/p456\n\n..." \
85125
--type Bug
126+
```
127+
128+
### From GitHub Issue
86129

87-
# Or use template
88-
inst-ai jira create --template bugReport --content '{"summary":"...","description":"...","issueType":"Bug"}'
130+
```bash
131+
# Fetch GitHub issue
132+
gh issue view 123 --repo instructure/instructure-ui --json title,body,labels,comments
133+
134+
# After analysis, create ticket
135+
inst-ai jira create --summary "Add dark mode support to Modal component" \
136+
--description "Feature request from GitHub: https://github.com/instructure/instructure-ui/issues/123\n\n..." \
137+
--type Story
138+
```
139+
140+
### From Text Description
141+
142+
```bash
143+
# User provides text directly, create ticket after drafting
144+
inst-ai jira create --summary "Select component: Dropdown not closing on blur" \
145+
--description "User reported issue:\n\nThe Select component dropdown remains open..." \
146+
--type Bug
89147
```
90148

91149
## Error Handling
92150

93-
- If Slack URL is invalid or inaccessible, inform user and ask for correct URL
94-
- If inst-ai is not installed, provide installation instructions
95-
- If configuration is missing, direct user to run `inst-ai config validate`
96-
- If ticket creation fails, show error and suggest using `--dry-run-jira` to debug
151+
- **Invalid Slack URL**: Inform user and ask for correct URL
152+
- **Invalid GitHub URL**: Inform user and ask for correct URL or issue number
153+
- **GitHub CLI not installed**: Provide installation instructions (`gh` is required)
154+
- **inst-ai not installed**: Provide installation instructions (`npm install -g github:instructure/inst-ai-tool`)
155+
- **Configuration missing**: Direct user to run `inst-ai config validate`
156+
- **Ticket creation fails**: Show error and suggest using `--dry-run` to debug
157+
- **Ambiguous text input**: Ask user for clarification or more details

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ tsconfig.build.tsbuildinfo
3434
!.claude/commands/pr.md
3535
!.claude/commands/ticket.md
3636
!.claude/commands/plan.md
37+
!.claude/commands/slack.md
3738

3839
# Playwright MCP
3940
.playwright-mcp

0 commit comments

Comments
 (0)