DEV Community

erin
erin

Posted on

I Built a Claude Code Mod That Lets You Run All Kinds of Actions on Selected Text

Are you using Claude Code?

While working in Claude Code, do you ever find yourself wondering about something only loosely related to the task at hand, like "What does this term mean again?" or "What was the reasoning behind this conclusion?"

If you just ask "By the way, what is X?" in your main session, that side question ends up cluttering the conversation's context. Until now, I'd look it up again in a browser, spin up Claude Code in another terminal to check, or use the /btw command, but personally I never found any of these quite convenient enough.

I want to stay in the terminal as much as possible while I work, so this kind of context switching is a small but constant source of friction.

Then Claude Code Mods arrived, making it possible to extend the terminal UI itself. So I went ahead and built "Quick Actions," a mod that lets you select any text in a response, run an action on it such as translating, explaining, or summarizing, and see the result in a separate pane.


What Are Claude Code Mods?

According to the official documentation, a mod is a plugin that changes how Claude Code looks and behaves, built from JavaScript / TypeScript event handlers (hooks). Because mods run inside the Claude Code process, they can directly add things like panes (panels beside the transcript) and bands above the prompt. Traditional hooks, skills, and MCP servers can't draw UI, so this is the biggest strength unique to mods.

References: Mods overview / Mods reference

What Is Quick Actions?

Quick Actions is a plugin (mod) that lets you run actions with a single click of an icon: on text you've selected in the Claude Code transcript (the part of the screen that shows the conversation), on the conversation itself, or as standalone tasks that use neither.

The basic flow is just three simple steps:

  1. Select text in the transcript with your mouse
  2. Click an icon on the hint row that appears below the prompt
  3. The result shows up in the "Quick Actions" pane

Hovering over an icon shows its label, such as ๐Ÿ’ก "Explain", ๐Ÿ”ค "To English", ๐Ÿ“ "Summarize", ๐Ÿ”Ž "Find the code", ๐Ÿงญ "Recap", or โœ… "Decisions so far". The icons are reordered by how often you use them, so your favorite actions are always within easy reach. Any other action can be picked from the right-hand pane opened via the "โ‹ฏ" at the end of the row.

The "Quick Actions" pane where results appear keeps a history of up to 20 entries, newest first, so it's easy to look back at them later.

Key Features

Three Kinds of Actions, Over 300 in Total

The built-in actions fall into three categories, and there are currently around 300 of them. In the hint row and the dialog opened from "โ‹ฏ", the type of bracket around each icon tells you which kind it is.

Kind Display Target Examples
Selection actions [icon] The selected text Translate, explain, summarize, proofread, walk through code, explain the grounds, convert data
Context actions <icon> The current conversation itself Recap the conversation, decisions so far, next steps, rephrase the last answer, draft a commit message
No-context (standalone) actions {icon} Neither Timer, calendar, calculator, password generator, templates, repository overview

Actions run in one of four modes:

  • complete: Processes only the selected text (or arguments) in a single model call, without including the conversation context
  • fork: Answers in a fork that inherits the current conversation (all context actions use this mode)
  • subagent: A dedicated subagent investigates autonomously using read-only tools (Read / Grep / Glob) and web tools (WebSearch / WebFetch), then answers
  • local: Completes and computes everything inside the plugin itself, without calling an LLM

The /quick-actions Command

You can also run actions directly from a command.

/quick-actions                 # Open the โ‹ฏ dialog
/quick-actions hint            # Show the hint row even with nothing selected
/quick-actions <id> [args]     # Run an action directly by its ID
Enter fullscreen mode Exit fullscreen mode

What I Love About It

1. You Never Have to Leave the Terminal (Claude Code)

No more switching to a browser or another app every time you want to do something small, like "translate this sentence," "find out what this error message means," or "format this JSON."

"Local" actions such as the timer, calculator, ID generator, and date calculations don't call a model, so results appear instantly and consume no tokens. You can even run a Pomodoro timer while you work, all without leaving the terminal.

2. Dig Into and Fact-Check Claude Code's Answers on the Spot

AI answers sometimes lean heavily on jargon or make leaps in context, leaving you wanting to ask "So what does that actually mean?" right as you read them. With Quick Actions, you can select part of an answer and dig deeper with a single click.

  • ๐Ÿ’ก Explain: Breaks down what a term or concept means and why it came up in this context
  • ๐Ÿงพ Why so?: Explains the grounds for the selected statement based on the conversation so far
  • ๐Ÿ“š Check on the web: Fact-checks it via web search
  • ๐Ÿ”Ž Find the code: Looks for where the selected wording or behavior comes from in the current repository
  • ๐Ÿ’ป Walk through code: Walks through the selected code in execution order, laying out its inputs, outputs, and side effects

3. Keep Your Main Context Clean with Forks and a Separate Pane

When you throw a side question into your main session, that exchange stays in the conversation history and needlessly takes up context (tokens) for all subsequent reasoning. Quick Actions is designed to prevent this:

  • Most selection actions use the complete mode, which doesn't include the conversation and sends only the selected text to the model.
  • Actions that target the whole conversation use the Mods API's $.model.fork to answer exactly once in a "forked process" that inherits the current conversation.
  • Results are shown only in the dedicated pane and are never added to the main transcript.

Thanks to this, you can ask things like "Summarize the decisions we've made so far" or "What should we do next?" with the whole conversation taken into account, while the main AI doesn't remember any of it and stays focused on the original task.

Claude Code itself also has /btw, a feature for asking side questions without adding them to the conversation history. I recommend using /btw when you want to ask a quick free-form question, and Quick Actions when you want to run a predefined operation on selected text or look back at past results.

Other Handy Features

  • Most-used first & pinning: Each run is counted, and the more often you use an action, the closer to the front of the UI it appears. You can also pin your favorite actions to the front with the pinActions setting.
  • Adding custom actions (customActions): Just describe an icon, label, prompt, and execution mode in JSON, and you can easily add your own original actions.
[{"id": "haiku-poem", "icon": "๐ŸŽ‹", "label": {"ja": "ไฟณๅฅใซใ™ใ‚‹", "en": "Make a haiku"}, "kind": "complete", "model": "haiku", "maxTokens": 300, "prompt": "Distill the selected text into a single haiku (5-7-5). Write it in the language the user is using, then add one short line explaining the image chosen."}]
Enter fullscreen mode Exit fullscreen mode

The JSON above may look a bit intimidating, but you can simply ask Claude Code:

Add a custom action to quick-actions that turns the selected text into a haiku
Enter fullscreen mode Exit fullscreen mode

and it will put together the JSON and add it for you, so you can freely and easily create as many actions of your own as you like.

Installation

In a Claude Code v2.1.287 or later session, run the following command:

/plugin install quick-actions --marketplace imahiro-t/quick-actions
Enter fullscreen mode Exit fullscreen mode

Even if you haven't added the marketplace yet, this single command adds the marketplace and installs the plugin in one go. After installation, you can change its settings from /config.

Wrapping Up

With the arrival of Claude Code Mods, we can now modify the terminal UI itself. Quick Actions grew out of a frustration of my own: "I want to check Claude Code's answers without leaving the terminal and without polluting the main conversation."

If you often find yourself thinking "I just want to double-check this real quick" during your daily coding, please give it a try. And I'd love for you to try creating custom actions tailored to your own workflow, too.

Top comments (0)