with one click
draft-pr
// Draft a PR description based on branch changes and the project PR template
// Draft a PR description based on branch changes and the project PR template
Create a template for checks and remediations
Create a new product in ComplianceAsCode project
Create Automatus test scenarios to test the given rule.
Search for existing rules that match a given requirement text. Identify rules that implement a specific control.
Create or update a versioned profile pair (versioned + unversioned extends pattern).
Build a ComplianceAsCode product
| name | draft-pr |
| description | Draft a PR description based on branch changes and the project PR template |
Generate a pull request description for the current branch by analyzing commits since the branching point from master, following the project's PR template format.
This skill uses mcp__content-agent__* tools when available (preferred — deterministic, structured results). When the MCP server is not configured, fall back to filesystem-based alternatives noted as Fallback in each step. See .claude/skills/shared/mcp_fallbacks.md for detailed fallback procedures. The skill must complete successfully either way.
Get current branch and branching point:
git branch --show-current
git merge-base HEAD master
Abort if not on a feature branch:
master, or if merge-base equals HEAD (no diverging commits), inform the user:
"No diverging commits found. Please switch to your feature branch first."Collect commit history (all commits since branching point):
MERGE_BASE=$(git merge-base HEAD master)
git log --no-merges --format="%H %s%n%b---" ${MERGE_BASE}..HEAD
Collect diff information:
MERGE_BASE=$(git merge-base HEAD master)
git diff --stat ${MERGE_BASE}..HEAD
git diff ${MERGE_BASE}..HEAD
git diff --name-only ${MERGE_BASE}..HEAD
Determine which categories apply based on changed files and diff content:
rule.yml added)rule.yml changed)shared/templates/).profile files)controls/)tests/)Look for product indicators:
rule.yml files (cce@rhel8, cce@rhel9, cce@rhel10, etc.)products/<product>/)For significant changed files, use MCP functions to get structured metadata:
mcp__content-agent__get_rule_details with the rule ID to get title, description, rationale, template, severity, references, and platform infomcp__content-agent__get_profile_details with product and profile ID to get profile structure and rule selectionsmcp__content-agent__get_control_details to understand control framework structuremcp__content-agent__get_template_schema to get template parameter infoFallback: Read the files directly — rule.yml, .profile, control YAML, and template files in shared/templates/<name>/.
tests/ subdirectoriesScan commit messages for patterns like Fixes #N, Resolves #N, Closes #N, or bare #N references.
Read the PR template:
cat .github/pull_request_template.md
Draft all three sections following the template format exactly:
Auto-generate from analysis:
<rule_id> that . The rule has <severity> severity and targets . It uses the <template> template / includes custom OVAL and <Bash/Ansible/both> remediation."<rule_id> to ."<template_name> to ."Attempt to infer from:
rationale field in rule.ymlIf rationale cannot be fully inferred, include what was found and mark gaps for user input.
Include issue reference if detected in commit messages, otherwise leave a placeholder.
Auto-generate:
./build_product --datastream-only <product>./tests/automatus.py rule --libvirt qemu:///session <product_vm_name> --datastream build/ssg-<product>-ds.xml <rule_id>
Note: Adjust qemu:///session to qemu:///system and <product_vm_name> to the actual VM name based on reviewer's local setup.Write the final description to PR_DESCRIPTION.md in the repository root. If the file already exists, inform the user and ask whether to overwrite.
The file must begin with the suggested PR title on the first line, followed by a blank line, then the PR template sections:
<suggested PR title>
#### Description:
- <description content>
#### Rationale:
- <rationale content>
- Fixes #<number> (only if user provided one, otherwise omit this line)
#### Review Hints:
- <review hints content>
Generate a PR title following project conventions:
The title is included at the top of PR_DESCRIPTION.md so the user can edit it alongside the body.
Tell the user:
PR_DESCRIPTION.md)git push -u origin <current_branch>
gh pr create --title "<suggested title>" --body-file PR_DESCRIPTION.md
PR_DESCRIPTION.md to the repository.github/pull_request_template.md--no-merges when reading commit log to skip merge commits