resolve-rule-variables

Resolves XCCDF variable selections for compliance rules into var_name=key entries.

2.8k|823|Updated Apr 29, 2014
One-click install
npx skills add https://github.com/ComplianceAsCode/content --skill resolve-rule-variables
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: resolve-rule-variables
Source: https://github.com/ComplianceAsCode/content/tree/main/.claude/skills/resolve-rule-variables
Command: npx skills add https://github.com/ComplianceAsCode/content --skill resolve-rule-variables

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml.

What problem does it solve?

When authoring compliance control files in ComplianceAsCode, rules often depend on XCCDF variables whose values must be selected. Manually tracking which variables each rule uses, reading their .var files, and choosing the correct option key is tedious and error-prone.

Core Features & Use Cases

  • Automatic Variable Detection: Looks up rule dependencies in the build-generated rule_variable_mapping.json and deduplicates variables shared across multiple rules.
  • Interactive Value Selection: Reads each variable's .var file options and prompts the author to pick a key, with CIS-suggested and default values clearly marked.
  • Control File Ready Output: Returns var_name=key selections ready to be written inline into a control file's rules list.
  • Use Case: After selecting rules like accounts_password_pam_minlen for a NIST control mapping on RHEL 9, run this skill to resolve var_password_pam_minlen and other dependencies, choosing values aligned with CIS recommendations.

Quick Start

Ask the assistant to resolve rule variables for product rhel9 and the rules accounts_password_pam_dcredit and accounts_tmout, optionally passing CIS variable suggestions.

Frequently Asked Questions about resolve-rule-variables

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I resolve XCCDF variables for compliance rules?

Invoke the skill with a product and rule IDs, for example /resolve-rule-variables rhel9 accounts_tmout. It reads build/<product>/rule_variable_mapping.json, loads each variable's .var file options, and prompts you to select a key for each variable.

What format are variable selections written in control files?

Selections are written inline in the control file's rules list as var_name=key entries, where key is the option key from the .var file's options dict, not the resolved value. For example, var_password_pam_dcredit=1 means key 1, which resolves to actual value -1.

Why does the skill report that rule_variable_mapping.json is missing?

The mapping file is generated during the product build. Run ./build_product <product> -d first to produce build/<product>/rule_variable_mapping.json, then rerun the skill to enable automatic variable detection.

Can I pass CIS variable selections as defaults?

Yes, use the --cis-vars flag with var_name=key entries, such as --cis-vars var_accounts_tmout=600. Matching options are pre-marked as CIS suggested in the selection prompt, but you can still choose a different key.

What happens if two rules share the same variable?

Shared variables are deduplicated automatically. The skill asks for the value once, shows all rules that use the variable, and applies the single selection to the rules list.