fix-parser
Auto-repair common parser errors in golden set test files including type coercion (strings to numbers), range format conversion (min/max), field ordering for v3.x schema, weight structure migration (legacy to v3.0), and hallucination detection. Use this skill when: (1) Golden set validation shows fixable pattern errors, (2) Migrating golden set to new schema version, (3) Type errors detected (strings instead of numbers), (4) Range formats need conversion ("8-12" to min/max), or (5) Batch fixing common mistakes before running /verify
SKILL.md
| Name | fix-parser |
| Description | Auto-repair common parser errors in golden set test files including type coercion (strings to numbers), range format conversion (min/max), field ordering for v3.x schema, weight structure migration (legacy to v3.0), and hallucination detection. Use this skill when: (1) Golden set validation shows fixable pattern errors, (2) Migrating golden set to new schema version, (3) Type errors detected (strings instead of numbers), (4) Range formats need conversion ("8-12" to min/max), or (5) Batch fixing common mistakes before running /verify |
name: fix-parser description: Auto-repair common parser errors in golden set test files including type coercion (strings to numbers), range format conversion (min/max), field ordering for v3.x schema, weight structure migration (legacy to v3.0), and hallucination detection. Use this skill when: (1) Golden set validation shows fixable pattern errors, (2) Migrating golden set to new schema version, (3) Type errors detected (strings instead of numbers), (4) Range formats need conversion ("8-12" to min/max), or (5) Batch fixing common mistakes before running /verify
Fix Parser Skill
Automatically detect and repair common parser errors in golden set files using predefined fix patterns.
Core Workflow
- Scan Golden Set - Load all
*_expected.jsonfiles fromdata/golden_set/ - Apply Fix Patterns - Run auto-repair functions in sequence
- Report Changes - Show what was fixed
- Verify - Optionally run
/verifyto confirm fixes
Common Fixes Applied
1. Type Errors
Convert string numbers to actual numbers:
Before: "target_sets": "3"
After: "target_sets": 3
2. Range Formats
Convert string ranges to min/max fields:
Before: "target_reps": "8-12"
After: "target_reps_min": 8, "target_reps_max": 12
3. Field Ordering (v3.x)
Reorder fields to match CANONICAL_JSON_SCHEMA.md:
Correct Order:
item_sequenceexercise_nameequipment_keyprescriptionperformed
4. Weight Structure (v3.0 Migration)
Convert legacy weight fields to v3.0 structure:
Before: "target_weight_kg": 100
After: "target_weight": {"value": 100, "unit": "kg"}
5. Prescription/Performance Separation
Ensure proper separation of planned vs actual:
Before: Mixed fields
After: Clear prescription and performed objects
Usage
# Fix all files in golden set
/fix-parser
# Fix specific file
/fix-parser workout_05
# Dry run (preview changes without applying)
/fix-parser --dry-run
# Fix and verify automatically
/fix-parser --verify
Expected Output
š§ Scanning golden set files...
Found 19 files to process:
- workout_01_expected.json ā
No changes needed
- workout_02_expected.json š§ Fixed 3 type errors
- workout_03_expected.json š§ Fixed 1 range format
- workout_04_expected.json š§ Fixed field ordering
- workout_05_expected.json ā ļø Manual review needed (hallucination detected)
...
Summary:
ā
12 files OK
š§ 6 files auto-fixed
ā ļø 1 file needs manual review
Changes saved. Run /verify to confirm fixes.
Manual Review Required
Some patterns require human judgment:
Hallucinations
ā ļø WARNING: workout_05.json
- Numeric value without source text: target_weight = 80kg
- Original text: "moderate weight"
- Recommendation: Replace with notes field
ā Manually review and fix
Ambiguous Context
ā ļø WARNING: workout_12.json
- Exercise name: "row"
- Could be: "Barbell Row" OR "Dumbbell Row" OR "Rowing Machine"
- Need context from original text
ā Check original text and add equipment_key
Fix Patterns Reference
See FIX_PATTERNS.md for detailed implementation of each fix pattern.
Post-Fix Workflow
-
Review Changes
git diff data/golden_set/ -
Verify Fixes
/verify -
Handle Warnings
- Review flagged files
- Fix hallucinations manually
- Resolve ambiguous cases
-
Commit
git add data/golden_set/ git commit -m "fix: Auto-repair common parser errors in golden set"
Success Criteria
- ā All fixable patterns corrected
- ā No new errors introduced
- ā Warnings flagged for manual review
- ā
/verifypasses after fixes
Safety Features
- Dry Run Mode - Preview changes first
- Backup Creation -
.backupfiles before modifying - Automatic Validation - Can run
/verifyautomatically - Git Integration - Easy rollback with
git checkout
Related Skills
/verify- Validate fixes after applying/debug-parse- Test parser logic on specific snippetsnpm run learn- Update parser brain with corrections
When to Use
| Scenario | Use fix-parser | Alternative |
|---|---|---|
| Type errors across multiple files | ā Yes | Manual fix |
| Schema version migration | ā Yes | Manual migration |
| Single file issue | ā ļø Manual faster | Manual fix |
| Hallucination detected | ā ļø Flags only | Manual fix required |
| After golden set update | ā Yes | N/A |
Version: 1.0.0 Last Updated: 2026-01-13 Duration: ~10-30 seconds