configure-git-repository
About
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.
Quick Install
Claude Code
Recommendednpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/configure-git-repositoryCopy and paste this command in Claude Code to install this skill
Documentation
設 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.name 與 git 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 Repository
Related Skills
llamaguard
OtherLlamaGuard is Meta's 7-8B parameter model for moderating LLM inputs and outputs across six safety categories like violence and hate speech. It offers 94-95% accuracy and can be deployed using vLLM, Hugging Face, or Amazon SageMaker. Use this skill to easily integrate content filtering and safety guardrails into your AI applications.
cost-optimization
OtherThis Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.
quantizing-models-bitsandbytes
OtherThis skill quantizes LLMs to 8-bit or 4-bit precision using bitsandbytes, achieving 50-75% memory reduction with minimal accuracy loss. It's ideal for running larger models on limited GPU memory or accelerating inference, supporting formats like INT8, NF4, and FP4. The skill integrates with HuggingFace Transformers and enables QLoRA training and 8-bit optimizers.
dispatching-parallel-agents
OtherThis Claude Skill dispatches multiple agents to investigate and fix 3+ independent problems concurrently. It is designed for scenarios involving unrelated failures that can be resolved without shared state or dependencies. The core capability is parallel problem-solving, assigning one agent per independent problem domain to maximize efficiency.
