syntax-keyword-assert-perl
Use Syntax::Keyword::Assert for zero-cost assertions in Perl
What this skill does
# Syntax::Keyword::Assert - Zero-Cost Assertions
Syntax::Keyword::Assert provides an `assert` keyword for Perl with zero runtime cost when disabled.
## Core Function
### `assert EXPR`
```perl
use Syntax::Keyword::Assert;
assert $x > 0;
assert $obj isa "MyClass";
assert defined $value;
# Dies with "Assertion failed" if expression is false
assert "apple" eq "banana"; # Dies: Assertion failed
```
## Key Features
### Zero Runtime Cost
When assertions are disabled, they are completely removed at compile time:
```perl
# In production with assertions disabled:
assert expensive_check(); # This code is completely removed
```
### Environment Control
```perl
# Enable/disable assertions before module loading
$ENV{PERL_ASSERT_ENABLED} = 0; # Disable assertions
use Syntax::Keyword::Assert;
# Or keep default (enabled)
use Syntax::Keyword::Assert;
```
## Practical Examples
### Input Validation
```perl
sub divide {
my ($a, $b) = @_;
assert defined $a && defined $b;
assert $b != 0;
return $a / $b;
}
```
### Object Type Checking
```perl
sub process_user {
my $user = shift;
assert $user isa "User";
assert $user->can("get_name");
return $user->get_name();
}
```
### Development Debugging
```perl
sub complex_algorithm {
my @data = @_;
assert @data > 0;
my $result = process_data(@data);
assert defined $result;
assert ref($result) eq 'HASH';
return $result;
}
```
### Contract Programming
```perl
sub fibonacci {
my $n = shift;
# Precondition
assert $n >= 0;
my $result = $n <= 1 ? $n : fibonacci($n-1) + fibonacci($n-2);
# Postcondition
assert $result >= 0;
return $result;
}
```
## Production Deployment
### Disable in Production
```perl
# In deployment script or environment setup
BEGIN {
$ENV{PERL_ASSERT_ENABLED} = 0 if $ENV{PRODUCTION};
}
use Syntax::Keyword::Assert;
# All assertions are now compile-time no-ops
```
### Conditional Assertions
```perl
# Development-only assertions
use Syntax::Keyword::Assert;
sub critical_function {
my $data = shift;
# This assertion disappears in production
assert validate_complex_invariant($data);
return process($data);
}
```
## Best Practices
1. **Use for debugging**: Add assertions during development, disable in production
2. **Check invariants**: Verify assumptions about data state and object types
3. **Validate inputs**: Assert preconditions for function parameters
4. **Document assumptions**: Assertions serve as executable documentation
5. **Zero-cost safety**: Enable aggressive checking without production performance penaltyRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.