home / skills / intellectronica / agent-skills / here-be-git

here-be-git skill

/skills/here-be-git

This skill initialises a git repository in the current directory, configures agent commit workflow and optional .gitignore to streamline version control.

npx playbooks add skill intellectronica/agent-skills --skill here-be-git

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.5 KB
---
name: here-be-git
description: Initialise a git repository with optional agent commit instructions and .gitignore. Use when users say "here be git", "init git", "initialise git", or otherwise indicate they want to set up version control in the current directory.
---

# Here Be Git

Initialise a git repository with optional configuration for agent workflows.

## Workflow

### Step 1: Initialise Git Repository

Run `git init` in the current working directory. Confirm to the user that the repository has been initialised.

### Step 2: Agent Commit Instructions

Ask the user:

> Would you like me to add instructions for the agent to always commit when it's done with a task?

If the user confirms:

1. Check if `AGENTS.md` exists in the current directory
2. If it exists, append the commit instructions to it
3. If it doesn't exist, create it with the commit instructions

The commit instructions to add:

```markdown
## Git Workflow

- Always commit your changes when you have completed a task or reached a logical stopping point
- Use clear, descriptive commit messages that explain what was done and why
- Ensure the working directory is clean (all changes committed) before ending your session
```

After creating or updating `AGENTS.md`:

1. Check if `CLAUDE.md` exists in the current directory
2. If it doesn't exist, create it with just `@AGENTS.md` followed by a newline
3. If it exists but doesn't already have `@AGENTS.md` at the top, prepend `@AGENTS.md` followed by a newline to the existing content
4. Commit both files together with an appropriate message

### Step 3: Gitignore Configuration

Ask the user:

> Would you like me to create a .gitignore? If so, what flavour or patterns should I include? (e.g., Node.js, Python, macOS, IDE files, or specific files/patterns)

If the user provides a flavour or patterns:

1. Generate an appropriate `.gitignore` based on their input
2. For common flavours, include standard patterns:
   - **Node.js**: `node_modules/`, `dist/`, `.env`, `*.log`, etc.
   - **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `.env`, `*.egg-info/`, etc.
   - **macOS**: `.DS_Store`, `.AppleDouble`, `.LSOverride`, `._*`
   - **IDE files**: `.idea/`, `.vscode/`, `*.swp`, `*.swo`, `*.sublime-*`
3. Include any specific files or patterns the user mentions
4. Commit the `.gitignore` with an appropriate message

If the user declines, skip this step.

## Notes

- If git is already initialised in the directory, inform the user and skip to Step 2
- Use the AskUserQuestion tool for the confirmation prompts
- Keep commits atomic and well-described

Overview

This skill initializes a Git repository in the current directory and optionally sets up agent commit instructions and a .gitignore. It guides the user through confirming automatic commit guidance for agents, creating or updating AGENTS.md and CLAUDE.md as needed, and generating a tailored .gitignore. The goal is a clean, version-controlled workspace with clear agent workflow notes.

How this skill works

The skill runs git init unless a repository already exists, then asks whether to add agent commit instructions. If confirmed, it creates or appends a Git workflow section to AGENTS.md and ensures CLAUDE.md references AGENTS.md at the top. It then offers to generate a .gitignore based on common flavours or user-specified patterns and commits changes with clear, atomic messages.

When to use it

  • You want to initialize version control in a project folder
  • You want agents to follow a consistent commit workflow
  • You need a .gitignore tailored to language or OS patterns
  • You are starting a new project and want immediate Git setup
  • You want concise, atomic commits documenting initial configuration

Best practices

  • Notify the user if git is already initialized and skip redundant init
  • Keep agent commit guidance brief and clear to encourage consistent behaviour
  • Create or append AGENTS.md atomically with a single clear commit
  • Prepend @AGENTS.md at the top of CLAUDE.md only if not already present
  • When creating .gitignore, include both common defaults for the chosen flavour and any user-specified patterns

Example use cases

  • New project: run the skill to initialize git, add Python .gitignore, and add agent commit rules
  • Existing repo without agent rules: skip init, append commit guidance to AGENTS.md and update CLAUDE.md
  • Cross-platform repo: generate a combined .gitignore for macOS, IDE files, and Node.js artifacts
  • Minimal setup: initialize git and only create AGENTS.md so agents know to commit frequently

FAQ

What happens if a git repo already exists in the folder?

The skill detects an existing repository, informs you, and skips git init. It still offers to add or update AGENTS.md, CLAUDE.md, and .gitignore as requested.

How are commits created and messaged?

Changes are committed atomically with clear messages describing the created or updated files, e.g., "init: add AGENTS.md and CLAUDE.md" or "config: add .gitignore (Python)".

Will existing AGENTS.md or CLAUDE.md be overwritten?

No. AGENTS.md is appended if present; CLAUDE.md is prepended with @AGENTS.md only if that marker is not already at the top. Existing content is preserved.