Inferensys

Prompt

SBOM Generation and Review Prompt Template

A practical prompt playbook for generating a structured software bill of materials from a dependency update, with completeness checks against the actual dependency graph.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, required context, and explicit boundaries for the SBOM generation and review prompt.

This prompt is for platform and security engineering teams that need to generate or review a software bill of materials (SBOM) from a dependency update. Use it when a pull request modifies a package manifest or lock file and you need a structured inventory of every component, version, supplier, and license before merge. The prompt produces an SBOM in a machine-readable format and runs completeness checks against the dependency graph to flag missing or phantom entries.

The ideal user is a developer or DevSecOps engineer reviewing a dependency update PR, or an automated CI/CD pipeline that gates merges on SBOM completeness. Required context includes the full diff of the package manifest and lock file, the project's dependency graph, and any existing SBOM for comparison. The prompt expects structured input: the changed files, the resolved dependency tree, and a target output schema such as SPDX or CycloneDX. Without this context, the model cannot verify that every transitive dependency is accounted for.

Do not use this prompt for runtime dependency analysis, vulnerability scoring, or license compliance decisions. It is a generation and structural review tool, not a policy engine. For vulnerability reachability analysis, use the Transitive Dependency Vulnerability Reachability Prompt. For license compliance, use the Dependency License Compliance Review Prompt. This prompt stops at producing a verified inventory; downstream decisions require separate, purpose-built workflows with human review for high-risk findings.

PRACTICAL GUARDRAILS

Use Case Fit

Where the SBOM Generation and Review prompt template delivers reliable value and where it introduces unacceptable risk. Use these cards to decide if this prompt fits your workflow before integrating it into a CI/CD pipeline or security review process.

01

Good Fit: Structured Dependency Updates

Use when: A pull request contains a batch of dependency updates with available changelogs, lock file diffs, and advisory data. The prompt excels at producing a structured SBOM with component inventory, version, supplier, and license fields. Guardrail: Always provide the actual dependency graph as input; do not rely on the model to infer transitive dependencies from memory.

02

Bad Fit: Zero-Context Package Guessing

Avoid when: You expect the model to generate an SBOM from a package name alone without providing manifest files, lock files, or advisory data. The model will hallucinate versions, dependencies, and licenses. Guardrail: Require concrete input artifacts (package.json, requirements.txt, pom.xml, lock files) as grounding evidence before invoking the prompt.

03

Required Inputs: Grounding Artifacts

What to watch: The prompt template requires specific inputs to produce a reliable SBOM: the dependency manifest, the lock file, any available advisory data, and the changelog diff. Missing inputs cause completeness gaps. Guardrail: Validate that all required input fields are populated before generation. If an input is missing, abort or flag the SBOM as partial with explicit gaps noted.

04

Operational Risk: Completeness Drift

What to watch: The model may omit transitive dependencies, skip packages with sparse metadata, or fail to detect newly introduced dependencies in a large update batch. This creates a false sense of security. Guardrail: Implement a post-generation completeness check that compares the SBOM component count against the actual dependency graph node count. Flag any mismatch for human review.

05

Operational Risk: License Misclassification

What to watch: The model may misclassify non-standard licenses, confuse similar license names, or fail to detect dual-licensing scenarios. This creates legal compliance risk. Guardrail: Route all license classifications through a deterministic allowlist/blocklist check after generation. Any license not matching a known SPDX identifier must be flagged for manual legal review.

06

Pipeline Integration: Human Approval Gate

What to watch: Teams may be tempted to auto-merge SBOM output into compliance records without review. An incorrect SBOM is worse than no SBOM because it creates false assurance. Guardrail: Require human approval for any SBOM containing packages with high-severity advisories, unknown licenses, or first-time dependencies. Automate the low-risk cases, escalate the rest.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for generating a structured Software Bill of Materials from a dependency update, ready to paste into your AI harness.

The following prompt template is designed to be copied directly into your AI orchestration layer, test suite, or evaluation harness. It accepts a dependency update context—such as a lock file diff, a package manifest change, or a changelog—and produces a structured SBOM with component inventory, version, supplier, license, and completeness checks. Every placeholder is enclosed in square brackets and must be replaced with real data before execution. The prompt is self-contained and does not depend on the rest of this playbook to function.

text
You are an SBOM generation assistant for platform and security engineering teams. Your task is to produce a Software Bill of Materials (SBOM) from the provided dependency update information. The output must be a structured JSON object that can be ingested by compliance, vulnerability management, and inventory systems.

## INPUT
[DEPENDENCY_UPDATE_CONTEXT]

## OUTPUT SCHEMA
Return a single JSON object with the following structure. Do not include any text outside the JSON object.

{
  "sbom": {
    "format": "CycloneDX",
    "specVersion": "1.5",
    "serialNumber": "urn:uuid:[GENERATE_A_UNIQUE_UUID]",
    "version": 1,
    "metadata": {
      "timestamp": "[ISO_8601_TIMESTAMP]",
      "tools": [
        {
          "vendor": "Inference Systems",
          "name": "SBOM Generation Prompt",
          "version": "1.0"
        }
      ],
      "component": {
        "type": "application",
        "name": "[APPLICATION_NAME]",
        "version": "[APPLICATION_VERSION]"
      }
    },
    "components": [
      {
        "type": "library",
        "name": "[COMPONENT_NAME]",
        "version": "[COMPONENT_VERSION]",
        "purl": "[PACKAGE_URL]",
        "supplier": {
          "name": "[SUPPLIER_NAME]"
        },
        "licenses": [
          {
            "license": {
              "id": "[SPDX_LICENSE_ID]"
            }
          }
        ],
        "hashes": [
          {
            "alg": "SHA-256",
            "content": "[INTEGRITY_HASH]"
          }
        ],
        "scope": "required",
        "evidence": {
          "identity": {
            "field": "purl",
            "confidence": 1.0,
            "methods": [
              {
                "technique": "manifest-analysis",
                "confidence": 1.0,
                "value": "[MANIFEST_FILE_PATH]"
              }
            ]
          }
        }
      }
    ],
    "dependencies": [
      {
        "ref": "[COMPONENT_REF]",
        "dependsOn": ["[DEPENDENCY_REF]"]
      }
    ]
  },
  "completeness_checks": {
    "total_declared_dependencies": [INTEGER],
    "total_enumerated_in_sbom": [INTEGER],
    "missing_from_sbom": ["[MISSING_COMPONENT_NAME]"],
    "unexpected_in_sbom": ["[UNEXPECTED_COMPONENT_NAME]"],
    "completeness_score": [FLOAT_BETWEEN_0_AND_1],
    "warnings": ["[WARNING_MESSAGE]"]
  }
}

## CONSTRAINTS
[CONSTRAINTS]

## EXAMPLES
[EXAMPLES]

## TOOLS
[TOOLS]

## RISK LEVEL
[RISK_LEVEL]

## INSTRUCTIONS
1. Parse [DEPENDENCY_UPDATE_CONTEXT] to identify every direct and transitive dependency being added, removed, or updated.
2. For each dependency, extract or infer the component name, version, package URL (purl), supplier, SPDX license identifier, and SHA-256 integrity hash.
3. Populate the `components` array with one object per dependency.
4. Populate the `dependencies` array to reflect the dependency graph, using the component's purl as the `ref`.
5. Run completeness checks by comparing the total number of dependencies declared in the input against the number you enumerated in the SBOM. Flag any discrepancies in `completeness_checks`.
6. If [RISK_LEVEL] is "high", include a `confidence` field in each component object indicating your certainty in the extracted data (0.0 to 1.0).
7. If [TOOLS] includes a package registry lookup function, call it to verify supplier and license data when confidence is below 0.8.
8. Do not fabricate data. If a field cannot be determined, set its value to `null` and add a warning to `completeness_checks.warnings`.
9. Return only the JSON object. No markdown fences, no explanatory text.

To adapt this template for your environment, replace each square-bracket placeholder with real data or a reference to your application's variable store. The [DEPENDENCY_UPDATE_CONTEXT] placeholder should receive the raw diff, manifest change, or changelog text. The [CONSTRAINTS] placeholder can inject additional rules, such as "only include production dependencies" or "exclude devDependencies with scope: optional." The [EXAMPLES] placeholder is optional but recommended for complex ecosystems; provide one or two few-shot examples of correct SBOM components for your language or package manager. The [TOOLS] placeholder should list any functions the model can call, such as a package registry API or a license database lookup. The [RISK_LEVEL] placeholder accepts "low," "medium," or "high" and controls whether confidence scoring is required. After adapting the template, run it against a known-good dependency set and validate the output JSON against your SBOM schema before integrating it into a CI pipeline or compliance workflow.

IMPLEMENTATION TABLE

Prompt Variables

Placeholders required by the SBOM Generation and Review Prompt Template. Each variable must be populated before the prompt is sent. Validation notes describe how to confirm the input is well-formed before execution.

PlaceholderPurposeExampleValidation Notes

[DEPENDENCY_UPDATE_CONTEXT]

Describes the dependency change being reviewed: package name, current version, target version, and update trigger

Package: requests, Current: 2.28.0, Target: 2.31.0, Trigger: dependabot PR #452

Must contain package name and both version strings. Reject if version format is non-standard or missing.

[MANIFEST_FILE]

The full package manifest or lock file content showing declared dependencies before and after the update

package.json, requirements.txt, Cargo.lock, or pom.xml content as raw text

Must be valid parseable manifest for the target ecosystem. Schema check against ecosystem parser before prompt assembly.

[DEPENDENCY_GRAPH]

The resolved dependency tree showing direct and transitive dependencies with their versions

JSON output from npm ls --json, pipdeptree, or cargo tree

Must include depth >= 2 to capture transitive dependencies. Validate JSON structure has name and version fields at minimum.

[ADVISORY_DATA]

Known security advisories, CVEs, or vulnerability records relevant to the updated packages

OSV.dev JSON response, GitHub Advisory Database entry, or internal advisory feed

Each advisory must have a CVE or GHSA identifier. Null allowed if no advisories exist. Validate identifier format.

[LICENSE_DATA]

License information for the package and its transitive dependencies

SPDX license expressions per package, output from license-checker tool

Each entry must map to a valid SPDX identifier or expression. Flag unknown or unparseable license strings before prompt use.

[CODEBASE_USAGE_PATTERNS]

Evidence of how the dependency is imported and used in the application codebase

grep output of import statements, call site references, or API surface usage

Must include file paths and line references. Empty result set is valid and indicates no direct usage, which should be noted in output.

[OUTPUT_SCHEMA]

The expected SBOM structure definition the model must conform to

CycloneDX 1.5 JSON schema, SPDX 2.3 JSON schema, or custom internal schema

Must be a valid JSON Schema or example structure. Validate schema before prompt assembly. Reject malformed schemas.

[COMPLETENESS_THRESHOLD]

The minimum percentage of dependency graph nodes that must appear in the generated SBOM

0.95 for 95% coverage requirement

Must be a float between 0.0 and 1.0. Default to 0.90 if not specified. Values below 0.80 should trigger a warning in the harness.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the SBOM generation prompt into a CI/CD pipeline or dependency review workflow with validation, retries, and human approval gates.

This prompt is designed to be called programmatically as part of a dependency update review pipeline, not as a one-off chat interaction. The typical integration point is a CI/CD job that triggers when a package-lock.json, yarn.lock, Cargo.lock, or equivalent manifest file changes in a pull request. The application layer is responsible for extracting the dependency graph from the lock file, formatting it as structured input, and injecting it into the [DEPENDENCY_GRAPH] placeholder. The model should never receive raw lock file text; pre-parsing ensures the model focuses on analysis rather than format interpretation.

Validation and retry logic is critical because the output must be machine-readable. After the model returns a response, the application layer must parse the JSON output and validate it against the expected SBOM schema: check that all required fields (component, version, supplier, license, relationship) are present for each entry, that version strings match the input graph, and that no components are missing. If validation fails, implement a single retry with the validation error message appended to the prompt as additional [CONSTRAINTS] context. After two failed attempts, escalate to a human reviewer queue rather than looping indefinitely. For high-risk repositories (e.g., production infrastructure, regulated systems), always require human approval on the final SBOM before it is committed to the attestation store.

Model choice and tool use should favor models with strong structured output support. Use constrained decoding or JSON mode when available to reduce malformed output. This prompt does not require tool calling or RAG in its base form, but if your pipeline includes a vulnerability database lookup, consider splitting the workflow: first generate the SBOM with this prompt, then pass the structured component list to a separate advisory matching tool or prompt. Log every SBOM generation with the prompt version, model, input hash, and validation result for auditability. Avoid running this prompt on every commit; trigger it only on dependency manifest changes to control cost and latency.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the structured SBOM and completeness check generated by the prompt. Use this contract to parse, validate, and integrate the model output into downstream systems.

Field or ElementType or FormatRequiredValidation Rule

sbom_version

string (semver)

Must match '1.0' or the version specified in [OUTPUT_SCHEMA]. Reject on mismatch.

generated_at

string (ISO 8601)

Must parse as valid ISO 8601 datetime. Must be within 5 minutes of system clock at generation time.

components

array of objects

Must be a non-empty array. If empty, the completeness check must flag a failure unless the manifest was also empty.

components[].name

string

Must match a package name from the input manifest. Non-empty. Trim whitespace before comparison.

components[].version

string

Must be a non-empty string. Should match the resolved version from the lock file if [LOCK_FILE] is provided.

components[].supplier

string or null

If present, must be a non-empty string. Null allowed when supplier is unknown. Do not hallucinate 'Unknown' as a string.

components[].licenses

array of strings or null

If present, each entry must be a valid SPDX identifier or 'NOASSERTION'. Null allowed. Empty array treated as missing data.

completeness_check.total_manifest_entries

integer

Must equal the count of dependencies parsed from the input manifest. Parse and compare; flag mismatch.

completeness_check.sbom_component_count

integer

Must equal the length of the 'components' array. Compute programmatically; do not trust the model's self-reported count.

completeness_check.missing_from_sbom

array of strings

Must list package names present in the manifest but absent from the components array. Empty array if complete. Validate by set difference.

PRACTICAL GUARDRAILS

Common Failure Modes

SBOM generation fails in predictable ways. These are the most common failure modes when generating a software bill of materials from a dependency update, along with practical guardrails to catch them before the SBOM reaches a compliance audit or security review.

01

Transitive Dependency Blind Spots

What to watch: The model generates an SBOM from the top-level manifest but misses transitive dependencies that are pulled in by the update. The SBOM looks complete but is missing 40-70% of the actual dependency graph. Guardrail: Always provide the full lock file alongside the manifest. Add a completeness check instruction that counts declared dependencies against SBOM entries and flags discrepancies. Cross-reference the SBOM component count with the lock file's resolved dependency count.

02

Version Drift Between SBOM and Lock File

What to watch: The model hallucinates version numbers or copies them from the manifest's declared range rather than the lock file's resolved version. The SBOM reports ^2.1.0 instead of the actually installed 2.1.3. Guardrail: Require the prompt to extract versions exclusively from the lock file, not the manifest. Add a post-generation validation step that samples 5-10 SBOM entries and verifies each version against the lock file. Flag any mismatch for human review.

03

Missing License and Supplier Fields

What to watch: The model populates component name and version but leaves license, supplier, or purl fields empty or marked UNKNOWN for packages where this data is available in the manifest or registry metadata. Guardrail: Include a structured output schema that requires non-null values for license and supplier fields. Add a post-generation completeness check that flags any component with more than one empty required field. For flagged components, trigger a secondary lookup prompt against the package registry.

04

Cyclical and Duplicate Component Entries

What to watch: The model duplicates the same component multiple times under different dependency paths or creates circular references where A depends on B and B depends on A. This inflates the SBOM and breaks downstream tooling. Guardrail: Add an explicit instruction to deduplicate components by purl or name-version pair. Include a post-generation validation that checks for duplicate purls and reports any cycle in the dependency graph. Reject SBOMs with duplicates before they reach compliance tools.

05

Scope Boundary Confusion

What to watch: The model includes devDependencies, test dependencies, or build-time tools in a production SBOM, or excludes runtime dependencies that should be present. The SBOM scope doesn't match the intended use case. Guardrail: Add a clear scope instruction in the prompt specifying which dependency types to include. Provide the dependency groups from the manifest with explicit include/exclude rules. Add a post-generation scope check that samples entries and verifies they match the declared scope policy.

06

Stale or Fabricated Advisory Data

What to watch: The model generates security advisory references or CVE IDs that sound plausible but don't exist, or cites advisories that have been patched in the resolved version. This creates false urgency or false confidence. Guardrail: Never ask the model to generate advisory data from its training data. Instead, provide a pre-fetched advisory feed as input context and instruct the model to only reference advisories present in that feed. Add a citation requirement that each advisory reference must include a verifiable CVE ID or advisory URL from the provided context.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test SBOM output quality before integrating the prompt into a CI pipeline or review workflow. Each criterion targets a specific failure mode observed in SBOM generation.

CriterionPass StandardFailure SignalTest Method

Component Completeness

All direct and transitive dependencies from [LOCK_FILE] appear in the SBOM

SBOM component count is less than 90% of the lock file dependency count

Parse lock file for unique package identifiers; compare set intersection with SBOM entries

Version Accuracy

Every component version matches the resolved version in [LOCK_FILE] exactly

Any version string in SBOM differs from lock file resolved version

Extract all name-version pairs from both sources; flag any mismatch

Supplier Attribution

Supplier field is populated for at least 80% of components using registry metadata or package.json author

More than 20% of components have null, empty, or 'unknown' supplier values

Count components with non-null supplier field; divide by total component count

License Identification

License field matches SPDX identifier where declared in package metadata; 'NOASSERTION' used only when license is genuinely absent

License field contains raw non-SPDX strings, 'UNKNOWN', or is empty for packages with declared licenses

Sample 10 random components; verify license field against package metadata source

Dependency Relationship Graph

Every transitive dependency has a 'dependsOn' relationship tracing back to at least one direct dependency

Orphan components exist with no inbound relationship from any other SBOM component

Build adjacency list from SBOM relationships; check every component has at least one parent or is a direct dependency

CycloneDX or SPDX Schema Validity

Output validates against the declared [OUTPUT_FORMAT] schema version without errors

Schema validator returns errors for required field violations or type mismatches

Run output through official CycloneDX or SPDX JSON schema validator

Hash Integrity

Package hash in SBOM matches the integrity hash in [LOCK_FILE] for every component

Any component hash mismatch between SBOM and lock file

Extract all component-hash pairs; compare with lock file integrity field; flag any difference

Timestamp and SBOM Metadata

SBOM metadata includes generation timestamp, tool name, and input source reference

Metadata section is missing, empty, or lacks timestamp

Check for presence of metadata.timestamp, metadata.tools, and metadata.component fields

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single package manifest and lighter validation. Replace [FULL_DEPENDENCY_GRAPH] with a parsed package.json or requirements.txt. Drop the completeness check step and focus on component inventory generation.

code
Generate an SBOM for the following dependency manifest:
[MANIFEST_CONTENT]

Output as JSON with fields: component, version, supplier, license.

Watch for

  • Missing license detection when package metadata is sparse
  • Transitive dependencies omitted entirely
  • Flat list instead of graph structure
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.