Use Code Writer for code suggestions
Code Writer lets you turn Slack conversations, incidents, and escalations into draft pull requests in GitHub without leaving Slack. You can ask Glean to propose code changes based on channel messages, tickets, or stack traces, and Code Writer opens a draft pull request with the proposed fix.
Code Writer in Slack must be turned on by your Glean admin. If it isn't available, share the Slack Code Writer admin guide with them.
How to use Code Writer
- In a Slack channel where Glean is active, mention
@Gleanand describe the code change you need. - Provide context such as error messages, stack traces, ticket IDs, or the repository name.
- Glean reads the conversation, uses Code Writer to propose a fix, and posts a draft pull request URL and summary back to the channel.
- Review and merge the pull request in GitHub following your team's existing review and CI processes.
Usage examples
Handle escalations in Slack
Use Code Writer in an escalation channel to propose fixes as part of your incident workflow.
- An on-call engineer posts an error and stack trace in
#prod-escalations. - A teammate mentions Glean in Slack and asks: 'Use Code Writer to propose a fix for this error in the
payments-servicerepo.' - Glean:
- Reads the message and any attached logs.
- Uses Code Writer to propose a fix in the configured repository and branch.
- Posts a draft pull request URL and summary back to
#prod-escalations.
Engineers review and merge the pull request in GitHub, following existing review and CI processes.
Run a Code Writer agent from Slack
If you have an agent with a Code Writer step:
- In Slack, start a conversation with Glean or use the Glean app in a channel.
- Trigger the agent (for example, by name or via a message shortcut, depending on your configuration).
- Provide the required inputs (such as a ticket ID or error summary).
- The agent runs, calls Code Writer as part of its steps, and returns the new pull request link in Slack.
This is useful for:
- Jira bug-fix agents.
- Backlog cleanup agents.
- Internal tools that should be accessible from Slack.
First-time setup
On first use, you need to connect your GitHub account:
- When you trigger Code Writer for the first time, Glean prompts you to authorize via GitHub OAuth.
- Complete the OAuth flow to connect your GitHub account.
- After authorization, Code Writer creates pull requests on your behalf.
This is a one-time step. After you connect your account, Code Writer works automatically in future requests.
See also
- Code Writer overview — capabilities and security considerations.
- Set up Code Writer actions — admin configuration for Code Writer.
- Code Writer in Agent Builder — how to add Code Writer to agents.
- Code generation in Assistant — end-user guide for code generation in chat.