@compilr-dev/sdk 0.10.0 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -67,8 +67,8 @@ export type { GuideEntry, ContentTopic, ContentSection, GuideToolConfig } from '
67
67
  export { createPlatformTools, createProjectTools, createWorkItemTools, createDocumentTools, createPlanTools, createBacklogTools, createAnchorTools, createArtifactTools, createEpisodeTools, createImageTools, ProjectAnchorStore, } from './platform/index.js';
68
68
  export type { ProjectAnchorStoreConfig, ImageToolsConfig, ImageResizer } from './platform/index.js';
69
69
  export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
70
- export type { CustomSkill, CompilrSkillExtension, ForkedFromMarker, SkillEligibilityContext, } from './skills/index.js';
71
- export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, } from './skills/index.js';
70
+ export type { CustomSkill, CompilrSkillExtension, ForkedFromMarker, SkillEligibilityContext, SkillCollision, SkillDiffLine, SkillValidationIssue, ScopeConfig, SkillResolution, } from './skills/index.js';
71
+ export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, } from './skills/index.js';
72
72
  export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
73
73
  export { ACTION_REGISTRY, getActionsForContext, getActionById, resolveActionPrompt, buildContextSummary, getSuggestedRole, } from './actions/index.js';
74
74
  export type { ActionContext, ActionDefinition } from './actions/index.js';
package/dist/index.js CHANGED
@@ -152,7 +152,7 @@ export { createPlatformTools, createProjectTools, createWorkItemTools, createDoc
152
152
  // Platform Workflow (pure step-criteria logic)
153
153
  // =============================================================================
154
154
  export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
155
- export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, } from './skills/index.js';
155
+ export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, } from './skills/index.js';
156
156
  export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
157
157
  // =============================================================================
158
158
  // Contextual Actions (skill invocations with context)
@@ -6,7 +6,7 @@
6
6
  import { defineSkill } from '@compilr-dev/agents';
7
7
  export const bookOutlineSkill = defineSkill({
8
8
  name: 'book-outline',
9
- description: 'Define book structure — beats, chapters, and story template',
9
+ description: 'Define the book structure — story template selection, beat sheet, chapter breakdown, and narrative arc. Use when starting a new book or restructuring an existing one. Produces a BookModel outline stored in the project database.',
10
10
  prompt: `You are in BOOK OUTLINE MODE. Help the user structure their book.
11
11
 
12
12
  ## Step 1: Book Overview
@@ -47,7 +47,7 @@ Create one "Chapter" work item per chapter.
47
47
  });
48
48
  export const characterDesignSkill = defineSkill({
49
49
  name: 'character-design',
50
- description: 'Build character profiles, arcs, and relationship maps',
50
+ description: 'Build detailed character profiles including backstory, traits, motivations, arcs, and relationship maps. Use after the outline exists. Creates or updates character entries in the BookModel with connections between characters.',
51
51
  prompt: `You are in CHARACTER DESIGN MODE. Help the user build their cast.
52
52
 
53
53
  ## Step 1: Read Context
@@ -84,7 +84,7 @@ This feeds the Character Map visualization.
84
84
  });
85
85
  export const plotThreadsSkill = defineSkill({
86
86
  name: 'plot-threads',
87
- description: 'Define and track plot threads across chapters',
87
+ description: 'Define and track plot threads across chapters — main plot, subplots, and thematic threads. Use when the outline and characters exist but narrative threads need explicit tracking. Maps each thread to the chapters where it appears.',
88
88
  prompt: `You are in PLOT THREADS MODE. Map the story's narrative threads.
89
89
 
90
90
  ## Step 1: Read Context
@@ -120,7 +120,7 @@ Report issues and suggest fixes.
120
120
  });
121
121
  export const sceneBreakdownSkill = defineSkill({
122
122
  name: 'scene-breakdown',
123
- description: 'Break a chapter into detailed scenes',
123
+ description: 'Break a chapter into detailed scenes with setting, characters present, POV, conflict, and beats. Use when a chapter outline exists but needs scene-level granularity before drafting. Produces scene entries linked to the chapter in the BookModel.',
124
124
  prompt: `You are in SCENE BREAKDOWN MODE. Detail a chapter's scenes.
125
125
 
126
126
  ## Step 1: Read Context
@@ -153,7 +153,7 @@ Save: \`book_model_update\` op: "scene_add"
153
153
  });
154
154
  export const bookReviewSkill = defineSkill({
155
155
  name: 'book-review',
156
- description: 'Structural review — beats, arcs, threads, pacing',
156
+ description: 'Structural review of the entire book validates beat sheet completeness, character arc consistency, thread coverage across chapters, and pacing balance. Use after substantial content exists to find structural gaps before drafting or revision.',
157
157
  prompt: `You are in BOOK REVIEW MODE. Evaluate the book's structure.
158
158
 
159
159
  ## Step 1: Load
@@ -6,7 +6,7 @@
6
6
  import { defineSkill } from '@compilr-dev/agents';
7
7
  export const businessVisionSkill = defineSkill({
8
8
  name: 'business-vision',
9
- description: 'Define the business identity, problem, solution, and value proposition',
9
+ description: 'Define the core business identity problem statement, solution, unique value proposition, target customer, and business stage. Use when starting a new business plan or when the foundational vision needs to be articulated. Produces the identity section of the BusinessModel.',
10
10
  prompt: `You are in BUSINESS VISION MODE. Help the user define and articulate their business idea.
11
11
 
12
12
  ## Step 1: Assess Current State
@@ -46,7 +46,7 @@ After saving, suggest:
46
46
  });
47
47
  export const marketAnalysisSkill = defineSkill({
48
48
  name: 'market-analysis',
49
- description: 'Analyze market size, trends, and customer segments',
49
+ description: 'Analyze the target market — total addressable market (TAM), serviceable market (SAM), growth trends, and customer segmentation. Use after the business vision is defined. Produces market analysis data in the BusinessModel including size estimates and segment profiles.',
50
50
  prompt: `You are in MARKET ANALYSIS MODE. Help the user understand their market.
51
51
 
52
52
  ## Step 1: Assess Current State
@@ -91,7 +91,7 @@ Create Milestone work items for:
91
91
  });
92
92
  export const competitorAnalysisSkill = defineSkill({
93
93
  name: 'competitor-analysis',
94
- description: 'Map the competitive landscape — identify competitors, strengths, weaknesses, positioning',
94
+ description: 'Map the competitive landscape — identify direct and indirect competitors, analyze their strengths and weaknesses, and define market positioning. Use after the market analysis to understand where the business fits. Produces competitor profiles and a positioning matrix in the BusinessModel.',
95
95
  prompt: `You are in COMPETITOR ANALYSIS MODE. Help the user understand their competition.
96
96
 
97
97
  ## Step 1: Assess Current State
@@ -151,7 +151,7 @@ Create work items for:
151
151
  });
152
152
  export const financialModelSkill = defineSkill({
153
153
  name: 'financial-model',
154
- description: 'Build revenue forecasts, cost structure, and break-even analysis',
154
+ description: 'Build the financial model — revenue streams, pricing strategy, cost structure, break-even analysis, and projections. Use when the business vision and market analysis are complete. Produces financial forecasts and unit economics in the BusinessModel.',
155
155
  prompt: `You are in FINANCIAL MODEL MODE. Help the user build financial projections.
156
156
 
157
157
  ## Step 1: Assess Current State
@@ -214,7 +214,7 @@ Save: \`business_model_update\` op: "set_financials_fields", financials_field: {
214
214
  });
215
215
  export const pitchOutlineSkill = defineSkill({
216
216
  name: 'pitch-outline',
217
- description: 'Structure an investor pitch or executive summary from the Business Model',
217
+ description: 'Structure an investor pitch deck or executive summary from the BusinessModel. Use when the plan is mature enough to present — extracts key metrics, value proposition, market opportunity, and financials into a presentation-ready narrative outline.',
218
218
  prompt: `You are in PITCH OUTLINE MODE. Help the user create a compelling pitch from their Business Model.
219
219
 
220
220
  ## Step 1: Assess Readiness
@@ -264,7 +264,7 @@ Create Milestone work items:
264
264
  });
265
265
  export const businessReviewSkill = defineSkill({
266
266
  name: 'business-review',
267
- description: 'Validate the business plan — find gaps, weak assumptions, and missing elements',
267
+ description: 'Critical review of the entire business plan — identifies gaps, weak assumptions, missing market data, unrealistic projections, and inconsistencies across sections. Use before presenting to stakeholders or investors to stress-test the plan.',
268
268
  prompt: `You are in BUSINESS REVIEW MODE. Critically evaluate the business plan like an investor would.
269
269
 
270
270
  ## Step 1: Load and Assess
@@ -6,7 +6,7 @@
6
6
  import { defineSkill } from '@compilr-dev/agents';
7
7
  export const brandSetupSkill = defineSkill({
8
8
  name: 'brand-setup',
9
- description: 'Define brand identity, visual guidelines, voice, audience, and content strategy',
9
+ description: 'Define the complete brand identity — name, tagline, visual guidelines, voice and tone, target audience personas, and content pillars. Use when starting a new brand or formalizing an existing one. Produces a BrandModel stored in the project database.',
10
10
  prompt: `You are in BRAND SETUP MODE. Guide the user through building their Brand Model step by step.
11
11
 
12
12
  ## Step 1: Brand Identity
@@ -62,7 +62,7 @@ Run \`brand_model_validate\` to check completeness. Report gaps and ask if user
62
62
  });
63
63
  export const contentStrategySkill = defineSkill({
64
64
  name: 'content-strategy',
65
- description: 'Define or refine content pillars and per-platform cadence',
65
+ description: 'Define or refine the content strategy — content pillars, platform-specific cadence, audience targeting per channel, and content mix ratios. Use after brand setup to plan what content to produce and where to publish it.',
66
66
  prompt: `You are in CONTENT STRATEGY MODE. Help the user plan their content approach.
67
67
 
68
68
  ## Step 1: Assess
@@ -86,7 +86,7 @@ Create initial content piece work items based on pillars and cadence.`,
86
86
  });
87
87
  export const contentCalendarSkill = defineSkill({
88
88
  name: 'content-calendar',
89
- description: 'Generate content piece work items for a specific period',
89
+ description: 'Generate a content calendar — create backlog work items for content pieces across a specific time period. Use after the content strategy is defined. Assigns topics to dates, platforms, and content pillars based on the planned cadence.',
90
90
  prompt: `You are in CONTENT CALENDAR MODE. Plan content for a specific period.
91
91
 
92
92
  ## Step 1: Assess
@@ -111,7 +111,7 @@ Present the calendar as a table before creating work items.`,
111
111
  });
112
112
  export const createContentSkill = defineSkill({
113
113
  name: 'create-content',
114
- description: 'Write copy and generate visual brief for a content piece',
114
+ description: 'Write the actual copy for a content piece and generate a visual brief for accompanying graphics. Use when a content calendar item is ready to produce. Follows brand voice guidelines and platform-specific formatting conventions.',
115
115
  prompt: `You are in CONTENT CREATION MODE. Create a complete content piece.
116
116
 
117
117
  ## Step 1: Read Context
@@ -148,7 +148,7 @@ Write everything as structured markdown in the work item description.
148
148
  });
149
149
  export const contentReviewSkill = defineSkill({
150
150
  name: 'content-review',
151
- description: 'Review content for voice consistency, brand alignment, and platform conventions',
151
+ description: 'Review a content piece for voice consistency, brand alignment, platform conventions, and audience fit. Use before publishing to catch tone mismatches, off-brand messaging, or format issues. Produces actionable feedback with specific suggestions.',
152
152
  prompt: `You are in CONTENT REVIEW MODE. Review a content piece as the brand's quality gate.
153
153
 
154
154
  ## Step 1: Read References
@@ -6,7 +6,7 @@
6
6
  import { defineSkill } from '@compilr-dev/agents';
7
7
  export const curriculumDesignSkill = defineSkill({
8
8
  name: 'curriculum-design',
9
- description: 'Define course structure — modules, learning objectives, progression',
9
+ description: 'Define the course structure — target audience, difficulty level, modules, learning objectives, prerequisites, and progression path. Use when starting a new course or restructuring an existing one. Produces a CurriculumModel stored in the project database.',
10
10
  prompt: `You are in CURRICULUM DESIGN MODE. Help the user structure their course.
11
11
 
12
12
  ## Step 1: Course Overview
@@ -50,7 +50,7 @@ Run \`curriculum_model_validate\` to check completeness.
50
50
  });
51
51
  export const lessonPlanSkill = defineSkill({
52
52
  name: 'lesson-plan',
53
- description: 'Break a module into detailed lessons with types and time estimates',
53
+ description: 'Break a module into detailed lessons lesson types (theory, demo, hands-on, discussion), time estimates, learning objectives per lesson, and key concepts. Use after the curriculum structure exists to add lesson-level detail.',
54
54
  prompt: `You are in LESSON PLAN MODE. Break a module into detailed lessons.
55
55
 
56
56
  ## Step 1: Read Context
@@ -88,7 +88,7 @@ Save: \`curriculum_model_update\` op: "assessment_add"
88
88
  });
89
89
  export const assessmentDesignSkill = defineSkill({
90
90
  name: 'assessment-design',
91
- description: 'Create quizzes, exercises, and projects for a module',
91
+ description: 'Create assessments for a module — quizzes, coding exercises, projects, and rubrics. Use after lessons are defined to add evaluation checkpoints. Aligns assessment types with learning objectives and difficulty level.',
92
92
  prompt: `You are in ASSESSMENT DESIGN MODE. Create assessments linked to learning objectives.
93
93
 
94
94
  ## Step 1: Read Context
@@ -120,7 +120,7 @@ Flag untested objectives.
120
120
  });
121
121
  export const courseReviewSkill = defineSkill({
122
122
  name: 'course-review',
123
- description: 'Review course for pedagogical quality — balance, coverage, progression',
123
+ description: 'Review the entire course for pedagogical quality — lesson type balance (theory vs hands-on), learning objective coverage, difficulty progression, time estimates, and assessment alignment. Use before publishing to identify structural gaps.',
124
124
  prompt: `You are in COURSE REVIEW MODE. Evaluate the curriculum as a pedagogical expert.
125
125
 
126
126
  ## Step 1: Load
@@ -6,4 +6,6 @@ export { RESERVED_SKILL_NAMES, isReservedSkillName } from './types.js';
6
6
  export { parseSkillMarkdown, loadSkillsFromDir } from './loader.js';
7
7
  export type { SkillEligibilityContext } from './resolver.js';
8
8
  export { resolveLayeredSkills, resolveSkillsForAgent } from './resolver.js';
9
+ export type { SkillCollision, SkillDiffLine, SkillValidationIssue, ScopeConfig, SkillResolution, } from './operations.js';
10
+ export { detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill, } from './operations.js';
9
11
  export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
@@ -1,4 +1,5 @@
1
1
  export { RESERVED_SKILL_NAMES, isReservedSkillName } from './types.js';
2
2
  export { parseSkillMarkdown, loadSkillsFromDir } from './loader.js';
3
3
  export { resolveLayeredSkills, resolveSkillsForAgent } from './resolver.js';
4
+ export { detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill, } from './operations.js';
4
5
  export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Skill operations — reusable logic for CLI and Desktop.
3
+ *
4
+ * - Collision detection (user skills vs SDK reserved names)
5
+ * - Diff (fork vs upstream SDK version)
6
+ * - Fork scaffold (build SKILL.md with forkedFrom marker)
7
+ * - Validation (quality checks beyond parseSkillMarkdown)
8
+ * - Binding resolution (config.json slash command remapping)
9
+ */
10
+ import type { CustomSkill, ForkedFromMarker } from './types.js';
11
+ export interface SkillCollision {
12
+ /** The colliding skill name */
13
+ name: string;
14
+ /** Path to the user's skill folder */
15
+ userPath: string;
16
+ /** Scope where the user skill lives */
17
+ scope: 'user' | 'project';
18
+ /** SDK package that owns the reserved name */
19
+ sdkSource: string;
20
+ }
21
+ /**
22
+ * Detect user/project skills that shadow SDK reserved names.
23
+ * Called at startup to warn users about collisions introduced by SDK updates.
24
+ *
25
+ * Note: Phase 1 blocks creation of reserved names via `/skill new`, but
26
+ * collisions can still happen if the SDK adds new skills after the user
27
+ * already has a skill with that name.
28
+ */
29
+ export declare function detectCollisions(userSkills: {
30
+ name: string;
31
+ scope: 'user' | 'project';
32
+ path: string;
33
+ }[]): SkillCollision[];
34
+ /**
35
+ * Format collision warnings for display.
36
+ */
37
+ export declare function formatCollisionWarnings(collisions: SkillCollision[]): string;
38
+ export interface SkillDiffLine {
39
+ type: 'same' | 'added' | 'removed';
40
+ content: string;
41
+ }
42
+ /**
43
+ * Compute a simple line-by-line diff between a forked skill and the
44
+ * upstream SDK skill it was forked from.
45
+ *
46
+ * Returns null if the upstream skill is not found.
47
+ */
48
+ export declare function diffForkVsUpstream(forkPrompt: string, upstreamSkillName: string): SkillDiffLine[] | null;
49
+ /**
50
+ * Build the SKILL.md content for a forked SDK skill.
51
+ */
52
+ export declare function buildForkContent(sdkSkill: {
53
+ name: string;
54
+ description: string;
55
+ prompt: string;
56
+ }, newName: string, sdkVersion: string): string;
57
+ /**
58
+ * Build the SKILL.md template for a new custom skill.
59
+ */
60
+ export declare function buildNewSkillContent(name: string, scope: string): string;
61
+ export interface SkillValidationIssue {
62
+ level: 'error' | 'warning';
63
+ message: string;
64
+ }
65
+ /**
66
+ * Validate a parsed custom skill beyond basic frontmatter parsing.
67
+ */
68
+ export declare function validateSkill(skill: CustomSkill, folderName: string): SkillValidationIssue[];
69
+ export interface ScopeConfig {
70
+ slashCommands?: Record<string, string>;
71
+ }
72
+ export interface SkillResolution {
73
+ /** The resolved skill prompt */
74
+ prompt: string;
75
+ /** Original command name the user typed */
76
+ commandName: string;
77
+ /** Actual skill name that provided the prompt (may differ if bound) */
78
+ skillName: string;
79
+ /** Whether this was resolved via a binding */
80
+ isBound: boolean;
81
+ /** Fork info if the skill is forked */
82
+ forkedFrom?: ForkedFromMarker;
83
+ /** Source layer */
84
+ source?: CustomSkill['source'];
85
+ }
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Skill operations — reusable logic for CLI and Desktop.
3
+ *
4
+ * - Collision detection (user skills vs SDK reserved names)
5
+ * - Diff (fork vs upstream SDK version)
6
+ * - Fork scaffold (build SKILL.md with forkedFrom marker)
7
+ * - Validation (quality checks beyond parseSkillMarkdown)
8
+ * - Binding resolution (config.json slash command remapping)
9
+ */
10
+ import { RESERVED_SKILL_NAMES } from './types.js';
11
+ import { platformSkills } from './platform-skills.js';
12
+ /**
13
+ * Detect user/project skills that shadow SDK reserved names.
14
+ * Called at startup to warn users about collisions introduced by SDK updates.
15
+ *
16
+ * Note: Phase 1 blocks creation of reserved names via `/skill new`, but
17
+ * collisions can still happen if the SDK adds new skills after the user
18
+ * already has a skill with that name.
19
+ */
20
+ export function detectCollisions(userSkills) {
21
+ const reserved = new Set(RESERVED_SKILL_NAMES);
22
+ const collisions = [];
23
+ for (const skill of userSkills) {
24
+ if (reserved.has(skill.name)) {
25
+ collisions.push({
26
+ name: skill.name,
27
+ userPath: skill.path,
28
+ scope: skill.scope,
29
+ sdkSource: '@compilr-dev/sdk',
30
+ });
31
+ }
32
+ }
33
+ return collisions;
34
+ }
35
+ /**
36
+ * Format collision warnings for display.
37
+ */
38
+ export function formatCollisionWarnings(collisions) {
39
+ if (collisions.length === 0)
40
+ return '';
41
+ const lines = [`⚠️ SDK update introduced new skills that collide with yours:`];
42
+ for (const c of collisions) {
43
+ lines.push(` '${c.name}' — your version: ${c.userPath} (${c.scope} scope)`, ` SDK version: ${c.sdkSource}`);
44
+ }
45
+ lines.push('', ' Run /skill to view details.', ' Options: rename your skill, delete it, or fork the SDK version.');
46
+ return lines.join('\n');
47
+ }
48
+ /**
49
+ * Compute a simple line-by-line diff between a forked skill and the
50
+ * upstream SDK skill it was forked from.
51
+ *
52
+ * Returns null if the upstream skill is not found.
53
+ */
54
+ export function diffForkVsUpstream(forkPrompt, upstreamSkillName) {
55
+ // Find the upstream SDK skill
56
+ // Check all platform skills + builtins
57
+ const allSdk = [...platformSkills];
58
+ const upstream = allSdk.find((s) => s.name === upstreamSkillName);
59
+ if (!upstream)
60
+ return null;
61
+ const upstreamLines = upstream.prompt.split('\n');
62
+ const forkLines = forkPrompt.split('\n');
63
+ return computeLineDiff(upstreamLines, forkLines);
64
+ }
65
+ /**
66
+ * Simple line diff (not a full Myers diff — sufficient for skill comparison).
67
+ * Uses longest common subsequence for reasonable output.
68
+ */
69
+ function computeLineDiff(oldLines, newLines) {
70
+ const result = [];
71
+ let oi = 0;
72
+ let ni = 0;
73
+ while (oi < oldLines.length && ni < newLines.length) {
74
+ if (oldLines[oi] === newLines[ni]) {
75
+ result.push({ type: 'same', content: oldLines[oi] });
76
+ oi++;
77
+ ni++;
78
+ }
79
+ else {
80
+ // Look ahead for the next matching line
81
+ const matchInNew = newLines.indexOf(oldLines[oi], ni);
82
+ const matchInOld = oldLines.indexOf(newLines[ni], oi);
83
+ if (matchInNew >= 0 && (matchInOld < 0 || matchInNew - ni <= matchInOld - oi)) {
84
+ // Lines added in new
85
+ while (ni < matchInNew) {
86
+ result.push({ type: 'added', content: newLines[ni] });
87
+ ni++;
88
+ }
89
+ }
90
+ else if (matchInOld >= 0) {
91
+ // Lines removed from old
92
+ while (oi < matchInOld) {
93
+ result.push({ type: 'removed', content: oldLines[oi] });
94
+ oi++;
95
+ }
96
+ }
97
+ else {
98
+ // No match found — treat as replace
99
+ result.push({ type: 'removed', content: oldLines[oi] });
100
+ result.push({ type: 'added', content: newLines[ni] });
101
+ oi++;
102
+ ni++;
103
+ }
104
+ }
105
+ }
106
+ // Remaining old lines
107
+ while (oi < oldLines.length) {
108
+ result.push({ type: 'removed', content: oldLines[oi] });
109
+ oi++;
110
+ }
111
+ // Remaining new lines
112
+ while (ni < newLines.length) {
113
+ result.push({ type: 'added', content: newLines[ni] });
114
+ ni++;
115
+ }
116
+ return result;
117
+ }
118
+ // =============================================================================
119
+ // Fork Scaffold
120
+ // =============================================================================
121
+ /**
122
+ * Build the SKILL.md content for a forked SDK skill.
123
+ */
124
+ export function buildForkContent(sdkSkill, newName, sdkVersion) {
125
+ const forkedFrom = {
126
+ source: '@compilr-dev/sdk',
127
+ skill: sdkSkill.name,
128
+ version: sdkVersion,
129
+ forkedAt: new Date().toISOString(),
130
+ };
131
+ const descLines = sdkSkill.description
132
+ .split('\n')
133
+ .map((l) => ` ${l}`)
134
+ .join('\n');
135
+ const fmLines = [
136
+ `name: ${newName}`,
137
+ 'description: |',
138
+ descLines,
139
+ 'version: 0.1.0',
140
+ 'forkedFrom:',
141
+ ` source: "${forkedFrom.source}"`,
142
+ ` skill: "${forkedFrom.skill}"`,
143
+ ` version: "${forkedFrom.version}"`,
144
+ ` forkedAt: "${forkedFrom.forkedAt}"`,
145
+ ];
146
+ return ['---', ...fmLines, '---', '', sdkSkill.prompt].join('\n');
147
+ }
148
+ // =============================================================================
149
+ // New Skill Scaffold
150
+ // =============================================================================
151
+ /**
152
+ * Build the SKILL.md template for a new custom skill.
153
+ */
154
+ export function buildNewSkillContent(name, scope) {
155
+ return `---
156
+ name: ${name}
157
+ description: |
158
+ Use this skill when … (replace with a paragraph-long description that names
159
+ the trigger conditions, the kinds of phrases the user will say, and the
160
+ expected output. Anthropic-style descriptions are keyword-dense and
161
+ intent-rich because the model reads them to decide when to load the skill.)
162
+ version: 0.1.0
163
+
164
+ # Optional — compilr extensions (ignored by Anthropic-compatible runtimes).
165
+ # Uncomment and edit to limit which agents and project types this skill applies to.
166
+ # compilr:
167
+ # targets:
168
+ # roles: [arch, qa]
169
+ # requires:
170
+ # tools: []
171
+ # projectTypes: []
172
+ # scope: ${scope}
173
+ ---
174
+
175
+ # ${name}
176
+
177
+ (Body markdown — the prompt the agent will receive when this skill activates.)
178
+
179
+ ## Step 1
180
+ Describe the first step.
181
+
182
+ ## Step 2
183
+
184
+ `;
185
+ }
186
+ /**
187
+ * Validate a parsed custom skill beyond basic frontmatter parsing.
188
+ */
189
+ export function validateSkill(skill, folderName) {
190
+ const issues = [];
191
+ if (skill.name !== folderName) {
192
+ issues.push({
193
+ level: 'error',
194
+ message: `Frontmatter name '${skill.name}' doesn't match folder '${folderName}'.`,
195
+ });
196
+ }
197
+ if (skill.description.length < 60) {
198
+ issues.push({
199
+ level: 'warning',
200
+ message: `Description is ${String(skill.description.length)} chars (recommend 60+).`,
201
+ });
202
+ }
203
+ if (!skill.prompt || skill.prompt.trim().length === 0) {
204
+ issues.push({
205
+ level: 'warning',
206
+ message: 'Body is empty.',
207
+ });
208
+ }
209
+ return issues;
210
+ }
@@ -6,7 +6,7 @@
6
6
  import { defineSkill } from '@compilr-dev/agents';
7
7
  export const outlineSkill = defineSkill({
8
8
  name: 'outline',
9
- description: 'Build or refine the research paper structure — sections, claims, source mapping',
9
+ description: 'Build or refine the research paper structure — define sections, formulate claims with evidence requirements, and map sources to claims. Use when starting a new paper or restructuring an existing one. Produces a ResearchModel outline stored in the project database.',
10
10
  prompt: `You are in OUTLINE MODE. Your goal is to help the user build or refine a structured outline for their research paper using the Research Model.
11
11
 
12
12
  ## When to Use
@@ -150,7 +150,7 @@ Create one work item per section:
150
150
  });
151
151
  export const literatureReviewSkill = defineSkill({
152
152
  name: 'literature-review',
153
- description: 'Analyze sources from the Knowledge Base — extract findings, link to claims, identify gaps',
153
+ description: 'Systematically analyze sources from the Knowledge Base — extract key findings, link evidence to claims in the outline, assess source quality, and identify coverage gaps. Use after the outline exists and sources have been added to the Knowledge Base.',
154
154
  prompt: `You are in LITERATURE REVIEW MODE. Your goal is to systematically analyze the sources in the Knowledge Base and connect them to the Research Model's sections and claims.
155
155
 
156
156
  ## When to Use
@@ -254,7 +254,7 @@ If multiple sources have been analyzed, provide a thematic synthesis:
254
254
  });
255
255
  export const draftSectionSkill = defineSkill({
256
256
  name: 'draft-section',
257
- description: 'Draft a paper section using the outline, claims, and linked sources',
257
+ description: 'Draft a specific paper section using the outline structure, claims, and linked sources. Use when the outline and literature review are complete for the target section. Produces academic prose with inline citations following the selected citation style.',
258
258
  prompt: `You are in DRAFT SECTION MODE. Your goal is to write or revise a section of the research paper, guided by the Research Model's outline, claims, and linked sources.
259
259
 
260
260
  ## When to Use
@@ -366,7 +366,7 @@ Report to the user:
366
366
  });
367
367
  export const peerReviewSkill = defineSkill({
368
368
  name: 'peer-review',
369
- description: 'Validate argument structure, find logical gaps, check consistency across sections',
369
+ description: 'Peer review the research paper — validate argument structure, find logical gaps, check claim-evidence consistency, assess citation coverage, and verify cross-section coherence. Use before submission to identify weaknesses. Produces a structured review report with actionable issues.',
370
370
  prompt: `You are in PEER REVIEW MODE. Your goal is to critically evaluate the research paper's argument structure, identify gaps, and check consistency — like an academic peer reviewer.
371
371
 
372
372
  ## When to Use
@@ -515,7 +515,7 @@ For issues that affect the Research Model:
515
515
  });
516
516
  export const researchScaffoldSkill = defineSkill({
517
517
  name: 'research-scaffold',
518
- description: 'Scaffold a research paper project from a template (APA, IEEE, Thesis, Literature Review, Lab Report)',
518
+ description: 'Scaffold a new research paper project from a template APA journal article, IEEE conference paper, thesis/dissertation, literature review, or lab report. Use when starting a fresh research project. Creates the ResearchModel with template-appropriate sections, citation style, and document structure.',
519
519
  prompt: `You are in RESEARCH SCAFFOLD MODE. Your goal is to help the user set up a new research paper project using a template.
520
520
 
521
521
  ## Available Templates
@@ -9,7 +9,7 @@ import { defineSkill } from '@compilr-dev/agents';
9
9
  // =============================================================================
10
10
  export const designSkill = defineSkill({
11
11
  name: 'design',
12
- description: 'Guide user through project design and requirements gathering',
12
+ description: 'Interactive requirements gathering session that produces 5-15 actionable backlog items. Use when starting a new project from scratch or when the user has an idea but no clear requirements. Asks structured questions about goals, users, features, and constraints.',
13
13
  prompt: `You are in DESIGN MODE. Your goal is to gather enough information to populate the project backlog with 5-15 actionable items.
14
14
 
15
15
  ## When to Use
@@ -90,7 +90,7 @@ When you have enough information:
90
90
  });
91
91
  export const refineSkill = defineSkill({
92
92
  name: 'refine',
93
- description: 'Iteratively refine and expand project requirements',
93
+ description: 'Iteratively refine and expand existing project requirements. Use when the project already has an initial design or backlog but needs deeper detail, edge cases, or new features explored. Walks through each area asking targeted follow-up questions.',
94
94
  prompt: `You are in REFINE MODE. Your goal is to deepen and expand existing requirements based on user feedback.
95
95
 
96
96
  ## When to Use
@@ -168,7 +168,7 @@ For complex features:
168
168
  });
169
169
  export const sketchSkill = defineSkill({
170
170
  name: 'sketch',
171
- description: 'Quick project outline with simple questions',
171
+ description: 'Quick lightweight project outline using a few simple questions. Use for rapid brainstorming or when the user wants a fast first pass before committing to a full design session. Produces a high-level summary, not detailed backlog items.',
172
172
  prompt: `You are in SKETCH MODE. Ask 6 quick questions, then create backlog items.
173
173
 
174
174
  ## When to Use
@@ -207,7 +207,7 @@ RULES:
207
207
  });
208
208
  export const refineItemSkill = defineSkill({
209
209
  name: 'refine-item',
210
- description: 'Focused refinement of a specific backlog item',
210
+ description: 'Deep-dive refinement of a single backlog work item. Use when an item needs more detail — acceptance criteria, implementation notes, subtask breakdown, or dependency analysis. Reads the item from the database and produces an updated version.',
211
211
  prompt: `You are in FOCUSED REFINE MODE. Your goal is to refine a specific backlog item.
212
212
 
213
213
  ## When to Use
@@ -275,7 +275,7 @@ Based on user's choice:
275
275
  });
276
276
  export const architectureSkill = defineSkill({
277
277
  name: 'architecture',
278
- description: 'Create architecture documentation (ADRs, diagrams, data models, API designs)',
278
+ description: 'Create or update architecture documentation including ADRs, system diagrams, data models, and API designs. Use after requirements are defined. Reads the current backlog and project documents to produce architecture artifacts stored as project documents.',
279
279
  prompt: `You are in ARCHITECTURE MODE. Your goal is to create architecture documentation.
280
280
 
281
281
  ## When to Use
@@ -420,7 +420,7 @@ Generate appropriate documentation.
420
420
  });
421
421
  export const prdSkill = defineSkill({
422
422
  name: 'prd',
423
- description: 'Amend or enhance the Product Requirements Document',
423
+ description: 'Create, amend, or enhance the Product Requirements Document. Use when formalizing requirements into a structured PRD with sections for overview, user personas, functional requirements, non-functional requirements, and success metrics. Stored as a project document.',
424
424
  prompt: `You are in PRD MODE. Your goal is to update or enhance the existing Product Requirements Document.
425
425
 
426
426
  ## When to Use
@@ -502,7 +502,7 @@ Based on section selected:
502
502
  });
503
503
  export const sessionNotesSkill = defineSkill({
504
504
  name: 'session-notes',
505
- description: 'Create structured session notes capturing work done and decisions made',
505
+ description: 'Create structured session notes capturing work done, decisions made, and open questions. Use at the end of a work session to document progress. Reviews conversation history and produces a formatted summary stored as a project document.',
506
506
  prompt: `You are in SESSION NOTES MODE. Your goal is to create a structured summary of the current session.
507
507
 
508
508
  ## When to Use
@@ -597,7 +597,7 @@ Create the directory if it doesn't exist.
597
597
  });
598
598
  export const buildSkill = defineSkill({
599
599
  name: 'build',
600
- description: 'Implement a backlog item end-to-end',
600
+ description: 'Implement a backlog work item end-to-end — read requirements, write code, run tests, and update the item status. Use when an item is ready to build. Follows a structured workflow: understand → plan → implement → verify → mark complete.',
601
601
  tags: ['implementation', 'coding'],
602
602
  prompt: `You are in BUILD MODE. Implement the specified backlog item.
603
603
 
@@ -694,7 +694,7 @@ Before implementing, read these files for context:
694
694
  });
695
695
  export const scaffoldSkill = defineSkill({
696
696
  name: 'scaffold',
697
- description: 'Create project foundation based on tech stack',
697
+ description: 'Generate a complete project scaffold from the Application Model or tech stack selection. Use after the design phase to create the initial codebase — directory structure, configuration, boilerplate, and starter components. Supports multiple toolkits (React+Node, Next+Prisma, FastAPI, Go, static landing).',
698
698
  tags: ['setup', 'foundation', 'scaffolding'],
699
699
  prompt: `You are creating the PROJECT SCAFFOLD (foundation).
700
700
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",