project-init

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Project Init

项目初始化

Initialize a project with standard Claude Code configuration.
使用标准Claude Code配置初始化项目。

What It Does

功能说明

  1. Adds a SessionStart hook to
    .claude/settings.json
    for remote environment setup
  2. Detects project languages and adds appropriate tool permissions
  1. .claude/settings.json
    添加SessionStart钩子,用于远程环境设置
  2. 检测项目语言并添加相应的工具权限

Language Detection

语言检测

The script detects languages based on project files and adds permissions:
Detection FileLanguagePermissions Added
go.mod
Go
go
,
golangci-lint
,
staticcheck
,
govulncheck
Package.swift
,
*.xcodeproj
Swift
swift
,
xcodebuild
,
swiftlint
,
xcrun
package.json
Node.js
npm
,
npx
,
node
, plus
yarn
/
pnpm
/
bun
if lockfiles present
pyproject.toml
,
requirements.txt
Python
python
,
pip
,
uv
,
pytest
,
ruff
,
mypy
Cargo.toml
Rust
cargo
,
rustc
Gemfile
Ruby
ruby
,
bundle
,
rake
,
rspec
pom.xml
Java (Maven)
mvn
,
java
build.gradle
Java (Gradle)
gradle
,
./gradlew
,
java
Dockerfile
Docker
docker
,
docker-compose
*.tf
Terraform
terraform
,
tofu
Makefile
Make
make
git
is always included.
脚本会根据项目文件检测语言并添加权限:
检测文件语言添加的权限
go.mod
Go
go
,
golangci-lint
,
staticcheck
,
govulncheck
Package.swift
,
*.xcodeproj
Swift
swift
,
xcodebuild
,
swiftlint
,
xcrun
package.json
Node.js
npm
,
npx
,
node
,若存在锁文件则额外添加
yarn
/
pnpm
/
bun
pyproject.toml
,
requirements.txt
Python
python
,
pip
,
uv
,
pytest
,
ruff
,
mypy
Cargo.toml
Rust
cargo
,
rustc
Gemfile
Ruby
ruby
,
bundle
,
rake
,
rspec
pom.xml
Java(Maven)
mvn
,
java
build.gradle
Java(Gradle)
gradle
,
./gradlew
,
java
Dockerfile
Docker
docker
,
docker-compose
*.tf
Terraform
terraform
,
tofu
Makefile
Make
make
git
权限始终会被包含。

Usage

使用方法

Run the setup script from your project directory:
bash
~/.claude/skills/project-init/scripts/setup-project.sh
The script:
  • Creates
    .claude/settings.json
    if it doesn't exist
  • Merges hooks and permissions into existing settings without overwriting
  • Is idempotent (safe to run multiple times)
  • Requires
    jq
    for JSON manipulation
从项目目录运行设置脚本:
bash
~/.claude/skills/project-init/scripts/setup-project.sh
该脚本:
  • .claude/settings.json
    不存在则创建它
  • 将钩子和权限合并到现有设置中,不会覆盖原有内容
  • 具有幂等性(可安全多次运行)
  • 需要
    jq
    工具用于JSON操作

Batch Setup

批量设置

To initialize multiple projects:
bash
for dir in ~/projects/*; do
  (cd "$dir" && ~/.claude/skills/project-init/scripts/setup-project.sh)
done
要初始化多个项目:
bash
for dir in ~/projects/*; do
  (cd "$dir" && ~/.claude/skills/project-init/scripts/setup-project.sh)
done