Skip to content

aipoch/open-science / resources/skills/skill-creator

skill-creator

Verified

Create, revise, evaluate, publish, and improve Open-Science Skills through the native JavaScript host.skills composer. Use when the user wants a reusable workflow, an existing Skill changed, test cases or benchmarks for a Skill, or better Skill triggering.

scripts/improve-description.js

View on GitHub
'use strict'
/* eslint-disable @typescript-eslint/explicit-function-return-type */

const buildImprovementPrompt = ({
  skillName,
  skillContent,
  currentDescription,
  evalResults,
  history = []
}) => {
  const failedPositive = evalResults.results.filter(
    (result) => result.should_trigger && !result.pass
  )
  const failedNegative = evalResults.results.filter(
    (result) => !result.should_trigger && !result.pass
  )
  return `Improve the trigger description for the Skill "${skillName}".

Current description:
<current_description>${currentDescription}</current_description>

Should have triggered but did not:
${failedPositive.map((result) => `- ${result.query}`).join('\n') || '- none'}

Should not have triggered but did:
${failedNegative.map((result) => `- ${result.query}`).join('\n') || '- none'}

Previous attempts:
${history.map((attempt) => `- ${attempt.description}`).join('\n') || '- none'}

Skill content:
<skill_content>${skillContent}</skill_content>

Generalize from the failures. Describe user intent, not implementation. Stay under 1024 characters.
Return only <new_description>...</new_description>.`
}

const parseImprovedDescription = (response) => {
  const match = /<new_description>([\s\S]*?)<\/new_description>/i.exec(response)
  const description = (match?.[1] ?? response).trim().replace(/^['"]|['"]$/g, '')
  if (!description) throw new Error('Description improvement returned empty text.')
  if (description.length > 1024) throw new Error('Description improvement exceeds 1024 characters.')
  return description
}

module.exports = { buildImprovementPrompt, parseImprovedDescription }
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall