generateVerifierSkillTemplate function

String generateVerifierSkillTemplate({
  1. required String verifierName,
  2. required String description,
  3. required VerifierType type,
  4. required String projectContext,
  5. required String setupInstructions,
  6. String? authenticationSection,
})

Generate a SKILL.md template for a verifier.

Implementation

String generateVerifierSkillTemplate({
  required String verifierName,
  required String description,
  required VerifierType type,
  required String projectContext,
  required String setupInstructions,
  String? authenticationSection,
}) {
  final buf = StringBuffer();

  // Frontmatter
  buf.writeln('---');
  buf.writeln('name: $verifierName');
  buf.writeln('description: $description');
  buf.writeln('allowed-tools:');
  buf.writeln(allowedToolsYaml(type));
  buf.writeln('---');
  buf.writeln();

  // Title
  buf.writeln('# ${_titleCase(verifierName.replaceAll('-', ' '))}');
  buf.writeln();
  buf.writeln(
    'You are a verification executor. You receive a verification plan '
    'and execute it EXACTLY as written.',
  );
  buf.writeln();

  // Project Context
  buf.writeln('## Project Context');
  buf.writeln(projectContext);
  buf.writeln();

  // Setup Instructions
  buf.writeln('## Setup Instructions');
  buf.writeln(setupInstructions);
  buf.writeln();

  // Authentication (optional)
  if (authenticationSection != null && authenticationSection.isNotEmpty) {
    buf.writeln('## Authentication');
    buf.writeln(authenticationSection);
    buf.writeln();
  }

  // Reporting
  buf.writeln('## Reporting');
  buf.writeln();
  buf.writeln(
    'Report PASS or FAIL for each step using the format specified in '
    'the verification plan.',
  );
  buf.writeln();

  // Cleanup
  buf.writeln('## Cleanup');
  buf.writeln();
  buf.writeln('After verification:');
  buf.writeln('1. Stop any dev servers started');
  buf.writeln('2. Close any browser sessions');
  buf.writeln('3. Report final summary');
  buf.writeln();

  // Self-Update
  buf.writeln('## Self-Update');
  buf.writeln();
  buf.writeln(
    'If verification fails because this skill\'s instructions are outdated '
    '(dev server command/port/ready-signal changed, etc.) -- not because the '
    'feature under test is broken -- or if the user corrects you mid-run, use '
    'AskUserQuestion to confirm and then Edit this SKILL.md with a minimal '
    'targeted fix.',
  );

  return buf.toString();
}