Brett Owers
← All Projects

Bereshit

Archived

July 1, 2022

A collection of shell scripts that auto-generate Flutter BLoC scaffolding — states, events, blocs, dashboards, widgets, repositories, and mocks — all linked and properly named from a single command. The precursor to AI-driven code generation, and a case for why scripting is an essential skill for any modern developer.

Purpose

Named after the Hebrew word for "In the beginning" (the first word of Genesis), Bereshit was a code generation toolkit. Run a command, pass a feature name, and the scripts would create an entire BLoC feature module: the bloc file, the state file, the event file, a dashboard widget, child widgets, a repository, and mock files for testing — all properly named, linked with imports, and ready to fill in with business logic.

Stack

ShellBashFlutterBLoCCode GenerationScriptingAutomation

What I Learned

  • BLoC architecture in Flutter requires a lot of files per feature: a bloc (handles events, emits states), a state file (defines all possible states), an event file (defines all possible inputs), a repository (data access layer), a widget (UI), and often mocks for testing. Creating these by hand for every new feature is 15-20 minutes of boilerplate. A shell script does it in seconds and never makes a typo.
  • Shell scripting is the duct tape of software engineering. A bash script that generates files from templates using mkdir, touch, cat with heredocs, and sed is not elegant — but it is fast to write, fast to run, and works on every Unix-based system without installing anything. The script does not need to be pretty. It needs to be correct and save time.
  • The naming convention enforcement was the real value. Every generated file followed the same pattern: feature_name_bloc.dart, feature_name_state.dart, feature_name_event.dart, feature_name_repository.dart, feature_name_dashboard.dart. Import paths were auto-generated to point at the right files. This eliminated an entire class of bugs (typos in imports, inconsistent naming) and made the codebase navigable by convention.
  • Auto-generating mocks alongside production code is an underappreciated practice. Most developers write the code first and the tests later (or never). By generating mock files at the same time as the real files, Bereshit made testing the path of least resistance. The mock was already there, already named, already imported. You just had to fill it in. Reducing friction for the right behavior changes the behavior.
  • Template-based code generation is a spectrum: shell scripts (simple, limited), code gen tools like mason (Flutter-specific, template-driven), build_runner (Dart's compile-time code generation for JSON serialization, freezed classes, etc.), and full scaffolding CLIs (Rails generators, Angular CLI, Create React App). Each level adds power and complexity. Shell scripts are the ground floor — the fastest to build and the fastest to outgrow.

Key Insights

  • Learning to script is an essential part of being a modern developer. Not because scripts are the most powerful tool, but because they teach you to think about your own workflow as something that can be automated. The developer who manually creates 7 files per feature does not think of their workflow as a system. The developer who scripts it does. That shift in perspective — from doing work to designing how work gets done — is the difference between a coder and an engineer.
  • Bereshit was, in hindsight, a primitive version of what AI code generation does today. The scripts encoded patterns: "when I need a new feature, create these files with these names and these boilerplate contents." Claude Code does the same thing but with natural language instead of heredocs, and with contextual intelligence instead of string templates. The evolution is: shell scripts → templating tools → AI agents. Each generation is more expressive and less rigid.
  • The name "Bereshit" — In the beginning — was apt. Every feature starts with scaffolding. Every project starts with a structure. The quality of the beginning determines the quality of everything that follows. A well-scaffolded feature is easy to implement, easy to test, easy to review. A poorly scaffolded feature (wrong names, missing mocks, broken imports) creates friction at every step. Investing in beginnings is investing in everything that comes after.
  • The scripting skills from Bereshit transfer everywhere: CI/CD pipeline scripts, deployment automation, data migration scripts, development environment setup scripts, git hooks. Once you are comfortable writing bash, the entire operating system becomes an automation surface. Every repetitive task becomes a candidate for scripting. That instinct — "I have done this three times, time to script it" — is one of the highest-leverage habits a developer can cultivate.
#shell#bash#scripting#code-generation#Flutter#BLoC#automation#scaffolding#developer-tools#naming-conventions#mocks#testing

This post was composed through a conversation between Brett Owers and Claude Code (Anthropic). The content reflects Brett's recollection of each project and the lessons drawn from it. Some details may be approximate or omitted — the purpose is to paint an honest picture of a software engineer's development over time, not to serve as a precise historical record.