From grimoire
Adopts trunk-based development to increase deployment frequency, reduce merge conflicts, and improve CI/CD practices. Useful for teams transitioning from long-lived branches.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:apply-trunk-based-developmentThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Integrate code to a single shared branch (trunk/main) continuously — at minimum daily — using short-lived feature branches and feature flags to decouple deployment from release.
Integrate code to a single shared branch (trunk/main) continuously — at minimum daily — using short-lived feature branches and feature flags to decouple deployment from release.
Adopted by: Google (single monorepo trunk), Facebook, Netflix, Amazon — DORA research found trunk-based development is one of the strongest predictors of elite delivery performance Impact: DORA "Accelerate" (2018): trunk-based teams deploy 46x more frequently with 5x lower change failure rates; reduces integration overhead by 70% vs. long-lived branches; merge conflicts drop to near-zero Why best: Long-lived branches defer integration pain, create merge hell, and hide bugs until the worst possible time; trunk-based development makes integration continuous and cheap
Sources: Forsgren, Humble & Kim "Accelerate" IT Revolution Press (2018); DORA State of DevOps Report 2019; Hammant "Trunk Based Development" (trunkbaseddevelopment.com)
Establish main as the permanent trunk — Protect main: require CI passing before merge, require at least one approval, disallow force-push. This is the single source of truth. All deployments come from trunk. Tag releases from trunk; never create release branches.
Enforce short-lived branches — Feature branches must be merged within 1-2 days. Branches older than 2 days are a smell; branches older than 5 days are a problem. Enforce via CI: fail the pipeline on branches with no merge activity for 3 days. Long-lived branches reintroduce the integration problems trunk-based development solves.
Implement feature flags — Decouple deployment from release using feature flags (LaunchDarkly, Unleash, environment variables). New features are deployed to production but hidden behind flags. This allows integration of incomplete features without exposing them to users. Flags also enable instant rollback without redeployment.
Commit to trunk at least daily — Every engineer integrates their changes to trunk at least once per day. Daily integration is the core practice; less frequent integration is not trunk-based development. If work-in-progress is incomplete, it goes behind a feature flag.
Maintain a passing CI pipeline on trunk at all times — Trunk must be green. Every commit triggers CI. If a commit breaks trunk, fixing it is the highest priority — above new feature work. Use a team agreement: "if you break trunk, you drop everything and fix it." A broken trunk blocks all deployments.
Write branch-by-abstraction for large refactors — For changes that touch many files over multiple days: introduce a new abstraction, implement it in parallel with the old, gradually migrate callers, delete the old implementation. This allows incremental integration of large changes without a long-lived branch.
Keep PRs small — Each PR should be < 400 lines and represent one logical change. Break features into a sequence of small, safe, independently reviewable PRs. A large feature is a series of small integrations, not a large merge at the end. Stacked PRs (PR2 based on PR1) are acceptable.
Use ship/show/ask classification for PR review — Ship: trivial changes merged without review (typos, dependency bumps with no behavior change). Show: changes merged, then shown to team for async comment. Ask: changes that need discussion before merge. Reduces review bottleneck without sacrificing quality on high-stakes changes.
Automate deployment from trunk — Every merge to trunk that passes CI should automatically deploy to a staging environment. Production deployment should be a one-step process (merge + manual trigger or automatic). Manual deployment steps are bottlenecks and sources of error.
Manage release cadence with tags, not branches — Releases are tagged commits on trunk (v1.2.3). Cherry-picks to a release branch are an anti-pattern — fix forward on trunk and release a patch. Release branches that diverge from trunk accumulate debt that never merges back.
npx claudepluginhub jeffreytse/grimoire --plugin grimoireApplies GitHub Flow: short-lived feature branches, PRs with passing CI, deploy immediately on merge. Keeps main deployable for continuous deployment teams.
Design branching strategies (git flow, trunk-based development, etc.) that support parallel work while maintaining stability. Use when establishing version control discipline or managing deployment complexity.
Guides teams in choosing a branching strategy (trunk-based, GitHub Flow, Git Flow, GitLab Flow), defining commit conventions (Conventional Commits), setting up PR workflows, managing releases, and establishing git standards.