{"id":"code-col-git-split-commit-plan","audience":"college","category":"coding","track":"coding","technique":"format","title":"Plan how to split one big diff into 3 commits","free":false,"task":"Your team's capstone repo wants small commits. Plan exactly 3 commits from your staged changes, in the order refactor, then feat, then docs. Write each as one numbered line: '<subject> - files: <files>', with Conventional Commits subjects using scopes auth, auth and readme, each subject under 50 characters. Every staged file must appear in exactly one commit. No code blocks, under 90 words.","materialLabel":"Your staged changes (attached to your prompt automatically)","material":"$ git status --short\nM  src/auth/session.js\nM  src/auth/tokens.js\nA  src/auth/passwordReset.js\nA  src/auth/passwordReset.test.js\nM  src/routes/account.js\nM  README.md\n\n$ git diff --staged --stat\n README.md                        |  14 +++++++++\n src/auth/passwordReset.js        |  88 +++++++++++++++++++++++++++\n src/auth/passwordReset.test.js   |  61 ++++++++++++++++++++\n src/auth/session.js              |  22 ++-----\n src/auth/tokens.js               |  35 ++++++-----\n src/routes/account.js            |  19 ++++++\n 6 files changed, 223 insertions(+), 32 deletions(-)\n\nWhat I actually did (my notes):\n- moved token signing out of session.js into tokens.js (no behavior\n  change, just cleanup so password reset can reuse it)\n- built password reset: new passwordReset.js + its tests, plus the\n  POST /account/reset route in account.js\n- added a \"Resetting your password\" section to the README\n\nTeam rule (CONTRIBUTING.md): \"One logical change per commit. Tests go\nin the same commit as the code they test.\"","rules":[{"type":"numberedItems","count":3},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":90}],"mistakes":[{"title":"One giant commit","why":"Asked for a commit message, the AI writes one message for everything.","fix":"Say: \"Plan exactly 3 commits: refactor, then feat, then docs.\"","checks":["numberedItems","r0"]},{"title":"Tests in their own commit","why":"The AI often splits tests out, which breaks your team rule.","fix":"Add: \"Tests go in the same commit as the code they test.\"","checks":["r1"]},{"title":"Missing or doubled files","why":"Without a check, a file can end up in two commits or none.","fix":"Add: \"Every staged file in exactly one commit.\"","checks":["r2"]},{"title":"A git tutorial","why":"The AI explains git add -p and interactive staging at length.","fix":"Add: \"One line per commit, no code blocks.\"","checks":["codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Sets the number of commits","patterns":["\\b(3|three)\\b.{0,15}commit"]},{"label":"Gives the order","patterns":["refactor","feat","docs"]},{"label":"Gives the line shape","patterns":["files:","- files","subject"]},{"label":"Mentions the test rule","patterns":["tests? (go|in the same)","same commit"]},{"label":"Asks for full coverage","patterns":["every (staged )?file","exactly one commit"]}],"hint":"Splitting a diff well depends on your team's rules. Tell the AI how many commits, in what order, the line shape and where tests belong.","rubricLabels":["The 3 lines are in the order refactor(auth): ..., feat(auth): ..., docs(readme): ..., each subject under 50 characters, in the form '<subject> - files: <files>'","The refactor commit has src/auth/session.js and src/auth/tokens.js, and the feat commit has src/auth/passwordReset.js, src/auth/passwordReset.test.js and src/routes/account.js","README.md is only in the docs commit, and every one of the 6 staged files appears in exactly one commit"]}