Skip to main content
Glama

generate_skill

Destructive

Generate Claude skills by analyzing repeated feedback patterns. Clusters failures by tags and creates SKILL.md files with actionable DO/INSTEAD rules.

Instructions

Auto-generate Claude skills from repeated feedback patterns. Clusters failure patterns by tags and produces SKILL.md files with DO/INSTEAD rules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
minOccurrencesNoMinimum pattern occurrences to trigger skill generation (default 3)
tagsNoFilter to specific tags

Implementation Reference

  • The handler for 'generate_skill' which calls the `generateSkills` function imported from `scripts/skill-generator.js`.
    case 'generate_skill':
      return toTextResult({
        skills: generateSkills({
          minClusterSize: Number(args.minOccurrences || 3),
        }).filter((entry) => {
          if (!Array.isArray(args.tags) || args.tags.length === 0) return true;
          return args.tags.some((tag) => entry.skillName.includes(String(tag)));
        }),
      });
  • The core implementation of the skill generation logic, which processes feedback, clusters it, and writes SKILL.md files.
    function generateSkills(options) {
      if (!options) options = {};
      const feedbackDir = options.feedbackDir || discoverFeedbackDir();
      const minClusterSize = options.minClusterSize || MIN_CLUSTER_SIZE;
      const minTagOverlap = options.minTagOverlap || MIN_TAG_OVERLAP;
      const dryRun = options.dryRun || false;
    
      const logPath = path.join(feedbackDir, 'feedback-log.jsonl');
      const outputDir = path.join(feedbackDir, 'generated-skills');
      const auditLogPath = path.join(feedbackDir, 'skill-generation-audit.jsonl');
    
      const entries = parseFeedbackFile(logPath);
      if (entries.length === 0) return [];
    
      // Separate positive and negative entries
      const posEntries = [];
      const negEntries = [];
      for (const entry of entries) {
        const cls = classifySignal(entry);
        if (cls === 'positive') posEntries.push(entry);
        else if (cls === 'negative') negEntries.push(entry);
      }
    
      if (negEntries.length === 0) return [];
    
      // Cluster negative feedback by tag overlap
      const clusters = clusterByTags(negEntries, minTagOverlap);
    
      const results = [];
    
      for (const [key, cluster] of clusters) {
        if (cluster.entries.length < minClusterSize) continue;
    
        // Compute domain-scoped approval rate
        const clusterTags = cluster.tags;
        let domainPos = 0;
        const domainNeg = cluster.entries.length;
        for (const pe of posEntries) {
          if (tagOverlap(extractTags(pe), clusterTags) >= 1) domainPos++;
        }
        const domainTotal = domainPos + domainNeg;
        const approvalRate = domainTotal > 0
          ? `${((domainPos / domainTotal) * 100).toFixed(1)}%`
          : '0.0%';
    
        const doRules = buildDoRules(posEntries, clusterTags);
        const insteadRules = buildInsteadRules(cluster.entries);
        const ruleCount = doRules.length + insteadRules.length;
    
        const skillContent = generateSkillFromCluster({
          tags: clusterTags,
          entries: cluster.entries,
          doRules,
          insteadRules,
          approvalRate,
        });
    
        const skillName = slugify(clusterTags.slice(0, 3).join('-')) || 'unnamed';
        const fileName = `${skillName}.SKILL.md`;
        const filePath = path.join(outputDir, fileName);
    
        if (!dryRun) {
          ensureDir(outputDir);
          fs.writeFileSync(filePath, skillContent, 'utf8');
    
          // Audit log
          appendJSONL(auditLogPath, {
            event: 'skill_generated',
            skillName,
            filePath,
            ruleCount,
            evidenceCount: cluster.entries.length,
            tags: clusterTags,
            approvalRate,
            timestamp: new Date().toISOString(),
          });
        }
    
        results.push({
          skillName,
          filePath,
          ruleCount,
          evidenceCount: cluster.entries.length,
        });
      }
    
      return results;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations indicate destructiveHint=true, which the description doesn't explicitly address, though 'Auto-generate' implies creation rather than destruction. The description adds useful context about clustering failure patterns and outputting SKILL.md files, but doesn't detail side effects, permissions, or rate limits beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, dense sentence with zero waste—each clause contributes essential information about the tool's function, process, and output. It's front-loaded with the core action and efficiently structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the destructiveHint annotation and lack of output schema, the description adequately covers the tool's purpose and output format (SKILL.md files). However, it doesn't address behavioral risks implied by destructiveHint or provide usage context, leaving gaps for a tool with potential side effects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters. The description adds no additional parameter semantics beyond implying pattern-based filtering with 'repeated feedback patterns' and 'tags', which aligns with but doesn't enhance the schema's details on minOccurrences and tags.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Auto-generate', 'Clusters', 'produces') and resources ('Claude skills', 'SKILL.md files'), distinguishing it from siblings like 'capture_feedback' or 'feedback_summary' by focusing on skill generation rather than feedback collection or analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'repeated feedback patterns' but doesn't specify prerequisites, exclusions, or recommend other tools for related tasks like 'feedback_stats' or 'diagnose_failure', leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IgorGanapolsky/mcp-memory-gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server