# How to Register Custom CV or Cover Letter Templates with `/add-template` in AI Job Search

> Learn to register custom CV or cover letter templates with the /add-template command in MadsLorentzen/ai-job-search. Simplify your job application process now.

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

---

**The `/add-template` command registers custom LaTeX or Typst templates by copying files to a dedicated folder, creating a manifest, verifying compilation, and inserting an activation block into the guidance files.**

The AI Job Search repository provides a streamlined workflow for job application generation, and the `/add-template` command is the central mechanism for replacing the default templates with your own professionally-designed CV or cover letter layouts. This command handles the entire lifecycle: ingestion, validation, storage, and activation.

## What `/add-template` Does

When you invoke `/add-template`, the system executes a five-phase pipeline defined in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md):

1. **Argument parsing** – Detects flags (`--list`, `--use <name>`) or interprets a file path as a new template source.
2. **Metadata capture** – Collects template type, compile command, fonts, style constraints, and known issues.
3. **Storage** – Creates a subdirectory under `templates/cv/` or `templates/cover_letters/` with the skeleton file, dependencies, and a [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) manifest.
4. **Verification** – Compiles a dummy document to confirm the template works and respects page limits.
5. **Activation** – Inserts a managed `<!-- ACTIVE-TEMPLATE: ... -->` block into [`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) for use by the `/apply` command.

The command is **idempotent**: re-running with the same name updates the existing template rather than creating duplicates.

## Command Syntax and Options

### Register a New Template

```markdown
/add-template path/to/my-cv.tex

```

This starts the interactive registration flow for a CV or cover letter template.

### List Registered Templates

```markdown
/add-template --list

```

Displays all templates stored in `templates/cv/` and `templates/cover_letters/` with their current status.

### Switch Between Templates

```markdown
/add-template --use modern-blue

```

Activates the template named `modern-blue` by updating the managed block in the appropriate guidance file.

### Revert to Built-in Defaults

```markdown
/add-template --use default

```

Removes custom template activation, falling back to the stock **moderncv** (CV) or **cover.cls** (cover letter) templates.

## Interactive Registration Flow

When you provide a file path, the command guides you through:

| Prompt | Purpose |
|--------|---------|
| Template type | Distinguishes **CV** from **cover letter** for correct folder placement. |
| Short name | Creates a kebab-case identifier (e.g., `awesome-cv`) for the folder and manifest. |
| Compile command | Suggests `lualatex -interaction=nonstopmode <file>.tex` or `typst compile <file>.typ` based on extension. |
| Font dependencies | Records required system or bundled fonts for reproducibility. |
| Style rules | Documents formatting constraints the AI must respect. |
| Page limit | Enforced during verification; compilation fails if exceeded. |
| Known pitfalls | Captures workarounds for template-specific issues. |

## File Structure and Key Paths

The template system uses these locations as implemented in `MadsLorentzen/ai-job-search`:

- **Command definition:** [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md)
- **CV activation target:** [`.claude/skills/job-application-assistant/05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/05-cv-templates.md)
- **Cover letter activation target:** [`.claude/skills/job-application-assistant/06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/06-cover-letter-templates.md)
- **CV template storage:** `templates/cv/<name>/`
- **Cover letter template storage:** `templates/cover_letters/<name>/`

Each template folder contains:

- `template.<ext>` – The skeleton file with `[PLACEHOLDER]` tokens for AI population.
- [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) – Manifest documenting metadata, compile command, and constraints.
- Auxiliary files – `.cls`, `.sty`, `.ttf`, or `.otf` dependencies.

## Verification and Safety

The test compile phase generates `_compile_test.tex` (or equivalent) containing placeholder content. The command:

- Runs your declared compile command in a temporary environment.
- Checks that PDF output exists and page count ≤ declared limit.
- Fails registration if verification fails, preventing broken templates from entering the workflow.

## Template Activation Mechanism

The managed block inserted into guidance files follows this pattern:

```markdown
<!-- ACTIVE-TEMPLATE: awesome-cv -->
<!-- Template: templates/cv/awesome-cv/ -->
<!-- Compile: lualatex -interaction=nonstopmode template.tex -->
<!-- DO NOT EDIT ABOVE THIS LINE -->

```

The `/apply` command reads this block to locate and use your active template. The surrounding content 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) remains intact, preserving any custom advice you've added.

## Requirements for Compatible Templates

To register custom CV or cover letter templates successfully:

- **Source format:** LaTeX (`.tex`), Typst (`.typ`), or any compile-to-PDF system.
- **Placeholder tokens:** Must include `[PLACEHOLDER]` or similar markers where AI-generated content inserts.
- **Self-contained:** All dependencies (classes, packages, fonts) must be present or documented.
- **Deterministic:** Compile command must produce consistent output without interactive prompts.

## Summary

- **`/add-template <path>`** registers new templates through an interactive five-phase workflow.
- **Storage location** distinguishes CVs (`templates/cv/`) from cover letters (`templates/cover_letters/`).
- **`--list`**, **`--use <name>`**, and **`--use default`** manage template selection without re-registration.
- **Verification** via test compile ensures templates work before activation.
- **Managed activation blocks** in guidance files enable seamless `/apply` integration while preserving custom content.

## Frequently Asked Questions

### What file formats does `/add-template` support?

The command accepts any compile-to-PDF format. LaTeX (`.tex`) and Typst (`.typ`) are explicitly handled with suggested compile commands, but you can specify custom commands for other systems like ConTeXt or R Markdown.

### Can I edit a template after registration?

Yes. Run `/add-template` with the same name and updated source files. The idempotent design replaces the existing template folder and re-runs verification. Your activation in the guidance files remains unchanged.

### Where does the AI insert my content when generating applications?

The AI replaces `[PLACEHOLDER]` tokens in `template.<ext>` with generated content, then executes your declared compile command. The placeholder convention is documented in the [`TEMPLATE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/TEMPLATE.md) manifest for reference.

### What happens if my template compilation fails during verification?

Registration aborts without modifying the guidance files. The error output from the compile command displays for debugging. Fix your template source, dependencies, or compile command, then retry registration.