← ClaudeAtlas

ai-code-maintainabilitylisted

Write production-safe code that survives maintenance — avoid the 15 patterns AI agents commonly generate that work on day 1 but break 3 months later; enforce error handling, logging, type safety, no magic values, and testable structure before writing any code.
phamlongh230-lgtm/yamtam-engine · ★ 3 · AI & Automation · score 65
Install: claude install-skill phamlongh230-lgtm/yamtam-engine
# AI Code Maintainability — Write Code That Survives **The core problem:** AI agents optimize for "works on first run." Maintenance bugs appear 3–6 months later when context is gone, requirements shift, or edge cases hit prod. --- ## The 15 Patterns That Kill Maintainability ### 1. Silent Error Swallowing (most dangerous) ```python # ❌ AI generates this — crashes silently in prod try: result = call_external_api(data) except: pass # ✅ Always log + re-raise or return error state import logging logger = logging.getLogger(__name__) try: result = call_external_api(data) except ExternalAPIError as e: logger.error("API call failed: %s | data=%s", e, data, exc_info=True) raise # or: return Result.error(str(e)) except Exception as e: logger.critical("Unexpected error in call_external_api: %s", e, exc_info=True) raise ``` ### 2. Bare `except` / Pokémon Exception Handling ```python # ❌ Catches KeyboardInterrupt, SystemExit, MemoryError — everything try: do_work() except Exception: # still too broad return None # swallowed silently # ✅ Catch specific exceptions, handle each explicitly try: do_work() except ValueError as e: logger.warning("Invalid input: %s", e) return default_value except NetworkError as e: logger.error("Network failure: %s", e) raise RetryableError(f"Network unavailable: {e}") from e ``` ### 3. Magic Numbers and Strings ```python # ❌ What is 300? What is "active"? if user.age > 300: status = "a