From 2b8019272a32a9dc0fa901f7c4194dd40e55d3e8 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 6 Apr 2026 12:37:42 -0400 Subject: [PATCH 1/5] Queued tasks --- llm-prompts/basic-integration/1.3-conclude.md | 2 ++ scripts/lib/skill-generator.js | 22 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/llm-prompts/basic-integration/1.3-conclude.md b/llm-prompts/basic-integration/1.3-conclude.md index b48af6a8..25d981d9 100644 --- a/llm-prompts/basic-integration/1.3-conclude.md +++ b/llm-prompts/basic-integration/1.3-conclude.md @@ -5,6 +5,8 @@ description: Review and fix any errors in the PostHog integration implementation Use the PostHog MCP to create a new dashboard named "Analytics basics" based on the events created here. Make sure to use the exact same event names as implemented in the code. Populate it with up to five insights, with special emphasis on things like conversion funnels, churn events, and other business critical insights. +Check for the installed skills in `/.claude/skills//` and add a note at the top about the PostHog SDK and version installed as: `This skill is intended for version .`. + Search for a file called `.posthog-events.json` and read it for available events. Do not spawn subagents. Create the file posthog-setup-report.md. It should include a summary of the integration edits, a table with the event names, event descriptions, and files where events were added, along with a list of links for the dashboard and insights created. Follow this format: diff --git a/scripts/lib/skill-generator.js b/scripts/lib/skill-generator.js index b6175a15..bd23257a 100644 --- a/scripts/lib/skill-generator.js +++ b/scripts/lib/skill-generator.js @@ -388,13 +388,13 @@ function discoverWorkflows(promptsDir) { return a.order - b.order; }); - // Link to next step within each category + // Link to next steps within each category (array for future parallelization) for (let i = 0; i < workflows.length; i++) { const current = workflows[i]; const next = workflows[i + 1]; if (next && next.category === current.category) { - current.nextFilename = `${next.category}-${next.filename}`; + current.nextFilenames = [`${next.category}-${next.filename}`]; } } @@ -404,7 +404,7 @@ function discoverWorkflows(promptsDir) { /** * Generate SKILL.md frontmatter */ -function generateFrontmatter(skill, version) { +function generateFrontmatter(skill, version, workflows) { const frontmatter = { name: skill.id, description: skill.description, @@ -414,6 +414,15 @@ function generateFrontmatter(skill, version) { }, }; + if (workflows.length > 0) { + frontmatter.workflow = workflows.map(wf => ({ + step_id: wf.filename.replace(/\.md$/, ''), + reference: `${wf.category}-${wf.filename}`, + title: wf.title, + next: wf.nextFilenames ?? [], + })); + } + return '---\n' + yaml.dump(frontmatter) + '---\n\n'; } @@ -525,10 +534,7 @@ async function generateSkill({ for (const workflow of workflows) { let content = fs.readFileSync(workflow.fullPath, 'utf8'); - // Append continuation message if there's a next step - if (workflow.nextFilename) { - content += `\n\n---\n\n**Upon completion, continue with:** [${workflow.nextFilename}](${workflow.nextFilename})`; - } + // Continuation links are now in SKILL.md frontmatter (workflow[].next) const filename = `${workflow.category}-${workflow.filename}`; fs.writeFileSync( @@ -557,7 +563,7 @@ async function generateSkill({ const workflowText = formatWorkflowSteps(workflows); // Build SKILL.md content - let skillContent = generateFrontmatter(skill, version); + let skillContent = generateFrontmatter(skill, version, skill.type === 'docs-only' ? [] : workflows); // Apply template substitutions let body = skillTemplate From b8024fa1f5efa0fc6878446b66134a6f1b225e36 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Apr 2026 15:19:46 -0400 Subject: [PATCH 2/5] queued workflow --- llm-prompts/basic-integration-v2/1.0-begin.md | 38 ++++++++++++++++++ llm-prompts/basic-integration-v2/1.1-edit.md | 32 +++++++++++++++ .../basic-integration-v2/1.2-revise.md | 18 +++++++++ .../basic-integration-v2/1.3-conclude.md | 40 +++++++++++++++++++ scripts/build.js | 38 +++++++++++++++--- scripts/dev-server.js | 9 +++++ scripts/lib/skill-generator.js | 23 ++++++++--- 7 files changed, 187 insertions(+), 11 deletions(-) create mode 100644 llm-prompts/basic-integration-v2/1.0-begin.md create mode 100644 llm-prompts/basic-integration-v2/1.1-edit.md create mode 100644 llm-prompts/basic-integration-v2/1.2-revise.md create mode 100644 llm-prompts/basic-integration-v2/1.3-conclude.md diff --git a/llm-prompts/basic-integration-v2/1.0-begin.md b/llm-prompts/basic-integration-v2/1.0-begin.md new file mode 100644 index 00000000..4edd9405 --- /dev/null +++ b/llm-prompts/basic-integration-v2/1.0-begin.md @@ -0,0 +1,38 @@ +--- +title: Analyze project and plan events +description: Start the event tracking setup process by analyzing the project and creating an event tracking plan +--- + +We're making an event tracking plan for this project. + +Before proceeding, find any existing `posthog.capture()` code. Make note of event name formatting. + +From the project's file list, select between 10 and 15 files that might have interesting business value for event tracking, especially conversion and churn events. Also look for additional files related to login that could be used for identifying users, along with error handling. Read the files. If a file is already well-covered by PostHog events, replace it with another option. Do not spawn subagents. + +Look for opportunities to track client-side events. + +**IMPORTANT: Server-side events are REQUIRED** if the project includes any instrumentable server-side code. If the project has API routes (e.g., `app/api/**/route.ts`) or Server Actions, you MUST include server-side events for critical business operations like: + + - Payment/checkout completion + - Webhook handlers + - Authentication endpoints + +Do not skip server-side events - they capture actions that cannot be tracked client-side. + +Create a new file with a JSON array at the root of the project: .posthog-events.json. It should include one object for each event we want to add: event name, event description, and the file path we want to place the event in. If events already exist, don't duplicate them; supplement them. + +Track actions only, not pageviews. These can be captured automatically. Exceptions can be made for "viewed"-type events that correspond to the top of a conversion funnel. + +As you review files, make an internal note of opportunities to identify users and catch errors. We'll need them for the next step. + +## Status + +Before beginning a phase of the setup, you will send a status message with the exact prefix '[STATUS]', as in: + +[STATUS] Checking project structure. + +Status to report in this phase: + +- Checking project structure +- Verifying PostHog dependencies +- Generating events based on project diff --git a/llm-prompts/basic-integration-v2/1.1-edit.md b/llm-prompts/basic-integration-v2/1.1-edit.md new file mode 100644 index 00000000..e7ed40d4 --- /dev/null +++ b/llm-prompts/basic-integration-v2/1.1-edit.md @@ -0,0 +1,32 @@ +--- +title: Implement PostHog +description: Implement PostHog event tracking in the identified files, following best practices and the example project +--- + +For each of the files and events noted in .posthog-events.json, make edits to capture events using PostHog. Make sure to set up any helper files needed. Carefully examine the included example project code: your implementation should match it as closely as possible. Do not spawn subagents. + +Use environment variables for PostHog keys. Do not hardcode PostHog keys. + +If a file already has existing integration code for other tools or services, don't overwrite or remove that code. Place PostHog code below it. + +For each event, add useful properties, and use your access to the PostHog source code to ensure correctness. You also have access to documentation about creating new events with PostHog. Consider this documentation carefully and follow it closely before adding events. Your integration should be based on documented best practices. Carefully consider how the user project's framework version may impact the correct PostHog integration approach. + +Remember that you can find the source code for any dependency in the node_modules directory. This may be necessary to properly populate property names. There are also example project code files available via the PostHog MCP; use these for reference. + +Where possible, add calls for PostHog's identify() function on the client side upon events like logins and signups. Use the contents of login and signup forms to identify users on submit. If there is server-side code, pass the client-side session and distinct ID to the server-side code to identify the user. On the server side, make sure events have a matching distinct ID where relevant. + +It's essential to do this in both client code and server code, so that user behavior from both domains is easy to correlate. + +You should also add PostHog exception capture error tracking to these files where relevant. + +Remember: Do not alter the fundamental architecture of existing files. Make your additions minimal and targeted. + +Remember the documentation and example project resources you were provided at the beginning. Read them now. + +## Status + +Status to report in this phase: + +- Inserting PostHog capture code +- A status message for each file whose edits you are planning, including a high level summary of changes +- A status message for each file you have edited diff --git a/llm-prompts/basic-integration-v2/1.2-revise.md b/llm-prompts/basic-integration-v2/1.2-revise.md new file mode 100644 index 00000000..4dfe95d4 --- /dev/null +++ b/llm-prompts/basic-integration-v2/1.2-revise.md @@ -0,0 +1,18 @@ +--- +title: Review and fix errors +description: Review and fix any errors in the PostHog integration implementation +--- + +Check the project for errors. Read the package.json file for any type checking or build scripts that may provide input about what to fix. Remember that you can find the source code for any dependency in the node_modules directory. Do not spawn subagents. + +Ensure that any components created were actually used. + +Once all other tasks are complete, run any linter or prettier-like scripts found in the package.json, but ONLY on the files you have edited or created during this session. Do not run formatting or linting across the entire project's codebase. + +## Status + +Status to report in this phase: + +- Finding and correcting errors +- Report details of any errors you fix +- Linting, building and prettying \ No newline at end of file diff --git a/llm-prompts/basic-integration-v2/1.3-conclude.md b/llm-prompts/basic-integration-v2/1.3-conclude.md new file mode 100644 index 00000000..5a3e42c2 --- /dev/null +++ b/llm-prompts/basic-integration-v2/1.3-conclude.md @@ -0,0 +1,40 @@ +--- +title: Create dashboard and wrap up +description: Review and fix any errors in the PostHog integration implementation +--- + +Use the PostHog MCP to create a new dashboard named "Analytics basics" based on the events created here. Make sure to use the exact same event names as implemented in the code. Populate it with up to five insights, with special emphasis on things like conversion funnels, churn events, and other business critical insights. + +Check for the installed skills in `/.claude/skills//` and add a note at the top about the PostHog SDK and version installed as: `This skill is intended for version .`. + +Search for a file called `.posthog-events.json` and read it for available events. Do not spawn subagents. + +Create the file posthog-setup-report.md. It should include a summary of the integration edits, a table with the event names, event descriptions, and files where events were added, along with a list of links for the dashboard and insights created. Follow this format: + + +# PostHog post-wizard report + +The wizard has completed a deep integration of your project. [Detailed summary of changes] + +[table of events/descriptions/files] + +## Next steps + +We've built some insights and a dashboard for you to keep an eye on user behavior, based on the events we just instrumented: + +[links] + +### Agent skill + +We've left an agent skill folder in your project. You can use this context for further agent development when using Claude Code. This will help ensure the model provides the most up-to-date approaches for integrating PostHog. + + + +Upon completion, remove .posthog-events.json. + +## Status + +Status to report in this phase: + +- Configured dashboard: [insert PostHog dashboard URL] +- Created setup report: [insert full local file path] \ No newline at end of file diff --git a/scripts/build.js b/scripts/build.js index e2208197..de817cd3 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -152,19 +152,33 @@ async function main() { const configDir = path.join(repoRoot, 'transformation-config'); const distDir = path.join(repoRoot, 'dist'); const skillsDir = path.join(distDir, 'skills'); + const skillsDirV2 = path.join(distDir, 'basic-integration-v2'); const tempDir = path.join(distDir, 'skills-temp'); + const tempDirV2 = path.join(distDir, 'skills-temp-v2'); const promptsDir = path.join(repoRoot, 'llm-prompts'); try { fs.mkdirSync(skillsDir, { recursive: true }); + fs.mkdirSync(skillsDirV2, { recursive: true }); - // Generate skill packages via generator + // Generate v1 skills (basic-integration: continuation links in body, no workflow frontmatter) const skills = await generateAllSkills({ repoRoot, configDir, outputDir: tempDir, promptsDir, version: BUILD_VERSION, + workflowCategories: ['basic-integration'], + }); + + // Generate v2 skills (basic-integration-v2: workflow[] frontmatter, no continuation links) + await generateAllSkills({ + repoRoot, + configDir, + outputDir: tempDirV2, + promptsDir, + version: BUILD_VERSION, + workflowCategories: ['basic-integration-v2'], }); // Load docs config @@ -175,18 +189,26 @@ async function main() { const uriSchema = loadUriSchema(configDir); - // Create ZIP for each skill + // Create ZIPs — v1 into dist/skills/, v2 into dist/basic-integration-v2/ console.log('\nCreating skill ZIPs...'); const skillZips = {}; for (const skill of skills) { + // v1 const skillDir = path.join(tempDir, skill.id); const buffer = await zipSkillToBuffer(skillDir); const filename = `${skill.id}.zip`; skillZips[filename] = buffer; - - const standaloneZipPath = path.join(skillsDir, filename); - fs.writeFileSync(standaloneZipPath, buffer); + fs.writeFileSync(path.join(skillsDir, filename), buffer); console.log(` ✓ ${filename} (${(buffer.length / 1024).toFixed(1)} KB)`); + + // v2 + const skillDirV2 = path.join(tempDirV2, skill.id); + if (fs.existsSync(skillDirV2)) { + const bufferV2 = await zipSkillToBuffer(skillDirV2); + skillZips[`v2/${filename}`] = bufferV2; + fs.writeFileSync(path.join(skillsDirV2, filename), bufferV2); + console.log(` ✓ v2/${filename} (${(bufferV2.length / 1024).toFixed(1)} KB)`); + } } // Generate marketplace plugin directories (before tempDir cleanup) @@ -199,6 +221,7 @@ async function main() { }); fs.rmSync(tempDir, { recursive: true, force: true }); + fs.rmSync(tempDirV2, { recursive: true, force: true }); // Fetch doc content directly (no generator, no ZIP) const docContents = {}; @@ -234,10 +257,13 @@ async function main() { for (const skill of skills) { const cat = skill.group; if (!skillsByCategory[cat]) skillsByCategory[cat] = []; + const downloadUrl = manifest.resources.find(r => r.id === skill.id)?.downloadUrl; skillsByCategory[cat].push({ id: skill.id, name: skill.name, - downloadUrl: manifest.resources.find(r => r.id === skill.id)?.downloadUrl, + downloadUrl, + // v2 URL: served from the basic-integration-v2/ folder + downloadUrlV2: downloadUrl ? downloadUrl.replace('/skills/', '/basic-integration-v2/') : undefined, }); } const skillMenu = { diff --git a/scripts/dev-server.js b/scripts/dev-server.js index 627a1fb1..80a163c6 100644 --- a/scripts/dev-server.js +++ b/scripts/dev-server.js @@ -134,6 +134,15 @@ function serveZip(res, zipPath, filename) { */ function createServer() { const server = http.createServer((req, res) => { + // Serve v2 skill ZIPs at /basic-integration-v2/{id}.zip + const v2Match = req.url?.match(/^\/basic-integration-v2\/(.+\.zip)$/); + if (v2Match) { + const skillFile = v2Match[1]; + const v2Dir = path.join(DIST_DIR, 'basic-integration-v2'); + serveZip(res, path.join(v2Dir, skillFile), `v2/${skillFile}`); + return; + } + // Serve individual skill ZIPs at /skills/{id}.zip const skillMatch = req.url?.match(/^\/skills\/(.+\.zip)$/); if (skillMatch) { diff --git a/scripts/lib/skill-generator.js b/scripts/lib/skill-generator.js index bd23257a..f965cf71 100644 --- a/scripts/lib/skill-generator.js +++ b/scripts/lib/skill-generator.js @@ -414,8 +414,10 @@ function generateFrontmatter(skill, version, workflows) { }, }; - if (workflows.length > 0) { - frontmatter.workflow = workflows.map(wf => ({ + // Only emit workflow[] frontmatter for v2 categories + const v2Workflows = workflows.filter(wf => wf.category.endsWith('-v2')); + if (v2Workflows.length > 0) { + frontmatter.workflow = v2Workflows.map(wf => ({ step_id: wf.filename.replace(/\.md$/, ''), reference: `${wf.category}-${wf.filename}`, title: wf.title, @@ -534,7 +536,14 @@ async function generateSkill({ for (const workflow of workflows) { let content = fs.readFileSync(workflow.fullPath, 'utf8'); - // Continuation links are now in SKILL.md frontmatter (workflow[].next) + // v2 categories (e.g. basic-integration-v2): no continuation links, + // ordering is in SKILL.md frontmatter (workflow[].next). + // v1 categories (e.g. basic-integration): append continuation links in body. + const isV2 = workflow.category.endsWith('-v2'); + if (!isV2 && workflow.nextFilenames && workflow.nextFilenames.length > 0) { + const nextRef = workflow.nextFilenames[0]; + content += `\n\n---\n\n**Upon completion, continue with:** [${nextRef}](${nextRef})`; + } const filename = `${workflow.category}-${workflow.filename}`; fs.writeFileSync( @@ -596,6 +605,7 @@ async function generateAllSkills({ outputDir, promptsDir, version, + workflowCategories, }) { console.log('Loading configuration...'); @@ -607,9 +617,12 @@ async function generateAllSkills({ // Expand grouped skills into flat array const skills = expandSkillGroups(skillsConfig, configDir); - // Discover workflows + // Discover workflows, optionally filtered to specific categories console.log('Discovering workflows...'); - const workflows = discoverWorkflows(promptsDir); + let workflows = discoverWorkflows(promptsDir); + if (workflowCategories) { + workflows = workflows.filter(wf => workflowCategories.includes(wf.category)); + } console.log(` Found ${workflows.length} workflow files`); // Create output directory From bf96d0a87614bdcdebcbd8fab9f6fa2f35ab315c Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Apr 2026 16:45:31 -0400 Subject: [PATCH 3/5] Clean ups --- llm-prompts/basic-integration-v2/1.0-begin.md | 2 ++ llm-prompts/basic-integration-v2/1.1-edit.md | 2 ++ .../basic-integration-v2/1.2-revise.md | 2 ++ scripts/build.js | 16 ++++++---- scripts/dev-server.js | 20 ++++--------- scripts/lib/skill-generator.js | 30 ++++++++----------- 6 files changed, 33 insertions(+), 39 deletions(-) diff --git a/llm-prompts/basic-integration-v2/1.0-begin.md b/llm-prompts/basic-integration-v2/1.0-begin.md index 4edd9405..5ccb14cc 100644 --- a/llm-prompts/basic-integration-v2/1.0-begin.md +++ b/llm-prompts/basic-integration-v2/1.0-begin.md @@ -1,6 +1,8 @@ --- title: Analyze project and plan events description: Start the event tracking setup process by analyzing the project and creating an event tracking plan +next: + - 1.1-edit.md --- We're making an event tracking plan for this project. diff --git a/llm-prompts/basic-integration-v2/1.1-edit.md b/llm-prompts/basic-integration-v2/1.1-edit.md index e7ed40d4..f6cdaad4 100644 --- a/llm-prompts/basic-integration-v2/1.1-edit.md +++ b/llm-prompts/basic-integration-v2/1.1-edit.md @@ -1,6 +1,8 @@ --- title: Implement PostHog description: Implement PostHog event tracking in the identified files, following best practices and the example project +next: + - 1.2-revise.md --- For each of the files and events noted in .posthog-events.json, make edits to capture events using PostHog. Make sure to set up any helper files needed. Carefully examine the included example project code: your implementation should match it as closely as possible. Do not spawn subagents. diff --git a/llm-prompts/basic-integration-v2/1.2-revise.md b/llm-prompts/basic-integration-v2/1.2-revise.md index 4dfe95d4..4d5ed1bd 100644 --- a/llm-prompts/basic-integration-v2/1.2-revise.md +++ b/llm-prompts/basic-integration-v2/1.2-revise.md @@ -1,6 +1,8 @@ --- title: Review and fix errors description: Review and fix any errors in the PostHog integration implementation +next: + - 1.3-conclude.md --- Check the project for errors. Read the package.json file for any type checking or build scripts that may provide input about what to fix. Remember that you can find the source code for any dependency in the node_modules directory. Do not spawn subagents. diff --git a/scripts/build.js b/scripts/build.js index de817cd3..b8faa512 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -19,6 +19,11 @@ const { REPO_URL } = require('./lib/constants'); const BUILD_VERSION = process.env.BUILD_VERSION || 'dev'; +// Workflow category names — v1 is the default (continuation links in body), +// v2 has workflow[] frontmatter and no continuation links. +const V1_WORKFLOW_CATEGORY = 'basic-integration'; +const V2_WORKFLOW_CATEGORY = 'basic-integration-v2'; + /** * Load URI schema configuration */ @@ -152,7 +157,7 @@ async function main() { const configDir = path.join(repoRoot, 'transformation-config'); const distDir = path.join(repoRoot, 'dist'); const skillsDir = path.join(distDir, 'skills'); - const skillsDirV2 = path.join(distDir, 'basic-integration-v2'); + const skillsDirV2 = path.join(distDir, V2_WORKFLOW_CATEGORY); const tempDir = path.join(distDir, 'skills-temp'); const tempDirV2 = path.join(distDir, 'skills-temp-v2'); const promptsDir = path.join(repoRoot, 'llm-prompts'); @@ -168,17 +173,17 @@ async function main() { outputDir: tempDir, promptsDir, version: BUILD_VERSION, - workflowCategories: ['basic-integration'], + workflowCategories: [V1_WORKFLOW_CATEGORY], }); - // Generate v2 skills (basic-integration-v2: workflow[] frontmatter, no continuation links) + // Generate v2 skills (workflow[] frontmatter, no continuation links) await generateAllSkills({ repoRoot, configDir, outputDir: tempDirV2, promptsDir, version: BUILD_VERSION, - workflowCategories: ['basic-integration-v2'], + workflowCategories: [V2_WORKFLOW_CATEGORY], }); // Load docs config @@ -262,8 +267,7 @@ async function main() { id: skill.id, name: skill.name, downloadUrl, - // v2 URL: served from the basic-integration-v2/ folder - downloadUrlV2: downloadUrl ? downloadUrl.replace('/skills/', '/basic-integration-v2/') : undefined, + downloadUrlV2: downloadUrl ? downloadUrl.replace('/skills/', `/${V2_WORKFLOW_CATEGORY}/`) : undefined, }); } const skillMenu = { diff --git a/scripts/dev-server.js b/scripts/dev-server.js index 80a163c6..acdfd58d 100644 --- a/scripts/dev-server.js +++ b/scripts/dev-server.js @@ -134,21 +134,11 @@ function serveZip(res, zipPath, filename) { */ function createServer() { const server = http.createServer((req, res) => { - // Serve v2 skill ZIPs at /basic-integration-v2/{id}.zip - const v2Match = req.url?.match(/^\/basic-integration-v2\/(.+\.zip)$/); - if (v2Match) { - const skillFile = v2Match[1]; - const v2Dir = path.join(DIST_DIR, 'basic-integration-v2'); - serveZip(res, path.join(v2Dir, skillFile), `v2/${skillFile}`); - return; - } - - // Serve individual skill ZIPs at /skills/{id}.zip - const skillMatch = req.url?.match(/^\/skills\/(.+\.zip)$/); - if (skillMatch) { - const skillFile = skillMatch[1]; - const skillPath = path.join(SKILLS_DIR, skillFile); - serveZip(res, skillPath, skillFile); + // Serve any .zip file under dist/ (skills, basic-integration-v2, etc.) + const zipMatch = req.url?.match(/^\/(.+\.zip)$/); + if (zipMatch) { + const zipPath = path.join(DIST_DIR, zipMatch[1]); + serveZip(res, zipPath, zipMatch[1]); return; } diff --git a/scripts/lib/skill-generator.js b/scripts/lib/skill-generator.js index f965cf71..ee9d26bc 100644 --- a/scripts/lib/skill-generator.js +++ b/scripts/lib/skill-generator.js @@ -376,6 +376,7 @@ function discoverWorkflows(promptsDir) { order: orderInfo?.order ?? 0, title: parsed.data.title || filename, description: parsed.data.description || '', + next: parsed.data.next || [], content: parsed.content, fullPath: filePath, }); @@ -388,16 +389,6 @@ function discoverWorkflows(promptsDir) { return a.order - b.order; }); - // Link to next steps within each category (array for future parallelization) - for (let i = 0; i < workflows.length; i++) { - const current = workflows[i]; - const next = workflows[i + 1]; - - if (next && next.category === current.category) { - current.nextFilenames = [`${next.category}-${next.filename}`]; - } - } - return workflows; } @@ -421,7 +412,7 @@ function generateFrontmatter(skill, version, workflows) { step_id: wf.filename.replace(/\.md$/, ''), reference: `${wf.category}-${wf.filename}`, title: wf.title, - next: wf.nextFilenames ?? [], + next: (wf.next || []).map(f => `${wf.category}-${f}`), })); } @@ -533,16 +524,19 @@ async function generateSkill({ // Include relevant workflows (flattened with category prefix, linked to next step) // Skip workflows for docs-only skills if (skill.type !== 'docs-only') { - for (const workflow of workflows) { + for (let i = 0; i < workflows.length; i++) { + const workflow = workflows[i]; let content = fs.readFileSync(workflow.fullPath, 'utf8'); - // v2 categories (e.g. basic-integration-v2): no continuation links, - // ordering is in SKILL.md frontmatter (workflow[].next). - // v1 categories (e.g. basic-integration): append continuation links in body. + // v2 categories: next steps defined in file frontmatter, emitted in SKILL.md workflow[]. + // v1 categories: append continuation links in body (computed from ordering). const isV2 = workflow.category.endsWith('-v2'); - if (!isV2 && workflow.nextFilenames && workflow.nextFilenames.length > 0) { - const nextRef = workflow.nextFilenames[0]; - content += `\n\n---\n\n**Upon completion, continue with:** [${nextRef}](${nextRef})`; + if (!isV2) { + const nextWf = workflows[i + 1]; + if (nextWf && nextWf.category === workflow.category) { + const nextRef = `${nextWf.category}-${nextWf.filename}`; + content += `\n\n---\n\n**Upon completion, continue with:** [${nextRef}](${nextRef})`; + } } const filename = `${workflow.category}-${workflow.filename}`; From 985abf480524793b348713baf44bd8899de3db9b Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Apr 2026 18:22:25 -0400 Subject: [PATCH 4/5] Fix url for context mill --- scripts/build.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index b8faa512..bf376826 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -258,16 +258,22 @@ async function main() { // Generate skill-menu.json: condensed list grouped by category // The wizard agent filters by category to keep context small + // v2 base: same host, /basic-integration-v2/ path instead of /skills/ + const v2BaseUrl = process.env.SKILLS_BASE_URL + ? process.env.SKILLS_BASE_URL.replace(/\/skills$/, `/${V2_WORKFLOW_CATEGORY}`) + : null; + const skillsByCategory = {}; for (const skill of skills) { const cat = skill.group; if (!skillsByCategory[cat]) skillsByCategory[cat] = []; const downloadUrl = manifest.resources.find(r => r.id === skill.id)?.downloadUrl; + const downloadUrlV2 = v2BaseUrl ? `${v2BaseUrl}/${skill.id}.zip` : undefined; skillsByCategory[cat].push({ id: skill.id, name: skill.name, downloadUrl, - downloadUrlV2: downloadUrl ? downloadUrl.replace('/skills/', `/${V2_WORKFLOW_CATEGORY}/`) : undefined, + downloadUrlV2, }); } const skillMenu = { From 5f709b2a12bf6c1b6191469ee5c4900530ceb2e4 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Wed, 8 Apr 2026 18:39:09 -0400 Subject: [PATCH 5/5] don't double distribute skills --- scripts/build.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index bf376826..1ec28270 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -206,11 +206,10 @@ async function main() { fs.writeFileSync(path.join(skillsDir, filename), buffer); console.log(` ✓ ${filename} (${(buffer.length / 1024).toFixed(1)} KB)`); - // v2 + // v2 (separate from bundle — served independently) const skillDirV2 = path.join(tempDirV2, skill.id); if (fs.existsSync(skillDirV2)) { const bufferV2 = await zipSkillToBuffer(skillDirV2); - skillZips[`v2/${filename}`] = bufferV2; fs.writeFileSync(path.join(skillsDirV2, filename), bufferV2); console.log(` ✓ v2/${filename} (${(bufferV2.length / 1024).toFixed(1)} KB)`); }