en un clic
create-validation
// Generate a draft VALIDATION.md for a skill by analyzing its SKILL.md construction steps
// Generate a draft VALIDATION.md for a skill by analyzing its SKILL.md construction steps
Automatically optimize a skill's SKILL.md by running test cases, scoring results, and iteratively improving instructions
Create new FreeCAD AI skills, modify existing skills, and iteratively improve them. Use when users want to create a skill from scratch, update or optimize an existing skill, capture a workflow as a reusable skill, or improve an existing skill's instructions. Also trigger when the user says "turn this into a skill", "make a skill for X", "save this as a command", or similar.
| name | create-validation |
| description | Generate a draft VALIDATION.md for a skill by analyzing its SKILL.md construction steps |
Generate a draft VALIDATION.md file for a skill by analyzing its SKILL.md.
This skill generates a DRAFT, not a finished product. The generated VALIDATION.md will likely contain errors, especially in volume formulas. You MUST:
--validate — run the skill with known-good parameters and --validate to see if the checks pass on correct geometry.when block covers the right checks.Common errors in generated VALIDATION.md:
/create-validation skill-name
Where skill-name is the name of an existing skill (e.g., enclosure, gear).
Read the specified skill's SKILL.md using execute_code:
import os
skills_dirs = [
os.path.expanduser("~/.config/FreeCAD/FreeCADAI/skills"),
]
# Also check built-in skills
builtin = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "skills") if '__file__' in dir() else ""
Or use get_document_state context to find the skill path.
Analyze the SKILL.md to extract:
create_body instructions. Note their labels.Generate VALIDATION.md with this structure:
# Validation Rules
## Parameters
(one line per parameter: name: type = default)
## Checks
### Body count
- total_bodies: N
### BodyLabel
- exists: true
- bbox: X_expr, Y_expr, Z_expr (tolerance 0.5)
- volume: formula (tolerance 5%)
- solid_count: 1
- valid_solid: true
#### when variant_param == "value"
- (variant-specific checks)
Write the file to the skill directory as VALIDATION.md.
IMPORTANT: After writing, display this message to the user:
Draft VALIDATION.md created. This is a starting point, NOT a finished file.
You must verify:
- All volume formulas — calculate expected values by hand for at least one set of dimensions
- Body labels match what FreeCAD actually creates (use
get_document_stateafter running the skill)- Conditional
whenblocks cover all variants- Tolerances are appropriate (0.5mm bbox, 5% volume are defaults)
Test it: Run
/skill-name args --validateto check against actual geometry.Fix it: Edit the VALIDATION.md directly if checks fail on correct geometry.
L*W*H - (L-2*T)*(W-2*T)*(H-T)
+ N * pi * R**2 * post_height
- N * pi * R**2 * depthL * W * Tpi constant, not 3.14159 (the expression evaluator supports pi)** for power, not ^ (the evaluator uses Python's ast module)| Check | Value format | When to use |
|---|---|---|
exists: true | — | Always, for each body |
bbox: X, Y, Z (tolerance 0.5) | Expressions, absolute mm | Always, for each body |
volume: expr (tolerance 5%) | Expression, relative % | When geometry has calculable volume |
solid_count: N | Integer | Always (usually 1 per body) |
valid_solid: true | — | Always, for each body |
total_bodies: N | Integer | Once, at document level |
has_holes: N | Integer | When through-all pockets expected |
has_feature: "Name" | String | When specific named features expected |
min_children: N | Integer | When minimum feature count matters |
| Type | Default syntax | Example |
|---|---|---|
float | = 2.5 | T: float = 2 |
int | = 4 | count: int = 4 |
str | = value | lid_type: str = screw |
bool | = false | add_vents: bool = false |