Skip to content

peteedoo/project-template / .agents/skills/ai-job-search/jobdanmark-search

jobdanmark-search

Verified

Make sure to use this skill whenever the user mentions anything related to Danish job listings, job search in Denmark, finding work in Denmark, or job vacancies on Jobdanmark — even if they don't explicitly mention jobdanmark.dk. Also invoke this skill for questions about specific Danish job categories, municipalities, job types, or salaries in a job-search context. Trigger phrases include: danish jobs, jobs in denmark, find job denmark, job search denmark, danish job listings, jobdanmark, job opslag, find job, jobsøgning, ledige stillinger, stillingsopslag, job i Danmark, fuldtidsjob, deltidsjob, studiejob, praktikplads, elev, fleksjob, IT job denmark, sygeplejersker job, håndværker job, ingeniør job, pædagog job, kontor job, leder job, salg job, hotel job, kirke job, job aarhus, job københavn, job odense, job aalborg, job sjælland, job jylland, job fyn, jobkategorier denmark, ledige job, ansøgningsfrist, søg job, job opslaget, jobopslag, danish vacancies, work in denmark, employment denmark, job denmark, jobs near me denmark, apprentice denmark, internship denmark, part-time denmark, full-time denmark.

cli/src/commands/detail.ts

View on GitHub
import { defineCommand, option } from "@bunli/core"
import { z } from "zod"
import { parse } from "node-html-parser"
import { BASE_URL, writeError } from "../helpers.js"

interface JsonLdJobPosting {
  "@context"?: string
  "@type"?: string
  title?: string
  datePosted?: string
  validThrough?: string
  employmentType?: string | string[]
  hiringOrganization?: {
    "@type"?: string
    name?: string
    logo?: string
  }
  jobLocation?: {
    "@type"?: string
    address?: {
      "@type"?: string
      streetAddress?: string
      addressLocality?: string
      addressRegion?: string
      postalCode?: string
      addressCountry?: string
    }
  }
  description?: string
}

export const detail = defineCommand({
  name: "detail",
  description: "Full detail for a single job posting (by slug)",
  options: {
    format: option(z.enum(["json", "plain"]).default("json"), {
      description: "Output format: json, plain",
    }),
  },
  handler: async ({ flags, positional, signal }) => {
    if (signal.aborted) return

    const slug = positional[0]
    if (!slug) {
      writeError("slug argument is required", "MISSING_REQUIRED")
      process.exit(1)
    }

    const url = `${BASE_URL}/job/${slug}`

    try {
      const response = await fetch(url, {
        headers: {
          "Accept": "text/html,application/xhtml+xml",
          "User-Agent": "Mozilla/5.0",
        },
      })

      if (response.status === 404) {
        writeError("Job not found", "NOT_FOUND")
        process.exit(1)
      }

      if (!response.ok) {
        writeError(`API request failed: ${response.status} ${response.statusText}`, "API_ERROR")
        process.exit(1)
      }

      const html = await response.text()
      const root = parse(html)

      // Find JSON-LD script tag
      const ldJsonScripts = root.querySelectorAll('script[type="application/ld+json"]')
      let jobPosting: JsonLdJobPosting | null = null

      for (const script of ldJsonScripts) {
        try {
          const parsed = JSON.parse(script.text)
          if (parsed["@type"] === "JobPosting") {
            jobPosting = parsed
            break
          }
        } catch {
          // continue to next script
        }
      }

      if (!jobPosting) {
        // Check for 404 by looking at page content
        const pageTitle = root.querySelector("title")?.text ?? ""
        if (pageTitle.toLowerCase().includes("404") || html.toLowerCase().includes("siden blev ikke fundet")) {
          writeError("Job not found", "NOT_FOUND")
        } else {
          writeError("Failed to parse JSON-LD from job page", "PARSE_ERROR")
        }
        process.exit(1)
      }

      if (signal.aborted) return

      const hiringOrg = jobPosting.hiringOrganization
      const address = jobPosting.jobLocation?.address

      const employmentType = Array.isArray(jobPosting.employmentType)
        ? jobPosting.employmentType
        : jobPosting.employmentType
          ? [jobPosting.employmentType]
          : []

      const output = {
        slug,
        url,
        title: jobPosting.title ?? "",
        datePosted: jobPosting.datePosted ?? "",
        validThrough: jobPosting.validThrough ?? null,
        employmentType,
        hiringOrganization: {
          name: hiringOrg?.name ?? "",
          logo: hiringOrg?.logo ?? null,
        },
        jobLocation: {
          streetAddress: address?.streetAddress ?? null,
          addressLocality: address?.addressLocality ?? null,
          addressRegion: address?.addressRegion ?? null,
          postalCode: address?.postalCode ?? null,
          addressCountry: address?.addressCountry ?? null,
        },
        description: jobPosting.description ?? "",
      }

      if (flags.format === "json") {
        console.log(JSON.stringify(output, null, 2))
      } else {
        outputPlain(output)
      }
    } catch (err) {
      if (err instanceof Error && err.message.includes("NOT_FOUND")) {
        writeError("Job not found", "NOT_FOUND")
      } else {
        writeError(err instanceof Error ? err.message : String(err), "API_ERROR")
      }
      process.exit(1)
    }
  },
})

function outputPlain(data: Record<string, unknown>): void {
  console.log(`slug: ${data.slug}`)
  console.log(`url: ${data.url}`)
  console.log(`title: ${data.title}`)
  console.log(`datePosted: ${data.datePosted}`)
  console.log(`validThrough: ${data.validThrough ?? "N/A"}`)
  const empType = Array.isArray(data.employmentType) ? data.employmentType.join(", ") : "-"
  console.log(`employmentType: ${empType}`)
  const org = data.hiringOrganization as { name: string; logo: string | null }
  console.log(`company: ${org.name}`)
  const loc = data.jobLocation as {
    streetAddress: string | null
    addressLocality: string | null
    postalCode: string | null
    addressCountry: string | null
  }
  console.log(`location: ${[loc.streetAddress, loc.addressLocality, loc.postalCode, loc.addressCountry].filter(Boolean).join(", ")}`)
  console.log(`description: ${data.description}`)
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall