# I Built My First npm Package , and It Solves Something with Git

If you write code every day, you probably write **Git commit messages** every day too.And if you're honest… you probably **don’t enjoy it**.

I definitely didn’t.

So I built a small tool that fixes this tiny but annoying problem.  
It’s called **slothcommit** , an AI-powered CLI that generates commit messages for you.

yeah so i decided to write this blog on " **my first npm package"** , why I built it, and what I learned along the way.

## The Problem: Writing Commit Messages is Annoying

My typical workflow looked something like this:

1.  Write some code
    
2.  Stage the files
    

```plaintext
git add .
```

3.  Then get stuck writing a commit message.
    

Sometimes I would write something lazy like:

```plaintext
fix stuff
```

Or something even worse:

```plaintext
update
```

When I *did* want a good commit message, the workflow was painful:

1.  Copy my code changes
    
2.  Paste them into ChatGPT
    
3.  Ask it to generate a commit message
    
4.  Copy the result back
    
5.  Finally run `git commit`
    

It worked but thing is it was **slow and repetitive** and focus am lazy asf so i wanted a more lazier way to do this git commit message thing.

So I thought:

> Why can't a CLI tool just do this automatically?

That idea became **slothcommit**.

### The Idea Behind Slothcommit

The idea was simple.

Instead of manually writing commit messages, a CLI tool should:

1.  Look at the **git diff**
    
2.  Send it to an **AI model**
    
3.  Generate a **clean conventional commit message**
    
4.  Run the commit automatically
    

So the workflow becomes:

```plaintext
git add .
sloth
```

And that's it.

workflow diagram :

![](https://cdn.hashnode.com/uploads/covers/63ef099546e2f1644c4f28c4/2d07e099-dc1a-43bf-9c6f-8514c496b5b3.png align="center")

### What Slothcommit Does (or how it works)

**slothcommit** is an **AI-powered Git commit assistant**.

It analyzes your staged changes and generates a commit message using the Conventional Commit format.

Example output:

```plaintext
feat(auth): add refresh token middleware
```

and while am writing this blog the package is now getting 100+ downloads every week, which is really encouraging to see!

If you haven’t tried it yet, check it out here:  
[https://www.npmjs.com/package/slothcommit](https://www.npmjs.com/package/slothcommit)

**and in case you like it ? do give it a star** [https://github.com/anshumancodes/sloth](https://github.com/anshumancodes/sloth)
