Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions promptbook/prompts.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,27 @@
],
"formatNotes": "All three. Point the tool at the Jenkinsfile, any shared-library `vars/*.groovy` it loads, and the scripts its `sh` steps call; list credential IDs only, never secret values. Copilot: jenkins-pipeline path instructions plus those files in agent mode. Claude Code: the jenkins-declarative-pipeline-guardrails skill plus the Jenkinsfile. Codex: AGENTS.md Jenkins section, then the diff.",
"body": "Task: Review and harden the Jenkins pipeline I specify. Keep it Declarative, move heavy logic out of Groovy, make every run bounded and reproducible, and make sure no credential can leak — then give me a minimal diff I can open as a PR.\n\nContext placeholders (fill from the repo or ask only if missing):\n- Pipeline file: {{JENKINSFILE_PATH}} (usually `Jenkinsfile`)\n- Job type: {{JOB_TYPE}} (multibranch | pipeline | organization-folder)\n- Build stack: {{BUILD_STACK}} (maven | gradle | docker | python | other)\n- Agents available: {{AGENTS}} (labels, Kubernetes pod templates, or \"unknown\")\n- Shared libraries: {{LIBRARIES}} (names and versions, or \"none\")\n- Credential IDs in use: {{CREDENTIAL_IDS}} (IDs only — never paste secret values)\n- Deploy targets: {{DEPLOY_TARGETS}} (e.g. aks-dev, aks-prod, artifact-repo, none)\n- Pain points: {{PAIN}} (hangs | slow | flaky | controller-load | secret-exposure | none)\n\nRequirements:\n\n1. Inventory\n - Read {{JENKINSFILE_PATH}} end to end: agent declarations, `options`, `environment`, every stage, `when` conditions, `script {}` blocks, `input` steps, `parallel`/`matrix`, `post`\n - List each credential binding, how the secret is referenced, and which stages can see it\n - List shared libraries and the version each is loaded at, plus any `Jenkins.instance` or other internal API use\n - Note how fork PRs are treated if {{JOB_TYPE}} is multibranch\n\n2. Findings (rank by risk: secret exposure > untrusted code with credentials > controller load > unbounded runs > reproducibility > hygiene)\n - Groovy-interpolated secrets (`\"${TOKEN}\"` inside `sh`), echoed secrets, `set -x` around secrets, secrets written to the workspace\n - Builds that can run on the controller, `agent any` without labels, unpinned images or tools\n - Large `script {}` blocks, Groovy JSON/XML parsing, loops of tiny `sh` calls\n - Missing `timeout`, `buildDiscarder`, `timestamps`, or concurrency policy\n - `input` holding an agent; deploys without `lock`/`milestone`; `if` logic that should be `when { ... beforeAgent true }`\n - Unpinned `@Library` refs, overridden built-in steps, sandbox bypasses\n - Missing `post` publishing (tests, artifacts with fingerprints) and workspace cleanup\n\n3. Fix\n - Declarative structure with `agent none` at the top only if every stage declares its own agent; otherwise one labelled agent or pod template\n - Move heavy logic into scripts (`scripts/ci/*.sh`) or build-tool goals ({{BUILD_STACK}}: e.g. `./mvnw -B -ntp verify`)\n - Top-level `options { timeout(...); buildDiscarder(logRotator(...)); timestamps(); disableConcurrentBuilds(abortPrevious: true) }` — adjust stage timeouts knowing they include agent provisioning when the agent is stage-level\n - Bind credentials per stage with `withCredentials` or `credentials()`; reference them only inside single-quoted `sh` strings\n - Approval stages: `agent none`, `input` with `timeout`, and `lock`/`milestone` on deploys to {{DEPLOY_TARGETS}}\n - Pin `@Library` to a tag or commit; replace `Jenkins.instance` use with a supported step or flag it for a plugin\n - `post { always { junit ...; archiveArtifacts ... fingerprint: true } cleanup { cleanWs() } }`\n - Keep deploy credentials out of PR and fork builds\n\n4. Verification\n - Run the Declarative linter (`jenkins-cli declarative-linter` or the validate endpoint) and include its output\n - Run on a branch build and, for multibranch, a PR build; compare duration and queue time with recent builds\n - Confirm in the console log that secrets show as masked and are never printed by a step\n - List anything that needs a Jenkins admin (plugins, credential scope, fork trust settings, agent templates)\n\nConstraints:\n- Minimal diff; keep stage names and artifacts unless a rename is needed for clarity.\n- Do not invent credential IDs, agent labels, image names, or URLs — use placeholders if unknown.\n- Never print or request secret values; refer to credentials by ID only.\n- Do not change what gets built or deployed; behaviour stays the same except for the safety fixes.\n- Optimize for GitHub Copilot, Claude Code, and Codex — concrete Jenkinsfile diff and a checklist.\n\nOutput format:\n1. Findings table: severity | location | issue | fix\n2. Patch (Jenkinsfile diff plus any new scripts)\n3. Before/after: run duration, queue time, controller-side `script` lines, credentials scope per stage\n4. Admin follow-ups and residual risks\n\nStart from {{JENKINSFILE_PATH}}. Fix secret handling before anything else."
},
{
"id": "wire-spring-micrometer-prometheus",
"title": "Wire Spring Boot Micrometer Prometheus Metrics",
"whenToUse": "Add or harden Micrometer Prometheus metrics on a Spring Boot service (RED/SLI histograms, cardinality-safe tags, management-port scrape) and produce a minimal config/code/manifest diff with a verification checklist.",
"tools": [
"copilot",
"claude-code",
"codex"
],
"tags": [
"spring-boot",
"micrometer",
"prometheus",
"observability",
"metrics",
"aks",
"java"
],
"formatNotes": "All three. Point the tool at `application.yml`/`application.properties`, Meter/Metrics config, the build file, and any ServiceMonitor/PodMonitor or Prometheus annotation manifests; keep Actuator security changes aligned with spring-boot-actuator-hardening. Copilot: spring-micrometer-prometheus path instructions plus those files in agent mode. Claude Code: the spring-boot-micrometer-prometheus-guardrails skill plus the config and scrape manifests. Codex: AGENTS.md Micrometer section, then the diff.",
"body": "Task: Wire or harden Micrometer + Prometheus metrics for the Spring Boot service I specify. Deliver RED-ready histograms, cardinality-safe tags, and a private management-port scrape path — then give me a minimal diff I can open as a PR.\n\nContext placeholders (fill from the repo or ask only if missing):\n- App module / root: {{APP_PATH}}\n- Spring Boot version: {{BOOT_VERSION}} (2.x | 3.x | unknown)\n- Build tool: {{BUILD_TOOL}} (maven | gradle)\n- Current Actuator exposure: {{ACTUATOR_EXPOSURE}} (e.g. health,info | include=* | unknown)\n- Management port today: {{MANAGEMENT_PORT}} (number | same-as-server | unknown)\n- Scrape style: {{SCRAPE_STYLE}} (servicemonitor | podmonitor | pod-annotations | none | unknown)\n- Cluster / env: {{ENVIRONMENT}} (e.g. aks-dev, aks-prod)\n- Service name for tags: {{SERVICE_NAME}}\n- Latency SLO targets (optional): {{SLO_BUCKETS_MS}} (e.g. 100,250,500,1000,2500,5000)\n- Pain points: {{PAIN}} (no-percentiles | cardinality | scrape-404 | public-actuator | missing-red | none)\n\nRequirements:\n\n1. Inventory\n - Read {{APP_PATH}} build file and `application*.yml|properties` for Actuator, Micrometer, and management server settings\n - List existing meters (`MeterRegistry` beans, `@Timed`, Observations) and any custom tags\n - Locate scrape manifests or annotations under deploy/Helm paths; note whether scrape hits the public or management port\n - Note overlap with Actuator security config (do not weaken lockdown)\n\n2. Findings (rank by risk: public sensitive Actuator > unbounded cardinality > scrape on public Ingress > missing histograms > hygiene)\n - `include=*` or sensitive endpoints exposed alongside prometheus\n - Raw URI / user id / exception message labels\n - Summaries without histogram buckets where p95/p99 or SLO burn is required\n - Scrape targeting the public Service/Ingress\n - Missing common tags (`application`, `environment`)\n - Custom meters with unbounded label values\n\n3. Fix\n - Dependencies: ensure `spring-boot-starter-actuator` and `micrometer-registry-prometheus` for {{BUILD_TOOL}}\n - Config: separate `management.server.port` when the app has a public HTTP surface; `management.endpoints.web.exposure.include=health,prometheus` (add `info` only if safe); set `management.metrics.tags.application={{SERVICE_NAME}}` and `management.metrics.tags.environment={{ENVIRONMENT}}`\n - HTTP server metrics: enable percentile-histogram (or distribution SLO deadlines / buckets from {{SLO_BUCKETS_MS}}) for `http.server.requests` so Prometheus can compute percentiles\n - Cardinality: ensure URI tags use route templates; strip or deny tags that carry ids or free text; rewrite custom meters to bounded enums\n - Scrape: for {{SCRAPE_STYLE}}, point path at `/actuator/prometheus` (honor any `management.endpoints.web.base-path`) on the **management** port; Prefer ServiceMonitor/PodMonitor selectors over scraping Ingress. Keep changes surgical — no full Helm rewrite unless required\n - Security: keep Actuator lockdown consistent with spring-boot-actuator-hardening; if scrape needs auth, document the platform mechanism without inventing secrets in Git\n - Do not invent OTel collectors or logging pipelines here — link to otel-aks-observability / structured-logging if gaps exist\n\n4. Verification\n - Show sample lines from `/actuator/prometheus` for `http_server_requests_*` including bucket series and common tags\n - Provide PromQL sketches: request rate, 5xx error ratio, `histogram_quantile(0.95, ...)` (and 0.99 if useful)\n - Confirm scrape config targets management port; note NetworkPolicy / private Service expectations for {{ENVIRONMENT}}\n - List residual risks (auth on management, bucket fit to SLO, remaining high-cardinality candidates)\n\nConstraints:\n- Minimal diff; do not refactor unrelated config or open extra Actuator endpoints.\n- Do not invent cluster URLs, credential values, or Helm chart names — use placeholders if unknown.\n- Do not put PII or secrets into metric tags or `info`.\n- Optimize for GitHub Copilot, Claude Code, and Codex — concrete diffs and a checklist.\n- Metrics lane only; defer traces and log shipping to their skills.\n\nOutput format:\n1. Findings table: severity | location | issue | fix\n2. Patch (build + application config + meter/tag fixes + scrape manifest/annotations)\n3. Verification: sample prometheus text, PromQL, scrape target summary\n4. Residual risks and follow-ups (Actuator auth, OTel, logging)\n\nStart from {{APP_PATH}}. Fix public Actuator exposure and unbounded labels before polishing dashboards.\n"
}
]
}
Loading
Loading