git-best-practiceslisted
Install: claude install-skill pmarashian/cursor-agent-skills
# Git Best Practices Skill
This skill provides comprehensive guidelines for proper git workflow management, with a focus on `.gitignore` setup and preventing accidental commits of unwanted files.
## .gitignore Management
### Critical: Always Check Before Initializing Package Managers
**BEFORE** initializing npm, pip, poetry, cargo, or any other package manager:
1. **Check if `.gitignore` exists**: Use `ls -la .gitignore` or check via file system
2. **If `.gitignore` doesn't exist**: Create it with appropriate patterns for your project type
3. **If `.gitignore` exists**: Verify it includes the necessary patterns for your package manager
4. **After creating/updating `.gitignore`**: Verify it's working with `git status` to ensure ignored files don't appear
### Required Patterns by Project Type
#### Node.js / npm / yarn / pnpm
```
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
.pnpm-store/
```
#### Python / pip / poetry
```
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
env.bak/
venv.bak/
.venv
pip-log.txt
pip-delete-this-directory.txt
.pytest_cache/
.coverage
htmlcov/
*.egg-info/
dist/
build/
```
#### Rust / cargo
```
target/
Cargo.lock
```
#### Go
```
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
go.work
```
#### Java / Maven / Gradle
```
*.class
*.log
*.jar
*.war
*.ear
target/
build/
.gradle/
.idea/
*.iml
```
### Universal Patterns (All Projects)
These should be included in every `.gitignore`:
```
# Environment fi