Skill v1.0.1
currentAutomated scan100/1003 files
version: "1.0.1" name: git description: Git workflow standards, commit conventions, hooks, and pull request practices. Use this when users need guidance on Conventional Commits, Git hooks with Lefthook, pull request templates, .gitignore configuration, or Git workflow best practices for team collaboration. license: MIT - Complete terms in LICENSE.txt
Git Skills & Best Practices
Git workflow standards, commit conventions, hooks, and pull request practices.
Table of Contents
Git Workflow
Conventional Commits
MUST use Conventional Commits format - this is a strict requirement. Follow the Conventional Commits specification:
Format:
<type>[optional scope]: <description>[optional body][optional footer(s)]
Types:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the coderefactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
Examples:
feat(auth): add user login functionalityfix(api): resolve race condition in data fetchingdocs: update README with setup instructions
.gitignore
Include standard exclusions for React/React Native projects:
Essential entries:
# Environment variables.env.env.local.env.*.local# Dependenciesnode_modules/.pnp.pnp.js# Build outputsdist/build/.next/out/# Testingcoverage/.nyc_output/# IDE.vscode/.idea/*.swp*.swo*~# OS.DS_StoreThumbs.db# Logs*.lognpm-debug.log*yarn-debug.log*yarn-error.log*lerna-debug.log*pnpm-debug.log*# pnpm.pnpm-store/# Misc.cache/.temp/.turbo/
Git Hooks
Lefthook Integration
PREFER using Lefthook for managing git hooks (guideline). Other tools are acceptable if they meet the strict hook requirements below.
Configuration (`lefthook.yml`):
pre-commit:parallel: truecommands:lint:run: pnpm run lintstage_fixed: trueformat:run: pnpm run format:checkstage_fixed: truetest:run: pnpm run test:cistage_fixed: truepre-push:parallel: truecommands:test:run: pnpm run testtypecheck:run: pnpm run typecheck
Pre-commit hooks (Strict Requirements):
- MUST run linting checks
- MUST run formatting checks
- MUST run unit tests
- Auto-fix issues when possible
Pre-push hooks (Strict Requirements):
- MUST run full test suite
- MUST run TypeScript type checking (
tsc) - MUST prevent pushing if checks fail
Pull Request Templates
Create .github/pull_request_template.md with the following structure:
## Overview<!-- Brief description of what this PR accomplishes -->## Solution<!-- Detailed explanation of the approach and implementation -->## Screenshots<!-- Add screenshots or screen recordings if applicable --><!-- For web: browser screenshots --><!-- For mobile: iOS/Android screenshots -->## Ticket<!-- Link to JIRA ticket or other project management tool --><!-- Format: [PROJECT-123](link-to-ticket) -->## Tested On<!-- Check all that apply -->-[ ] Web-[ ] Mobile-[ ] iOS-[ ] Android-[ ] Other: ___________## Additional Notes<!-- Any additional context, breaking changes, or follow-up items -->
GitHub CLI (gh) Integration
The GitHub CLI (gh) enables AI agents to interact with GitHub repositories programmatically, automating common Git and GitHub workflows.
Authentication
Setup:
# Login to GitHubgh auth login# Check authentication statusgh auth status# Refresh authentication tokengh auth refresh
For AI Agents:
- Use
gh auth tokento retrieve the authentication token for API calls - Configure authentication before performing any GitHub operations
- Use
gh auth setup-gitto configure Git credentials automatically
Pull Request Management
Create Pull Requests:
# Create a PR interactivelygh pr create# Create a PR with title and bodygh pr create --title "feat: add user authentication" --body "Implements OAuth2 login flow"# Create a PR from current branch to maingh pr create --base main --head feature/auth --title "feat: add authentication"# Create a draft PRgh pr create --draft
View and Manage PRs:
# List open PRsgh pr list# View PR detailsgh pr view <number># View PR diffgh pr diff <number># Checkout PR locallygh pr checkout <number># Review PR status and checksgh pr checks <number># Comment on PRgh pr comment <number> --body "LGTM! Great work."# Approve PRgh pr review <number> --approve# Merge PRgh pr merge <number> --squashgh pr merge <number> --mergegh pr merge <number> --rebase
For AI Agents:
- Automatically create PRs after completing features
- Check PR status and wait for CI checks to pass
- Add comments with analysis or suggestions
- Merge PRs after approval (when appropriate)
Issue Management
Create and Manage Issues:
# Create an issuegh issue create --title "Bug: login fails" --body "Description of the bug"# List issuesgh issue list# View issue detailsgh issue view <number># Comment on issuegh issue comment <number> --body "This is fixed in PR #123"# Close issuegh issue close <number># Reopen issuegh issue reopen <number>
For AI Agents:
- Create issues for bugs discovered during code review
- Link issues to PRs automatically
- Update issue status based on PR status
- Create issues from TODO comments or technical debt
Repository Operations
Repository Management:
# Clone a repositorygh repo clone owner/repo# View repository detailsgh repo view# Create a new repositorygh repo create my-project --public --clone# Fork a repositorygh repo fork owner/repo# View repository settingsgh repo view --web
For AI Agents:
- Clone repositories for analysis or contribution
- Create new repositories with proper structure
- Fork repositories for experimentation
Branch and Commit Operations
Branch Management:
# List branchesgh repo view --json defaultBranchRef# Create branch from issuegh issue develop <number> --branch feature/issue-123
Browse GitHub Resources:
# Open current PR in browsergh pr view --web# Open current issue in browsergh issue view --web# Open repository in browsergh repo view --web
Search and Discovery
Search Capabilities:
# Search codegh search code "function authenticate"# Search repositoriesgh search repos "react typescript"# Search issuesgh search issues "bug login"# Search pull requestsgh search prs "is:open author:@me"
For AI Agents:
- Search for similar implementations before creating new code
- Find existing issues or PRs related to current work
- Discover patterns and best practices from other repositories
API Access
Direct API Calls:
# Make authenticated API callsgh api repos/:owner/:repo/pulls# Get specific datagh api repos/:owner/:repo/pulls/123 --jq '.title, .body'# POST requestsgh api repos/:owner/:repo/issues -X POST -f title="New Issue" -f body="Description"
For AI Agents:
- Access GitHub API for advanced operations not covered by CLI commands
- Retrieve detailed data in JSON format for processing
- Perform bulk operations efficiently
Workflow Automation Examples
Complete Feature Workflow:
# 1. Create and checkout feature branchgit checkout -b feature/new-feature# 2. Make changes and commitgit add .git commit -m "feat: implement new feature"# 3. Push branchgit push -u origin feature/new-feature# 4. Create PRgh pr create --title "feat: implement new feature" --body "Description" --draft# 5. Wait for CI checksgh pr checks --watch# 6. After approval, mergegh pr merge --squash --delete-branch
For AI Agents:
- Automate the complete PR workflow from branch creation to merge
- Monitor CI checks and retry failed workflows
- Update PR descriptions with analysis or documentation
- Clean up branches after merge
Best Practices for AI Agents
- Always authenticate first: Check
gh auth statusbefore operations - Use appropriate PR flags: Use
--draftfor work-in-progress,--fillto auto-populate from commits - Monitor CI checks: Use
gh pr checks --watchto wait for checks to complete - Provide context: Always include meaningful titles and descriptions
- Link related items: Reference issues in PR descriptions with
Closes #123 - Handle errors gracefully: Check command exit codes and provide helpful error messages
- Respect rate limits: Implement delays for bulk operations
- Use JSON output: Use
--jsonflag for programmatic processing
Additional Resources
Notes
- This document should be reviewed and updated regularly as best practices evolve
- Team-specific additions and modifications are encouraged
- When in doubt, refer to official documentation and community standards