# How Magic Keywords Trigger Skill Activation in Oh-My-ClaudeCode

> Discover how magic keywords activate skills in Oh-My-ClaudeCode via substring matching. Learn about longest match precedence and explicit $skill invocations.

- Repository: [Bellman/oh-my-claudecode](https://github.com/Yeachan-Heo/oh-my-claudecode)
- Tags: internals
- Published: 2026-03-27

---

**Magic keywords trigger immediate skill activation through case-insensitive substring matching defined in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md), with the longest matching keyword taking precedence and explicit `$skill` invocations overriding automatic detection.**

The oh-my-claudecode framework implements a lightweight parsing layer that scans every user message for **magic keywords** before any other processing occurs. This detection system, configured in the repository's [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) file, serves as the exclusive entry point for the autonomous skill activation pipeline. Understanding how this mechanism identifies triggers, resolves conflicts, and delegates execution is essential for customizing the framework's behavior or troubleshooting unexpected skill invocations.

## How Magic Keyword Detection Works

The detection logic operates as a pure string-matching gate that processes raw user input through specific rules defined in the *keyword_detection* section of [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md).

### Case-Insensitive Substring Scanning

The system performs a **case-insensitive substring search** across the entire user message content. As implemented in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 158-161, the matcher evaluates whether any defined keyword entry exists as a substring within the message text, regardless of capitalization or surrounding context. This scanning happens immediately upon message receipt and precedes all other parsing operations.

When a match occurs, the corresponding **skill** (such as `$ralph`, `$autopilot`, or `$ultrawork`) is selected instantly. The framework does not prompt for confirmation or present disambiguation dialogs—it proceeds directly to activation as specified in the directive: "When the user's message contains a magic keyword, activate the corresponding skill IMMEDIATELY."

### Conflict Resolution and Priority Rules

When multiple keywords match a single message, the framework applies a **longest-match-wins** algorithm. According to [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 176-179, the system selects the most specific (longest) keyword from the candidate matches, ensuring that precise triggers take precedence over generic ones.

However, explicit skill invocations using the `$name` syntax override the automatic keyword detector entirely. As documented in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 179-180, if a user prefixes their message with `$skillname`, the framework bypasses substring scanning and routes directly to the specified skill, regardless of whether other keywords appear in the message.

## The Skill Activation Pipeline

Once detection completes, the framework executes a standardized activation sequence that extracts the task context and loads the appropriate skill definition.

### Immediate Execution Policy

The activation process follows a zero-confirmation policy. Upon keyword identification, the system immediately reads the skill definition file located at `~/.agents/skills/{skill_name}/SKILL.md` and begins executing the workflow defined therein. This behavior, detailed in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 162-174, ensures that matched keywords translate directly to action without intermediate steps.

### Task Extraction Logic

After identifying the triggering keyword, the framework strips that keyword from the original message and passes the remaining text as the **task description** to the activated skill. As noted in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 180-181, this remainder becomes the operational context for the skill's execution. For example, a message containing "ralph fix the login validation" removes the "ralph" keyword and forwards "fix the login validation" as the specific task for the `$ralph` skill to process.

## Practical Implementation Examples

The following examples demonstrate how the detection and activation rules apply in real scenarios:

```text
User:  ralph fix the login validation

# → "ralph" matches the first keyword → $ralph skill is launched

#   Remaining task: "fix the login validation"

User:  I want a full autonomous pipeline for the new API

# → "build me" / "I want a" matches the autopilot entry → $autopilot skill runs

#   Remaining task: "full autonomous pipeline for the new API"

User:  plan this new feature and then ultrawork it

# → "plan this" has higher specificity than "ultrawork" → $plan skill runs first

#   Remaining task: "new feature and then ultrawork it"

User:  $ultrawork migrate the DB schema

# → Explicit "$ultrawork" overrides keyword detection → $ultrawork skill runs

```

## Key Configuration Files

Understanding the detection mechanism requires familiarity with these source files:

- **[`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md)** (*keyword_detection* section): Defines the keyword-to-skill mapping table, case-insensitivity rules, longest-match logic, and the immediate activation policy (lines 158-186).

- **[`skills/ralph/SKILL.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/ralph/SKILL.md)**: Example skill definition invoked when the "ralph" keyword is detected.

- **[`skills/autopilot/SKILL.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/autopilot/SKILL.md)**: Contains the autopilot skill workflow triggered by keywords like "autopilot" or "build me".

- **[`skills/ultrawork/SKILL.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/ultrawork/SKILL.md)**: Houses the ultrawork skill activated by its associated magic keywords.

## Summary

- **Magic keyword detection** relies on case-insensitive substring matching performed immediately upon receiving user input.
- **Conflict resolution** follows a longest-match-wins strategy, with explicit `$skill` syntax taking absolute precedence over automatic detection.
- **Immediate activation** occurs without confirmation prompts, routing directly to the skill defined in `~/.agents/skills/{name}/SKILL.md`.
- **Task extraction** removes the triggering keyword and forwards the remaining message content as the operational context for the skill.
- **Configuration** is centralized in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 158-186, which governs the entire detection-to-activation pipeline.

## Frequently Asked Questions

### What happens if multiple magic keywords appear in one message?

When multiple keywords match simultaneously, the framework selects the **longest matching keyword** to ensure the most specific trigger wins. For example, if "plan this new feature" contains both "plan" and "plan this", the longer phrase takes precedence and activates the `$plan` skill according to [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 176-179.

### Can I override the automatic keyword detection?

Yes. Prefixing your message with an explicit skill invocation using the **`$skillname`** syntax bypasses the automatic substring scanner entirely. As documented in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 179-180, writing `$ultrawork migrate the DB` forces the `$ultrawork` skill to run regardless of other keywords present in the message.

### Does the system ask for confirmation before activating a skill?

No. The framework implements an **immediate activation policy** with no confirmation step. Once a magic keyword is detected, the system proceeds directly to reading the corresponding [`SKILL.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/SKILL.md) file and executing its workflow, as specified in the "activate the corresponding skill IMMEDIATELY" directive in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 158-161.

### Where are skill definitions stored for activated keywords?

Skill definitions reside in the `~/.agents/skills/{skill_name}/` directory, specifically in the [`SKILL.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/SKILL.md) file within that folder. When a keyword triggers activation, the framework reads this file to execute the skill's specific workflow, as described in [`AGENTS.md`](https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/AGENTS.md) lines 162-174.