Generate AI SBOM Declaration
Generate a formatted ai-assisted code fence block for a PR description that declares which AI tools, models, and skills contributed to the work.
Modes
Current Session
When the user asks to generate an AI SBOM during an active session, you already know which skills were invoked. Collect the list from your own tool usage history in this conversation. Get the tool version by running claude --version.
Past Session
When the user wants an SBOM for a previous session or across multiple sessions:
- Identify the project directory:
~/.claude/projects/<project-path-with-dashes>/ - Run the extraction script:
python3 <ai-sbom-plugin-path>/scripts/extract_skills.py <path-to-session-or-project-dir> - The script outputs a JSON object with
skills,models, andtool_version. The tool version is extracted from the session transcript when available; if not found, it falls back to the currently installed version viaclaude --version.
Resolving Provenance
For each skill identified, resolve its version and source:
Read
~/.claude/plugins/installed_plugins.jsonto find the plugin entry- The key format is
plugin-name@marketplace-name(e.g.,superpowers@claude-plugins-official) - Extract
versionandgitCommitShafrom the entry
- The key format is
Read
~/.claude/plugins/known_marketplaces.jsonto find the source repo- Match the marketplace name to get the
source.repo(e.g.,anthropics/claude-plugins-official)
- Match the marketplace name to get the
For repo-local skills (
.claude/skills/), use therepo:prefix with no versionFor user-level skills (
~/.claude/skills/), use theuser:prefix with no version
Output Format
Read the format specification at plugins/ai-sbom/docs/AI_SBOM.md for the exact block structure, field definitions, skill entry format, and examples. Generate the ai-assisted code fence block following that spec.
Writing to a PR
When the user asks to write the SBOM to a PR:
- Find the PR for the current branch:
gh pr view --json number,body - Generate the SBOM block with the
## AI Assistanceheader - Check if the PR body already contains a
## AI Assistancesection- If yes, replace everything from
## AI Assistancethrough the closing```of theai-assistedfence - If no, append the section to the end of the PR body
- If yes, replace everything from
- Update the PR:
gh pr edit <number> --body "<updated body>" - Confirm to the user what was written
Steps
- Determine mode (current session or past session)
- Get the tool version by running
claude --version - Collect the list of skills used (from self-knowledge or extraction script)
- Read
~/.claude/plugins/installed_plugins.json - Read
~/.claude/plugins/known_marketplaces.json - For each skill, resolve: marketplace, version, source repo, commit SHA
- Check
.claude/skills/and~/.claude/skills/for repo-local and user-level skills - Format the
## AI Assistancesection with theai-assistedcode fence block - If the user wants it written to a PR, update the PR body using
gh pr edit - Otherwise, present it to the user for manual inclusion