Skip to main content
skill

prompt-engineering-guidance — Claude Code skill: how to install

Guides Claude Code in applying Microsoft Research's Guidance framework. It enforces structured LLM output using regular expressions and context-free grammars.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill ai-research/prompt-engineering-guidance
Open on GitHub

What prompt-engineering-guidance does

This skill provides practical patterns for Microsoft Research's Guidance library. Instead of relying on unconstrained text completion, it filters tokens at runtime. As a result, the model returns guaranteed JSON structures, specific multiple-choice values, or text matching a regular expression.

The guidance covers backends for Anthropic Claude, OpenAI, and local setups using Transformers or llama.cpp. It also explains token healing, which backs up one token to fix unnatural whitespace boundaries. Running these workflows requires Python along with the guidance package installed in your project environment.

What it helps with

  • Force LLM outputs to match a strict regex for emails or phone numbers
  • Restrict model choices to a predefined list using select
  • Build multi-step agent workflows with the @guidance decorator
  • Generate valid JSON structures without broken syntax

Example prompts for the agent

  • Show me how to constrain Claude output to an email format with Guidance regex
  • Write a Guidance script using select to pick from four predefined answers
  • Create a multi-step agent with the @guidance decorator for tool execution

How to install prompt-engineering-guidance

1claude-code-templates

npx claude-code-templates@latest --skill ai-research/prompt-engineering-guidance

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill prompt-engineering-guidance -a claude-code

3Manually: put the files in place

~/.claude/skills/prompt-engineering-guidance/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/prompt-engineering-guidance/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about prompt-engineering-guidance

How do I install prompt-engineering-guidance in Claude Code?

Run npx claude-code-templates@latest --skill ai-research/prompt-engineering-guidance or npx skills add davila7/claude-code-templates --skill prompt-engineering-guidance -a claude-code. Alternatively, place the file into ~/.claude/skills/prompt-engineering-guidance/SKILL.md.

What is prompt-engineering-guidance?

It is a skill that instructs Claude Code on writing constrained generation code with the Guidance library. It guarantees syntax validation during model output.

What backends does Guidance support?

The skill outlines integration with Anthropic Claude and OpenAI APIs, alongside local models through Hugging Face Transformers or llama.cpp.

Similar skills

All skills for AI and ML →

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor