Skip to content

Commit 26cb375

Browse files
Bulat Skill7claude
andcommitted
fix: guard skill loading in prompt to prevent session init crash
Wrap Skill.all() in try/catch so a malformed skill file doesn't crash session initialization. Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 985fc30 commit 26cb375

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎packages/cli/src/session/prompt.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,13 @@ export namespace SessionPrompt {
651651
const system = [...(await SystemPrompt.environment(model)), ...(await InstructionPrompt.system())]
652652

653653
// Automatically load all skills into system prompt
654-
const { Skill } = await import("../skill/skill")
655-
const allSkills = await Skill.all()
656-
for (const skill of allSkills) {
657-
system.unshift(`AVAILABLE SKILL: ${skill.name}\n\n${skill.content}`)
658-
}
654+
try {
655+
const { Skill } = await import("../skill/skill")
656+
const allSkills = await Skill.all()
657+
for (const skill of allSkills) {
658+
system.unshift(`AVAILABLE SKILL: ${skill.name}\n\n${skill.content}`)
659+
}
660+
} catch {}
659661

660662
const format = lastUser.format ?? { type: "text" }
661663
if (format.type === "json_schema") {

0 commit comments

Comments
 (0)