con un clic
error-standardizer
Error handling standardization agent for converting inconsistent error patterns to emit_error().
Menú
Error handling standardization agent for converting inconsistent error patterns to emit_error().
CI/CD pipeline creation, deployment automation, and troubleshooting for GitHub Actions and GitLab CI. Use when user says "CI pipeline", "CD pipeline", "GitHub Actions", "GitLab CI", "deployment automation", "pipeline debugging", "deployment pipeline", "workflow file".
Codebase statistics and technical debt tracking agent.
Dependency analysis agent for detecting circular dependencies and validating architecture layers.
Docker environment validation agent for Stage 5 compliance. Validates Docker availability, captures pre-test state, runs Compose build/deploy, tests HTTP endpoints (authenticated and unauthenticated), detects 4xx/5xx errors, and restores Docker state to pre-test baseline.
Docker image building, container execution, and debugging patterns with security checklists.
Documentation writing skill for creating and editing markdown files. Use when creating, editing, or reviewing documentation files (markdown, MDX, README, guides). Use when the user asks to "write docs", "create documentation", "edit the README", "improve doc clarity", "make docs more readable", "follow the style guide", or "write user-facing content". Applies conversational, clear, and user-focused writing style.
| name | error-standardizer |
| description | Error handling standardization agent for converting inconsistent error patterns to emit_error(). |
| triggers | ["standardize errors","fix error handling","error patterns","convert to emit_error"] |
Identifies inconsistent error handling patterns in shell and Python and converts them to the standardized emit_error() pattern from error-json.sh / lib.layer1.error_json.
Read the following reference file(s) before proceeding with any workflow step:
references/error-patterns.md — Reference patterns for consistent error handling across CLI scripts.| Parameter | Required | Description | Example |
|---|---|---|---|
TASK_ID | Yes | Current task identifier | 5 |
DATE | Yes | Current date (YYYY-MM-DD) | 2026-03-03 |
SLUG | Yes | URL-safe topic name | error-standardization |
TARGET_FILES | No | Files to analyze | lib/*.sh scripts/*.sh |
EXIT_CODES_FILE | No | Exit codes definition | lib/exit-codes.sh |
ERROR_JSON_FILE | No | Error emitter | lib/error-json.sh |
EPIC_ID | No | Parent epic identifier | — |
SESSION_ID | No | Session identifier | — |
OUTPUT_DIR | Injected | Output directory | .orchestrate/<SESSION_ID>/logs/ |
MANIFEST_PATH | Injected | Path to MANIFEST.jsonl | — |
in_progress{{OUTPUT_DIR}}/{{DATE}}_{{SLUG}}.mdcompletedDefined in lib/exit-codes.sh (shell) and lib/layer0/exit_codes.py (Python):
| Constant | Value | Meaning |
|---|---|---|
E_SUCCESS | 0 | Success |
E_GENERAL | 1 | Unspecified error |
E_USAGE | 2 | Invalid arguments |
E_NOT_FOUND | 3 | Resource missing |
E_VALIDATION | 4 | Data validation failed |
E_PERMISSION | 5 | Permission denied |
E_IO | 6 | I/O error |
E_CONFLICT | 7 | Resource conflict |
E_INTERNAL | 8 | Internal error |
emit_errorsource "${LIB_DIR:-lib}/error-json.sh"
source "${LIB_DIR:-lib}/exit-codes.sh"
emit_error <message> <exit_code> [<key> <value>]...
# Example:
emit_error "File not found" "$E_NOT_FOUND" "file" "$file"
emit_errorfrom lib.layer1.error_json import emit_error
from lib.layer0.exit_codes import E_NOT_FOUND
emit_error(message: str, exit_code: int, **context) -> NoReturn
# Example:
emit_error("File not found", E_NOT_FOUND, file=file_path)
| Pattern | Example | Problem |
|---|---|---|
| Direct echo | echo "Error: not found" | Not machine-parseable |
| Raw exit | exit 1 | Hardcoded, undocumented |
| stderr redirect | >&2 echo "..." | No structure |
| Pattern | Example | Problem |
|---|---|---|
| Bare raise | raise Exception("...") | No structured context |
| Print to stderr | print("Error:", file=sys.stderr) | Not machine-parseable |
| Hardcoded exit | sys.exit(1) | Undocumented code |
| Broad catch | except Exception: | Catches too broadly |
# BEFORE
if [[ ! -f "$file" ]]; then
echo "Error: File not found: $file" >&2
exit 1
fi
# AFTER
if [[ ! -f "$file" ]]; then
emit_error "File not found" "$E_NOT_FOUND" "file" "$file"
fi
# BEFORE
if not os.path.isfile(file_path):
print(f"Error: File not found: {file_path}", file=sys.stderr)
sys.exit(1)
# AFTER
if not os.path.isfile(file_path):
emit_error("File not found", E_NOT_FOUND, file=file_path)
python scripts/error_pattern_detector.py src/ -o json # Full scan
python scripts/error_pattern_detector.py --exclude "*test*" src/ # Skip tests
python scripts/error_pattern_detector.py src/ -o json | jq '.recommendations'
# Shell: non-standard errors
grep -rn 'echo.*[Ee]rror' lib/*.sh scripts/*.sh | grep -v 'emit_error'
grep -rn 'exit [0-9]' lib/*.sh scripts/*.sh | grep -v 'exit 0' | grep -v '\$E_'
grep -rn '>&2' lib/*.sh scripts/*.sh | grep -v 'emit_error'
# Python: non-standard errors
grep -rn "raise\s" lib/layer*/*.py | grep -v "emit_error"
grep -rn "sys.exit([0-9])" lib/layer*/*.py
grep -rn 'print.*stderr' lib/layer*/*.py | grep -v 'emit_error'
grep -rn "except Exception:" lib/layer*/*.py
Write to {{OUTPUT_DIR}}/{{DATE}}_{{SLUG}}.md:
| Direction | Skills | Pattern |
|---|---|---|
| Consumes from | security-auditor | Vulnerability list, risk assessment for prioritization |
| Produces for | validator | Standardization report, converted source files |
| Don't | Why | Do Instead |
|---|---|---|
| Partial conversion within a file | Inconsistent error handling in same file | Convert all patterns in a file at once |
Use E_GENERAL for everything | Loses error specificity | Map to the most specific exit code |
Call emit_error without sourcing | Runtime failure | Add source/import at file top |
| Emit errors without a message | Silent, undebuggable failures | Always include a descriptive message |
"Error standardization complete. See MANIFEST.jsonl for summary."