PromptsLibrary 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package PromptsLibrary --version 1.0.1
                    
NuGet\Install-Package PromptsLibrary -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PromptsLibrary" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PromptsLibrary" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="PromptsLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PromptsLibrary --version 1.0.1
                    
#r "nuget: PromptsLibrary, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PromptsLibrary@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PromptsLibrary&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=PromptsLibrary&version=1.0.1
                    
Install as a Cake Tool

PromptsLibrary

A lightweight .NET library for managing and rendering templated prompts using Handlebars templates.

Features

  • 📁 Group-based prompt organization
  • 🎨 Handlebars template support
  • 📝 Dynamic parameter injection
  • 📊 Comprehensive logging
  • ⚡ .NET 8 optimized

Installation

Add to your project via NuGet: Install-Package PromptsLibrary

Quick Start

Configuration

builder.Services.AddPromptsLibrary();

Create Prompts

create a text file (*.txt) with your desired name and put your prompt inside it.

Summarize the following text in {{count}} words.
{{text}}

Create Prompts Folder

Create a folder named prompts (lowercase recommended) in your project root: Set the "Copy To Output Directory" for all of your prompts to "Copy Always" or "Copy if newer"

├── prompts/
│   ├── summarization/
│   │   ├── simple.txt
│   │   └── with-bullets.txt
│   ├── translation/
	 		└── english-to-persian.txt

Usage

public async Task<string> SummarizeText(string text, int count = 150)
{
    var parameters = new { text, count };

    var prompt = _promptsLibraryService.RenderPrompt(
        groupName: "summarization", //prompt parent folder
        promptName: "simple",  // without .txt extension
        parameters: parameters
    );

    // Send to LLM...
}

Options

you can set the options via appsettings.json or when you creating the service

  builder.Services.AddPromptsLibrary(options =>
{
    options.PromptsFolderPath = "MyPrompts";                    // default: "prompts"
    options.SkipEmptyGroups = false;                            // default: true
    options.SkipEmptyPrompts = false;                           // default: true
    options.SkipUncompilablePrompts = true;                     // default: false
});

Dependencies

  • Handlebars.Net - Template engine
  • Microsoft.Extensions.Logging
  • Microsoft.Extensions.Options

License

MIT

Contributing

Contributions are welcome! Please follow these guidelines:

  • Create a feature branch
  • Add/update tests
  • Ensure all tests pass
  • Submit a pull request
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 83,737 7/23/2026
1.0.1 758 12/2/2025
1.0.0 713 12/2/2025