# How to Add a Custom Document Template to AI Job Search: Complete Workflow Guide

> Add custom document templates to AI Job Search using the /add-template command. This guide covers a seven-step workflow for seamless integration of your CV or cover-letter templates.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: how-to-guide
- Published: 2026-08-25

---

**Use the `/add-template` command in the MadsLorentzen/ai-job-search repository to register, validate, and activate custom CV or cover-letter templates through a guided seven-step workflow that handles metadata capture, compilation verification, and automatic integration into the application pipeline.**

AI Job Search uses a thin-pointer architecture that stores all document-generation logic within the `.claude/` directory. Adding a custom document template to AI Job Search requires no manual editing of core application code; instead, the system provides a deterministic registration process that validates, stores, and activates templates through carefully managed configuration blocks.

## Understanding the Template Architecture

The repository maintains a **single source of truth** for template management. All registration logic lives in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md), which implements a strict workflow for converting external CV or cover-letter designs into integrated template skeletons.

When you add a custom document template to AI Job Search, the system creates a deterministic folder structure under `templates/`:

- `templates/cv/<name>/` for curriculum vitae designs
- `templates/cover_letters/<name>/` for cover letter formats

Each template directory contains:
- `template<extension>` — The skeleton file containing `[PLACEHOLDER]` tokens
- [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) — A manifest recording metadata (compile command, fonts, page limits)
- `fonts/` sub-directory — Copy of required font files (if applicable)
- Companion class/style files — LaTeX `.cls` or `.sty` dependencies

## The Seven-Step Registration Workflow

The `/add-template` command follows a strict, ordered process defined in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md):

### Step 1: Argument Parsing

The command first determines whether to list existing templates, switch to a previously registered template, or initiate fresh registration. This validation occurs in the command's entry point ([step 0](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L11-L18)).

### Step 2: Template Type and Source Specification

You specify whether the target is a CV or cover-letter, then provide the source file or directory. The command validates that any non-standard class, package, or font files referenced in the source are present before proceeding ([step 1](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L55-L65)).

### Step 3: Metadata Capture

The system extracts or prompts for crucial metadata: template name, source file extension, compile command, engine/toolchain (e.g., `lualatex`, `xelatex`), required fonts, style rules, page limits, and known pitfalls ([step 2](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L69-L87)).

### Step 4: Directory Structure Creation

The command creates the appropriate subdirectory under `templates/` and populates it with:
- The skeleton template renamed to `template<extension>` with preserved `[PLACEHOLDER]` tokens
- Copied auxiliary files (classes, styles)
- Font resources in `fonts/`
- The [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) manifest recording all captured metadata ([step 3](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L90-L103))

### Step 5: Compile Verification

A mandatory test compile ensures the template produces a PDF respecting the declared page limit. Failures abort registration and surface diagnostic messages to prevent broken templates from entering the pipeline ([step 4](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L130-L144)).

### Step 6: Activation via Managed Blocks

Upon successful verification, the command injects a **managed block** into the appropriate guidance file:
- [`05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/05-cv-templates.md) for CV templates
- [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md) for cover letters

This block instructs the `/apply` workflow which skeleton file and compile command to use. The system maintains idempotency—only one managed block may exist at a time, guaranteeing clean switching between templates ([step 5](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L146-L165)).

### Step 7: Confirmation

The workflow concludes with a concise summary showing the registered template name, type, and active status, with options to immediately list all templates or switch to another ([step 6](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L77-L92)).

## Practical Usage Examples

### Register a New LaTeX CV Template

To add a custom document template to AI Job Search using an existing LaTeX file:

```bash
/add-template my-awesome-cv.tex

```

The command interactively requests:
- **Type**: CV
- **Name**: `awesome-cv`
- **Compile command**: Inferred as `lualatex -interaction=nonstopmode <file>.tex`
- **Fonts and dependencies**: Roboto, etc.
- **Page limits and style rules**

After successful compilation verification, the system confirms:

```text
Template `awesome-cv` registered and activated.

```

### List Registered Templates

To view all available templates and their status:

```bash
/add-template --list

```

Output format:

```text

## Registered Templates

| Name          | Type | Source | Toolchain | Fonts | Active |
|---------------|------|--------|-----------|-------|--------|
| awesome-cv    | CV   | .tex   | lualatex  | Roboto| yes    |
| modern-cover  | Cover| .tex   | xelatex   | –     | no     |

```

### Switch Between Templates

To activate a different registered template:

```bash
/add-template --use modern-cover

```

The command resolves the manifest at [`templates/cover_letters/modern-cover/TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/templates/cover_letters/modern-cover/TEMPLATE.md), verifies file existence, and updates the managed block in [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md) to reference the new skeleton.

### Revert to Built-in Defaults

To remove custom templates and restore stock behavior (moderncv for CVs, cover.cls for letters):

```bash
/add-template --use default

```

This removes the managed block entirely from the respective guidance file.

## Integration with the Application Pipeline

When processing job applications, the `/apply` command reads the managed blocks in [`05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/05-cv-templates.md) or [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md) to determine:
- Which `template<extension>` skeleton to load
- Which compile command to execute
- Where to find associated fonts and dependencies

This architecture ensures that adding a custom document template to AI Job Search requires zero modifications to the core application logic—the `.claude/` directory serves as the complete configuration interface.

## Summary

- **Single command interface**: All template operations flow through `/add-template` defined in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md).
- **Strict validation**: Every template undergoes mandatory compilation verification before activation.
- **Managed activation**: Templates integrate via managed blocks in [`05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/05-cv-templates.md) or [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md), ensuring clean switching.
- **Deterministic storage**: The `templates/` directory uses consistent naming conventions with [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) manifests.
- **Zero core edits**: The thin-pointer architecture requires no modifications to application source code when adding templates.

## Frequently Asked Questions

### What file formats are supported when adding custom templates?

AI Job Search supports any compilable document format, though LaTeX (`.tex`) and Typst are the most common. The system stores the literal extension in `template<extension>` and executes the compile command specified during registration (e.g., `lualatex`, `xelatex`, or `typst compile`). The critical requirement is that the source file contains `[PLACEHOLDER]` tokens that the `/apply` workflow can replace with generated content.

### Why does template registration require a test compilation?

The test compilation enforces quality control by verifying that the template actually produces a PDF and respects the declared page limit before entering the production pipeline. According to the source implementation in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md) ([step 4](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L130-L144)), failures abort registration immediately and surface diagnostic messages, preventing malformed templates from breaking application generation workflows.

### How do I update an existing custom template?

To modify a registered template, re-run `/add-template` with the updated source file using the same template name. The command overwrites the existing directory structure in `templates/cv/<name>/` or `templates/cover_letters/<name>/` and re-verifies compilation. Alternatively, manually edit the skeleton file and [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) manifest, then run `/add-template --use <name>` to refresh the managed block reference.

### Can I use custom fonts with my document template?

Yes. During metadata capture ([step 2](https://github.com/MadsLorentzen/ai-job-search/blob/master/.claude/commands/add-template.md#L69-L87)), the command asks about required fonts. If specified, the system creates a `fonts/` sub-directory within the template folder and copies font files as needed. The compile command in [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) should reference these fonts using relative paths or installed system font names that LaTeX/XeLaTeX can resolve during the PDF generation process.