Skip to content

AGI-comming/functional-skill-creator / skills/fskill-creator/sub-skills/migrate

fskill-creator-migrate

Verified

Migrate lane for fskill-creator; analyzes a legacy skill directory into behavior map, function split proposal, and source evidence.

scripts/lint_skill.mjs

View on GitHub
import { readdir, readFile, stat } from 'node:fs/promises';
import path from 'node:path';

export const REQUIRED_DIRS = [
  'functions',
  'references',
  'scripts',
  'testcases/unit'
];

async function pathExists(filePath) {
  try {
    await stat(filePath);
    return true;
  } catch {
    return false;
  }
}

async function listMarkdownFiles(dirPath) {
  if (!(await pathExists(dirPath))) return [];
  const entries = await readdir(dirPath, { withFileTypes: true });
  return entries
    .filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
    .map((entry) => path.join(dirPath, entry.name));
}

export async function lintFunctionalSkill(rootDir) {
  const errors = [];
  const warnings = [];
  const skillPath = path.join(rootDir, 'SKILL.md');
  if (!(await pathExists(skillPath))) {
    errors.push({ code: 'MISSING_SKILL', message: '缺少 SKILL.md。' });
  }
  for (const dir of REQUIRED_DIRS) {
    if (!(await pathExists(path.join(rootDir, dir)))) {
      errors.push({ code: 'MISSING_DIR', message: `缺少 ${dir}/。` });
    }
  }
  const functionFiles = await listMarkdownFiles(path.join(rootDir, 'functions'));
  if (functionFiles.length === 0) {
    warnings.push({ code: 'NO_FUNCTIONS', message: '未找到 function contracts。' });
  }
  for (const functionFile of functionFiles) {
    const text = await readFile(functionFile, 'utf8');
    for (const section of ['## Purpose', '## Input', '## Output', '## Logic']) {
      if (!text.includes(section)) {
        errors.push({
          code: 'FUNCTION_CONTRACT_INCOMPLETE',
          message: `${path.relative(rootDir, functionFile)} 缺少 ${section}。`
        });
      }
    }
  }
  return { ok: errors.length === 0, errors, warnings, functionCount: functionFiles.length };
}

if (import.meta.url === `file://${process.argv[1]}`) {
  const dir = path.resolve(process.argv[2] || '.');
  lintFunctionalSkill(dir)
    .then((result) => {
      process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
      if (!result.ok) process.exitCode = 1;
    })
    .catch((error) => {
      console.error(error.message);
      process.exitCode = 1;
    });
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 468kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 321kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 321kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 321kUpdated Claude CodeCodexVerifiedInstall