# How to Add Custom LaTeX CV and Cover Letter Templates Using the `/add-template` Command

> Easily add custom LaTeX CV and cover letter templates to your AI Job Search workflow. Use the /add-template command to register, compile, and manage your own professional documents.

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

---

**The `/add-template` command in the AI-Job-Search framework initiates an interactive interview that registers your LaTeX files, validates them through a mandatory test compile, and stores the metadata in managed registry blocks for automatic use by the `/apply` workflow.**

The MadsLorentzen/ai-job-search repository provides a structured workflow for job applications where custom LaTeX styling is essential for maintaining professional document standards. When you need to move beyond the stock templates, the `/add-template` command serves as the primary entry point for registering your own CV and cover letter designs.

## Interactive Template Registration Process

Running `/add-template` launches an interactive interview that collects critical metadata about your LaTeX source files. This process ensures that the framework understands how to compile and render your documents correctly before they enter the active workflow.

### Metadata Collection and Validation

The command gathers specific configuration details required for successful compilation:

- **Compile engine**: `lualatex` for CV templates or `xelatex` for cover letter templates
- **Auxiliary files**: Any custom `.cls` or `.sty` style files required by your template
- **Font dependencies**: Specific font files such as Lato or Raleway that must be available to the compiler
- **Page constraints**: Rules like "CV must be ≤ 2 pages" or "Cover letter must be 1 page"
- **Layout preservation**: Hints about sections that must stay on a single page to maintain visual integrity

After collecting this data, the system performs a **mandatory test compile** to verify that the template renders without errors before registration completes.

### Engine Selection and Page Limits

The framework distinguishes between document types through engine selection. According to the source code in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md), CV templates typically use `lualatex` while cover letters default to `xelatex`. The interview explicitly asks for page-limit rules, storing these constraints alongside the template metadata to enforce formatting standards during the `/apply` workflow.

## Template Storage and Registry Management

Once validation succeeds, the system organizes your files and updates the central registries that control which templates are active for document generation.

### The `templates/` Directory Structure

Physical template files are stored in the `templates/` directory at the repository root. As documented in [`templates/README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/templates/README.md), this location holds:

- Main `.tex` source files
- Custom `.cls` and `.sty` class and style files
- Font files and other assets required for compilation

When you register a template named `fancy-cv`, the system copies your files into `templates/fancy-cv/` to isolate dependencies and ensure reproducible builds.

### Managed Blocks in Registry Files

Template activation is recorded in managed markdown blocks within the skills directory. The `/add-template` command updates either [`.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) (for CVs) or [`.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) (for cover letters).

These files contain specially marked blocks that the command manages automatically:

```markdown
<!-- BEGIN ACTIVE-TEMPLATE (managed by /add-template - do not edit by hand) -->
name: my-fancy-template
engine: xelatex
...
<!-- END ACTIVE-TEMPLATE -->

```

**Do not edit these blocks manually**—the `/add-template` command maintains this metadata to prevent configuration drift and syntax errors.

## Switching and Listing Templates

The command provides helper flags for template management beyond initial registration.

### Activating Custom Templates

To switch between registered templates without re-registering them, use the `--use` flag:

```bash

# Activate a custom template for subsequent /apply runs

/add-template --use fancy-cv

```

This updates the `ACTIVE-TEMPLATE` block in the appropriate registry file. The next invocation of `/apply` (defined in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md)) automatically reads this metadata and sources files from `templates/fancy-cv/` instead of the default locations.

### Reverting to Default Templates

To return to the stock templates provided by the framework:

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

```

This restores the built-in `moderncv` class for CVs and `cover.cls` for cover letters, bypassing any custom templates in the `templates/` directory.

### Listing Available Templates

To view all registered templates including the default options:

```bash
/add-template --list

```

This outputs a summary such as:
- `default` – stock moderncv / cover.cls
- `fancy-cv` – custom moderncv-style template
- `sleek-letter` – minimal cover-letter class

## Integration with the Apply Workflow

The `/apply` workflow depends on the registry metadata set by `/add-template`. When generating application documents, the workflow:

1. Reads the active template name from the managed block 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)
2. Locates the corresponding files in the `templates/` directory
3. Compiles the CV or cover letter using the specified engine (`lualatex` or `xelatex`)
4. Runs ATS (Applicant Tracking System) checks against the rendered output

This integration ensures that once you **add custom LaTeX CV and cover letter templates**, they become seamlessly available for all future job applications without manual file path configuration.

## Summary

- The `/add-template` command orchestrates an interactive interview defined in [`.claude/commands/add-template.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/add-template.md) that captures compile engines, fonts, and page limits.
- Custom files are stored in the `templates/` directory and validated through a mandatory test compile before activation.
- Template metadata is written to managed blocks in [`05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/05-cv-templates.md) (CVs) or [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md) (cover letters) and should never be edited by hand.
- Use `/add-template --use <name>` to switch templates and `/add-template --use default` to revert to stock `moderncv` and `cover.cls` templates.
- The `/apply` workflow automatically detects the active template and compiles documents using the specified engine and constraints.

## Frequently Asked Questions

### What file types should I prepare before running `/add-template`?

Prepare your main `.tex` source file along with any custom `.cls` or `.sty` files that define your document class or styling. If your template uses non-standard fonts (such as Lato or Raleway), ensure those font files are accessible. The interactive interview will prompt you for the paths to these dependencies and copy them into the `templates/` directory during registration.

### How does the framework handle compilation errors during template registration?

The `/add-template` command performs a mandatory test compile immediately after collecting your metadata. If the LaTeX engine encounters errors—whether from missing packages, font issues, or syntax problems—the registration aborts and the template is not added to the active registry. You must fix the underlying LaTeX errors and rerun the command to successfully register the template.

### Can I use different templates for my CV and cover letter simultaneously?

Yes. The framework maintains separate registries in [`05-cv-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/05-cv-templates.md) and [`06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/06-cover-letter-templates.md). You can activate a custom template for your CV (using `lualatex`) while using a different template—or the default `cover.cls`—for your cover letter (using `xelatex`). The `/apply` workflow reads both registries independently when generating application materials.

### What happens to my existing templates when I register a new one?

Registering a new template with `/add-template` does not delete or overwrite previously registered templates in the `templates/` directory. The command simply adds a new subdirectory and updates the active template pointer in the managed registry block. You can switch back to any previously registered template at any time using `/add-template --use <name>`, provided the template files remain in the `templates/` directory.