skills/self-adaptive-systems/SKILL.md
Engineering methodology for building software systems that autonomously manage themselves through explicit architectural separation and formal guarantees
npx skillsauth add curiositech/windags-skills self-adaptive-systemsInstall 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.
Engineering methodology for building software systems that autonomously manage themselves through explicit architectural separation and formal guarantees.
| System Property | Choose Strategy | Implementation | |-----------------|----------------|----------------| | Single goal, predictable dynamics | Simple feedback control (PID-style) | Monitor → Calculate error → Proportional/Integral/Derivative response | | Multiple conflicting goals | Formal goal specifications with utility functions | Define weighted objectives → Multi-objective optimization → Synthesize controller | | >10 interacting components | Hierarchical feedback loops | Reactive (ms-s) → Deliberative (min-hr) → Reflective (days) layers | | High environmental uncertainty | Probabilistic models + runtime updates | Maintain confidence intervals → Detect model drift → Trigger re-identification | | Millisecond adaptation required | Pre-computed policy tables | Offline synthesis → Lookup-based execution → Background policy updates |
IF confidence > 90% AND drift < threshold
THEN incremental model update (recursive least squares)
ELSE IF abrupt change detected OR confidence < 50%
THEN trigger re-identification experiments
ELSE IF formal guarantees required
THEN use model checking on policies before deployment
ELSE
THEN fallback to conservative policy + alert operators
Does current system have scattered adaptation logic?
├─ YES → Extract to explicit managing/managed separation
│ └─ Can you draw clear boundary between domain logic and adaptation logic?
│ ├─ NO → Refactor with MAPE-K pattern first
│ └─ YES → Proceed with formal goal specification
└─ NO → Is this new system design?
└─ YES → Start with single feedback layer
└─ Expected to grow beyond 10 components?
├─ YES → Design hierarchical from start
└─ NO → Single layer, plan evolution path
Detection Rule: If system alternates between opposing states (scale up → scale down → scale up) with increasing frequency Symptom: Thrashing behavior, degrading performance despite "working" adaptation Root Cause: Controller gain too aggressive OR conflicting timescales in single layer Fix: Reduce proportional gain by 50%, add derivative term to dampen, OR separate into reactive/deliberative layers
Detection Rule: If adaptation confidence remains constant despite changing conditions OR no confidence tracking exists Symptom: Mysterious failures in production, adaptation working in test but not reality Root Cause: Models assume certainty, no drift detection, point estimates treated as truth Fix: Add probabilistic models with confidence intervals → Track model prediction accuracy → Trigger re-learning when confidence drops below threshold
Detection Rule: If team debates "is the adaptation working?" OR cannot define success criteria OR has conflicting informal goals Symptom: Endless tuning, stakeholder disagreements, no objective success metrics Root Cause: Informal goals ("fast and reliable") cannot drive automated decisions Fix: Formalize as executable specifications: P≥0.95[responseTime ≤ 200ms] AND cost ≤ $X/hour → Verify policies against formal goals before deployment
Detection Rule: If adaptation component has >1000 lines OR >20 configuration parameters OR debugging requires system-wide tracing Symptom: Adding adaptation features breaks existing ones, emergent behaviors, impossible to predict changes Root Cause: Forcing different timescales into single control loop Fix: Decompose into hierarchical layers: Reactive handles immediate responses, Deliberative optimizes patterns, Reflective evolves strategy
Detection Rule: If adaptation policies deployed based on intuition OR testing only happy path scenarios OR discovering issues only in production Symptom: "It worked in staging but failed in production", unpredictable behavior under load Root Cause: Adaptation space is exponential, manual testing insufficient Fix: Model check policies before deployment → Use statistical verification for probabilistic properties → Runtime monitoring of guarantee violations
Scenario: Online retailer needs adaptive resource management balancing response time (<200ms for 95% requests), availability (99.9% uptime), and cost (<$500/hour infrastructure).
Step 1: Architecture Decision
Step 2: Formal Goal Specification
Primary: P≥0.95[responseTime ≤ 200ms]
Secondary: availability ≥ 99.9%
Constraint: cost ≤ $500/hour
Step 3: Hierarchical Design
Step 4: Controller Synthesis
Deliberative layer models relationship: responseTime = f(activeServers, requestRate, cpuUtilization)
From experimental data: responseTime ≈ 50 + (requestRate/activeServers) * 0.8 + cpuNoise
Synthesize controller: targetServers = requestRate/targetThroughputPerServer + safetyMargin
Expert vs Novice Differences:
Result: System maintains goals under 3x traffic spikes, reduces cost 40% during low-traffic periods, provides formal guarantees on response time distribution.
Task complete when all conditions verified:
Do NOT use this skill for:
event-driven-architecture insteadresilient-system-design for simpler fault tolerancereal-time-systems insteadDelegate to other skills:
control-theory-for-softwareformal-methodssoftware-architecture-patternssystem-observabilitytools
Building resilient distributed systems with circuit breakers, retries with full-jitter exponential backoff, retry budgets (per-request 3-attempt + per-client 10% ratio per Google SRE), deadline propagation, and the cascading-failure math (4 layers × 3 retries = 64x amplification). Grounded in Resilience4j, Microsoft Cloud Patterns, AWS Architecture Blog (Marc Brooker), and Google SRE Book.
testing
Designing HTTP cache headers that work correctly across browsers, CDNs, and shared proxies — `Cache-Control` directives per RFC 9111, `stale-while-revalidate` and `stale-if-error` per RFC 5861, the Vary header for varying responses, and surrogate keys for tag-based purging. Grounded in IETF RFCs and Cloudflare/Fastly docs.
development
Use when designing or fixing a Content Security Policy on a real site, choosing between nonce-based and hash-based CSP, adding strict-dynamic, debugging "Refused to execute inline script" errors, deploying CSP in report-only mode first, configuring report-to / report-uri, or auditing an existing policy for unsafe-inline / unsafe-eval / wildcards. Triggers: "CSP blocks legitimate inline script", strict-dynamic, nonce-{RANDOM}, sha256-{HASH}, object-src none, base-uri none, frame-ancestors, Trusted Types, X-Content-Security-Policy obsolete, report-only vs enforced. NOT for general HTTP security headers (HSTS, COOP/COEP), Trusted Types deep dive, CORS configuration, or building a WAF.
tools
Choosing and operating an HTTP API versioning strategy that doesn't break clients — Stripe's date-based pinned versions, the Deprecation/Sunset header pair (RFC 9745 + RFC 8594), URI vs header vs media-type approaches, and the version-transformer pattern. Grounded in Stripe's published architecture and IETF RFCs.