| name | generate-sbom |
| description | Generate an AI SBOM declaration for a PR description. Use this skill when the user asks to generate an AI SBOM, create an ai-assisted block, fill out their AI assistance section, or prepare a PR description with AI provenance. Also use when the user says 'what skills did I use' or 'summarize my AI usage'. |
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, and tool_version. The tool version is extracted from the session transcript when available; if not found, it falls back to the currently installed version via claude --version.
Resolving Provenance
For each skill identified, resolve its version and source:
-
Read ~/.claude/plugins/installed_plugins.json to find the plugin entry
- The key format is
plugin-name@marketplace-name (e.g., superpowers@claude-plugins-official)
- Extract
version and gitCommitSha from the entry
-
Read ~/.claude/plugins/known_marketplaces.json to find the source repo
- Match the marketplace name to get the
source.repo (e.g., anthropics/claude-plugins-official)
-
For repo-local skills (.claude/skills/), use the repo: prefix with no version
-
For user-level skills (~/.claude/skills/), use the user: 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 Assistance header
- Check if the PR body already contains a
## AI Assistance section
- If yes, replace everything from
## AI Assistance through the closing ``` of the ai-assisted fence
- If no, append the section to the end of the PR body
- 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 Assistance section with the ai-assisted code 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