# How Reusable AI Artifacts (Prompts, Skills, and Agents) Work in AI Engineering from Scratch

> Discover how reusable AI artifacts like prompts, skills, and agents are automatically discovered and installed in AI Engineering from Scratch. Learn how this simplifies LLM and agent runtime consumption without re-reading code.

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

---

**Reusable AI artifacts in the AI Engineering from Scratch project are Markdown files with YAML front-matter that are automatically discovered, indexed, and installed via the [`install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/install_skills.py) script, enabling them to be consumed by LLMs, agent runtimes, and MCP servers without re-reading lesson code.**

The rohitg00/ai-engineering-from-scratch repository implements a **"Build It / Use It"** philosophy where every lesson ships concrete reusable AI artifacts. These artifacts—including prompts, skills, and agents—are stored as structured Markdown files that can be directly consumed by Claude, Cursor, OpenAI, or custom agent loops.

## Artifact Generation and Structure

Every lesson in the curriculum follows a consistent pattern that separates implementation from reusable output.

### Lesson Implementation Layout

Each lesson contains a `code/` directory with runnable reference implementations (Python, TypeScript, Rust, or Julia) alongside an `outputs/` directory containing the artifact itself. For example, the End-to-End Safety Gate lesson stores its skill definition at [`phases/19-capstone-projects/87-end-to-end-safety-gate/outputs/skill-end-to-end-safety-gate.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/87-end-to-end-safety-gate/outputs/skill-end-to-end-safety-gate.md).

### Standardized Schema with YAML Front-Matter

All artifacts use a Markdown file with YAML front-matter containing metadata fields such as `name`, `description`, `phase`, `lesson`, `tags`, and `version`. This standardization allows the repository's discovery system to parse and catalog every artifact across all 503 lessons uniformly.

The front-matter structure appears as follows:

```markdown
---
name: end-to-end-safety-gate
description: Validates outputs against safety constraints
phase: 19
lesson: 87
tags: [safety, validation, capstone]
version: 1.0.0
---

## Implementation

[Actionable algorithm description here]

```

## Discovery and Indexing

The project automates artifact discovery through a centralized parsing script rather than manual cataloging.

### The Artifact Discovery Script

The [`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py) file walks the `phases/**/outputs` directories and reads each `.md` file. It extracts front-matter using `_lib.parse_frontmatter` and instantiates an `Artifact` dataclass typed as *skill*, *prompt*, or *agent*.

The script supports filtering by **type**, **phase**, or **tag**, allowing selective installation of specific artifact categories.

### Manifest Generation

After parsing, the script generates a [`manifest.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/manifest.json) that lists every artifact with its source path, target path, and metadata. This manifest powers both the CLI installer and the website's interactive catalog, creating a searchable index of all reusable AI artifacts.

## Installation and Consumption Patterns

Artifacts are designed for immediate consumption across different environments without framework lock-in.

### CLI Installation

Install artifacts locally using the discovery script:

```bash
python3 scripts/install_skills.py ./my_artifacts --type all --layout flat

```

The `--layout` flag supports three modes:
- **flat**: Copies all artifacts into a single directory
- **per-phase**: Organizes by curriculum phase
- **skills**: Structures for Claude-compatible skill loading

### Usage in LLM Workflows

Because artifacts are plain Markdown, they integrate with any LLM workflow:

- **Prompts** are ready-to-use strings (e.g., [`phases/04-computer-vision/04-image-classification/outputs/prompt-classifier-pipeline-auditor.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/04-computer-vision/04-image-classification/outputs/prompt-classifier-pipeline-auditor.md)) that can be pasted directly into chat interfaces
- **Skills** (Claude-style [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) files like [`.claude/skills/find-your-level/SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/.claude/skills/find-your-level/SKILL.md)) define structured capabilities that agent runtimes read and execute
- **Agents** are distributed as [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) specifications that map declared actions to internal functions
- **MCP servers** are placed under `outputs/` and started via the MCP client code in Phase 13

## Runtime Integration

The framework-agnostic design allows runtime loading across Python, TypeScript, or direct API usage.

### Loading Skills in Python

Parse and execute skills using standard libraries:

```python
import pathlib
import yaml

def load_skill(path: pathlib.Path):
    text = path.read_text()
    # Split front-matter and body

    parts = text.split('---')
    meta = yaml.safe_load(parts[1])
    body = '---'.join(parts[2:]).strip()
    return meta, body

skill_path = pathlib.Path("my_artifacts/skill-end-to-end-safety-gate.md")
meta, body = load_skill(skill_path)

print(f"Skill: {meta['name']}")
print("Description:", meta['description'])
print("\n--- Implementation ---\n", body[:200], "...")

```

### Direct Prompt Usage

Send prompts directly to LLM APIs without intermediate processing:

```python
import json
import requests
import pathlib

prompt_path = pathlib.Path(
    "my_artifacts/prompt-classifier-pipeline-auditor.md"
)
prompt_md = prompt_path.read_text()

# Extract content after front-matter

prompt = prompt_md.split('---', 2)[2].strip()

response = requests.post(
    "https://api.openai.com/v1/chat/completions",
    headers={"Authorization": f"Bearer {YOUR_API_KEY}"},
    json={
        "model": "gpt-4o-mini",
        "messages": [{"role": "user", "content": prompt}],
        "temperature": 0.0,
    },
)
print(json.dumps(response.json(), indent=2))

```

### Agent Runtime Execution

For agents, the runtime reads the [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) specification and maps declared actions to internal functions (e.g., `AskUserQuestion`, `RunTool`). The agent loop from Phase 14 ([`phases/14-agent-engineering/01-agent-loop/outputs/skill-agent-loop.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/14-agent-engineering/01-agent-loop/outputs/skill-agent-loop.md)) demonstrates how user queries are processed, tools invoked, and final outputs produced.

## Website Integration

The static site generator ([`site/build.js`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/site/build.js)) reads the README markdown table, extracts lesson links, and imports artifacts from `outputs/` sub-folders. The generated [`site/data.js`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/site/data.js) drives the interactive catalog on the public website, allowing users to browse, filter, and copy any prompt, skill, or agent directly from the UI.

## Summary

- **Reusable AI artifacts** are Markdown files with YAML front-matter stored in lesson-specific `outputs/` directories
- **[`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py)** automatically discovers, parses, and installs artifacts across all 503 lessons
- **Three artifact types** are supported: prompts (ready-to-use strings), skills (Claude-compatible [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) files), and agents (structured specifications)
- **Framework-agnostic design** allows consumption by Claude, Cursor, OpenAI, or custom MCP servers
- **Manifest generation** creates a searchable catalog that powers both CLI tools and the project website

## Frequently Asked Questions

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

A **skill** is a reusable capability definition (stored as [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md)) that defines specific actions or knowledge domains, such as the end-to-end safety gate. An **agent** is also stored as a [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) file but represents a complete autonomous entity with a specific loop and tool-calling capabilities, as demonstrated in Phase 14's agent loop implementation.

### How does the install script handle different artifact types?

The [`install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/install_skills.py) script uses the `type` field in the YAML front-matter to categorize each artifact. It instantiates an `Artifact` dataclass with the appropriate type annotation (skill, prompt, or agent) and filters based on the `--type` CLI argument, allowing you to install only specific categories or all artifacts at once.

### Can these artifacts be used outside of the AI Engineering from Scratch curriculum?

Yes. Because artifacts are plain Markdown with standardized YAML front-matter, they are framework-agnostic. You can load them into any Python environment using `yaml.safe_load`, paste prompts directly into ChatGPT, Claude, or Cursor, or register MCP servers with any compatible client. The repository provides helpers but does not require proprietary runtimes.

### Where are the actual artifact files located in the repository?

Artifact files are located in `outputs/` subdirectories within each lesson folder under `phases/`. For example, the safety gate skill is at [`phases/19-capstone-projects/87-end-to-end-safety-gate/outputs/skill-end-to-end-safety-gate.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/phases/19-capstone-projects/87-end-to-end-safety-gate/outputs/skill-end-to-end-safety-gate.md), while Claude-specific skills are stored in `.claude/skills/` (e.g., [`.claude/skills/find-your-level/SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/.claude/skills/find-your-level/SKILL.md)).