.claude/skills/checking-code-consistency/SKILL.md
Check Python logging levels and patterns for correctness. Focus on identifying wrong severity levels and missing exception handling. Use when reviewing code quality.
npx skillsauth add taylorsatula/mira-oss Code Consistency - Logging & StandardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Scan Python files for logging issues. Flag incorrect severity levels and missing exception context.
Ask: What happened in this code?
Variable value, loop iteration, function entry/exit, detailed diagnostics?
→ DEBUG
Successful operation, workflow step completed, state change confirmed?
→ INFO
Unexpected but handled: fallback used, retry attempt, deprecated call, approaching limit?
→ WARNING
Functionality failed: operation error, caught exception, feature broken?
→ ERROR (use logger.exception() in except blocks)
System-wide failure: cannot serve requests, out of resources, imminent crash?
→ CRITICAL
# ❌ WRONG: Exception logged as INFO
try:
result = risky_operation()
except Exception as e:
logger.info(f"Operation failed: {e}") # Should be ERROR
# ✅ CORRECT: Use logger.exception() in except blocks
try:
result = risky_operation()
except Exception as e:
logger.exception("Operation failed") # Automatically ERROR + stack trace
# ❌ WRONG: Normal operation logged as ERROR
user = get_user(user_id)
logger.error(f"Retrieved user {user_id}") # Should be INFO or DEBUG
# ✅ CORRECT: Normal operations are INFO
user = get_user(user_id)
logger.info(f"Retrieved user {user_id}")
# ❌ WRONG: Fallback behavior logged as ERROR
cache_value = cache.get(key)
if cache_value is None:
logger.error("Cache miss, using database") # Should be WARNING or INFO
value = db.query(key)
# ✅ CORRECT: Degraded mode is WARNING
cache_value = cache.get(key)
if cache_value is None:
logger.warning("Cache miss, falling back to database")
value = db.query(key)
# ❌ WRONG: Routine error logged as CRITICAL
if not user_id:
logger.critical("Missing user_id parameter") # Should be ERROR
raise ValueError("user_id required")
# ✅ CORRECT: CRITICAL only for system-wide failures
if connection_pool_exhausted():
logger.critical("Database connection pool exhausted, cannot serve requests")
shutdown()
# ❌ WRONG: Missing stack trace
try:
process_data()
except Exception as e:
logger.error(f"Failed: {e}") # No stack trace
# ✅ CORRECT: Use logger.exception() or exc_info=True
try:
process_data()
except Exception as e:
logger.exception("Data processing failed") # Includes stack trace
# ✅ ALSO CORRECT: Explicit exc_info
try:
process_data()
except Exception as e:
logger.error("Data processing failed", exc_info=True)
# ❌ WRONG: Using root logger
logger = logging.getLogger()
logger.info("message")
# ✅ CORRECT: Named logger
logger = logging.getLogger(__name__)
logger.info("message")
# ❌ WRONG: Using print() for logging
print(f"Processing user {user_id}")
# ✅ CORRECT: Use logger
logger.info(f"Processing user {user_id}")
# ❌ WRONG: Logging sensitive data
logger.info(f"User authenticated: {username} / {password}")
logger.debug(f"API request: {api_key}")
# ✅ CORRECT: Redact sensitive information
logger.info(f"User authenticated: {username}")
logger.debug("API request authenticated")
Production: Set level to INFO or higher
If it's expected and good, it's INFO
If it's weird but working, it's WARNING
Use logger.exception() in except blocks
Should trigger immediate alerts/paging
Find all logger calls: logger.debug/info/warning/error/critical/exception()
For each call, ask:
logger.exception())Check patterns:
getLogger(__name__))print() statements for operational logging?Flag issues with:
FILE: path/to/file.py
LOGGING ISSUES:
Line 23: Severity too high
Current: logger.error("Retrieved user data")
Should be: logger.info("Retrieved user data")
Reason: Normal successful operation should be INFO, not ERROR
Line 78: Missing exception context
Current: logger.error(f"Failed: {e}")
Should be: logger.exception("Operation failed")
Reason: Use logger.exception() in except blocks for automatic stack trace
Line 134: Severity too low
Current: logger.info("API call failed, retrying")
Should be: logger.warning("API call failed, retrying")
Reason: Retry indicates unexpected issue, should be WARNING
Line 201: Security violation
Current: logger.debug(f"Authenticating with token: {api_token}")
Should be: logger.debug("Authenticating with API")
Reason: Never log credentials, tokens, or passwords
Line 234: Wrong logger pattern
Current: logger = logging.getLogger()
Should be: logger = logging.getLogger(__name__)
Reason: Use named logger, not root logger
Line 289: Should use logger instead of print
Current: print(f"Processing {count} items")
Should be: logger.info(f"Processing {count} items")
Reason: Use logging module for operational messages
SUMMARY: 6 logging issues found
| Situation | Level | Example |
|-----------|-------|---------|
| Loop iteration details | DEBUG | logger.debug(f"Processing item {i} of {total}") |
| Successful operation | INFO | logger.info("Memory consolidation completed") |
| Fallback/retry | WARNING | logger.warning("Cache miss, using database") |
| Operation failed | ERROR | logger.exception("Failed to process data") |
| System cannot function | CRITICAL | logger.critical("Database unreachable") |
In except blocks: Always use logger.exception() or logger.error(..., exc_info=True)
Named logger: Always logger = logging.getLogger(__name__)
Security: Never log passwords, tokens, API keys, or PII
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.