# How to Use the /apply Command with a Job URL in ai-job-search

> Master the /apply command in ai-job-search by providing a job URL. Discover its six-step workflow to fetch, evaluate, draft, critique, and compile ATS-ready PDFs.

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

---

**The `/apply` command accepts a job posting URL or raw text and executes a six-step, two-agent workflow that fetches the posting, evaluates your fit against local profile data, drafts tailored LaTeX documents, critiques them through a dedicated reviewer agent, and compiles ATS-ready PDFs.**

The `ai-job-search` repository by MadsLorentzen provides an automated job application pipeline that transforms raw postings into polished application materials. At the center of this system is the `/apply` slash command, defined in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md), which orchestrates a sophisticated multi-agent process to generate customized CVs and cover letters from a single URL or text block.

## Architecture and Workflow

The `/apply` command implements a **two-agent architecture** comprising a **DRAFTER** and a **REVIEWER**. This design keeps processing token-efficient by passing data inline between steps rather than repeatedly reading from disk, ensuring that once a file is loaded it remains in memory for subsequent operations.

### Step 0 — Parse Input and Fetch URL

The command first detects whether you provided a URL or plain text. If a URL is supplied, the system invokes **WebFetch** to retrieve the raw HTML of the job posting. It then extracts essential metadata including company name, role title, department, location, and language settings to configure the downstream workflow.

### Step 1 — Evaluate Fit (DRAFTER)

The DRAFTER agent reads the evaluation framework from [`.claude/skills/job-application-assistant/04-job-evaluation.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/04-job-evaluation.md) and your candidate profile from [`.claude/skills/job-application-assistant/01-candidate-profile.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/01-candidate-profile.md). It optionally executes [`salary_lookup.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/salary_lookup.py) to inject market-salary benchmarks. The agent produces a structured fit assessment including skills match, experience alignment, culture fit, and salary expectations, then prompts you to confirm before proceeding.

### Step 2 — Draft CV and Cover Letter (DRAFTER)

Upon confirmation, the DRAFTER reads style guides and LaTeX templates—specifically `cv/main_example.tex` and `cover_letters/cover.cls`—to generate `cv/main_<company>_<role>.tex` and `cover_letters/cover_<company>_<role>.tex`. Every requirement from the job posting is mapped to specific sections in the documents, respecting the language settings and auditing grounding against your master profile.

### Step 3 — Research and Critique (REVIEWER)

A separate REVIEWER agent receives the drafts inline (without additional file reads) and performs research, factual grounding checks, and style analysis. It returns a structured critique divided into two parts: **Part A**, a JSON edit list for automated changes, and **Part B**, narrative suggestions requiring manual incorporation.

### Step 4 — Revise Based on Feedback (DRAFTER)

The DRAFTER automatically applies the JSON edits from Part A and manually integrates the narrative suggestions from Part B. This step guarantees no fabrications are introduced and ensures the drafts remain consistent with your established candidate profile.

### Step 5 — Compile and Inspect PDFs (DRAFTER)

The command runs **lualatex** for the CV and **xelatex** for the cover letter, generating final PDFs. It verifies page count, checks for orphaned sections, and confirms ATS-readability of the text layer. If issues are detected, the DRAFTER re-edits the LaTeX source and recompiles until all visual and technical checks pass.

### Step 6 — Present Final Output

Finally, the command executes the master verification checklist defined in [`CLAUDE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/CLAUDE.md), displaying a concise summary of tailoring decisions and listing the created files with their paths.

## Command Syntax and Examples

You can invoke the `/apply` command from any interface that respects the slash-command syntax. The following patterns are supported:

```bash

# Standard usage with a direct job URL

/apply https://jobs.example.com/software-engineer-12345

```

```bash

# Using raw posting text for offline or paywalled listings

/apply <<EOF
We are looking for a Senior Data Scientist with 5+ years of experience...
EOF

```

During execution, you will see interactive prompts. After Step 1, you receive an evaluation report similar to:

```

Skills match: 7 / 9
Experience match: strong
Salary benchmark: $120k-$140k (Denmark)
Overall fit: strong
Proceed with drafting? (yes/no)

```

Once drafting completes, the reviewer returns structured feedback. Example JSON edit list (Part A):

```json
[
  {
    "file": "cv/main_acme_corp_senior_data_scientist.tex",
    "old_string": "Machine Learning Engineer",
    "new_string": "Senior Machine Learning Engineer",
    "reason": "keyword match (senior)"
  }
]

```

After revision and compilation, the terminal displays:

```

✅ All checks passed.
📄 Created files:
  - cv/main_acme_corp_senior_data_scientist.tex
  - cover_letters/cover_acme_corp_senior_data_scientist.tex

```

## Key Implementation Files

- **[`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md)** — The main command definition containing the six-step workflow logic and agent instructions.
- **[`.claude/skills/job-application-assistant/04-job-evaluation.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/04-job-evaluation.md)** — Evaluation framework used to score job fit during Step 1.
- **[`.claude/skills/job-application-assistant/01-candidate-profile.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/01-candidate-profile.md)** — Source-of-truth candidate profile referenced throughout drafting.
- **[`salary_lookup.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/salary_lookup.py)** — Optional Python tool invoked during fit evaluation to retrieve market salary data.
- **`cv/main_example.tex`** — Master LaTeX CV template providing structural reference for generated documents.
- **`cover_letters/cover.cls`** — LaTeX class file defining cover letter styling and layout.
- **[`CLAUDE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/CLAUDE.md)** — Global configuration and verification checklist ensuring factual accuracy and ATS compatibility.

## Summary

- The `/apply` command in `ai-job-search` automates the full job application pipeline from URL to PDF.
- It uses a **two-agent system** (DRAFTER and REVIEWER) with inline data passing to optimize token usage.
- The workflow covers six distinct phases: input parsing, fit evaluation, document drafting, content critique, revision, and PDF compilation.
- Key files include [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md) for logic and [`CLAUDE.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/CLAUDE.md) for verification standards.
- Supports both URL fetching via WebFetch and direct text input for maximum flexibility.

## Frequently Asked Questions

### Can I use the /apply command with plain text instead of a URL?

Yes. While the command automatically detects and fetches URLs using WebFetch, you can paste raw job description text directly after the `/apply` command. This is useful for paywalled job boards or when you have the description in a local file.

### What LaTeX engines does the command use for compilation?

According to the source code in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md), the DRAFTER uses **lualatex** to compile the CV and **xelatex** to compile the cover letter. This dual-engine approach ensures proper font rendering and layout consistency across both documents.

### How does the reviewer agent provide feedback?

The REVIEWER agent returns feedback in two parts: **Part A** is a structured JSON array specifying exact string replacements for automated application, and **Part B** contains narrative suggestions that require manual review. The DRAFTER then applies Part A automatically while carefully integrating Part B.

### Is the salary lookup automatic when using /apply?

The salary lookup via [`salary_lookup.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/salary_lookup.py) is optional. During Step 1 (Evaluate Fit), the DRAFTER may invoke this tool to add market-salary context to the evaluation report, but the workflow proceeds regardless of whether salary data is available.