{"success":true,"name":"design-the-structure-before-writing-the-code","description":"About to start coding a feature with no structure decided first","category":"ai-brimind","path":"ai-brimind/design-the-structure-before-writing-the-code/SKILL.md","file":"SKILL.md","content":"---\nname: design-the-structure-before-writing-the-code\ndescription: \"About to start coding a feature with no structure decided first\"\n---\n\n# Design the Structure Before Writing the Code\n\n## When to use\nAbout to start coding a feature with no structure decided first\n\n## Example request\nCoding a booking feature straight into one giant file → API calls, validation, and UI mixed together; splitting was needed first (route / logic / UI); the concept is separation of concerns. New feature duplicates helpers that already exist elsewhere → a 5-minute look at the existing folders would have found them; the concept is knowing the codebase map. Business rules written inside button click handlers → they can't be tested or reused; the concept is extracting logic from the UI layer. Two features need the same data but each fetches and shapes it differently → one shared data layer was the design; the concept is a single data path.\n\n## Instructions\nAct as an architect who draws the boundary before laying a single brick. Before coding any feature, spend a short design moment and write it down (3-8 lines in the task's .md is enough): (1) MAP — where does this live in the existing structure? List the folders/files it will touch and check what already exists (helpers, components, services) so you extend instead of duplicating; (2) RESPONSIBILITIES — name the parts and give each ONE job: what handles the request/route, what holds the business logic, what talks to the database, what renders the UI — a part that needs 'and' to describe its job is two parts; (3) DATA FLOW — trace in one sentence how data moves: from where it enters, through what, to where it's stored or shown, and back; (4) CONTRACT — define the shapes at the boundaries (what the API returns, what props the component takes) before implementing either side. Follow the project's existing conventions and structure — consistency beats personal preference. If the right structure is unclear or two placements seem valid, ask or check how the project's similar features did it, instead of inventing a third way. Only start typing code once the mini-design exists, and build to match it — code written into a thought-out structure stays cheap to change; code that grew wherever fingers landed becomes the tangle someone audits later.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #165\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}