Automated summary
Provides standardized functions to format, log, and return user-friendly error messages across an application.
Strengths
- Centralized and consistent error handling
- Clear formatted error messages with optional error codes
- Logging with timestamp and context for debugging
Limitations
- Messages are not internationalized
- Does not handle async or multithreaded exceptions
- Limited customization of log format
When implementing uniform error handling in a Python application, especially for APIs or command-line scripts.
For environments requiring advanced localization or complex retry strategies.
Security analysis
SafeThis skill only defines error handling utility functions (formatting, logging) without any system or network access. It does not execute commands, send data externally, or include obfuscated code. No dangerous operations are performed.
No concerns found
How this analysis is madeExamples
Create a script that reads a file and uses the error handling skill to catch exceptions and display user-friendly messages.Add the format_error_message function to my project to ensure all errors follow '✗ Error: [message]' format.Use the log_error function to log an exception with context information like 'database_connection'.name: error-handling-skill description: Standardized error handling functions for formatting, logging, and returning user-friendly error messages across the application. functions:
-
name: handle_error description: Format an error message, log it with context, and return a user-friendly message parameters: type: object properties: error: type: Exception description: The exception or error to handle context: type: str description: Context information about where/why the error occurred required: - error - context returns: type: str description: A user-friendly error message
-
name: format_error_message description: Format an error message with consistent styling and optional error code parameters: type: object properties: message: type: str description: The error message to format error_code: type: str description: Optional error code to include default: "" required: - message returns: type: str description: Formatted error message in "✗ Error: [message]" format
-
name: log_error description: Log an error to stderr or file with timestamp and context parameters: type: object properties: error: type: Exception description: The exception to log context: type: str description: Context information about where the error occurred required: - error - context returns: type: None description: None
Error Handling Skill
Purpose
Provides standardized error handling across the application with consistent formatting, logging, and user-friendly messages.
Functions
1. handle_error(error: Exception, context: str) -> str
Handles an exception by formatting the error message, logging it with context, and returning a user-friendly message.
Parameters:
error(Exception): The exception or error object to handlecontext(str): Context information about where/why the error occurred
Returns:
- A user-friendly error message string
Behavior:
- Format the error message using
format_error_message() - Log the error using
log_error() - Return a user-friendly message for display
2. format_error_message(message: str, error_code: str = "") -> str
Formats an error message with consistent styling and optional error code.
Parameters:
message(str): The error message to formaterror_code(str, optional): Error code to include. Defaults to "".
Returns:
- Formatted error message in the format: "✗ Error: [message]"
- If error_code is provided: "✗ Error: [message] [error_code]"
Examples:
format_error_message("File not found") # "✗ Error: File not found"
format_error_message("Connection failed", "ERR_001") # "✗ Error: Connection failed [ERR_001]"
3. log_error(error: Exception, context: str) -> None
Logs an error to stderr or file with timestamp and context information.
Parameters:
error(Exception): The exception or error object to logcontext(str): Context information about where the error occurred
Returns:
- None
Log Format:
[TIMESTAMP] ERROR | Context: [context] | Message: [error_message] | Type: [error_type]
Error Message Format
All error messages follow the format:
✗ Error: [message]
Logging Setup
The skill uses Python's standard logging module with the following configuration:
- Format:
[%(asctime)s] %(levelname)s | %(message)s - Timestamp: ISO 8601 format
- Output: stderr by default
- Can be configured to log to file by setting up a file handler
Usage Example
from error_handling_skill import handle_error, format_error_message, log_error
try:
risky_operation()
except Exception as e:
user_message = handle_error(e, "user_authentication")
print(user_message)
# Output: "✗ Error: Authentication failed - Invalid credentials"
Implementation Notes
- All functions include proper type hints
- All functions have docstrings documenting parameters, returns, and behavior
- Logging is configurable for different output destinations
- Error codes are optional but recommended for traceability
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/standardized-error-handling-mm5t89or/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/standardized-error-handling-mm5t89or' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/standardized-error-handling-mm5t89or/download' --output '.skill-downloads/standardized-error-handling-mm5t89or/SKILL.md.part' && mv '.skill-downloads/standardized-error-handling-mm5t89or/SKILL.md.part' '.skill-downloads/standardized-error-handling-mm5t89or/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.
Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/standardized-error-handling-mm5t89or/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.