diff --git a/src/detect.ts b/src/detect.ts new file mode 100644 index 0000000..a7401d6 --- /dev/null +++ b/src/detect.ts @@ -0,0 +1,8 @@ +/** Raw `/skill:name` at start of user input (SPEC ยง6.2 #1). */ +const SLASH_SKILL_RE = /^\/skill:([a-z0-9-]+)/; + +/** Returns skill name when text is a slash skill command, else null. */ +export function detectSlashSkill(text: string): string | null { + const match = SLASH_SKILL_RE.exec(text); + return match?.[1] ?? null; +}