Skip to content

Your First AI Commit: Step-by-Step Guide

Your first AI-generated code commit in 10 minutes. Step-by-step, no experience needed.

Reading time: 4 minutes Category: Getting Started Published: January 11, 2026

What You’ll Commit

Simple but real: Add email validation to your app

Why this task?

  • Low risk (validation utility)
  • High value (prevents bugs)
  • Easy to test
  • Perfect AI task

Step 1: Setup (2 min)

Install Claude Code:

Terminal window
npm install -g claude-code
claude auth login

Or use any AI coding assistant you prefer.

Step 2: Write the Prompt (1 min)

Copy this:

Create an email validation function:
- Name: isValidEmail
- Input: string
- Output: boolean
- Use regex to check format
- Add TypeScript types
- Include JSDoc with example
- Export the function

Step 3: Get AI Code (30 sec)

AI generates:

/**
* Validates email address format
* @param email - Email string to validate
* @returns true if valid, false otherwise
* @example
* isValidEmail('user@example.com') // true
* isValidEmail('invalid') // false
*/
export function isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}

Step 4: Test It (2 min)

Ask AI for tests:

Write tests for isValidEmail using Jest

AI generates:

describe('isValidEmail', () => {
it('validates correct emails', () => {
expect(isValidEmail('user@example.com')).toBe(true);
});
it('rejects invalid emails', () => {
expect(isValidEmail('invalid')).toBe(false);
expect(isValidEmail('@example.com')).toBe(false);
expect(isValidEmail('user@')).toBe(false);
});
});

Run tests:

Terminal window
npm test

All pass? ✅ Ready to commit

Step 5: Commit (2 min)

Terminal window
git add src/utils/email.ts src/utils/email.test.ts
git commit -m "Add email validation utility
- Created isValidEmail function with regex
- Added comprehensive tests
- Includes TypeScript types and JSDoc
🤖 Generated with Claude Code"
git push

Step 6: Celebrate 🎉

You just:

  • ✅ Used AI to write production code
  • ✅ Added tests
  • ✅ Committed to your repo
  • ✅ Saved 20 minutes

Time: 10 minutes total Value: Working, tested utility function

What’s Next?

Tomorrow: Try Quick Wins This Week: Learn AI Workflow Next Month: Use Claude Zen for full AI workflow

Keep going: Every commit gets easier.