AgentSkillsCN

project-init

通过标准钩子和特定于语言的权限,初始化 Claude Code 项目设置。适用于为新项目配置 Claude Code,或在现有项目中添加标准化配置时使用。

SKILL.md
--- frontmatter
name: project-init
description: Initialize Claude Code project settings with standard hooks and language-specific permissions. Use when setting up a new project for Claude Code or adding standard configuration to an existing project.

Project Init

Initialize a project with standard Claude Code configuration.

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

Language Detection

The script detects languages based on project files and adds permissions:

Detection FileLanguagePermissions Added
go.modGogo, golangci-lint, staticcheck, govulncheck
Package.swift, *.xcodeprojSwiftswift, xcodebuild, swiftlint, xcrun
package.jsonNode.jsnpm, npx, node, plus yarn/pnpm/bun if lockfiles present
pyproject.toml, requirements.txtPythonpython, pip, uv, pytest, ruff, mypy
Cargo.tomlRustcargo, rustc
GemfileRubyruby, bundle, rake, rspec
pom.xmlJava (Maven)mvn, java
build.gradleJava (Gradle)gradle, ./gradlew, java
DockerfileDockerdocker, docker-compose
*.tfTerraformterraform, tofu
MakefileMakemake

git is always included.

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

Batch Setup

To initialize multiple projects:

bash
for dir in ~/projects/*; do
  (cd "$dir" && ~/.claude/skills/project-init/scripts/setup-project.sh)
done