Defra branching strategy — never commit or push directly to main or master. Use a feature branch named for the work, open a pull request, get review, then merge. Use when the agent is about to run git commit, git push, or git checkout, or when a developer asks how to start a piece of work.
Ships in defra-shared. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Defra repositories use a feature-branch workflow. Direct commits to main (or master on older repos) are forbidden. Every change goes through a feature branch and a pull request, even one-line changes.
main:
git checkout main
git pull --ff-only
git checkout -b <prefix>/<short-description>
feature/<name> for new functionalityfix/<name> for bug fixeschore/<name> for tooling, deps, refactors with no behaviour changedocs/<name> for documentation-only changesfeature/CAIT-96-defra-shared-plugin.origin and open a pull request. Never git push directly to main / master.The companion hook branch-guard enforces this: any git commit or git push while HEAD is on main / master is blocked, and any git push -f / --force / --force-with-lease whose args mention main / master is blocked from any branch (force-push to a protected branch is refused even when you are not currently on it).
git commit on main / master — even "just this once".git push origin main / git push origin master.git push --force to a shared branch (rebase locally, then --force-with-lease to your own feature branch only).develop branch in parallel with main — Defra repos use trunk-based branching off main only.node_modules/, .env) onto any branch.main / master.If a user asks the agent to do any of the above, the agent refuses and explains the standard.
User: "I've made a small typo fix in the README, just commit it on main."
Agent response:
I can't commit directly to
main— Defra branching requires every change to go through a feature branch and a pull request, even one-line fixes. Here's what I'll do instead:git checkout -b docs/fix-readme-typo git add README.md git commit -m "docs: fix typo in install instructions" git push -u origin docs/fix-readme-typoThen open a pull request from
docs/fix-readme-typointomain. Want me to draft the PR description as well?
If the agent is already on main when the user asks for a commit, it switches to a new branch first — it does not just commit and hope.
feature/ vs feat/ vs Jira-id-only) is not yet pinned by the project owner. The provisional set above (feature/, fix/, chore/, docs/) is what this skill enforces until that lands. See the open-questions list in docs/spec/PLAN.md "Decisions still required" in the upstream planning repo.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/defra-accessibilityDefra accessibility expectations — WCAG 2.2 AA for code-generating roles (frontend, backend rendering HTML), and semantic-markup expectations for documentation roles. Use when the agent generates a page, a component, a markdown file, or any artefact that will be read by a screen reader, a keyboard-only user, or a user with reduced vision./defra-commit-messagesDefra commit-message format — provisionally Conventional Commits (type(scope) subject + optional body and footers). Subject ≤ 72 chars, imperative mood, no trailing period. Use whenever the agent is about to run git commit -m, draft a commit message for a developer, or review an existing commit message./defra-quality-gatesDefra code-quality gates — lint, format, test, and coverage must all pass before code is committed. The role plugin pins the exact toolchain (ESLint/Prettier/Vitest, dotnet format/xUnit, ruff/black/pytest, etc.); this skill states the universal expectations. Use before git commit, when wiring a new project, or when a hook reports a failure./defra-security-piiDefra security and PII handling — never hard-code secrets, never log PII, refuse unsafe template patterns, and redact known UK PII (NI numbers, NHS numbers, postcodes, DoB combinations) before any output leaves the service. Use when the agent is editing code that handles user data, writing log lines, configuring templates, or wiring credentials./defra-shared:defra-branchingfrom defra-shared
npx claudepluginhub defra/defra-ai-plugins --plugin defra-shared