Claude-skill-registry genaiscript
Comprehensive expertise for working with Microsoft's GenAIScript framework - a JavaScript/TypeScript-based system for building automatable LLM prompts and AI workflows. Use when creating, debugging, or optimizing GenAIScript scripts, implementing prompts-as-code, working with tools and agents, processing files (PDF, CSV, DOCX), defining schemas, or building AI automation workflows.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/genaiscript" ~/.claude/skills/majiayu000-claude-skill-registry-genaiscript && rm -rf "$T"
skills/data/genaiscript/SKILL.mdGenAIScript 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 Task | Core Concepts | API Ref | Examples | Patterns |
|---|---|---|---|---|
| Understanding framework fundamentals | ✓ | |||
| Explaining script structure, workflow basics | ✓ | |||
| Learning specific API functions | ✓ | ✓ | ||
Using , , , , 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
(find similar example)resources/examples.md - Optimizing → Load
(see advanced patterns)resources/patterns.md - Complex task → Load
(design patterns section)resources/patterns.md
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
| Resource | Purpose | Size | Best For |
|---|---|---|---|
| core-concepts.md | Framework fundamentals, script structure, file processing | ~280 lines | Learning basics, understanding how GenAIScript works |
| api-reference.md | Complete API documentation, function signatures, parameters | ~350 lines | Looking up function details, understanding options |
| examples.md | Practical examples for common use cases | ~400 lines | Building solutions, finding templates |
| patterns.md | Advanced patterns, optimization, best practices, design patterns | ~350 lines | Optimizing performance, handling complex tasks |
Common Workflows
I want to...
→ Analyze existing code
- Read
(understandresources/core-concepts.md
)def() - Check
→ Code Quality sectionresources/examples.md - See
→ Error Handlingresources/patterns.md
→ Generate documentation
- Check
→ Documentation sectionresources/examples.md - Use example as template
- See
forresources/api-reference.mddefFileOutput()
→ Process files and extract data
- Read
(file processing section)resources/core-concepts.md - Check
→ Data Processing sectionresources/examples.md - Reference
→ Parsersresources/api-reference.md
→ Build multi-step workflow
- See
→ Design Patterns (Chain of Responsibility)resources/patterns.md - Check
→ Advanced Workflows sectionresources/examples.md - Reference
for function detailsresources/api-reference.md
→ Optimize performance or debug
- See
→ Performance Optimization sectionresources/patterns.md - Check
→ Error Handling sectionresources/patterns.md - Reference
for token management optionsresources/api-reference.md
Quick Reference
| Component | Learn More |
|---|---|
template tag | api-reference.md § Core Functions |
file inclusion | api-reference.md § Core Functions |
output structure | api-reference.md § Core Functions + examples.md |
, | api-reference.md § Core Functions |
| Parsers (PDF, CSV, XLSX, etc.) | api-reference.md § Parsers |
| Environment variables | api-reference.md § Environment + core-concepts.md |
| Token management | patterns.md § Performance Optimization |
| Error handling | patterns.md § Error Handling |
| Design patterns | patterns.md § Design Patterns |
Getting Help
When helping with GenAIScript:
- Ask what they're building - Analysis? Generation? Transformation?
- Point to resource - Use decision table above
- Show example - See
for similar use caseresources/examples.md - Check patterns - For optimization/debugging, see
resources/patterns.md - Reference API - For specific functions, see
resources/api-reference.md
VS Code Integration
GenAIScript includes a VS Code extension with:
- Syntax highlighting for
files.genai.mjs - IntelliSense for API functions
- Debug support with breakpoints
- Script runner to test scripts
- Output preview for generated files
# Running scripts genaiscript run <script-name> genaiscript run <script-name> file1.ts file2.ts genaiscript run <script-name> --var KEY=value genaiscript run <script-name> --model openai:gpt-4
See
resources/core-concepts.md for more details.
Navigation Tip: Each resource file contains cross-references. Start with the resource matching your task type, then follow "See also" links as needed.