返回技能列表

configure-git-repository

pjt222
更新于 5 days ago
36 次查看
17
2
17
在 GitHub 上查看
其他general

关于

This skill configures Git repositories with standardized settings including .gitignore files, branch strategies, and commit hooks. It provides language-specific templates for R, Node.js, and Python projects during initial setup. Use it when establishing version control for new projects or standardizing existing repositories.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/configure-git-repository

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

設 Git 庫

設 Git 庫附合項類之設。

用時

  • 新項目之版控初
  • 為特語/框加 .gitignore
  • 設枝護與規
  • 設提鉤

  • :項目之目
  • :項類(R 包、Node.js、Python、通)
  • 可選:遠庫之 URL
  • 可選:枝之策(主幹、Git Flow)
  • 可選:提訊之規

第一步:初庫

cd /path/to/project
git init
git branch -M main

得: .git/ 目已建。默枝名 main

敗則:git init 敗,確 Git 已裝(git --version)。若目已有 .git/,庫已初——略此步。

第二步:建 .gitignore

R 包

# R artifacts
.Rhistory
.RData
.Rproj.user/
*.Rproj

# Environment (sensitive)
.Renviron

# renv library (machine-specific)
renv/library/
renv/staging/
renv/cache/

# Build artifacts
*.tar.gz
src/*.o
src/*.so
src/*.dll

# Documentation build
docs/
inst/doc/

# IDE
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

Node.js/TypeScript

node_modules/
dist/
build/
.next/
.env
.env.local
.env.*.local
*.log
npm-debug.log*
.DS_Store
Thumbs.db
.vscode/
.idea/
coverage/

Python

__pycache__/
*.py[cod]
*.egg-info/
dist/
build/
.eggs/
.venv/
venv/
.env
*.log
.mypy_cache/
.pytest_cache/
htmlcov/
.coverage
.DS_Store
.idea/
.vscode/

得: .gitignore 檔建附合項類之條。敏檔(.Renviron.env)與生品皆排。

敗則: 若不確含何條,用 gitignore.io 或 GitHub 之 .gitignore 範為始而自改。

第三步:建初提

git add .gitignore
git add .  # Review what's being added first with git status
git commit -m "Initial project setup"

得: 初提已建含 .gitignore 與初項檔。git log 示一提。

敗則:git commit 敗以「nothing to commit」,確檔已以 git add 階。若以作者識誤敗,設 git config user.namegit config user.email

第四步:連遠

# Add remote
git remote add origin [email protected]:username/repo.git

# Push
git push -u origin main

得:origin 已設。git remote -v 示取與推 URL。初提已推於遠。

敗則: 若推敗以「Permission denied (publickey)」,設 SSH 符(見 setup-wsl-dev-environment)。若遠已存,以 git remote set-url origin <url> 更之。

第五步:設枝規

主幹(小團宜)

  • main:可產之碼
  • 功枝:feature/description
  • 修枝:fix/description
# Create feature branch
git checkout -b feature/add-authentication

# After work is done, merge or create PR
git checkout main
git merge feature/add-authentication

得: 枝名之規已立且書。團員知各類作用何前綴。

敗則: 若枝已不一名,以 git branch -m old-name new-name 易名而更開之 PR。

第六步:設提規

Conventional Commits 式:

type(scope): description

feat: add user authentication
fix: correct calculation in weighted_mean
docs: update README installation section
test: add edge case tests for parser
refactor: extract helper function
chore: update dependencies

得: 提訊之規已書且團同。後提循 type: description 式。

敗則: 若團員不循,以提訊鉤執之(見第七步)。

第七步:設預提鉤(選)

.githooks/pre-commit

#!/bin/bash
# Run linter before commit

# For R packages
if [ -f "DESCRIPTION" ]; then
  Rscript -e "lintr::lint_package()" || exit 1
fi

# For Node.js
if [ -f "package.json" ]; then
  npm run lint || exit 1
fi
chmod +x .githooks/pre-commit
git config core.hooksPath .githooks

得: 預提鉤於每 git commit 自行。查誤阻提至修。

敗則: 若鉤不行,驗 core.hooksPath 已設(git config core.hooksPath)且鉤檔可行(chmod +x)。

第八步:建 README

# Minimal README
echo "# Project Name" > README.md
echo "" >> README.md
echo "Brief description of the project." >> README.md
git add README.md
git commit -m "Add README"

得: README.md 已提於庫。項目於 GitHub 有簡而有資之落頁。

敗則:README.md 已存,更之勿覆。R 項目用 usethis::use_readme_md() 生附徽之範。

  • .gitignore 排敏與生檔
  • 無敏資(符、密)於追檔
  • 遠庫已連且可訪
  • 枝名規已書
  • 初提清建

  • .gitignore 前之提:先加 .gitignore。已追之檔不受後條影。
  • 史中之敏:若秘已提,雖刪仍於史。用 git filter-repo 或 BFG 清。
  • 大二進檔:勿提大二。逾 1MB 用 Git LFS。
  • 行末:Windows/WSL 設 core.autocrlf=input 免 CRLF/LF 問。

  • commit-changes - 階與提之流
  • manage-git-branches - 枝建與規
  • create-r-package - Git 設為 R 包建之一部
  • setup-wsl-dev-environment - Git 裝與 SSH 符
  • create-github-release - 自庫建發
  • security-audit-codebase - 察已提之秘

GitHub 仓库

pjt222/agent-almanac
路径: i18n/wenyan/skills/configure-git-repository
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

llamaguard

其他

LlamaGuard是Meta推出的7-8B参数内容审核模型,专门用于过滤LLM的输入和输出内容。它能检测六大安全风险类别(暴力/仇恨、性内容、武器、违禁品、自残、犯罪计划),准确率达94-95%。开发者可通过HuggingFace、vLLM或Sagemaker快速部署,并能与NeMo Guardrails集成实现自动化安全防护。

查看技能

cost-optimization

其他

这个Claude Skill帮助开发者优化云成本,通过资源调整、标记策略和预留实例来降低AWS、Azure和GCP的开支。它适用于减少云支出、分析基础设施成本或实施成本治理策略的场景。关键功能包括提供成本可视化、资源规模调整指导和定价模型优化建议。

查看技能

quantizing-models-bitsandbytes

其他

这个Skill使用bitsandbytes库量化大语言模型,能在GPU内存有限时通过8位或4位量化减少50-75%内存占用,同时保持精度损失最小。它支持INT8、NF4、FP4等多种量化格式,可与HuggingFace Transformers无缝集成,适用于需要部署更大模型或加速推理的场景。还提供QLoRA训练和8位优化器支持,让开发者能轻松实现高效模型压缩。

查看技能

dispatching-parallel-agents

其他

该Skill用于并行处理3个以上无依赖关系的独立故障,可为每个问题域分派专属Claude代理同时执行调查修复。它通过并发处理多个独立问题显著提升故障排查效率,特别适用于测试文件、子系统等无共享状态的场景。

查看技能