# How to Install Skills with `install_skills.py`: Complete Guide to the AI Engineering Curriculum Artifact Installer

> Learn the skill installation process using install_skills.py. This guide covers the AI Engineering Curriculum Artifact Installer script for easy setup.

- Repository: [Rohit Ghumare/ai-engineering-from-scratch](https://github.com/rohitg00/ai-engineering-from-scratch)
- Tags: how-to-guide
- Published: 2026-06-08

---

**The [`install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/install_skills.py) script is a self‑contained Python utility that discovers, filters, and copies curriculum artifacts—skills, prompts, and agents—into a user‑specified directory using configurable layout strategies and zero external dependencies.**

The **skill installation process** in the `rohitg00/ai-engineering-from-scratch` repository automates the distribution of educational content from the curriculum's `phases/**/outputs/` folders to your local environment. Whether you need to extract machine‑learning prompts, agent configurations, or skill definitions, this script handles metadata parsing, conflict resolution, and reproducible deployments through a simple command‑line interface.

## How the Skill Installation Process Works

The installer operates through four deterministic stages implemented in [`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py). Each stage transforms the raw curriculum files into a structured, queryable installation.

### Stage 1: Discovering Artifacts

The script begins by walking the repository structure and parsing every Markdown file matching the patterns `skill‑*.md`, `prompt‑*.md`, or `agent‑*.md` located under `phases/**/outputs/`. For each file, it invokes `parse_frontmatter` (defined in [`scripts/_lib.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/_lib.py)) to extract YAML‑style headers containing metadata such as `name`, `phase`, `tags`, and `version`. These attributes populate an **Artifact** dataclass that represents the file's type, source path, and curriculum context. This discovery logic is encapsulated in the `discover_artifacts()` function.

### Stage 2: Filtering by Metadata

Once the complete inventory is built, the script applies user‑supplied constraints via `filter_artifacts()`. You can narrow the selection using:

- **`--type`** – Restrict to `skill`, `prompt`, or `agent`.
- **`--phase`** – Select only artifacts belonging to a specific curriculum phase (e.g., phase 14).
- **`--tag`** – Filter by semantic tags defined in the file's front‑matter.

If no filters are provided, the script processes all discovered artifacts.

### Stage 3: Planning the Installation Layout

Before writing any files, the `build_plan()` function computes a deterministic **target path** for each artifact based on the chosen layout strategy. The script supports three organizational schemes:

- **`skills`** (default) – Creates a subdirectory per artifact: `<target>/<name>/SKILL.md`.
- **`flat`** – Collapses everything into a single directory: `<target>/<name>.md`.
- **`by‑phase`** – Groups files by their curriculum phase: `<target>/phase‑NN/<name>.md`.

During this phase, the installer checks for existing files and records collisions. If the `--force` flag is set, the plan marks these for overwrite; otherwise, they are flagged as errors.

### Stage 4: Applying the Installation Plan

The final stage executes the planned file operations through `apply_plan()`. Each source file is copied to its computed destination, and `write_manifest()` generates a **manifest.json** in the target root. This JSON file catalogs every installed artifact with its source path, destination, type, phase, tags, and version, providing an auditable record for downstream tooling.

## Installation Layouts and Configuration

Understanding the **front‑matter parsing** mechanism is crucial for advanced usage. The `parse_frontmatter` utility in [`_lib.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/_lib.py) implements a minimal YAML‑subset parser that reads the `--- … ---` header blocks of Markdown files. This allows the installer to obtain structured metadata without requiring third‑party libraries like PyYAML.

The **Artifact** dataclass serves as the canonical representation of each file throughout the pipeline, ensuring type safety and consistent attribute access during filtering and path generation.

## Practical Examples for Installing Skills

The following commands demonstrate common workflows using [`scripts/install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/scripts/install_skills.py).

### Basic Skill Installation

Install all skills into a local directory using the default `skills` layout:

```bash
python3 scripts/install_skills.py /tmp/my-skills

```

This creates `/tmp/my-skills/<skill-name>/SKILL.md` for each discovered artifact and writes [`/tmp/my-skills/manifest.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main//tmp/my-skills/manifest.json).

### Filtered Installation by Phase and Type

Extract only prompts from phase 14 using the flat layout:

```bash
python3 scripts/install_skills.py /tmp/prompts \
  --type prompt \
  --phase 14 \
  --layout flat

```

Resulting files are placed directly in `/tmp/prompts/<prompt-name>.md`.

### Dry Run and Tag Filtering

Preview which experimental agents would be installed without writing files:

```bash
python3 scripts/install_skills.py /tmp/agents \
  --type agent \
  --tag experimental \
  --dry-run

```

### Force Overwrite and JSON Output

Replace existing files and suppress human‑readable output:

```bash
python3 scripts/install_skills.py /tmp/skills \
  --force \
  --json

```

This overwrites colliding artifacts and emits only the [`manifest.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/manifest.json) file.

## Summary

- **Self‑contained execution**: The [`install_skills.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/install_skills.py) script requires only Python 3.10+ and the standard library, with no external package dependencies.
- **Four‑stage pipeline**: Discovery, filtering, planning, and application ensure predictable and auditable installations.
- **Flexible organization**: Three layout modes (`skills`, `flat`, `by‑phase`) adapt the output structure to your workflow.
- **Metadata‑driven**: Front‑matter parsing from [`_lib.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/_lib.py) enables sophisticated filtering by type, phase, and custom tags.
- **Reproducible deployments**: The generated [`manifest.json`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/manifest.json) provides a complete audit trail of every installed artifact.

## Frequently Asked Questions

### What file types can be installed using the script?

The installer recognizes three artifact types based on filename patterns: **skills** (`skill‑*.md`), **prompts** (`prompt‑*.md`), and **agents** (`agent‑*.md`). All files must reside within `phases/**/outputs/` directories and contain valid YAML front‑matter headers declaring metadata such as `name`, `phase`, and `version`.

### What is the difference between the layout options?

The **`skills`** layout creates a dedicated subdirectory for each artifact containing a [`SKILL.md`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/SKILL.md) file, ideal for curated libraries. The **`flat`** layout dumps all files into a single directory with descriptive names, suitable for simple collections. The **`by‑phase`** layout mirrors the curriculum structure, organizing files into `phase‑NN` folders to preserve the original pedagogical sequence.

### How does the script handle file collisions?

By default, the installer aborts when detecting existing files at target paths to prevent accidental overwrites. Supplying the `--force` flag instructs the `build_plan()` function to mark collisions for replacement during the apply stage, allowing idempotent re-installations of updated curriculum content.

### Does the installation process require internet access or external libraries?

No. The **skill installation process** is fully offline‑capable and relies solely on the Python standard library. All parsing logic, including the YAML‑subset front‑matter reader in [`_lib.py`](https://github.com/rohitg00/ai-engineering-from-scratch/blob/main/_lib.py), is implemented without external dependencies like PyYAML or requests, ensuring portability across air‑gapped environments.