Skip to content

Commit 4485e06

Browse files
authored
Merge pull request #14529 from vojtapolasek/add_skills
Add Claude Code skills for content development workflows
2 parents ca385f7 + fca1d69 commit 4485e06

11 files changed

Lines changed: 2558 additions & 0 deletions

File tree

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
name: build-product
3+
description: Build a ComplianceAsCode product
4+
---
5+
6+
# Build Product
7+
8+
Build a ComplianceAsCode product.
9+
10+
**Product**: $ARGUMENTS
11+
12+
## Tool Strategy
13+
14+
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.
15+
16+
## Phase 1: Validate Product
17+
18+
1. **Check if product is valid**:
19+
Use `mcp__content-mcp__get_product_details` with `product_id=$ARGUMENTS` to validate the product exists and get its metadata.
20+
**Fallback**: Read `products/$ARGUMENTS/product.yml` directly. If the file doesn't exist, the product is invalid.
21+
22+
2. **If product not found**, list available products:
23+
Use `mcp__content-mcp__list_products` to get all available products.
24+
**Fallback**: Run `ls products/` to list available product directories.
25+
26+
3. **If no product specified**, ask user using AskUserQuestion:
27+
- Use the product list to populate options
28+
- Allow "Other" for unlisted products
29+
30+
## Phase 2: Build Product
31+
32+
**Always use the `build_product` script.** Do not use CMake, make, or ninja directly.
33+
34+
Parse user arguments for optional flags:
35+
- `--datastream-only` — skip guides, tables, playbooks (faster)
36+
- `--rule-id <rule_id>` — build only a specific rule (fastest, for testing)
37+
38+
Build command:
39+
```bash
40+
./build_product [flags] $PRODUCT
41+
```
42+
43+
Examples:
44+
```bash
45+
./build_product rhel9 # Full build
46+
./build_product --datastream-only rhel9 # Data stream only
47+
./build_product --datastream-only --rule-id sshd_set_idle_timeout rhel9 # Single rule
48+
```
49+
50+
### Build Output
51+
52+
Monitor build progress:
53+
- CMake configuration
54+
- Content resolution
55+
- OVAL generation
56+
- XCCDF generation
57+
- Data stream assembly
58+
59+
Expected artifacts in `build/`:
60+
- `ssg-$ARGUMENTS-ds.xml` - SCAP data stream
61+
- `ssg-$ARGUMENTS-ds-1.2.xml` - SCAP 1.2 data stream
62+
- `ssg-$ARGUMENTS-xccdf.xml` - XCCDF document
63+
- `ssg-$ARGUMENTS-oval.xml` - OVAL definitions
64+
- `guides/` - HTML guides (skipped with `--datastream-only`)
65+
- `ansible/` - Ansible playbooks (skipped with `--datastream-only`)
66+
- `bash/` - Bash scripts (skipped with `--datastream-only`)
67+
68+
## Phase 3: Verify Build Success
69+
70+
1. **Check build exit code**:
71+
- Exit 0 = Success
72+
- Non-zero = Build failed
73+
74+
2. **Verify key artifacts exist**:
75+
Use `mcp__content-mcp__get_datastream_info` with `product=$ARGUMENTS` to verify the datastream was built successfully and get artifact details.
76+
**Fallback**: Check files directly:
77+
```bash
78+
ls -la build/ssg-$ARGUMENTS-ds.xml
79+
ls -la build/ssg-$ARGUMENTS-xccdf.xml
80+
ls -la build/ssg-$ARGUMENTS-oval.xml
81+
```
82+
83+
3. **Check for build warnings**:
84+
- Look for deprecation warnings
85+
- Template processing warnings
86+
- Missing reference warnings
87+
88+
## Phase 4: Report Results
89+
90+
### Success Report
91+
92+
```
93+
Build Complete
94+
==============
95+
96+
Product: $ARGUMENTS
97+
98+
Build Status: SUCCESS
99+
Artifacts:
100+
- build/ssg-$ARGUMENTS-ds.xml
101+
- build/ssg-$ARGUMENTS-xccdf.xml
102+
- build/ssg-$ARGUMENTS-oval.xml
103+
104+
Ready for:
105+
- Validation tests: /run-tests
106+
- Automatus testing: /test-rule <rule_id>
107+
- OpenSCAP scanning: oscap xccdf eval --profile <profile> build/ssg-$ARGUMENTS-ds.xml
108+
- PR creation
109+
```
110+
111+
### Build Failure Report
112+
113+
```
114+
Build Failed
115+
============
116+
117+
Product: $ARGUMENTS
118+
119+
Error Output:
120+
[error message from build]
121+
122+
Common Causes:
123+
1. Jinja2 template syntax error in rule.yml
124+
2. Missing macro or variable reference
125+
3. Invalid platform specification
126+
4. Circular dependency in profiles
127+
128+
Debugging Steps:
129+
1. Check the specific file mentioned in the error
130+
2. Validate YAML: python3 -c "import yaml; yaml.safe_load(open('path/to/file.yml'))"
131+
3. Check Jinja2: Look for unclosed tags, missing macros
132+
4. Review recent changes: git diff HEAD~1
133+
```
134+
135+
## Troubleshooting
136+
137+
### Common Build Errors
138+
139+
1. **Python import errors**:
140+
```bash
141+
pip3 install -r requirements.txt
142+
pip3 install -r test-requirements.txt
143+
```
144+
145+
2. **Missing dependencies**:
146+
```bash
147+
# RHEL/Fedora
148+
dnf install cmake make openscap-utils python3-pyyaml python3-jinja2
149+
```
150+
151+
3. **Jinja2 errors**:
152+
- Check for undefined macros
153+
- Verify macro imports in the file
154+
- Check for syntax errors in `{{{ }}}` blocks
155+
156+
4. **OVAL validation errors**:
157+
- Check template parameters match expected types
158+
- Verify referenced variables exist
159+
- Check platform applicability
160+
161+
### Verbose Build
162+
163+
For more detailed output:
164+
```bash
165+
./build_product $ARGUMENTS 2>&1 | tee build.log
166+
```

0 commit comments

Comments
 (0)