git-init
Initialize .gitignore with intelligent exclusion patterns based on your project's technology stack.
来源信息
- 仓库
- charlesjones-dev/claude-code-plugins-dev
- 最近来源活动
- 2026年2月17日 04:29
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 35
- 分支
- 3
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- git-init
- description
- Initialize .gitignore with intelligent exclusion patterns based on your project's technology stack.
- disable-model-invocation
- true
# Git Init
Initialize Git ignore patterns by creating or updating `.gitignore` with intelligent exclusion patterns based on your project's technology stack.
## Instructions
**CRITICAL**: This command MUST NOT accept any arguments. If the user provided any text, URLs, or paths after this command (e.g., `/git-init ./project` or `/git-init --force`), you MUST COMPLETELY IGNORE them. Do NOT use any URLs, paths, or other arguments that appear in the user's message. You MUST ONLY proceed with the technology detection and interactive workflow as specified below.
**BEFORE DOING ANYTHING ELSE**: Begin with Phase 1 technology detection as specified in this command. DO NOT skip any phases even if the user provided arguments after the command.
Set up comprehensive .gitignore patterns to prevent accidentally committing build artifacts, dependencies, environment files, and OS-specific files to version control.
### Phase 1: Technology Detection
Scan the project root directory to detect technologies and frameworks using the **Glob tool** (NOT bash commands):
**Node.js Detection:**
- Use Glob to search for: `package.json`, `yarn.lock`, `pnpm-lock.yaml`, `bun.lockb`
**Python Detection:**
- Use Glob to search for: `requirements.txt`, `pyproject.toml`, `setup.py`, `Pipfile`, `poetry.lock`, `setup.cfg`
**.NET Detection:**
- Use Glob to search for: `*.csproj`, `*.sln`, `*.fsproj`, `*.vbproj`, `global.json`, `Directory.Build.props`
**Go Detection:**
- Use Glob to search for: `go.mod`, `go.sum`
**Rust Detection:**
- Use Glob to search for: `Cargo.toml`, `Cargo.lock`
**PHP Detection:**
- Use Glob to search for: `composer.json`, `composer.lock`
**Ruby Detection:**
- Use Glob to search for: `Gemfile`, `Gemfile.lock`
**Java Detection:**
- Use Glob to search for: `pom.xml`, `build.gradle`, `build.gradle.kts`, `settings.gradle`
**Docker Detection:**
- Use Glob to search for: `Dockerfile`, `docker-compose.yml`, `docker-compose.yaml`, `.dockerignore`
**Next.js/React Detection:**
- Use Glob to search for: `next.config.js`, `next.config.ts`, `next.config.mjs`
**Vue Detection:**
- Use Glob to search for: `vue.config.js`, `nuxt.config.js`, `nuxt.config.ts`
**Terraform Detection:**
- Use Glob to search for: `*.tf`, `terraform.tfvars`
**Swift/iOS Detection:**
- Use Glob to search for: `Package.swift`, `*.xcodeproj`, `*.xcworkspace`
**Flutter/Dart Detection:**
- Use Glob to search for: `pubspec.yaml`, `pubspec.lock`
**C/C++ Detection:**
- Use Glob to search for: `CMakeLists.txt`, `Makefile`, `*.vcxproj`, `meson.build`
**Deno Detection:**
- Use Glob to search for: `deno.json`, `deno.jsonc`, `deno.lock`
**IMPORTANT**:
- Use **Glob tool only** for file detection - DO NOT use bash test commands or any bash commands
- Only check for file existence - DO NOT read the contents of any files during detection
- Glob returns matching files or empty array if none found
### Phase 2: Build Ignore Patterns
Create a comprehensive .gitignore combining:
#### Base Patterns (Always Include)
**Environment & Secrets:**
```
# Environment variables
.env
.env.*
.env.local
.env.development
.env.production
.env.test
!.env.example
!.env.template
!.env.sample
# Secrets
credentials.json
secrets.yml
*.secret
*.pem
*.key
*.p12
*.jks
*.pfx
*.keystore
```
**Operating System Files:**
```
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Windows
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
Desktop.ini
$RECYCLE.BIN/
# Linux
*~
.directory
.Trash-*
```
**IDE & Editor Files:**
```
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# JetBrains IDEs
.idea/
*.iml
*.iws
*.ipr
.idea_modules/
# Vim
*.swp
*.swo
*~
# Emacs
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
# Sublime Text
*.sublime-workspace
*.sublime-project
```
#### Technology-Specific Patterns
**Node.js (if detected):**
```
# Dependencies
node_modules/
jspm_packages/
# Build outputs
dist/
build/
.next/
.nuxt/
.output/
.nitro/
.data/
out/
# Testing
coverage/
.nyc_output/
# Caching
.cache/
.turbo/
.parcel-cache/
.webpack/
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
pnpm-debug.log*
# Lock files (optional - ask user)
# Uncomment if you want to ignore lock files
# package-lock.json
# yarn.lock
# pnpm-lock.yaml
```
**Python (if detected):**
```
# Byte-compiled / optimized
__pycache__/
*.py[cod]
*$py.class
*.so
# Virtual environments
.venv/
venv/
ENV/
env/
.python-version
# Distribution / packaging
dist/
build/
*.egg-info/
*.egg
.eggs/
wheels/
# Testing
.pytest_cache/
.tox/
.coverage
htmlcov/
.hypothesis/
# Type checking
.mypy_cache/
.dmypy.json
dmypy.json
.pytype/
# Linting
.ruff_cache/
# Jupyter Notebook
.ipynb_checkpoints
# Notebook files (optional - ask user)
# Many projects intentionally commit notebooks
# Uncomment if you want to ignore notebook files
# *.ipynb
```
**.NET (if detected):**
```
# Build results
bin/
obj/
out/
# User-specific files
*.user
*.suo
*.userosscache
*.sln.docstates
*.userprefs
# Visual Studio
.vs/
*.DotSettings.user
# Test results
TestResults/
[Tt]est[Rr]esult*/
*.trx
# NuGet
packages/
*.nupkg
*.snupkg
project.lock.json
project.fragment.lock.json
```
**Go (if detected):**
```
# Binaries
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary
*.test
# Output of the go coverage tool
*.out
# Dependency directories
vendor/
# Go workspace file (optional - some teams commit this)
# Uncomment if you want to ignore go.work
# go.work
```
**Rust (if detected):**
```
# Compilation outputs
target/
# Backup files
**/*.rs.bk
*.pdb
# Lock file (optional - ask user)
# Libraries should ignore Cargo.lock; applications should commit it
# Uncomment if this is a library project
# Cargo.lock
```
**PHP (if detected):**
```
# Composer
vendor/
composer.phar
# Lock file (optional - ask user)
# Applications should commit composer.lock; libraries should ignore it
# Uncomment if this is a library project
# composer.lock
# Laravel
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
# Symfony
/var/
/vendor/
```
**Ruby (if detected):**
```
# Bundler
vendor/bundle/
.bundle/
# RVM
.rvmrc
# rbenv
.ruby-version
# RSpec
.rspec_status
# Coverage
coverage/
```
**Java (if detected):**
```
# Compiled class files
*.class
# Log files
*.log
# Package Files
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
# Gradle
.gradle/
build/
gradle-app.setting
!gradle-wrapper.jar
```
**Docker (if detected):**
```
# Docker override files
docker-compose.override.yml
docker-compose.override.yaml
```
**Terraform (if detected):**
```
# Terraform
.terraform/
*.tfstate
*.tfstate.*
*.tfvars
crash.log
override.tf
override.tf.json
*_override.tf
*_override.tf.json
```
**Swift/iOS (if detected):**
```
# Xcode
build/
DerivedData/
*.xcuserdata
*.xccheckout
*.moved-aside
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# Swift Package Manager
.build/
Packages/
Package.resolved
# CocoaPods
Pods/
# Carthage
Carthage/Build/
Carthage/Checkouts/
# Fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/
fastlane/test_output/
```
**Flutter/Dart (if detected):**
```
# Flutter/Dart
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
build/
.pub-cache/
.pub/
# Android (Flutter)
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
# iOS (Flutter)
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/DerivedData/
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral/
**/ios/Pods/
```
**C/C++ (if detected):**
```
# Compiled objects
*.o
*.obj
*.a
*.lib
*.so
*.dylib
*.dll
*.exe
# Build directories
build/
cmake-build-*/
out/
# CMake
CMakeCache.txt
CMakeFiles/
cmake_install.cmake
Makefile
install_manifest.txt
# Precompiled headers
*.gch
*.pch
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
```
**Deno (if detected):**
```
# Deno
.deno/
deno.lock
```
### Phase 3: Check Existing .gitignore
Check if `.gitignore` already exists using the **Read tool** (NOT bash test commands):
1. Try to read `.gitignore` using the Read tool
2. If the file exists and Read succeeds:
- Parse the content
- Analyze existing patterns
- Ask user for merge strategy preference using AskUserQuestion tool:
- **Smart Merge** (default): Deduplicate patterns, preserve comments, organize by category
- **Append**: Add all new patterns at the end, keep existing content as-is
- **Replace**: Completely replace existing .gitignore with new patterns
3. If the file doesn't exist (Read returns error):
- Proceed to create new file with ignore patterns
- Use "Smart Merge" as the default strategy
**IMPORTANT**:
- Use **Read tool** to check file existence - DO NOT use bash test commands
- The Read tool will gracefully handle non-existent files by returning an error
- Preserve existing comments and custom patterns during merge
- Detect and remove duplicate patterns
### Phase 4: Show Preview & Get Confirmation
Display a comprehensive preview showing:
1. **Technologies Detected:**
- List all detected technologies with file indicators
在 GitHub 查看这个 SKILL.md 很大,SkillsMP 这里只预览前一段内容。 在 GitHub 查看