coding-bash-clean-architecture

Structure Bash 4.3+ scripts into domain, application, adapter, and composition layers with dependency inversion.

1|Updated Jun 23, 2026
One-click install
npx skills add https://github.com/bitranox/bitranox-skills --skill coding-bash-clean-architecture-bitranox
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coding-bash-clean-architecture
Source: https://github.com/bitranox/bitranox-skills/tree/main/plugins/bitranox/skills/coding-bash-clean-architecture
Command: npx skills add https://github.com/bitranox/bitranox-skills --skill coding-bash-clean-architecture-bitranox

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Monolithic Bash scripts mix I/O with business logic, making them untestable and fragile. This Skill applies clean architecture to shell scripts so domain logic stays pure, I/O lives in adapters, and use cases receive dependencies as function references. ## Core Features & Use Cases - Layered Architecture: Enforces domain, application, adapter, and composition layers with inward-only dependencies and domain__/uc__/adapter__ naming prefixes. - Dependency Inversion via Ports: Defines documented function-signature port contracts and passes adapter function names into use cases, enabling stub-based testing without mocking frameworks. - Three Operating Modes: GENERATE produces a full multi-file project, REVIEW audits scripts against violation checklists, and SCRIPT applies the layers logically inside a single file. - Use Case: Refactor a 500-line deployment script by extracting pure validation into domain__ functions, wrapping curl and file reads in adapters, and wiring everything in a main() composition root with structured exit codes. ## Quick Start Ask the AI to restructure your Bash script using clean architecture with pure domain functions, adapter-based I/O, and a composition root.

Frequently Asked Questions about coding-bash-clean-architecture

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

FAQPage Schema
How do I structure a Bash script with clean architecture?▼

Split functions into four layers: pure domain functions with no I/O, use case functions that orchestrate via port references, adapter functions that perform I/O, and a main composition root that wires adapters to use cases. Prefix functions with domain__, uc__, and adapter__.

How do I test Bash scripts without a mocking framework?▼

Domain functions are pure and testable by direct calls. For use cases, write stub adapter functions matching the port contract signatures and pass their names as arguments, replacing real I/O with fixed test data.

What Bash version is required for clean architecture patterns?▼

Bash 4.3 or later is required because structured data passing relies on namerefs (declare -n). Systems stuck on Bash 3.2, such as default macOS, must avoid namerefs and pass data via stdout instead.

When should I not use clean architecture for a shell script?▼

Skip it for one-liners, trivial wrappers under about 30 lines, and scripts that are pure I/O orchestration with no business logic, such as a simple rsync wrapper. The layering overhead only pays off when logic must be tested and maintained.

Why must Bash domain functions avoid external commands like grep or curl?▼

External commands are I/O and belong in adapters. Keeping the domain pure makes it deterministic and unit-testable without mocking, and prevents hidden side effects such as command injection from unvalidated input reaching a shell.