All skills
Skillintermediate

API Reference

> Auto-generated from TypeScript source files

Claude Code Knowledge Pack7/10/2026

Overview

API Reference

Auto-generated from TypeScript source files

Table of Contents


variables/index

Variable Detection Utility Detects common variable-like patterns in text that could be converted to our supported format: ${variableName} or ${variableName:default}

Types

VariablePattern

type VariablePattern = | "double_bracket"      // [[name]] or [[ name ]]
  | "double_curly"        // {{name}} or {{ name }}
  | "single_bracket"      // [NAME] or [name]
  | "single_curly"        // {NAME} or {name}
  | "angle_bracket"       //  or <name>
  | "percent"             // %NAME% or %name%
  | "dollar_curly"

Interfaces

DetectedVariable

Variable Detection Utility Detects common variable-like patterns in text that could be converted to our supported format: ${variableName} or ${variableName:default}

PropertyTypeDescription
originalstring-
namestring-
defaultValuestring-
patternVariablePattern-
startIndexnumber-
endIndexnumber-

Functions

detectVariables()

Detect variable-like patterns in text Returns detected variables that are NOT in our supported format

detectVariables(text: string): DetectedVariable[]

Parameters:

  • text: string

Returns: DetectedVariable[]

convertToSupportedFormat()

Convert a detected variable to our supported format

convertToSupportedFormat(variable: DetectedVariable): string

Parameters:

  • variable: DetectedVariable

Returns: string

convertAllVariables()

Convert all detected variables in text to our supported format

convertAllVariables(text: string): string

Parameters:

  • text: string

Returns: string

getPatternDescription()

Get a human-readable pattern description

getPatternDescription(pattern: VariablePattern): string

Parameters:

  • pattern: VariablePattern

Returns: string

extractVariables()

Extract variables from our supported ${var} or ${var:default} format

extractVariables(text: string): Array<{ name: string; defaultValue?: string }>

Parameters:

  • text: string

Returns: Array<{ name: string; defaultValue?: string }>

compile()

Compile a prompt template with variable values

compile(template: string, values: Record<string, string>, options?: { useDefaults?: boolean }): string

Parameters:

  • template: string
  • values: Record<string, string>
  • options: { useDefaults?: boolean } (optional) = {}

Returns: string

Constants

normalize

Alias for convertAllVariables - normalizes all variable formats to ${var}

normalize = convertAllVariables

detect

Alias for detectVariables

detect = detectVariables

similarity/index

Content similarity utilities for duplicate detection

Functions

normalizeContent()

Content similarity utilities for duplicate detection

normalizeContent(content: string): string

Parameters:

  • content: string

Returns: string

calculateSimilarity()

Combined similarity score using multiple algorithms Returns a value between 0 (completely different) and 1 (identical)

calculateSimilarity(content1: string, content2: string): number

Parameters:

  • content1: string
  • content2: string

Returns: number

isSimilarContent()

Check if two contents are similar enough to be considered duplicates Default threshold is 0.85 (85% similar)

isSimilarContent(content1: string, content2: string, threshold?: number): boolean

Parameters:

  • content1: string
  • content2: string
  • threshold: number (optional) = 0.85

Returns: boolean

getContentFingerprint()

Get normalized content hash for database indexing/comparison This is a simple hash for quick lookups before full similarity check

getContentFingerprint(content: string): string

Parameters:

  • content: string

Returns: string

findDuplicates()

Find duplicates in an array of prompts Returns groups of similar prompts

findDuplicates(prompts: T[], threshold?: number): T[][]

Parameters:

  • prompts: T[]
  • threshold: number (optional) = 0.85

Returns: T[][]

deduplicate()

Deduplicate an array of prompts, keeping the first occurrence

deduplicate(prompts: T[], threshold?: number): T[]

Parameters:

  • prompts: T[]
  • threshold: number (optional) = 0.85

Returns: T[]

Constants

calculate

Alias for calculateSimilarity

calculate = calculateSimilarity

isDuplicate

Alias for isSimilarContent

isDuplicate = isSimilarContent

quality/index

Prompt Quality Checker - Local validation for prompt quality

@example


const result = quality.check("Act as a developer...");
console.log(result.score); // 0.85
console.log(result.issues); // []

Interfaces

QualityIssue

Prompt Quality Checker - Local validation for prompt quality

PropertyTypeDescription
type`'error''warning'
codestring-
messagestring-
position{ start: number; end: number }-

QualityResult

PropertyTypeDescription
validboolean-
scorenumber-
issuesQualityIssue[]-
statsunknown-

Functions

check()

Check prompt quality locally (no API needed)

check(prompt: string): QualityResult

Parameters:

  • prompt: string

Returns: QualityResult

validate()

Validate a prompt and throw if invalid

validate(prompt: string): void

Parameters:

  • prompt: string

isValid()

Check if a prompt is valid

isValid(prompt: string): boolean

Parameters:

  • prompt: string

Returns: boolean

getSuggestions()

Get suggestions for improving a prompt

getSuggestions(prompt: string): string[]

Parameters:

  • prompt: string

Returns: string[]


parser/index

Prompt Parser - Parse and load prompt files in various formats

Supports:

  • .prompt.yml / .prompt.yaml (YAML format)
  • .prompt.json (JSON format)
  • .prompt.md (Markdown with frontmatter)
  • .txt (Plain text)

@example


const prompt = parser.parse(`
name: Code Review
messages:
  - role: system
    content: You are a code reviewer.
`);

Interfaces

PromptMessage

Prompt Parser - Parse and load prompt files in various formats

Supports:

  • .prompt.yml / .prompt.yaml (YAML format)
  • .prompt.json (JSON format)
  • .prompt.md (Markdown with frontmatter)
  • .txt (Plain text)
PropertyTypeDescription
role`'system''user'
contentstring-

ParsedPrompt

PropertyTypeDescription
namestring-
descriptionstring-
modelstring-
modelParametersunknown-
messagesPromptMessage[]-
variablesunknown-
metadataRecord<string, unknown>-

Functions

parse()

Parse prompt content in various formats

parse(content: string, format?: 'yaml' | 'json' | 'markdown' | 'text'): ParsedPrompt

Parameters:

  • content: string
  • format: 'yaml' | 'json' | 'markdown' | 'text' (optional)

Returns: ParsedPrompt

toYaml()

Serialize a ParsedPrompt to YAML format

toYaml(prompt: ParsedPrompt): string

Parameters:

  • prompt: ParsedPrompt

Returns: string

toJson()

Serialize a ParsedPrompt to JSON format

toJson(prompt: ParsedPrompt, pretty?: boolean): string

Parameters:

  • prompt: ParsedPrompt
  • pretty: boolean (optional) = true

Returns: string

getSystemPrompt()

Get the system message content from a parsed prompt

getSystemPrompt(prompt: ParsedPrompt): string

Parameters:

  • prompt: ParsedPrompt

Returns: string

interpolate()

Interpolate variables in a prompt

interpolate(prompt: ParsedPrompt, values: Record<string, string>): ParsedPrompt

Parameters:

  • prompt: ParsedPrompt
  • values: Record<string, string>

Returns: ParsedPrompt


builder/index

Prompt Builder - A fluent DSL for creating structured prompts

@example


const prompt = builder()
  .role("Senior TypeScript Developer")
  .context("You are helping review code")
  .task("Analyze the following code for bugs")
  .constraints(["Be concise", "Focus on critical issues"])
  .output("JSON with { bugs: [], suggestions: [] }")
  .variable("code", { required: true })
  .build();

Interfaces

PromptVariable

Prompt Builder - A fluent DSL for creating structured prompts

PropertyTypeDescription
namestring-
descriptionstring-
requiredboolean-
defaultValuestring-

BuiltPrompt

PropertyTypeDescription
contentstring-
variablesPromptVariable[]-
metadataunknown-

Classes

PromptBuilder

Methods:

MethodDescription
role(role: string): thisSet the role/persona for the AI
persona(persona: string): thisAlias for role()
context(context: string): thisSet the context/background information
background(background: string): thisAlias for context()
task(task: string): thisSet the main task/instruction
instruction(instruction: string): thisAlias for task()
constraints(constraints: string[]): thisAdd constraints/rules the AI should follow
constraint(constraint: string): thisAdd a single constraint
rules(rules: string[]): thisAlias for constraints()
output(format: string): thisSet the expected output format
format(format: string): thisAlias for output()
example(input: string, output: string): thisAdd an example input/output pair
examples(examples: Array<{ input: string; output: string }>): thisAdd multiple examples
variable(name: string, options?: { description?: string; required?: boolean; defaultValue?: string }): thisDefine a variable placeholder
section(title: string, content: string): thisAdd a custom section
raw(content: string): thisSet raw content (bypasses structured building)
build(): BuiltPromptBuild the final prompt
toString(): stringBuild and return only the content string
role()

Set the role/persona for the AI

role(role: string): this

Parameters:

  • role: string

Returns: this

persona()

Alias for role()

persona(persona: string): this

Parameters:

  • persona: string

Returns: this

context()

Set the context/background information

context(context: string): this

Parameters:

  • context: string

Returns: this

background()

Alias for context()

background(background: string): this

Parameters:

  • background: string

Returns: this

task()

Set the main task/instruction

task(task: string): this

Parameters:

  • task: string

Returns: this

instruction()

Alias for task()

instruction(instruction: string): this

Parameters:

  • instruction: string

Returns: this

constraints()

Add constraints/rules the AI should follow

constraints(constraints: string[]): this

Parameters:

  • constraints: string[]

Returns: this

constraint()

Add a single constraint

constraint(constraint: string): this

Parameters:

  • constraint: string

Returns: this

rules()

Alias for constraints()

rules(rules: string[]): this

Parameters:

  • rules: string[]

Returns: this

output()

Set the expected output format

output(format: string): this

Parameters:

  • format: string

Returns: this

format()

Alias for output()

format(format: string): this

Parameters:

  • format: string

Returns: this

example()

Add an example input/output pair

example(input: string, output: string): this

Parameters:

  • input: string
  • output: string

Returns: this

examples()

Add multiple examples

examples(examples: Array<{ input: string; output: string }>): this

Parameters:

  • examples: Array<{ input: string; output: string }>

Returns: this

variable()

Define a variable placeholder

variable(name: string, options?: { description?: string; required?: boolean