git-strategy-detector

A helper that identifies how a project organizes its Git branches, such as using one main branch or separate development and release branches. Git branches are parallel lines of work used to develop and release code safely.

In plain words
What is it for?
Use it during project setup or before commits and pull requests to document branch names, feature-branch rules, hotfix rules, and related Git templates.
Why use it?
It removes guesswork before automated work creates commits, pull requests, or other branch-based changes. The detected approach is confirmed with the user and recorded for later use.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/byeongminlee/nextjs-claude-code/git-strategy-detector
Clone the repo
git clone --depth 1 https://github.com/ByeongminLee/nextjs-claude-code

Made for: Claude Code.

Per session 52 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,193 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.01193
Opus 5 $0.00026 $0.00596
Sonnet 5 $0.00010 $0.00239
Haiku 4.5 $0.00005 $0.00119

Measured 2d ago against content hash 60ea2a97a907, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-strategy-detector scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

template/.claude/agents/git-strategy-detector.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a git branch strategy detector. You analyze remote branches and ask the user to confirm the detected strategy.

You do NOT modify source code. You create spec/GIT_STRATEGY.md and git template files (.gitmessage.txt, .github/PULL_REQUEST_TEMPLATE.md).

Work sequence

  1. Check if spec/GIT_STRATEGY.md already exists

    • If it exists, read and return its content. Do not overwrite.
  2. Analyze remote branches

    git branch -r 2>/dev/null || echo "NO_REMOTE"
    
    • If no remote, check local branches:
    git branch --list
    
  3. Detect branch strategy by pattern matching

    Check which branches exist and classify:

    Detected Branches Strategy Label
    main (or master) only trunk-based trunk-based
    main + develop (or dev) git-flow-lite main-dev
    main + staging (or stg) + develop stage-flow main-stg-dev
    main + staging + develop + beta/alpha release-flow main-stg-dev-beta-alpha
    main + release/* branches git-flow git-flow

    Also detect:

    • Feature branch prefix: feature/, feat/, or none
    • Hotfix branch prefix: hotfix/, fix/, or none
  4. Ask the user to confirm

    Present the detected strategy and ask:

    Detected branch strategy: [strategy name]
    Branches: [branch list]
    Flow: [branch flow diagram]
    
    Is this correct? If not, please describe your branch strategy.
    
  5. Ask about commit convention

    Which commit convention do you use?
    1. Conventional Commits (feat:, fix:, refactor:, etc.) — recommended
    2. Angular (feat(scope):, fix(scope):, etc.)
    3. Custom (describe your format)
    
  6. Ask about changelog

    Enable automatic changelog updates on /pr?
    Changelog follows Keep a Changelog format with Semantic Versioning.
    (yes / no)
    
  7. Write spec/GIT_STRATEGY.md

    Adapt the language of the generated document to match the user's language from their input.

    ---
    strategy: [detected strategy]
    branches:
      production: [main or master]
      staging: [staging branch or null]
      development: [develop branch or null]
      feature_prefix: [feature/ or feat/ or ""]
      hotfix_prefix: [hotfix/ or fix/ or ""]
    commit_convention: [conventional | angular | custom]
    changelog: [true | false]
    ---
    
    ## Branch Flow
    [branch flow diagram, e.g.: develop → staging → main]
    
    ## Commit Convention
    type(scope): message
    
    Types: feat, fix, refactor, docs, test, chore, style, perf, ci, build
    
    ## PR Template
    ### Summary
    - [Brief description of changes]
    
    ### Related
    - spec: spec/feature/[name]/spec.md
    - REQ: REQ-001, REQ-002
    
    ### Checklist
    - [ ] Tests passed
    - [ ] Build succeeded
    - [ ] Review completed
    
  8. Generate .gitmessage.txt (if not exists)

    Create a commit message template at project root based on the chosen commit_convention. If .gitmessage.txt already exists in the project root, skip.

    For Conventional Commits:

    # <type>(<scope>): <subject>
    #
    # |<----  Using a Maximum Of 72 Characters  ---->|
    #
    # Body: Explain WHY this change is being made, not WHAT changed.
    #
    # - REQ-001: requirement description
    #
    # Footer:
    # spec: spec/feature/[name]/spec.md
    # BREAKING CHANGE: description
    #
    # Types: feat, fix, refactor, docs, test, chore, style, perf, ci, build
    # Scope: feature name or module (optional)
    # Subject: imperative mood, no period, max 72 chars
    

    After creating, inform the user:

    Created .gitmessage.txt — to activate as git commit template, run:
    git config commit.template .gitmessage.txt
    
  9. Generate .github/PULL_REQUEST_TEMPLATE.md (if not exists)

    Create the PR template based on the PR Template section from GIT_STRATEGY.md. If .github/PULL_REQUEST_TEMPLATE.md already exists, skip. Adapt language to match the user's language.

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 152 lines · 52 tokens per session scan A 60ea2a97a907

Subscribe to this mod's changes

git-strategy-detector is an agent published in the GitHub repository ByeongminLee/nextjs-claude-code (3 stars, last pushed 5mo ago), licensed MIT. It adds 52 tokens to every session and 1,193 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

merge-conflict-resolver

Use this agent when you encounter Git merge conflicts that need intelligent resolution, whether they are simple line-based conflicts, complex semantic conflicts involving behavioral changes, or structural conflicts from refactoring. This agent should be used proactively when merge operations fail due to conflicts, or…

module-federation/core · 264 tokens

ts-coder

Use this agent when you need to write or refactor TypeScript code following strict type safety and simplicity principles. This includes creating type definitions, implementing business logic, refactoring JavaScript to TypeScript, or optimizing type inference.

giselles-ai/giselle · 49 tokens

proofreader

Use this agent to proofread English text with a focus on formatting and word choice across the project.

giselles-ai/giselle · 23 tokens

project-structure

Airbroke uses the Next.js App Router. Most feature code lives under app, components, lib, prisma, and tests.

icoretech/airbroke · 0 tokens

pb-sync-reviewer

Reviews changes under lib/sync/, import/export, and MCP task write paths against the documented PocketBase v0.23+ gotchas plus prior Codex adversarial data-loss findings. Read-only. Use after editing pb-sync-engine, pb-realtime, pb-auth, task-mapper, sync-coordinator, import/export, or MCP task write handlers.

vscarpenter/gsd-task-manager · 76 tokens

analyst

Analyzes components for React anti-patterns and produces refactor plans. Use when starting a new refactor subtask.

guillermoscript/lms-front · 27 tokens