nullable-architecture

Apply Nullables-style explicit construction and infrastructure wrappers to refactoring and tests.

Updated Apr 24, 2025
One-click install
npx skills add https://github.com/danielbush/oneput --skill nullable-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nullable-architecture
Source: https://github.com/danielbush/oneput/tree/main/.agents/skills/nullable-architecture
Command: npx skills add https://github.com/danielbush/oneput --skill nullable-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use when refactoring code or writing tests in the Nullables style to promote explicit construction, infrastructure wrappers, behavior simulation, and observable outputs without mocks.

Core Features & Use Cases

  • Explicit construction using new, .create(), and .createNull() to model real vs test environments
  • Infrastructure wrappers at the environment boundary to decouple code from I/O
  • Behavior simulation and output tracking to verify interactions without side effects
  • Example-driven, state-based tests that stay sociable and readable

Quick Start

Create a minimal test that wires a real class under test with a real dependency via create(), a nulled dependency via createNull(), and asserts the observable outputs.

Frequently Asked Questions about nullable-architecture

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

FAQPage Schema
How do I refactor code safely without using mocks for unit tests?

Behavior simulation in testing replaces mocks by tracking observable outputs through infrastructure wrappers. The Nullables approach uses .create() and .createNull() for explicit construction, allowing state-based tests to verify interactions without side effects or mock frameworks.

What is the Nullables approach for writing state-based tests?

The Nullables approach models real and test environments using explicit construction with new, .create(), and .createNull(). It places infrastructure wrappers at the environment boundary to decouple code from I/O and verify behavior through observable output tracking.

How do I start writing tests with create() and createNull() methods?

Start by wiring a real class with a real dependency via .create() and a nulled dependency via .createNull() in a minimal test. Assert observable outputs using a clear Arrange-Act-Assert structure to verify behavior without side effects.

Do I need infrastructure wrappers to use the Nullables testing pattern?

Yes, the Nullables testing pattern requires infrastructure wrappers at the environment boundary. These wrappers must expose .create() and .createNull() methods and support configurable null-dependencies to properly decouple code from I/O operations.

How does observable output tracking compare to mock-based testing for refactoring?

Observable output tracking verifies interactions by checking outputs rather than setting up mock expectations. This state-based approach keeps tests sociable and readable, validating behavior simulation without side effects while promoting safe refactoring.

Can I apply the Nullables pattern to integration tests across different environments?

Yes, the Nullables pattern applies to unit and integration tests across environments. It uses explicit construction to model real versus test environments, relying on infrastructure wrappers to maintain consistent behavior simulation and output tracking.