en un clic
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
Run Automatus tests for a security rule
Create a new security rule with all required components
Interactive control-to-rule mapping session. Walk through unmapped requirements, suggest rules using cross-framework analysis, and write selections to control files.
Map rules to a single control file requirement using cross-framework analysis and rule search.
Onboard a new security policy as a control file. Parse the document, create control file structure, and map existing rules to requirements.
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-mcp__* 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-mcp__get_rule_details with the rule ID to get title, description, rationale, template, severity, references, and platform infomcp__content-mcp__get_profile_details with product and profile ID to get profile structure and rule selectionsmcp__content-mcp__get_control_details to understand control framework structuremcp__content-mcp__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