# What Reusable AI Artifacts (Prompts, Skills, and Agents) Are Generated by Each Lesson

> Discover the reusable AI artifacts like prompts, skills, and agents generated by each AI Engineering From Scratch lesson. Easily integrate them into your workflows.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: deep-dive
- Published: 2026-06-23

---

**Each lesson in the AI Engineering From Scratch curriculum automatically generates three types of reusable artifacts—skills as markdown documents, prompts as JSON templates, and agents as orchestration scripts—stored in the lesson's `outputs/` directory for immediate reuse in downstream AI workflows.**

The *AI Engineering From Scratch* repository implements a **lesson-driven code generation** architecture where every algorithmic implementation produces concrete, version-controlled outputs. Instead of static tutorials, each lesson generates **reusable AI artifacts** including self-contained capabilities, curated prompt templates, and deployable agent definitions that can be imported into production systems without hidden runtime dependencies.

## The Three Core Artifact Types

### Skills

**Skills** are markdown documents that encapsulate self-contained capabilities. Each skill file documents a specific algorithm or pipeline—such as a policy-gradient trainer, jailbreak taxonomy classifier, or multimodal document QA system—and includes executable code blocks.

According to the repository's [`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md) specification, skills are written to `phases/<phase-slug>/<lesson-slug>/outputs/skill-<name>.md`. For example, reinforcement learning lessons output files like [`phases/09-reinforcement-learning/08-ppo/outputs/skill-ppo-trainer.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/09-reinforcement-learning/08-ppo/outputs/skill-ppo-trainer.md), while capstone projects generate specialized tools like [`phases/19-capstone-projects/82-jailbreak-taxonomy/outputs/skill-jailbreak-taxonomy.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/82-jailbreak-taxonomy/outputs/skill-jailbreak-taxonomy.md).

### Prompts

**Prompts** are JSON or markdown files storing curated prompt templates with placeholders for downstream models. These artifacts standardize how LLMs and multimodal models receive instructions for specific tasks.

Prompt files follow the naming convention `phases/<phase-slug>/<lesson-slug>/outputs/prompt-<name>.md`, allowing them to be version-controlled and searched independently of the implementation code.

### Agents

**Agents** are small Python or TypeScript programs that orchestrate multiple LLM or service calls to achieve higher-level tasks. In this repository, agents are also expressed as *skill* documents, meaning they ship as markdown files containing both the orchestration logic and usage documentation.

Typical agents include issue-to-PR bots and LLM observability dashboards, located at paths like [`phases/19-capstone-projects/11-llm-observability-dashboard/outputs/skill-llm-observability.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/11-llm-observability-dashboard/outputs/skill-llm-observability.md).

## How Lessons Generate Artifacts

The generation pipeline follows a strict four-phase contract enforced by [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py):

1. **Implementation** – Source code resides under `phases/.../code/main.<lang>` demonstrating the algorithm.
2. **Tests** – Unit tests validate correctness under `code/tests/`.
3. **Outputs** – Upon execution, the lesson writes artifacts to the `outputs/` directory.
4. **Catalog** – The [`outputs/index.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/index.json) master index records all generated artifacts, which [`site/build.js`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/site/build.js) consumes to build the public catalog.

Because artifacts are plain text (markdown and JSON), they integrate into any workflow without proprietary runtime dependencies.

## Loading and Reusing Generated Skills

Since skills are markdown files with embedded Python code, you can extract and execute them dynamically. The following example demonstrates loading a policy-gradient trainer from its skill file:

```python
from pathlib import Path

def extract_code(md_path: Path) -> str:
    """Extract Python code blocks from markdown skill files."""
    inside = False
    lines = []
    for line in md_path.read_text().splitlines():
        if line.strip().startswith("```python"):
            inside = True
            continue
        if line.strip().startswith("```") and inside:
            break
        if inside:
            lines.append(line)
    return "\n".join(lines)

# Load a specific skill from the reinforcement learning phase

skill_path = Path(
    "phases/09-reinforcement-learning/08-ppo/outputs/skill-ppo-trainer.md"
)

code = extract_code(skill_path)
namespace = {}
exec(code, namespace)

# Execute the trainer function defined in the skill

trainer = namespace["train_ppo"]
env = ...  # Initialize your gym environment

config = {"learning_rate": 3e-4, "epochs": 100}
trainer(env, config)

```

This pattern applies to all skill types, from the [`skill-constitutional-rules-engine.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/skill-constitutional-rules-engine.md) in `phases/19-capstone-projects/86-constitutional-rules-engine/outputs/` to the [`skill-video-qa.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/skill-video-qa.md) in `phases/19-capstone-projects/12-video-understanding-pipeline/outputs/`.

## Key Source Files and Locations

The artifact system is governed by several critical files in the repository:

- **[`AGENTS.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/AGENTS.md)** – Formal definition of the artifact contract and naming conventions.
- **[`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py)** – Entry point that executes lessons and persists outputs to disk.
- **[`site/build.js`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/site/build.js)** – Build pipeline that ingests the `outputs/` directory to generate the public catalog.
- **[`outputs/index.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/index.json)** – Master index mapping all generated skills, prompts, and agents to their source lessons.

## Summary

- **Three artifact types** are generated automatically: **skills** (markdown documentation with code), **prompts** (templated instructions), and **agents** (orchestration scripts).
- **Storage location** follows the pattern `phases/<phase-slug>/<lesson-slug>/outputs/<artifact-type>-<name>.md`.
- **Plain text format** ensures version control compatibility and eliminates runtime dependencies.
- **Dynamic loading** is possible by extracting code blocks from markdown skill files and executing them in Python namespaces.
- **Master indexing** via [`outputs/index.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/index.json) enables discovery across the entire curriculum.

## Frequently Asked Questions

### How do I find all available skills in the repository?

All generated artifacts are cataloged in [`outputs/index.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/index.json) at the repository root. This JSON file maps every skill, prompt, and agent to its generating lesson, allowing you to search for specific capabilities like "policy-gradient" or "jailbreak-taxonomy" without browsing individual directories.

### Can I use these artifacts in my own AI projects?

Yes. The artifacts are designed for immediate reuse. Since skills are markdown files containing executable Python code, you can extract the implementation using the code extraction pattern shown above and integrate it into your training pipelines or inference services. The prompts function as drop-in templates for any OpenAI-compatible API.

### What is the difference between a skill and an agent in this repository?

**Skills** encapsulate single capabilities—such as a specific training algorithm or classification pipeline—while **agents** orchestrate multiple calls to achieve higher-level goals. However, both are serialized as markdown files in the `outputs/` directory. Agents typically include orchestration logic that coordinates multiple skills or external services.

### How are the artifacts generated during the lesson execution?

When [`scripts/lesson_run.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/lesson_run.py) executes a lesson, it runs the implementation code located in `phases/<phase>/code/main.<lang>`, validates it against tests in `code/tests/`, then writes the resulting artifacts to the lesson's `outputs/` subdirectory. The script simultaneously updates the global [`outputs/index.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/outputs/index.json) to reflect the new artifacts.