---
name: apex-build-context-pack
description: >-
   Create or update `private/inputs/application_context.md` containing all raw inputs
   (job history, admin profile, job description, requirements, qualification questions,
   term extractor, skills taxonomy and limits) for the Exceptional Candidate workflow.
   Use this skill to assemble or refresh the context pack before analysis or generation tasks.
---

# apex-build-context-pack

## Purpose

This skill consolidates all required user inputs into a single Markdown file (`private/inputs/application_context.md`) that other skills
reference.
It does not perform any analysis or generate documents; it simply organizes the raw data in a standard structure with paste-ready blocks.

## Shared definitions

Follow `AGENTS.md` and the source-grounding, placeholder, and format-safety
rules defined in `apex-guardrails`.

Treat this `SKILL.md` as the canonical behavior contract for the skill.

## Inputs

Provide the following data when invoking this skill (either by
pasting directly or referencing existing files in the repo):

1. `USER_JOB_HISTORY_TEXT`
2. `USER_ADMIN_PROFILE_TEXT`
3. `JOB_DESCRIPTION_TEXT`
4. `JOB_REQUIREMENT_TEXT`
5. `JOB_QUALIFICATION_QUESTIONS`
6. `TERM_EXTRACTOR`
7. `SKILLS_TAXONOMY`
8. `LIMITS` (TARGET_SYSTEM, CHAR_LIMIT, TARGET_LOW, TARGET_HIGH, WORD_TARGET)

If any section is missing, use a placeholder block with `[PASTE HERE]` to
indicate that the user must supply it later.

Use only content the user provides directly or via referenced repository
files. Do not fabricate or silently infer missing facts.

Optional (recommended for improved ATS/keyword work):
- `JD_KEYWORD_BANK` (20–40 phrases from `apex-jd-keyword-bank`)

## Output behavior

1. Ensure an `private/inputs/` directory exists; create it if necessary.
2. Create or overwrite `private/inputs/application_context.md` with the following structure and headings:
   Notes:
   - Preserve pasted user text verbatim inside fenced code blocks.
   - Keep headings exactly as written to reduce downstream parsing issues.

   ```
   # Application Context Pack

   ## USER_JOB_HISTORY_TEXT
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## USER_ADMIN_PROFILE_TEXT
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## JOB_DESCRIPTION_TEXT
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## JOB_REQUIREMENT_TEXT
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## JOB_QUALIFICATION_QUESTIONS
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## TERM_EXTRACTOR
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## JD_KEYWORD_BANK
   ```
   <optional; paste output from apex-jd-keyword-bank or leave [PASTE HERE]>
   ```

   ## SKILLS_TAXONOMY
   ```
   <pasted text or [PASTE HERE]>
   ```

   ## LIMITS
   TARGET_SYSTEM: <INSPIRA | UNICEF | IOM | OTHER or [PASTE HERE]>
   CHAR_LIMIT: <value or [PASTE HERE]>
   TARGET_LOW: <value or [PASTE HERE]>
   TARGET_HIGH: <value or [PASTE HERE]>
   WORD_TARGET: <value or [PASTE HERE]>
   
   ## Optional per-system or per-field overrides (leave blank if not used):
   INSPIRA_DUTIES_CHAR_LIMIT: 1000
   UNICEF_RESPONSIBILITIES_CHAR_LIMIT: 2500
   IOM_RESPONSIBILITIES_CHAR_LIMIT: UNLIMITED
   IOM_ACHIEVEMENTS_CHAR_LIMIT: UNLIMITED
   ```

3. In `## LIMITS`, always include:
   - `TARGET_SYSTEM`
   - `CHAR_LIMIT`
   - `TARGET_LOW`
   - `TARGET_HIGH`
   - `WORD_TARGET`
4. If an existing context pack already contains additional limit keys
   (for example field-specific overrides), preserve and merge them rather
   than deleting unknown keys.
5. After writing the file, run the **Pre-flight Validation** below and
   output only a concise pre-flight checklist table plus any critical
   blockers.

## Pre-flight Validation

Before any downstream skill consumes `private/inputs/application_context.md`,verify that all 11 required sections are populated (contain
substantive text, not just `[PASTE HERE]`).

Required sections status table:
| # | Section | Status |
|---|---------|--------|
| 1 | `USER_JOB_HISTORY_TEXT` | populated / missing |
| 2 | `USER_ADMIN_PROFILE_TEXT` | populated / missing |
| 3 | `JOB_DESCRIPTION_TEXT` | populated / missing |
| 4 | `JOB_REQUIREMENT_TEXT` | populated / missing |
| 5 | `JOB_QUALIFICATION_QUESTIONS` | populated / missing |
| 6 | `TERM_EXTRACTOR` | populated / missing |
| 7 | `SKILLS_TAXONOMY` | populated / missing |
| 8 | `CHAR_LIMIT` | populated / missing |
| 9 | `TARGET_LOW` | populated / missing |
| 10 | `TARGET_HIGH` | populated / missing |
| 11 | `WORD_TARGET` | populated / missing |

Optional section check (do not block workflow):
- `JD_KEYWORD_BANK`: populated / missing

If any required section is missing, list it and recommend the user supply the data before proceeding. Do not allow the orchestrator to run with missing critical sections (`USER_JOB_HISTORY_TEXT`, `JOB_DESCRIPTION_TEXT`).

## When to use

Use this skill whenever the raw context needs to be assembled or refreshed.
Run it before other analytical or generation skills if the context file is missing or outdated.

## Rules

1. Preserve user-provided text verbatim inside fenced code blocks.
2. Use `[PASTE HERE]` for missing sections rather than fabricating.
3. Preserve unknown `## LIMITS` keys already present in the file.
4. Do not proceed to the orchestrator when critical sections are missing.
