genaiscript

from markpitt/claude-skills

No description

5 stars1 forksUpdated Dec 5, 2025
npx skills add https://github.com/markpitt/claude-skills --skill genaiscript

SKILL.md

GenAIScript Expert

You are an expert in Microsoft's GenAIScript framework, a JavaScript-based system for building automatable prompts and AI workflows. This skill provides orchestrated access to comprehensive GenAIScript documentation.

What GenAIScript Feature Do I Need?

Use this decision table to find the right resource for your task:

Your TaskCore ConceptsAPI RefExamplesPatterns
Understanding framework fundamentals
Explaining script structure, workflow basics
Learning specific API functions
Using $, def(), defSchema(), defTool(), etc.
Building practical solutions
Code review, doc generation, testing scripts
Designing robust solutions
Performance, error handling, modular architecture
Advanced workflows, design patterns, optimization
Token management, caching, parallelization

Quick Start

1. Basic Script Structure

script({
    title: "My Script",
    description: "What this does",
    model: "openai:gpt-4"
})

def("FILE", env.files)
$`Analyze the FILE and provide insights.`

See resources/core-concepts.md for detailed explanation.

2. Include Context

// Include file content
def("CODE", env.files, { endsWith: ".ts", lineNumbers: true })

// Include structured data
const rows = await parsers.CSV(env.files[0])
defData("ROWS", rows)

// Define output structure
const schema = defSchema("RESULT", {
    type: "object",
    properties: { /* schema */ }
})

See resources/api-reference.md for all functions.

3. Common Patterns

  • Code review & analysis → resources/examples.md (Code Quality section)
  • Documentation generation → resources/examples.md (Documentation section)
  • Data extraction → resources/examples.md (Data Processing section)
  • Performance optimization → resources/patterns.md (Performance section)

3-Phase Orchestration Protocol

Phase 1: Task Analysis

Determine what you're building:

Script Purpose:

  • Analysis: Review code, find issues, validate structure
  • Generation: Create tests, docs, code, configs
  • Transformation: Convert formats, migrate code, refactor
  • Integration: Connect APIs, process files, orchestrate workflows

Complexity Level:

  • Simple: Single LLM call, clear requirements
  • Intermediate: 2-3 LLM calls, structured outputs
  • Advanced: Multi-step workflows, agents, tools, caching

Phase 2: Resource Selection

Load resources based on task type:

  • Starting out → Load resources/core-concepts.md
  • Need API details → Load resources/api-reference.md
  • Building solution → Load resources/examples.md (find similar example)
  • Optimizing → Load resources/patterns.md (see advanced patterns)
  • Complex task → Load resources/patterns.md (design patterns section)

Phase 3: Execution & Validation

While building:

  • Reference decision table above to navigate resources
  • Use examples as templates
  • Follow patterns for performance/reliability

Before using script:

  • Validate file inputs are available
  • Test with sample data
  • Check token budget (see patterns/performance)
  • Verify schema matches expected output

Core Concepts Overview

GenAIScript enables:

  • Prompt-as-Code: Build prompts programmatically with JavaScript/TypeScript
  • File Processing: Import context from PDFs, DOCX, CSV, and other formats
  • Tool Integration: Define custom tools and agents for LLMs
  • Structured Output: Generate files, edits, and structured data from LLM responses
  • MCP Support: Integrate with Model Context Protocol tools and resources

For detailed explanation of concepts, see resources/core-concepts.md

Resource Files

ResourcePurposeSizeBest For
core-concepts.mdFramework fundamentals, script structure, file processing~280 linesLearning basics, understanding how GenAIScript works
api-reference.mdComplete API documentation, function signatures, parameters~350 linesLooking up function details, understanding options
examples.mdPractical examples for common use cases~400 linesBuilding solutions, finding templates
patterns.mdAdvanced patterns, optimization, best practices, design patterns~350 linesOptimizing performance, handling complex tasks

Common Workflows

I want to...

Analyze existing code

  1. Read resources/core-concepts.md (understand def())
  2. Check resources/examples.md → Code Quality section
  3. See resources/patterns.md → Error Handling

Generate documentation

  1. Check resources/examples.md → Documentation section
  2. Use example as template
  3. See `res

...

Read full content

Repository Stats

Stars5
Forks1