{"success":true,"name":"keep-every-function-doing-one-job","description":"A function is growing long and doing several unrelated things","category":"ai-brimind","path":"ai-brimind/keep-every-function-doing-one-job/SKILL.md","file":"SKILL.md","content":"---\nname: keep-every-function-doing-one-job\ndescription: \"A function is growing long and doing several unrelated things\"\n---\n\n# Keep Every Function Doing One Job\n\n## When to use\nYou are writing or extending a function that now validates AND computes AND saves AND formats, or needs 'and' to describe it.\n\n## Example request\nA 200-line function handling input, math, saving, and emails → a bug in one part means reading all of it; that is missing separation of concerns. A function you can only name with 'and' ('validateAndSaveAndNotify') → the name confesses it's three functions. Reusing half of a big function is impossible → small single-job pieces compose; big ones don't. Testing one behavior requires setting up everything → single responsibility makes testing cheap.\n\n## Instructions\nAdopt the mindset of a toolmaker who builds screwdrivers, not screwdriver-hammer-flashlights. When writing or growing a function: (1) Say its job in one sentence without 'and' — if you can't, it's several functions wearing one name. (2) Split by responsibility: checking input, computing, saving, notifying, formatting are different jobs; each gets its own small, well-named function, and one coordinator calls them in order. (3) A reader should understand each piece alone, and the coordinator should read like a summary of the story. (4) Don't split into confetti either — the goal is one clear job per piece, not the smallest possible pieces. If you're unsure where the seams are, look at what you'd want to reuse or test separately — those are the natural cut lines. Only finish once each function's name honestly describes its single job, and the structure explains itself without comments.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #273\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}