Validates logs against type-specific schemas checking frontmatter, structure, and required fields
Validates log files against type-specific schemas, rules, and standards. Triggers when you ask to validate logs or after creating/updating log files to check for required fields, proper structure, and compliance.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-logs@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/load-validation-context.shscripts/validate-rules.shYou verify that logs meet structural requirements, follow conventions, and contain all required information. You can validate individual logs or batch-validate entire directories. </CONTEXT>
<CRITICAL_RULES>
For single log validation:
log_path - Path to log file to validatevalidation_level - "strict" (all checks), "standard" (schema + critical rules), or "basic" (schema only)For batch validation:
directory - Path to directory containing logslog_type_filter - Optional: only validate specific type(s)fail_fast - If true, stop on first errorFor specific validation:
validate_schema - Check frontmatter against schemavalidate_rules - Check type-specific rulesvalidate_standards - Check adherence to standardsExample request:
{
"operation": "validate-log",
"log_path": ".fractary/logs/session/session-001.md",
"validation_level": "strict"
}
</INPUTS>
<WORKFLOW>
## Step 1: Parse Log File
Read log file and extract:
- **Frontmatter**: YAML between `---` delimiters
- **Body content**: Markdown after frontmatter
- **Log type**: From `log_type` field in frontmatter
If frontmatter invalid or missing, fail immediately.
Execute scripts/load-validation-context.sh {log_type} to get:
types/{log_type}/schema.json)types/{log_type}/validation-rules.md)types/{log_type}/standards.md)Execute validation-data.sh from log-writer skill (reuse):
Schema validation checks:
Parse validation-rules.md and check:
Execute scripts/validate-rules.sh {log_path} {rules_path}:
Example rules:
✅ **MUST have** valid session_id (UUID format)
✅ **MUST redact** secrets and API keys
⚠️ **SHOULD have** conversation content section
Parse standards.md and verify:
Collect all validation results:
Critical errors (MUST requirements):
Warnings (SHOULD requirements):
Info (MAY requirements):
Format structured output:
{
"status": "passed" | "failed" | "warnings",
"log_path": "{path}",
"log_type": "{type}",
"errors": [
{
"severity": "critical",
"check": "schema.required_fields",
"message": "Missing required field: session_id",
"location": "frontmatter"
}
],
"warnings": [
{
"severity": "warning",
"check": "rules.recommended_sections",
"message": "Missing recommended section: Test Coverage",
"location": "body"
}
],
"info": [
{
"severity": "info",
"check": "standards.best_practices",
"message": "Consider adding error categorization",
"location": "body"
}
],
"summary": {
"total_checks": 23,
"passed": 20,
"failed": 1,
"warnings": 2
}
}
</WORKFLOW>
<COMPLETION_CRITERIA> ✅ Log file parsed successfully ✅ Type context loaded ✅ Schema validation completed ✅ Type-specific rules checked ✅ Standards compliance verified ✅ Validation report generated with specific errors </COMPLETION_CRITERIA>
<OUTPUTS> Return to caller: ``` 🎯 STARTING: Log Validator Log: {log_path} Type: {log_type} Validation level: {level} ───────────────────────────────────────📋 Schema Validation ✓ All required fields present (8/8) ✓ Field types valid ✓ Enum values valid ✓ Pattern validation passed
📋 Rules Validation ✓ Required sections present (5/5) ⚠️ Missing recommended field: duration_seconds ✓ Content consistency checks passed
📋 Standards Validation ✓ Redaction rules applied (0 secrets exposed) ✓ Format conventions followed ✓ Retention metadata valid
✅ COMPLETED: Log Validator Status: passed (with 1 warning) Errors: 0 critical Warnings: 1 (missing recommended field) ─────────────────────────────────────── Next: Use log-lister to view all logs, or log-archiver to archive validated logs
</OUTPUTS>
<DOCUMENTATION>
Write to execution log:
- Operation: validate-log
- Log path: {path}
- Log type: {type}
- Status: passed/failed/warnings
- Critical errors: {count}
- Warnings: {count}
- Timestamp: ISO 8601
</DOCUMENTATION>
<ERROR_HANDLING>
**File not found:**
❌ ERROR: Log file not found Path: {log_path} Cannot validate non-existent log
**Invalid frontmatter:**
❌ ERROR: Invalid frontmatter Path: {log_path} Issue: YAML parsing failed or frontmatter missing Expected: Content between --- delimiters
**Unknown log type:**
❌ ERROR: Unknown log type '{type}' Path: {log_path} Available types: session, build, deployment, debug, test, audit, operational, _untyped
**Schema validation failed:**
❌ VALIDATION FAILED: Schema Errors Log: {log_path} Errors:
**Rules validation failed:**
❌ VALIDATION FAILED: Rules Violations Log: {log_path} Critical:
</ERROR_HANDLING>
## Scripts
This skill uses two supporting scripts:
1. **`scripts/load-validation-context.sh {log_type}`**
- Loads paths to validation files for a type
- Returns JSON with schema, rules, standards paths
- Reuses log-writer's load-type-context.sh
2. **`scripts/validate-rules.sh {log_path} {rules_path} {standards_path}`**
- Parses validation-rules.md and standards.md
- Checks log content against all rules
- Returns structured validation results
- Categorizes by severity (critical/warning/info)