Orchestrate:precommit

From kagenti/kagenti · View interactive version

Orchestrate:precommit is an AI agent skill from the GitHub repository kagenti/kagenti. Add pre-commit hooks, linting, CLAUDE.md, and foundational .claude/ setup to a target repo

How to use this skill

Skill file

flowchart TD
    START(["/orchestrate:precommit"]) --> DETECT["Detect language"]:::orch
    DETECT --> PRECOMMIT["Generate .pre-commit-config.yaml"]:::orch
    PRECOMMIT --> LINT["Generate lint config"]:::orch
    LINT --> MAKEFILE["Add Makefile targets"]:::orch
    MAKEFILE --> CLAUDE_MD["Create CLAUDE.md"]:::orch
    CLAUDE_MD --> SETTINGS["Create .claude/settings.json"]:::orch
    SETTINGS --> BRANCH["Create branch"]:::orch
    BRANCH --> SIZE{Under 700 lines?}
    SIZE -->|Yes| PR["Commit + open PR"]:::orch
    SIZE -->|No| SPLIT["Split into sub-PRs"]:::orch
    SPLIT --> PR
    PR --> DONE([Phase complete])

    classDef orch fill:#FF9800,stroke:#333,color:white

Follow this diagram as the workflow.

Orchestrate: Pre-commit

Establish the code quality baseline for a target repo. This is Phase 2 and

produces PR #1 — the foundation that validates all subsequent PRs.

When to Use

Prerequisites

Step 1: Detect Language

Use the scan report or check directly:

ls .repos/<target>/go.mod .repos/<target>/pyproject.toml .repos/<target>/package.json .repos/<target>/requirements.yml 2>/dev/null

Step 2: Generate Pre-commit Config

Create .pre-commit-config.yaml with language-appropriate hooks.

Python hooks

Go hooks

Node hooks

Ansible hooks

Step 3: Generate Lint Config

Python (`pyproject.toml`)

[tool.ruff]
line-length = 120
target-version = "py311"

[tool.ruff.lint]
select = ["E", "F", "I", "W"]

Go (`.golangci.yml`)

linters:
  enable:
    - errcheck
    - govet
    - staticcheck
    - unused
run:
  timeout: 5m

Node (`.eslintrc.json`)

{
  "extends": ["eslint:recommended"],
  "env": { "node": true, "es2022": true }
}

Step 4: Add Makefile Targets

If no Makefile exists, create one. If it exists, add targets:

.PHONY: lint fmt

lint:
	pre-commit run --all-files

fmt:
	# language-specific formatter command

Step 5: Create CLAUDE.md

Template for the target repo:

# <Repo Name>

## Overview
<brief description from README or scan>

## Repository Structure
<key directories and their purpose>

## Key Commands
| Task | Command |
|------|---------|
| Lint | `make lint` |
| Format | `make fmt` |
| Test | <detected test command> |
| Build | <detected build command> |

## Code Style
- <language> with <linter>
- Pre-commit hooks: `pre-commit install`
- Sign-off required: `git commit -s`

Step 6: Create .claude/settings.json

{
  "permissions": {
    "allow": [
      "Bash(git status:*)",
      "Bash(git log:*)",
      "Bash(git diff:*)",
      "Bash(git branch:*)",
      "Bash(ls:*)",
      "Bash(cat:*)",
      "Bash(find:*)",
      "Bash(make lint:*)",
      "Bash(make fmt:*)",
      "Bash(pre-commit run:*)"
    ]
  }
}

Step 7: Create Branch and PR

Create branch in the target repo:

git -C .repos/<target> checkout -b orchestrate/precommit

PR size check

git -C .repos/<target> diff --stat | tail -1

Target ~600-700 lines. Split if over 700.

Skills to push alongside

Include initial skills in .claude/skills/ within the target repo:

Commit and push

git -C .repos/<target> add -A
git -C .repos/<target> commit -s -m "feat: add pre-commit hooks, linting, and Claude Code setup"
git -C .repos/<target> push -u origin orchestrate/precommit

Create PR

gh pr create --repo org/repo --title "Add pre-commit hooks and code quality baseline" --body "Phase 2 of repo orchestration. Adds pre-commit hooks, linting config, CLAUDE.md, and .claude/ setup."

Update Phase Status

Update /tmp/rossoctl/orchestrate/<target>/phase-status.md:

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.