بنقرة واحدة
sba
Story-Based Architecture conventions for this codebase. Apply when implementing or refactoring use cases.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Story-Based Architecture conventions for this codebase. Apply when implementing or refactoring use cases.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | SBA |
| description | Story-Based Architecture conventions for this codebase. Apply when implementing or refactoring use cases. |
This codebase follows Story-Based Architecture. Every business operation is a self-contained narrative living in a single file. Apply these principles strictly.
Every use case follows the same pattern:
def use_case(args):
# 1. Load: gather all data needed upfront
...
# 2. Validate: check every precondition before any mutation
...
# 3. Execute: perform calculations and mutations
...
Load everything first, validate everything, then mutate. No interleaving unless there is a performance justification.
The behavior of a use case must be visible by reading only that file. Avoid:
Two use cases that look similar might serve different business purposes. Keep them separate. Similar code is not duplication when it can evolve independently.
Sandi Metz: "Duplication is far cheaper than the wrong abstraction."
DRY applies to knowledge, not to code. Hunt and Thomas: "Every piece of knowledge must have a single, unambiguous, authoritative representation."
When something is genuinely shared across use cases, share only the bare minimum and do not over generalize. Keep the boundaries of what is shared minimal in order to avoid dependencies and abstractions that will make the code harder to read.
Files are named after the business operation they perform: place_order.py. Not OrderHandler.py or OrderService.py. Open the file, see the story.
domain folder. Use a meaningful filename. It is ok to reuse the same filename if the knowledge falls in the same domain. For example, if you have two use cases that need to share the same business rules for calculating discounts, you can create a domain/discounts.py file and put the shared logic there.