Creates or updates logs using type-specific templates with automatic validation and formatting
Creates or updates structured logs using type-specific templates with automatic validation and formatting. Triggers when you request to write logs of any type (session, build, deployment, etc.) with data that needs validation, redaction, and template rendering.
/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-type-context.shscripts/render-template.shscripts/validate-data.shYou are a universal operation skill - you don't contain type-specific logic. Instead, you load type context dynamically and apply it to create properly structured, validated logs. </CONTEXT>
<CRITICAL_RULES>
Required:
log_type - Type of log to create (session, build, deployment, debug, test, audit, operational, _untyped)title - Log titledata - Object with template variables and frontmatter fieldsOptional:
output_path - Where to write log (defaults to .fractary/logs/{log_type}/{log_id}.md)validate_only - If true, validate data without writing filedry_run - If true, show what would be written without creating fileExample request:
{
"operation": "write-log",
"log_type": "session",
"title": "Fix authentication bug",
"data": {
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"issue_number": 123,
"status": "active",
"conversation_content": "User reported login issues...",
"repository": "acme/webapp",
"model": "claude-sonnet-4.5"
}
}
</INPUTS>
<WORKFLOW>
## Step 1: Load Type Context
Execute `scripts/load-type-context.sh {log_type}` to get:
- Schema path (`types/{log_type}/schema.json`)
- Template path (`types/{log_type}/template.md`)
- Standards path (`types/{log_type}/standards.md`)
- Validation rules path (`types/{log_type}/validation-rules.md`)
- Retention config path (`types/{log_type}/retention-config.json`)
If type not found, fail with clear error message listing available types.
Execute scripts/validate-data.sh:
If validation fails, return errors to caller without writing file.
Read type's standards.md to identify redaction patterns:
[REDACTED:API_KEY][REDACTED:PASSWORD][REDACTED:PII:{type}][REDACTED:SECRET]Apply redaction to data before rendering template.
Execute scripts/render-template.sh:
{{#field}}...{{/field}}){{#array}}...{{/array}})Execute scripts/write-log-file.sh:
{output_path} or .fractary/logs/{log_type}/{log_id}.md{output_path}.tmpmv {output_path}.tmp {output_path}chmod 644 {output_path}If dry_run=true, skip write but return rendered content.
Return structured output:
{
"status": "success",
"log_id": "{generated or provided}",
"log_type": "{log_type}",
"log_path": "{absolute path to written file}",
"size_bytes": {file size},
"validation": "passed"
}
</WORKFLOW>
<COMPLETION_CRITERIA> ✅ Type context loaded successfully ✅ Data validated against schema ✅ Redaction applied per type standards ✅ Template rendered with all variables ✅ File written atomically to correct location ✅ Result returned with log_path and log_id </COMPLETION_CRITERIA>
<OUTPUTS> Return to caller: 1. **Success status** with log path and ID 2. **Validation errors** (if data invalid) 3. **Type not found errors** (if log_type invalid) 4. **File system errors** (if write fails)Format:
🎯 STARTING: Log Writer
Type: {log_type}
Title: {title}
Output: {output_path or auto-generated}
───────────────────────────────────────
📋 Loaded type context from types/{log_type}/
✓ Schema validation passed
✓ Redaction applied (n patterns)
✓ Template rendered (m variables)
✓ File written: {log_path}
✅ COMPLETED: Log Writer
Log ID: {log_id}
Path: {log_path}
Size: {size_bytes} bytes
───────────────────────────────────────
Next: Use log-validator to verify log structure, or log-lister to view all logs of this type
</OUTPUTS>
<DOCUMENTATION>
Write to execution log:
- Operation: write-log
- Log type: {log_type}
- Log ID: {log_id}
- File path: {log_path}
- Validation status: passed/failed
- Timestamp: ISO 8601
</DOCUMENTATION>
<ERROR_HANDLING> Type not found:
❌ ERROR: Unknown log type '{log_type}'
Available types: session, build, deployment, debug, test, audit, operational, _untyped
Location: plugins/logs/types/{log_type}/
Validation failed:
❌ VALIDATION FAILED: {log_type}
Errors:
- Missing required field: {field}
- Invalid format for {field}: expected {expected}, got {actual}
- Invalid enum value for {field}: {value} (must be one of: {options})
Template rendering failed:
❌ TEMPLATE ERROR: {log_type}
Issue: {error message}
Template: types/{log_type}/template.md
Missing variables: {list}
File write failed:
❌ WRITE ERROR
Path: {output_path}
Error: {filesystem error}
Suggestion: Check directory permissions and disk space
Always clean up temp files on error. </ERROR_HANDLING>
This skill uses three supporting scripts:
scripts/load-type-context.sh {log_type}
scripts/validate-data.sh {schema_path} {data_json}
scripts/render-template.sh {template_path} {data_json}