claude-code-best/src/costrict/skills/strictReview.ts
kingboung 08ad8a55da refactor: strict review variants load skill via Skill tool
Remove embedded files, use Skill tool to load review/security-review
skill instead, matching the same mechanism as /review.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 17:38:56 +08:00

51 lines
1.2 KiB
TypeScript

import { registerBundledSkill } from 'src/skills/bundledSkills.js'
import {
SKILL_METADATA,
} from 'src/costrict/review/skill/builtin.js'
import { getResolvedLanguage } from 'src/utils/language.js'
const LOCALE_MAP: Record<string, string> = { zh: 'zh-CN', en: 'en' }
function getLocale(): string {
const lang = getResolvedLanguage()
return LOCALE_MAP[lang] ?? 'zh-CN'
}
const ALLOWED_TOOLS = [
'Skill',
'Glob',
'Grep',
'Read',
'TodoWrite',
'Bash',
'Agent',
]
function registerStrictReviewSkill(
name: string,
skillKey: string,
description: string,
): void {
registerBundledSkill({
name,
description,
whenToUse: description,
userInvocable: true,
disableModelInvocation: false,
allowedTools: ALLOWED_TOOLS,
async getPromptForCommand(args) {
return [{ type: 'text', text: `Please use the Skill tool to load the \`${skillKey}\` skill.\n\n${args.trim()}` }]
},
})
}
export function registerStrictReviewSkills(): void {
const locale = getLocale()
const localeMetadata = SKILL_METADATA[locale]
if (!localeMetadata) return
for (const [skillKey, meta] of Object.entries(localeMetadata)) {
registerStrictReviewSkill(`strict:${skillKey}`, skillKey, meta.description)
}
}