anti-defensive

Detect defensive programming anti-patterns that cause silent failures.

6|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/archibate/archibate-skills --skill anti-defensive
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: anti-defensive
Source: https://github.com/archibate/archibate-skills/tree/main/skills/anti-defensive
Command: npx skills add https://github.com/archibate/archibate-skills --skill anti-defensive

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defensive programming patterns often hide errors, fabricate data, and allow silent failures that make bugs harder to detect and fix; this guide helps reviewers and developers identify and replace those anti-patterns with fail-fast, honest behavior.

Core Features & Use Cases

  • Detection of anti-patterns: Highlights common issues like swallowing exceptions, fabricated defaults, unnecessary null checks, type coercion, compatibility shims, and catch-all handlers.
  • Guidance for remediation: Recommends fail-fast replacements such as raising explicit errors, validating at boundaries, and trusting internal contracts.
  • Use cases: Code review checklists for PRs, automated review prompts for LLM assistants, and team training on safer error-handling practices.

Quick Start

Ask the assistant to review the provided function for defensive programming anti-patterns and recommend fail-fast replacements with specific code changes.

Frequently Asked Questions about anti-defensive

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect defensive programming anti-patterns in my code?

Detect defensive programming anti-patterns by reviewing code for exception swallowing, fabricated defaults, unnecessary null checks, and compatibility shims. This process highlights silent failures and recommends explicit fail-fast replacements to correct them.

What is the difference between fail-fast and defensive programming?

Fail-fast programming exposes errors immediately by raising explicit exceptions, while defensive programming hides errors through fabricated defaults and catch-all handlers. Fail-fast makes bugs easier to detect, whereas defensive patterns cause silent failures.

How do I stop silent errors and exception swallowing during a code review?

Stop silent errors and exception swallowing during a code review by applying a fail-fast checklist that identifies catch-all handlers. Replace them with explicit error raising and validate inputs at system boundaries instead of internally.

When should I not use defensive programming in application logic?

Avoid defensive programming in internal application logic when you can trust internal contracts. Over-validation and unnecessary null checks inside trusted boundaries hide bugs; instead, validate data only at external boundaries and let internal calls fail fast.

Can I use this fail-fast approach for automated pull request audits?

Yes, you can apply this fail-fast approach to automated pull request audits and static analysis. It provides review checklists and explicit remediation steps to identify anti-patterns like type coercion and fabricated defaults in internal logic.