Mahmoud-Qandeel/GetJobIQ / 01-FRAMEWORK/.agents/skills/jobindex-search
jobindex-search
VerifiedMake sure to use this skill whenever the user wants to search for jobs in Denmark, find Danish job listings, look up a specific job posting, or asks anything about the Danish job market — even if they don't mention jobindex.dk explicitly. Invoke this skill for questions about open positions, job vacancies, hiring in Denmark, job opportunities in Danish cities or sectors, or when the user wants to find work in Denmark. Also trigger for phrases like "find me a job", "are there any jobs for X in Copenhagen", or "what jobs are available in Aarhus" when the context is Denmark. Trigger phrases include: jobindex, jobsøgning, job i Danmark, ledige stillinger, job opslag, find job, stillingopslag, jobannonce, job vacancy denmark, danish jobs, jobs in denmark, job search denmark, work in denmark, find work denmark, IT jobs denmark, engineer jobs denmark, developer jobs copenhagen, marketing jobs aarhus, jobs aarhus, jobs copenhagen, jobs odense, jobs aalborg, job openings denmark, hiring denmark, job listings denmark, python jobs denmark, grafisk designer job, data engineer job, softwareudvikler job, full stack developer job danmark.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.3 KB |
| cli/README.md | markdown | 8.3 KB |
| cli/package.json | manifest | 546 B |
| cli/src/cli.ts | script | 1.5 KB |
| cli/src/commands/detail.ts | script | 10.8 KB |
| cli/src/commands/search.ts | script | 3.1 KB |
| cli/src/helpers.ts | script | 11.4 KB |
| cli/tests/cli-contract.test.ts | script | 1.2 KB |
| cli/tests/cli-flag-validation.test.ts | script | 3.5 KB |
| cli/tests/detail-parsing.test.ts | script | 6.0 KB |
| cli/tests/helpers.ts | script | 959 B |
| cli/tests/parsing.test.ts | script | 3.7 KB |
| cli/tests/request-timeout.test.ts | script | 1.3 KB |
| cli/tests/retry-backoff.test.ts | script | 3.0 KB |
| cli/tests/search-page.test.ts | script | 2.7 KB |
| cli/tsconfig.json | config | 489 B |
| url-reference.md | markdown | 3.3 KB |
cli/src/commands/detail.ts
View on GitHubimport { defineCommand, option } from "@bunli/core"
import { z } from "zod"
import { htmlFetch, writeError } from "../helpers.js"
const BASE_URL = "https://www.jobindex.dk"
interface DetailResult {
id: string
title: string
company: string | null
companyUrl: string | null
location: string | null
date: string | null
deadline: string | null
employmentType: string | null
hours: string | null
applyUrl: string | null
url: string
description: string | null
}
/**
* Convert a Unicode code point to a string. Uses `fromCodePoint` (not
* `fromCharCode`) so supplementary-plane code points (e.g. emoji, U+1F600)
* decode correctly, and drops out-of-range values instead of throwing.
*/
function numericEntity(cp: number): string {
return cp >= 0 && cp <= 0x10ffff ? String.fromCodePoint(cp) : ""
}
/**
* Decode HTML entities in text
*/
function decodeHtmlEntities(text: string): string {
return text
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, '"')
.replace(/'/g, "'")
.replace(/'/g, "'")
// Danish letters appear as named entities in employer-hosted ad markup.
.replace(/ø/g, "ø")
.replace(/Ø/g, "Ø")
.replace(/æ/g, "æ")
.replace(/Æ/g, "Æ")
.replace(/å/g, "å")
.replace(/Å/g, "Å")
// Numeric character references: decimal (é) and hexadecimal (é).
.replace(/&#(\d+);/g, (_, dec) => numericEntity(parseInt(dec, 10)))
.replace(/&#[xX]([0-9a-fA-F]+);/g, (_, hex) => numericEntity(parseInt(hex, 16)))
.replace(/ /g, " ")
}
/**
* Strip HTML tags from text
*/
function stripTags(html: string): string {
return html.replace(/<[^>]+>/g, "").trim()
}
/**
* Extract job ID from URL or return as-is if already an ID
*/
function extractIdFromUrl(url: string): string {
// Match IDs like h1647303, r13677312, etc.
const match = url.match(/\/jobannonce\/([a-zA-Z]\d+)/)
if (match) return match[1]
return url
}
function buildUrl(idOrUrl: string): { url: string; id: string } {
if (idOrUrl.startsWith("http")) {
const id = extractIdFromUrl(idOrUrl)
return { url: idOrUrl, id }
}
// It's a bare ID
const url = `${BASE_URL}/jobannonce/${idOrUrl}`
return { url, id: idOrUrl }
}
const DANISH_MONTHS: Record<string, string> = {
januar: "01", februar: "02", marts: "03", april: "04", maj: "05", juni: "06",
juli: "07", august: "08", september: "09", oktober: "10", november: "11", december: "12",
}
/**
* Normalize a date found on a detail page to YYYY-MM-DD, or null.
* Live pages carry three shapes: ISO, DD-MM-YYYY (the hr-manager widget),
* and Danish long form ("13. september 2026", the jobindex-native facts box).
*/
export function toIsoDate(value: string | null | undefined): string | null {
if (!value) return null
const text = value.trim()
let m = text.match(/^(\d{4})-(\d{2})-(\d{2})/)
if (m) return `${m[1]}-${m[2]}-${m[3]}`
m = text.match(/^(\d{2})-(\d{2})-(\d{4})/)
if (m) return `${m[3]}-${m[2]}-${m[1]}`
m = text.match(/^(\d{1,2})\.?\s+([a-zæøå]+)\s+(\d{4})/i)
if (m) {
const month = DANISH_MONTHS[m[2].toLowerCase()]
if (month) return `${m[3]}-${month}-${m[1].padStart(2, "0")}`
}
return null
}
function metaContent(html: string, matcher: string): string | null {
const re = new RegExp(
`<meta[^>]+(?:property|name|itemprop)="${matcher}"[^>]+content="([^"]*)"|<meta[^>]+content="([^"]*)"[^>]+(?:property|name|itemprop)="${matcher}"`,
"i",
)
const m = html.match(re)
const value = m ? (m[1] ?? m[2]) : null
return value ? decodeHtmlEntities(value).trim() || null : null
}
/** The text of the <p> inside a jobindex-native jd-* facts block. */
function jdBlockValue(html: string, cls: string): string | null {
const m = html.match(new RegExp(`class="${cls}"[^>]*>[\\s\\S]*?<p[^>]*>([\\s\\S]*?)</p>`, "i"))
return m ? decodeHtmlEntities(stripTags(m[1])).replace(/\s+/g, " ").trim() || null : null
}
/** Drop head/script/style content so text scans never read CSS or JS. */
function visibleHtml(html: string): string {
return html
.replace(/<head[\s\S]*?<\/head>/gi, "")
.replace(/<script[\s\S]*?<\/script>/gi, "")
.replace(/<style[\s\S]*?<\/style>/gi, "")
.replace(/<!--[\s\S]*?-->/g, "")
}
function bodyText(html: string): string | null {
const text = decodeHtmlEntities(stripTags(visibleHtml(html).replace(/<(br|\/p|\/div|\/li|\/h[1-6])[^>]*>/gi, "\n")))
.split("\n")
.map((line) => line.replace(/\s+/g, " ").trim())
.filter(Boolean)
.join("\n")
return text || null
}
/**
* Parse a live detail page. Jobindex serves two shapes (verified live
* 2026-08-19; the selectors the previous parser used exist in neither):
*
* - the jobindex-native shape, recognisable by its `jd-*` facts blocks
* (jd-deadline, jd-location, ...), with the company as the `<title>`
* prefix ("COMPANY - Job title");
* - an external ATS passthrough (hr-manager/Talentech and similar), where
* the page IS the employer's hosted ad: `og:url` points at the ATS,
* `og:site_name` is the ATS brand, and there is no reliable company
* anchor at all - so `company` is honestly null there, never the ATS.
*
* `id` and `url` are always the caller's jobindex id and its jobannonce
* URL: the canonical/og:url on these pages is the external ATS, and
* storing that broke /scrape's "store a URL that resolves to the posting".
*/
export function parseDetailPage(html: string, url: string, id: string): DetailResult {
const isNative = html.includes('class="jd-')
const ogTitle = metaContent(html, "og:title")
const itempropName = metaContent(html, "name")
const h1 = html.match(/<h1[^>]*>([\s\S]*?)<\/h1>/i)
const h1Title = h1 ? decodeHtmlEntities(stripTags(h1[1])).replace(/\s+/g, " ").trim() : null
const title = ogTitle ?? itempropName ?? h1Title ?? ""
if (!title) {
throw new Error("Failed to parse job listing HTML")
}
// Company: only the native shape carries one - as the <title> prefix,
// "VELLIV - Udvikler til Camunda/AWS". Require the suffix to be the job
// title so an unrelated <title> never becomes a company name.
let company: string | null = null
if (isNative) {
const titleTag = html.match(/<title>([\s\S]*?)<\/title>/i)
const pageTitle = titleTag ? decodeHtmlEntities(titleTag[1]).replace(/\s+/g, " ").trim() : ""
if (pageTitle.endsWith(` - ${title}`)) {
company = pageTitle.slice(0, -(title.length + 3)).trim() || null
}
}
let location: string | null = null
let deadline: string | null = null
let employmentType: string | null = null
let hours: string | null = null
let description: string | null = null
if (isNative) {
location = jdBlockValue(html, "jd-location")
deadline = toIsoDate(jdBlockValue(html, "jd-deadline"))
employmentType = jdBlockValue(html, "jd-type")
hours = jdBlockValue(html, "jd-workhours")
const desc = html.match(/class="jd-description"[^>]*>([\s\S]*?)<\/div>/i)
description = desc
? decodeHtmlEntities(stripTags(desc[1])).replace(/\s+/g, " ").trim() || null
: null
} else {
// hr-manager-style widget: a rowheader label followed by the value span.
const workplace = visibleHtml(html).match(
/class="workplace[^"]*"[\s\S]*?<span class="empty">([\s\S]*?)<\/span>/i,
)
location = workplace
? decodeHtmlEntities(stripTags(workplace[1])).replace(/\s+/g, " ").trim() || null
: null
// Deadline: label + a real date within range, scanned only over visible
// markup - the label also appears inside a CSS comment on these pages,
// which the previous parser captured verbatim as the deadline.
const due = visibleHtml(html).match(
/(?:Ansøgningsfrist|Application\s*due|Frist)[\s\S]{0,300}?(\d{2}-\d{2}-\d{4}|\d{4}-\d{2}-\d{2}|\d{1,2}\.?\s+[a-zæøå]+\s+\d{4})/i,
)
deadline = due ? toIsoDate(due[1]) : null
description = bodyText(html)
if (!description || description.length < 100) {
description = metaContent(html, "og:description") ?? metaContent(html, "description") ?? description
}
}
if (!description) {
description = metaContent(html, "og:description")
}
// Apply URL: jobindex's own /c?t= redirect when present.
let applyUrl: string | null = null
const ctMatch = html.match(/href="(\/c\?t=[^"]+)"/)
if (ctMatch) {
applyUrl = `${BASE_URL}${decodeHtmlEntities(ctMatch[1])}`
}
const timeMatch = html.match(/<time[^>]+datetime="([^"]+)"/)
return {
id,
title,
company,
companyUrl: null,
location,
date: timeMatch ? toIsoDate(timeMatch[1]) : null,
deadline,
employmentType,
hours,
applyUrl,
url,
description,
}
}
export const detail = defineCommand({
name: "detail",
description: "Fetch full job listing detail by ID or URL",
options: {
format: option(z.enum(["json", "plain"]).default("json"), {
description: "Output format: json, plain",
}),
},
handler: async ({ positional, flags, signal }) => {
if (signal.aborted) return
const idArg = positional[0]
if (!idArg) {
writeError("Job ID or URL is required", "MISSING_REQUIRED")
process.exit(1)
}
const { url, id } = buildUrl(idArg)
try {
const html = await htmlFetch(url)
if (signal.aborted) return
let data: DetailResult
try {
data = parseDetailPage(html, url, id)
} catch (parseErr) {
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr)
writeError(msg, "PARSE_ERROR")
process.exit(1)
}
// Verify it's a valid job page (has a title)
if (!data.title) {
writeError("Failed to parse job listing HTML", "PARSE_ERROR")
process.exit(1)
}
if (flags.format === "json") {
console.log(JSON.stringify(data, null, 2))
} else {
outputPlain(data)
}
} catch (err) {
const message = err instanceof Error ? err.message : String(err)
if (message.includes("Job not found") || message.includes("404") || message.includes("NOT_FOUND")) {
writeError("Job not found", "NOT_FOUND")
} else if (message.includes("Failed to parse") || message.includes("PARSE_ERROR")) {
writeError(message, "PARSE_ERROR")
} else {
writeError(message, "API_ERROR")
}
process.exit(1)
}
},
})
function outputPlain(data: DetailResult): void {
console.log(`id: ${data.id}`)
console.log(`title: ${data.title}`)
console.log(`company: ${data.company ?? "-"}`)
console.log(`location: ${data.location ?? "-"}`)
console.log(`date: ${data.date ?? "-"}`)
console.log(`deadline: ${data.deadline ?? "-"}`)
console.log(`employmentType: ${data.employmentType ?? "-"}`)
console.log(`hours: ${data.hours ?? "-"}`)
console.log(`applyUrl: ${data.applyUrl ?? "-"}`)
console.log(`url: ${data.url}`)
console.log("")
if (data.description) {
console.log(data.description)
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |