GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): skills named in a Claude question answer now run by snnbotchway · Pull Request #33523 · pingdotgg/t3code

fix(server): skills named in a Claude question answer now run #33523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
snnbotchway wants to merge 8 commits into pingdotgg:main
base: main
Loading
Loading
from snnbotchway:fix/question-dialog-slash-command
+131 −27
Open

fix(server): skills named in a Claude question answer now run #33523

Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
d4ba4f0
fix(server): skills named in a Claude question answer now run
snnbotchway Nov 9, 2026
a3d43d0
fix(server): a typed /skill at the start of a Claude answer runs too
snnbotchway Nov 9, 2026
d552b0f
fix(server): a leading path in a Claude answer keeps its slash
snnbotchway Nov 9, 2026
6c3a3a1
perf(server): plain Claude question answers skip skill discovery
snnbotchway Nov 9, 2026
0669f57
perf(server): amounts and paths in Claude answers skip skill discovery
snnbotchway Nov 9, 2026
d28e985
Merge branch 'main' into fix/question-dialog-slash-command
snnbotchway Nov 12, 2026
2830553
Merge origin/main into fix/question-dialog-slash-command
juliusmarminge Nov 14, 2026
bc0efcb
fix(server): Claude follows user-only skills named in a question answer
juliusmarminge Nov 14, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

24 changes: 20 additions & 4 deletions 24 apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,29 @@ describe("ClaudeAdapterV2 runtime query policy", () => {
],
);
const sdkAnswers: NonNullable<AskUserQuestionInput["answers"]> =
ClaudeAdapterV2.claudeSdkUserInputAnswers({
"Which approach?": ["Simple", "Safe"],
"Deploy now?": "Yes",
});
ClaudeAdapterV2.claudeSdkUserInputAnswers(
{
"Which approach?": ["Simple", "Safe"],
"Deploy now?": "Yes",
"Anything else?": "$wait-what then $review it",
"Typed command?": "/wait-what please",
"A path?": "/srv/wait-what",
"A path and a skill?": "/srv/app then $review it",
},
new Map([
["wait-what", { path: "/skills/wait-what/SKILL.md", userInvocationOnly: true }],
["review", { path: "/skills/review/SKILL.md" }],
]),
);
assert.deepEqual(sdkAnswers, {
"Which approach?": "Simple, Safe",
"Deploy now?": "Yes",
"Anything else?":
"/wait-what [The user invoked this skill. Follow the instructions at: /skills/wait-what/SKILL.md] then /review it",
"Typed command?":
"/wait-what [The user invoked this skill. Follow the instructions at: /skills/wait-what/SKILL.md] please",
"A path?": "/srv/wait-what",
"A path and a skill?": "/srv/app then /review it",
});
assert.isTrue(
ClaudeAdapterV2.ClaudeProviderCapabilitiesV2.planning.supportsStructuredQuestions,
Expand Down
25 changes: 19 additions & 6 deletions 25 apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ import { resolveAttachmentPath } from "../../attachmentStore.ts";
import { snapshotMcpApp } from "../../mcpApps/McpAppSnapshot.ts";
import { resolveClaudeSdkExecutablePath } from "../../provider/Drivers/ClaudeExecutable.ts";
import {
answerMayMentionClaudeSkill,
rewriteClaudeSkillMentionsInAnswer,
planClaudeSkillDispatch,
type ClaudeSkillTarget,
} from "../../provider/Drivers/ClaudeSkillDispatch.ts";
Expand Down Expand Up @@ -4641,15 +4643,19 @@ export function claudeUserInputQuestions(

export function claudeSdkUserInputAnswers(
answers: ProviderUserInputAnswers,
skills: ReadonlyMap<string, ClaudeSkillTarget>,
): NonNullable<AskUserQuestionInput["answers"]> {
return Object.fromEntries(
Object.entries(answers).map(([question, answer]) => [
question,
Array.isArray(answer)
? answer.filter((value): value is string => typeof value === "string").join(", ")
: typeof answer === "string"
? answer
: String(answer ?? ""),
rewriteClaudeSkillMentionsInAnswer(
Array.isArray(answer)
? answer.filter((value): value is string => typeof value === "string").join(", ")
: typeof answer === "string"
? answer
: String(answer ?? ""),
skills,
),
]),
);
}
Expand Down Expand Up @@ -10431,7 +10437,14 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
behavior: "allow",
updatedInput: {
questions: toolInput.questions,
answers: claudeSdkUserInputAnswers(resolvedAnswers),
answers: claudeSdkUserInputAnswers(
resolvedAnswers,
Object.values(claudeSdkUserInputAnswers(resolvedAnswers, new Map())).some(
answerMayMentionClaudeSkill,
)
? yield* userInvocableSkills(context.input.runtimePolicy.cwd)
: new Map(),
),
},
toolUseID: callbackOptions.toolUseID,
} satisfies PermissionResult);
Expand Down
18 changes: 17 additions & 1 deletion 18 apps/server/src/provider/Drivers/ClaudeSkillDispatch.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { describe, expect, it } from "vite-plus/test";

import { planClaudeSkillDispatch, type ClaudeSkillTarget } from "./ClaudeSkillDispatch.ts";
import {
answerMayMentionClaudeSkill,
planClaudeSkillDispatch,
rewriteClaudeSkillMentionsInAnswer,
type ClaudeSkillTarget,
} from "./ClaudeSkillDispatch.ts";

const skillPath = (name: string) => `/home/me/.claude/skills/${name}/SKILL.md`;

Expand Down Expand Up @@ -83,4 +88,15 @@ describe("planClaudeSkillDispatch", () => {
commandText: "/implement the fixes",
});
});

it("pre-check passes every answer the rewrite would change", () => {
const userOnly = new Map([["review", { path: skillPath("review"), userInvocationOnly: true }]]);
for (const answer of ["$review", "ok €review now", "/review", "\n /review it"]) {
expect(rewriteClaudeSkillMentionsInAnswer(answer, userOnly)).not.toBe(answer);
expect(answerMayMentionClaudeSkill(answer)).toBe(true);
}
for (const answer of ["Yes", "Simple, Safe", "see docs/review", ""]) {
expect(answerMayMentionClaudeSkill(answer)).toBe(false);
}
});
});
68 changes: 51 additions & 17 deletions 68 apps/server/src/provider/Drivers/ClaudeSkillDispatch.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,74 @@ export interface ClaudeSkillDispatch {
readonly commandText: string;
}

export function planClaudeSkillDispatch(
prompt: string,
skills: ReadonlyMap<string, ClaudeSkillTarget>,
): ClaudeSkillDispatch | undefined {
const mentions = [...prompt.matchAll(SKILL_MENTION_PATTERN)].flatMap((match) => {
function matchSkillMentions(prompt: string, skills: ReadonlyMap<string, ClaudeSkillTarget>) {
return [...prompt.matchAll(SKILL_MENTION_PATTERN)].flatMap((match) => {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

const name = match[2] ?? "";
const skill = skills.get(name);
if (!skill) return [];
const start = (match.index ?? 0) + (match[1]?.length ?? 0);
return [{ name, skill, start, end: (match.index ?? 0) + match[0].length }];
});
const last = mentions.at(-1);
if (!last) {
return undefined;
}
}

// Only the final skill gets native expansion. Earlier user-only skills need
// a fallback to their raw file because Claude's Skill tool refuses them.
const annotated = new Set([last.name]);
let promptWithInlineSlashes = "";
// Claude's Skill tool refuses user-only skills, so any mention Claude will not
// expand natively points at the skill's raw file instead.
function inlineSkillMentions(
prompt: string,
mentions: ReturnType<typeof matchSkillMentions>,
nativelyExpanded: string | undefined,
): string {
const annotated = new Set(nativelyExpanded === undefined ? [] : [nativelyExpanded]);
let text = "";
let cursor = 0;
for (const mention of mentions) {
promptWithInlineSlashes += `${prompt.slice(cursor, mention.start)}/${mention.name}`;
text += `${prompt.slice(cursor, mention.start)}/${mention.name}`;
if (mention.skill.userInvocationOnly === true && !annotated.has(mention.name)) {
promptWithInlineSlashes += ` [The user invoked this skill. Follow the instructions at: ${mention.skill.path}]`;
text += ` [The user invoked this skill. Follow the instructions at: ${mention.skill.path}]`;
annotated.add(mention.name);
}
cursor = mention.end;
}
promptWithInlineSlashes = `${promptWithInlineSlashes}${prompt.slice(cursor)}`.trimEnd();
return `${text}${prompt.slice(cursor)}`.trimEnd();
}

export function planClaudeSkillDispatch(
prompt: string,
skills: ReadonlyMap<string, ClaudeSkillTarget>,
): ClaudeSkillDispatch | undefined {
const mentions = matchSkillMentions(prompt, skills);
const last = mentions.at(-1);
if (!last) {
return undefined;
}
return {
leadingText:
prompt.slice(0, last.start).trim().length > 0 ? promptWithInlineSlashes : undefined,
prompt.slice(0, last.start).trim().length > 0
? inlineSkillMentions(prompt, mentions, last.name)
: undefined,
commandText: `/${last.name}${prompt.slice(last.end)}`.trimEnd(),
};
}

/** Cheap pre-check so an answer with no skill syntax skips skill discovery. */
export function answerMayMentionClaudeSkill(answer: string): boolean {
return /\p{Sc}|^\s*\//u.test(answer);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

}

/** Tool results never expand skills, so an answer only names them for the agent to run. */
export function rewriteClaudeSkillMentionsInAnswer(
answer: string,
skills: ReadonlyMap<string, ClaudeSkillTarget>,
): string {
// A leading `/name` invokes a skill in the composer, so it counts here too.
const leadingSlash = /^(\s*)\/(?=\S)/.exec(answer);
if (leadingSlash) {
const asMention = `${leadingSlash[1]}$${answer.slice(leadingSlash[0].length)}`;
const mentions = matchSkillMentions(asMention, skills);
if (mentions[0]?.start === leadingSlash[1]?.length) {
return inlineSkillMentions(asMention, mentions, undefined);
}
}
const mentions = matchSkillMentions(answer, skills);
return mentions.length === 0 ? answer : inlineSkillMentions(answer, mentions, undefined);
}
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.