liveBook · Manning

Chapter 2: Instructions for AI agents

What you will learn in chapter 2 of Context Engineering

Introduces instructions as the context source that sets rules and behavioral expectations for LLM-based systems.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces instructions as the context source that sets rules and behavioral expectations for LLM-based systems.

Key terms: instructions, instruction layers

2.1 Instructions

This section explains what instructions do in LLM-based systems, distinguishes three ways agents receive them, and sketches how an agent assembles them into context.

Key terms: instructions, operating rules, safety boundaries, system prompt, agent skills, instruction artifacts, context manager, context window, skill frontmatter, token budget

2.2 The system prompt

Defines the system prompt as the initial instruction layer that sets an LLM’s baseline behavior.

Key terms: system prompt, system message, baseline behavior, tone, constraints

2.2.1 Content of the system prompt

This section explains how to write a system prompt as an operational specification using distinct instruction components.

Key terms: system prompt, operational specifications, persona, goal, rules, constraints, examples, input-output relationship

2.2.2 System prompts in products and APIs

This section contrasts who controls system prompts in products and APIs, then explains why system prompts should contain only instructions that apply to every request.

Key terms: system prompt, system message, developer-facing APIs, specialized procedures, modular instruction packages, agent skills

2.3 Agent skills

This section explains how agent skills package specialized instructions for on-demand loading instead of placing every procedure in a global system prompt.

Key terms: agent skills, system prompts, procedural knowledge, progressive disclosure, lightweight metadata, active context, agent harness, skill descriptions, activation triggers, working context

2.3.1 The anatomy of a skill

This section explains the required SKILL.md file, how its metadata and instructions work, and the purposes of optional files in a skill directory.

Key terms: skill, SKILL.md, YAML frontmatter, name, description, skill body, Markdown, procedure, conventional commit message, scripts/

2.3.2 Best practices for designing agent skills

This section explains how to design agent skills that activate appropriately, divide work between code and the model, enforce requirements, support follow-on work, and remain reliable in production.

Key terms: activation conditions, description field, frontmatter, overactivation, underactivation, deterministic logic, probabilistic reasoning, orchestration, contextual reasoning, SKILL.md

2.4 Instruction artifacts

This section explains how instruction artifacts make project-specific guidance available to agents without overloading a global system prompt.

Key terms: instruction artifacts, global system prompt, version-controlled files, implicit team conventions, machine-readable context, permanent project policy, ephemeral conversation prompts

2.4.1 Instruction artifacts in coding agents

This section explains why coding agents use repository-adjacent instruction files and how file conventions vary across agent environments.

Key terms: instruction artifacts, durable guidance, version-controlled files, AGENTS.md, CLAUDE.md, .github/copilot-instructions.md, .cursor/rules/*.mdc, active context

2.4.2 Best practices for designing instruction artifacts

The section gives four practices for making instruction artifacts useful to agents and maintainable as a codebase changes.

Key terms: instruction artifacts, actionable command, specific location, explicit boundary, token budget, AGENTS.md, CLAUDE.md, untracked local configurations, directory locality, nested instruction artifacts

2.5 Hands-on

2.5.1 Using system prompts

A two-call example shows how a system prompt changes an LLM’s response to the same user request.

Key terms: system prompt, user prompt, persona and style constraints

2.5.2 Creating custom agent skills

This section shows how to create a custom agent skill in SKILL.md, make it discoverable by an agent, and activate it when needed.

Key terms: custom skills, SKILL.md, frontmatter description, Markdown body, output template, skill directory, agent harness, discovery locations, slash syntax, description

2.5.3 Using existing agent skills

This section explains why teams reuse existing agent skills, how they find and install them, and why they must vet third-party skills before use.

Key terms: pre-built agent skills, standardized workflows, curated catalogs, registries, CLI utilities, project-aware installer, third-party skills, external software dependencies, SKILL.md, tool permissions

2.5.4 Creating custom instruction artifacts

Shows how to share project instructions across coding agents and test whether they follow the same guidance.

Key terms: AGENTS.md, CLAUDE.md, adapter, @path/to/file, project guidance, validation commands, repository rules, system prompts, skills, instruction artifacts

2.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 1: Introduction to context engineering Chapter 3: External knowledge and retrieval →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.