一键导入
map-requirement
// Map rules to a single control file requirement using cross-framework analysis and rule search.
// Map rules to a single control file requirement using cross-framework analysis and rule search.
| name | map-requirement |
| description | Map rules to a single control file requirement using cross-framework analysis and rule search. |
Map rules to a single requirement in a control file. This is the atomic unit of the mapping workflow — it finds candidate rules, presents them to the author, and writes the selection back to the control file.
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.
Without MCP server: Cross-framework similarity search is unavailable. Candidate rules will be found by keyword search only, which may miss semantically similar but differently-worded requirements.
Arguments: $ARGUMENTS — format: <control_id> <requirement_id> --product <product_id> [--policy <path>]
Examples:
/map-requirement anssi R3 --product rhel9/map-requirement srg_gpos SRG-OS-000001-GPOS-00001 --product rhel10/map-requirement hipaa 164.312(a)(1) --product rhel9/map-requirement anssi R34 --product rhel9 --policy security_policies/anssi_2.mdParse arguments: Extract control_id, requirement_id, --product flag, and optional --policy flag from $ARGUMENTS.
If no --product specified, discover available products and ask the user via AskUserQuestion:
ls products/ (or call mcp__content-mcp__list_products) to get the list of available productsCheck build artifacts: Call mcp__content-mcp__list_built_products.
AskUserQuestion:
/build-product {product} --datastream-only before starting the mapping session"build-product skill: Skill(skill="build-product", args="{product} --datastream-only"). Wait for the build to complete before continuing.build/{product}/rules/ directory exists. If not, offer the build prompt above.Load the requirement: Call mcp__content-mcp__get_control_details with control_id.
mcp__content-mcp__list_controls and show options.requirement_id in the controls list.controls/<control_id>.yml or products/<product>/controls/<control_id>.yml. If the file has controls_dir:, read individual requirement files from that directory. To list controls, run ls controls/*.yml and ls products/*/controls/*.yml.Display the requirement:
## Requirement: {requirement_id}
**Title**: {title}
**Description**: {description}
**Current status**: {status}
**Current rules**: {rules or "none"}
If no --policy specified, show a tip:
Tip: Pass
--policy <path>to enrich mapping with the original security policy text (PDF, Markdown, HTML). This improves cross-framework matching accuracy.
--policy provided)If --policy was specified:
Infer document type from the file extension:
.md → markdown.pdf → pdf.html → htmltextCall mcp__content-mcp__parse_policy_document with:
source: the policy pathdocument_type: inferred from extensionrequirement_id: the requirement ID from Phase 1If sections returned, display the policy context:
### Policy Context (from {policy_path})
**{section_title}**
{section_content}
{subsection contents...}
Store the combined section text as policy_text for use in Phase 2.
Execute steps 2a-2c to build a candidate list from multiple sources.
Call mcp__content-mcp__find_similar_requirements with:
requirement_text: if policy_text is available, use it; otherwise use the requirement's title + " " + descriptionexclude_control_id: current control_idmax_results: 10Fallback: Extract 3-5 key terms from the requirement text. Use Grep to search for each term across controls/*.yml and products/*/controls/*.yml. Requirements matching multiple terms are likely similar. Read matched requirements to extract their rules: lists.
If results found, present them grouped by control framework:
### Similar Requirements in Other Frameworks
- [{control_id}] {requirement_id}: "{title}" → rules: {rules}
- [{control_id}] {requirement_id}: "{title}" → rules: {rules}
Extract the union of all rules from similar requirements as "cross-framework candidates".
Search for candidate rules using rendered build artifacts (Jinja-expanded, product-specific):
Extract 3-5 key terms from the requirement title and description.
For each key term, call mcp__content-mcp__search_rendered_content with:
query: the key termproduct: the target product from Phase 1limit: 15Grep to search for key terms in rule.yml files under linux_os/guide/ and applications/. This may miss rules with Jinja-templated descriptions.Deduplicate results across all term searches. Combine with cross-framework candidates from Step 2a.
For each candidate rule, use mcp__content-mcp__get_rendered_rule (or get_rule_details) to read its title and description. Reason about which rules best match the requirement:
Present the top candidates in a table:
### Rule Candidates
| Rule ID | Title | Source | Reasoning |
|---------|-------|--------|-----------|
| {rule_id} | {title} | cross-ref / search | {why it matches} |
Since search_rendered_content only returns rules present in the target product's build, all search results are already confirmed available. For cross-framework candidates (from Step 2a) that did NOT appear in the rendered search, call mcp__content-mcp__get_rule_product_availability to verify availability.
Fallback: For each rule, find its rule.yml and check the identifiers: section for cce@<product> entries. Also grep for the rule ID in products/<target_product>/profiles/*.profile and products/<target_product>/controls/*.yml.
Flag rules that are NOT available for the target product:
Warning: Rule '{rule_id}' has identifiers for {other_products} but NOT for {target_product}.
May need platform/identifier additions to work for {target_product}.
For rules missing from the target product, use LLM judgment to assess portability:
template is not None in get_rule_details), it's likely portablemcp__content-mcp__get_rule_details with rendered_detail=full and product=<a product that has it> to read the actual OVAL/remediation and assess whether it's product-specificBuild unified candidate list: Combine cross-framework and search candidates, deduplicated by rule_id, sorted by relevance.
Present candidates using AskUserQuestion with multiSelect: true:
Ask about status using a separate AskUserQuestion:
Based on author's decision:
Call mcp__content-mcp__update_requirement_rules with:
control_id: the control file IDrequirement_id: the requirement IDrules: the selected rule IDsstatus: "automated" or "partially_automated" based on author's choiceget_requirement_file_path fallback (see above). Use Edit tool to update the rules: and status: fields in the YAML. Be careful to preserve existing formatting, comments, and Jinja2 templating.Verify the result:
success field in the responseReport:
Updated requirement '{requirement_id}' in '{control_id}':
- Rules: {rules}
- Status: {status}
- File: {file_path}
Call mcp__content-mcp__update_requirement_rules with:
control_id: the control file IDrequirement_id: the requirement IDrules: [] (empty list)status: "not_applicable"status: not_applicable and rules: [].Report the change.
Report that no changes were made and move on.
Present a brief summary:
## Mapping Complete
Requirement: {requirement_id} ({title})
Control file: {control_id}
Action: {mapped N rules / marked not applicable / skipped}
File modified: {file_path or "none"}
Next steps:
- Map another requirement: `/map-requirement {control_id} <next_req_id> --product {product}`
- Map all unmapped: `/map-controls {control_id} --product {product}`
- Review changes: `git diff controls/`
update_requirement_rules fails, display the error message and suggest the user manually edit the file. Use mcp__content-mcp__get_requirement_file_path to find the correct file, or Fallback: locate it by reading the control YAML's controls_dir: field or searching for the requirement in the inline controls: list.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.
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
Draft a PR description based on branch changes and the project PR template