Skip to content
Closed
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 @@ -370,6 +370,27 @@
],
"formatNotes": "All three. Point the tool at `.github/workflows` and any existing `azure/login` or `AZURE_CLIENT_SECRET` usage first. Prefer replacing secret-based login over adding a parallel OIDC path. Copilot: apply instructions to workflow YAML. Claude Code: skill + workflow edits. Codex: AGENTS.md CI/OIDC section plus concrete workflow diff.",
"body": "Task: Wire GitHub Actions OIDC login to Azure (Microsoft Entra federated identity credentials) for the repository and environment I specify. Replace client-secret login where present.\n\nContext placeholders (fill from the repo or ask only if missing):\n- Repository: {{REPO}} (org/name)\n- Entra application (client) ID: {{AZURE_CLIENT_ID}}\n- Tenant ID: {{AZURE_TENANT_ID}}\n- Subscription ID: {{AZURE_SUBSCRIPTION_ID}}\n- Target GitHub Environment (if used): {{TARGET_ENV}} (e.g. production, staging \u2014 or \"none\")\n- Azure RBAC roles needed by the pipeline: {{AZURE_ROLES}} (e.g. AcrPush on registry X, Contributor on RG Y)\n- Workflow file to change or create: {{WORKFLOW_PATH}}\n- FIC subject strategy: {{SUBJECT_STRATEGY}} (ref | environment | workflow_ref)\n- Use immutable GitHub OIDC subject (2026 guidance): {{IMMUTABLE_SUB}} (yes | no)\n\nRequirements:\n\n1. Inventory\n - Workflows for `azure/login`, `AZURE_CLIENT_SECRET`, or secret-based `az login`\n - `permissions:` defaults; `pull_request` / fork exposure\n - GitHub Environments and protection rules for {{TARGET_ENV}}\n - Existing Entra FIC (issuer, audience, subject)\n\n2. Design\n - OIDC `azure/login` with {{AZURE_CLIENT_ID}}, {{AZURE_TENANT_ID}}, {{AZURE_SUBSCRIPTION_ID}} (vars/secrets names only in output)\n - Job-level `permissions: id-token: write` on the Azure job only\n - FIC subject for {{SUBJECT_STRATEGY}} (ref / environment:{{TARGET_ENV}} / workflow_ref on {{WORKFLOW_PATH}})\n - If {{IMMUTABLE_SUB}}=yes: dual-FIC migration (add immutable, validate, remove name-based); note Flexible FIC / repository_id checks if available\n - Audience `api://AzureADTokenExchange` unless repo documents custom aud end-to-end\n - RBAC: {{AZURE_ROLES}} at minimal scope; no subscription Owner for CI\n - Deny fork `pull_request` paths from OIDC + {{TARGET_ENV}} deploy\n\n3. Author artifacts (prefer concrete diffs)\n - Workflow at {{WORKFLOW_PATH}}: pinned `azure/login`, permissions, triggers\n - PR notes: FIC fields (issuer, audience, exact subject string) \u2014 no secret values\n - RBAC bullets: role + scope; remove secret login \u2014 no parallel OIDC + secret paths\n\n4. Verification\n - Subject match checklist (GitHub `sub` vs Entra FIC)\n - Dry reasoning: allowed ref/env succeeds; wrong branch/env fails\n - Fork PR cannot get `id-token: write` with cloud deploy\n - Grep: no `AZURE_CLIENT_SECRET`, no token echo, pinned SHAs\n\nConstraints:\n- Do not invent IDs or client secrets \u2014 placeholders if missing.\n- No broad FIC subjects (`repo:ORG/REPO:*`).\n- Minimal diff; no unrelated workflow refactors.\n- Optimize for GitHub Copilot, Claude Code, and Codex \u2014 concrete YAML and checklists.\n\nOutput format:\n1. Plan (subject, permissions, RBAC)\n2. Workflow diff for {{WORKFLOW_PATH}}\n3. Entra FIC + RBAC setup notes\n4. Verification checklist + fork PR denial\n5. Residual risks (immutable sub window, shared identity)\n\nStart from `.github/workflows` and {{WORKFLOW_PATH}}. Prefer replacing secret login over a second login path.\n"
},
{
"id": "review-spring-data-jpa-queries",
"title": "Review These Spring Data JPA Queries",
"whenToUse": "You need a PR-ready review or refactor of Spring Data JPA repositories, entity fetch plans, and service-layer query usage \u2014 N+1, pagination, projections, @Query safety, and index notes.",
"tools": [
"copilot",
"claude-code",
"codex"
],
"tags": [
"java",
"spring-boot",
"spring-data-jpa",
"sql",
"performance",
"hibernate",
"review"
],
"formatNotes": "All three. Point the tool at the repository package, entity package, and the service/controller call sites first. Prefer fixing fetch plans and projections over enabling open-in-view. Copilot: apply path-scoped instructions for `**/*Repository.java` and entity packages.",
"body": "Task: Review and harden Spring Data JPA queries and fetch plans for the feature I specify. Eliminate N+1 and pagination traps; prefer DTO projections on read paths; keep @Query parameterized and transactional boundaries clear.\n\nContext placeholders (fill from the repo or ask only if missing):\n- Module / package root: {{PACKAGE_ROOT}} (e.g. com.example.orders)\n- Primary entities: {{ENTITIES}} (comma-separated)\n- Hot endpoints or use cases: {{USE_CASES}} (e.g. list orders, order detail, admin search)\n- Pagination style required: {{PAGINATION}} (Page | Slice | keyset | none)\n- Max page size: {{MAX_PAGE_SIZE}}\n- Open-in-view policy: {{OPEN_IN_VIEW}} (off | on-legacy | unknown)\n- Soft-delete in play: {{SOFT_DELETE}} (yes | no | unknown)\n- DB dialect: {{DB_DIALECT}} (PostgreSQL | MySQL | SQL Server | other)\n- Query-budget test harness available: {{QUERY_BUDGET}} (datasource-proxy | Hibernate statistics | none)\n\nRequirements:\n\n1. Inventory\n - Repositories under {{PACKAGE_ROOT}} touching {{ENTITIES}}\n - FetchType on associations; existing `@EntityGraph`, `JOIN FETCH`, `@BatchSize`\n - Call sites for {{USE_CASES}} (controller \u2192 service \u2192 repository)\n - Any `Pageable` + collection fetch combinations; `findAll` without bounds\n - Native/`@Query` strings; modifying queries; soft-delete filters if {{SOFT_DELETE}}=yes\n\n2. Design\n - Per {{USE_CASES}}: projection vs entity graph vs fetch join vs batch fetch\n - If {{PAGINATION}} needs collections: two-step ID page then fetch-by-ids (never collection JOIN FETCH + Pageable)\n - Cap page size at {{MAX_PAGE_SIZE}}; whitelist sort properties\n - Respect {{OPEN_IN_VIEW}}: if off/unknown, fetch or project inside `@Transactional(readOnly = true)`\n - Index notes for new WHERE/ORDER BY under {{DB_DIALECT}}\n - If {{QUERY_BUDGET}} \u2260 none: add or outline a statement-count assertion for the hottest list path\n\n3. Author artifacts (prefer concrete diffs)\n - Repository method changes (`@EntityGraph`, `@Query`, projections)\n - Service transaction + DTO mapping adjustments\n - Optional Flyway/Liquibase index stub only if filters changed (do not invent unrelated schema)\n - Test sketches: result correctness + query budget when {{QUERY_BUDGET}} allows\n\n4. Verification\n - Explain why N+1 is gone for {{USE_CASES}}\n - Confirm no HHH90003004-style in-memory pagination\n - Grep: no entity returns on public API for list paths; no string-concat query parameters\n - Soft-delete + uniqueness notes if {{SOFT_DELETE}}=yes\n\nConstraints:\n- Do not invent schema or indexes unrelated to {{USE_CASES}}.\n- Minimal diff; match existing repository style (derived vs `@Query`).\n- No enabling open-in-view as a \u201cfix\u201d for LazyInitializationException.\n- Optimize for GitHub Copilot, Claude Code, and Codex \u2014 concrete Java and checklists.\n\nOutput format:\n1. Plan (fetch strategy per use case)\n2. Code diffs (repository/service/DTO)\n3. Index / migration notes (if any)\n4. Verification checklist + query-budget evidence\n5. Residual risks (cartesian joins, soft-delete, count query cost)\n\nStart from repositories and entities under {{PACKAGE_ROOT}}. Prefer projections and explicit fetch plans over EAGER mappings or open-in-view.\n"
}
]
}
Loading
Loading