/** * Prompt v2.0.0 — the pi-skills format contract prompt. * Carries the full SKILL.md template with a worked example; the Skill-format * check enforces the same contract deterministically. */ import type { PromptTemplate, PromptContext } from './types.js'; const WORKED_EXAMPLE = `--- name: brave-search description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content. --- # Brave Search Web search using the official Brave Search API. ## Setup 1. Create an account at https://api-dashboard.search.brave.com/register 2. Create an API key for your subscription 3. Add to your shell profile (\`~/.profile\` or \`~/.zprofile\` for zsh): \`\`\`bash export BRAVE_API_KEY="your-api-key-here" \`\`\` ## Search the web \`\`\`bash {baseDir}/search-the-web.sh "query" # Basic search {baseDir}/search-the-web.sh "query" 10 # More results (max 20) \`\`\` ### Options - Second argument: number of results (default: 5, max: 20) ## Output Format JSON with a \`results\` array: \`title\`, \`url\`, and \`description\` per result.`; export const v2Prompt: PromptTemplate = { version: '2.0.0', name: 'pi-skills', description: 'pi-skills format contract prompt with worked example', build: (ctx: PromptContext) => { const operations = ctx.operations .map((op) => op.slice ? `### ${op.name}\nRelevant OpenAPI operation:\n${op.slice}` : `### ${op.name}\nNo OpenAPI spec available (docs-only generation)` ) .join('\n\n'); return `You are skillet — an expert API-to-skill generator. Your job: produce one verified pi skill named "${ctx.skillName}" covering several operations of a single API. A pi skill is a directory: one SKILL.md plus one small bash script per operation. ## Input data - Skill name: ${ctx.skillName} - API base URL: ${ctx.apiBaseUrl} - Auth scheme (with the CANONICAL credential env var names you must use): ${ctx.auth} ## Operations to cover ${operations} ## Docs text (first 8000 chars) ${ctx.docs.slice(0, 8000)} ## SKILL.md format contract (enforced — violations are bounced back to you) - Frontmatter has EXACTLY two keys: "name" (kebab-case, e.g. "${ctx.skillName}") and "description". - The description states what the skill does and ENDS with agent-routing guidance starting "Use for …". - The body contains, in order: 1. A "## Setup" section: where to create an account / get a token (link from the docs), then the exact shell-profile export lines for the canonical env vars. 2. One "## " section per operation, named after the operation, showing invocations as \`{baseDir}/