Manage Trunk-Based Development workflows using the tbdflow CLI...
This skill enables an AI agent to manage a Trunk-Based Development (TBD) workflow using the tbdflow CLI (v0.34.0).
The skill exists to:
main)recover)--json) for scripting, automation, and GUI frontendstbdflow is the only interface the agent should use for Git workflow actions covered by this skill.
Use this skill when the user wants to:
mainTypical trigger phrases include:
Do not use this skill to:
tbdflowIf an action cannot be performed via tbdflow, explain the limitation instead of falling back to raw Git commands.
Before invoking any tbdflow command, the agent must verify that the CLI is installed and accessible.
Run the following to confirm availability:
command -v tbdflow && tbdflow --version
If tbdflow is not found, the agent must attempt to install it automatically using one of the strategies below.
1. Cargo Install (requires Rust toolchain)
If cargo is available on the system:
cargo install tbdflow
This downloads the latest release from crates.io and compiles it locally.
2. GitHub Releases (pre-built binary)
If cargo is not available but curl is:
curl -fsSL https://github.com/cladam/tbdflow/releases/latest/download/tbdflow-$(uname -m)-$(uname -s | tr '[:upper:]' '[:lower:]') -o /usr/local/bin/tbdflow
chmod +x /usr/local/bin/tbdflow
Adjust the binary path if /usr/local/bin is not writable (e.g. use ~/.local/bin).
3. Manual Prompt
If neither strategy is viable, inform the user:
tbdflowis not installed. Please install it using one of:
cargo install tbdflow- Download a binary from https://github.com/cladam/tbdflow/releases
See the README for details.
After installation, always confirm:
tbdflow --version
If the version is outdated, suggest:
tbdflow update
Follow the instructions below exactly. Each capability defines intent, constraints, and decision rules.
Intent Create a structured, conventional commit on trunk or a short-lived branch.
Staging Behaviour
tbdflow automatically stages the relevant changes when committinggit add or any raw Git staging commandsPreconditions
Command
tbdflow commit -t <type> [-s <scope>] -m "<message>" [--body "<body>"] [--issue <issue>] [-b] [--tag <tag>]
File-Based Input (automation-friendly)
--message-file <path> to read the subject from a file (- for stdin). Conflicts with -m/--message.--body-file <path> to read the body from a file (- for stdin). Conflicts with --body.Decision Rules
Allowed commit types:
feat, fix, chore, docs, refactor, test, build, ci, perf, revert, styleNever invent new commit types
If no type is specified:
chore unless behaviour changesDoD Checklist: If a .dod.yml file exists in the project root and --no-verify is not passed, an interactive
checklist will appear. Unchecked items will result in a TODO: footer being appended to the commit message.
Use -b / --breaking if the change introduces breaking behaviour, and --breaking-description to describe it
Use --issue when the user references a ticket ID (JIRA, GitHub, etc.)
Use --tag <tag> to create and push an annotated tag on the commit
Any pending intent-log notes (see §7) are automatically appended to the commit body and then consumed
Use This When
Intent Start a new unit of work in a short-lived branch that will be merged back to trunk quickly.
Preconditions
Command
tbdflow branch -t <type> -n <name> [--issue <issue>] [-f <from_commit>]
Decision Rules
Branch naming follows:
<type>/<name> or<type>/<issue>-<name>If the user provides a task description:
-n parameterUse --issue when a ticket ID is available
Use -f only if the user explicitly asks to branch from a non-HEAD commit
Use This When
mainIntent Safely merge completed work back into trunk and clean up the branch.
Preconditions
Command
tbdflow complete -t <type> -n <name>
Decision Rules
Infer <type> and <name> from:
tbdflow branch invocationThe merge is performed using --no-ff
Both local and remote branch copies are deleted after merge
Use This When
Intent Keep the local workspace aligned with trunk and provide situational awareness.
Commands
tbdflow sync
tbdflow status
Decision Rules
Use sync to:
Use status to:
Use This When
Intent Orient before typing. Radar is the situational-awareness dashboard for TBD, answering three questions at a glance: is the trunk healthy (Trunk Status), where is work concentrating (Hotspots / churn), and is anyone touching the same files as me (Overlap Scan). The social coding safety net for TBD.
Commands
tbdflow radar
Decision Rules
Use radar to:
Radar is also integrated into:
tbdflow sync — shows a one-liner warning if overlap is detectedtbdflow commit — optionally warns or prompts for confirmationDetection Levels
| Level | What it checks | Speed |
|---|---|---|
file |
Same files touched (default) | ~5ms/branch |
line |
Overlapping line ranges in same files | ~50ms/branch |
Configuration (.tbdflow.yml)
radar:
enabled: true
level: file # file | line
on_sync: true # Show warnings during tbdflow sync
on_commit: warn # off | warn | confirm
ignore_patterns: # Files to exclude from overlap detection
- "*.lock"
- "*-lock.*"
- "CHANGELOG.md"
Use This When
Intent Immediately revert a broken commit on trunk, restoring it to a green state. In TBD, if trunk breaks, you fix it or revert it — there is no middle ground.
Command
tbdflow undo <sha> [--no-push]
Preconditions
Decision Rules
undo will:
git revert --no-edit--no-push)Use --no-push when the user wants to inspect the revert locally before pushing
The reverted changes remain in Git history and can be re-applied later
This command only works on commits that are on the main branch
Use This When
Always run tbdflow sync before tbdflow commit.
The sync command:
git status)This prevents conflicts and ensures commits are based on the latest trunk state.
tbdflow enforces workflow correctness using an internal linter. The agent must understand and respect these rules.
-m message)| Rule | Requirement | Example |
|---|---|---|
| Max Length | 72 characters | "add user profile" âś“ |
| Capitalisation | Must not start with a capital letter | "add feature" âś“, "Add feature" âś— |
| Punctuation | Must not end with a period | "fix bug" âś“, "fix bug." âś— |
| Type | Must be one of: feat, fix, chore, docs, refactor, test, build, ci, perf, revert, style |
feat âś“, feature âś— |
| Scope | Optional, lowercase, no spaces | -s login âś“, -s "user login" âś— |
| Message | Required, non-empty, imperative mood | "add user profile" âś“, "" âś— |
| Breaking | Must use -b flag if breaking change |
-b for breaking âś“ |
| Rule | Requirement |
|---|---|
| Line Length | Each line must not exceed 80 characters |
| Separation | Must be separated from subject by a blank line |
--issue)| Rule | Requirement | Example |
|---|---|---|
| Format | Uppercase project key, dash, number | PROJ-123 âś“, proj-123 âś— |
| Rule | Requirement | Example |
|---|---|---|
| Type | Must match commit types | feat/ âś“, feature/ âś— |
| Name | Lowercase, hyphen-separated, no spaces | add-user-profile âś“, Add User Profile âś— |
| Issue | Optional, prefixed to name | feat/API-456-add-user âś“ |
If tbdflow rejects input:
The agent should prefer generating valid inputs over relying on linter errors.
Intent Capture architectural decisions, failed attempts, or logic pivots during the development process before the final commit.
Breadcrumbs provide a lightweight way to document the why behind code changes — the reasoning that would otherwise be lost between keystrokes.
Commands
tbdflow note "<breadcrumb_message>" # canonical form
tbdflow + "<breadcrumb_message>" # shorthand alias
tbdflow n "<breadcrumb_message>" # shorthand alias
tbdflow note --show # show the current intent log
Task context (optional but recommended)
Group breadcrumbs under a named task so the intent log tells a coherent story:
tbdflow task start "<task description>" # begin a named task
tbdflow task show # show current task and notes
tbdflow task clear # discard the current intent log
Decision Rules
tbdflow commit bodyStorage & Safety
Breadcrumbs are stored locally in .tbdflow-intent.json at the repository root. This file is never committed — it is consumed and deleted after the next tbdflow commit.
tbdflow automatically ensures .tbdflow-intent.json is listed in .gitignore the first time a breadcrumb is saved. This prevents the git add . staging pattern from accidentally committing raw intent data.
If .gitignore does not exist, it will be created with the entry. If it already contains the entry, no changes are made.
Decision Rules: The Intent Log
Breadcrumbs are not optional decoration — they are the agent's audit trail.
tbdflow +.
This gives the human auditor context on what you didn't do and why."Velocity is nothing without observability. The trunk is live, the struggle is logged, the audit is parallel."
Agent Behaviour
tbdflow + to document your chain of thought during developmentExamples
| Scenario | Command |
|---|---|
| Switching architectural pattern | tbdflow + "switched from Factory to Trait: Factory felt over-engineered for this scope" |
| Documenting a rejected edge-case | tbdflow + "decided against async here: the overhead outweighs the benefits for this sync task" |
| Explaining complex regex/logic | tbdflow + "using lookahead in regex to handle nested brackets without recursion" |
Use This When
Intent Summarise changes using structured commit history.
Command
tbdflow changelog [--unreleased] [--from <ref>]
Decision Rules
--unreleased when the user asks "What's new?"--from <ref> when comparing against a specific tag or versionUse This When
Intent Facilitate Trunk-Based post-commit review. Code is already on trunk; reviews are for course correction and knowledge sharing, not gatekeeping. Reviewers focus on Intent, Impact, and Insight.
Preconditions
.tbdflow.yml (review.enabled: true)github-issue / github-workflow strategies, the GitHub CLI (gh) is installed and authenticatedCommands
tbdflow review <sha> # request a review for a specific commit
tbdflow review --trigger # request a review for the current HEAD
tbdflow review --digest [--since <time>] # list commits needing review
tbdflow review --approve <hash> # mark approved (closes issue, review-accepted)
tbdflow review --concern <hash> -m "<message>" # raise a concern (keeps issue open)
tbdflow review --dismiss <hash> -m "<message>" # dismiss (closes issue, review-dismissed)
Decision Rules
review-concern label, a comment, and a checklist item, and
encourage fix-forward rather than blocking the trunk--approve and --dismiss close the associated issue; --concern keeps it open-m/--message is required with --concern and --dismissgithub-issue (direct issues), github-workflow (GitHub Actions, audit trails), log-only (offline)Use This When
Intent Never lose work-in-progress. WIP Guard automatically captures immutable snapshots of the working directory at key moments so uncommitted work can always be recovered.
How it works
git stash create — they don't touch the stash reflog, can't interfere with manual stashes, and
persist in the object store until garbage collection (typically 14–30 days)tbdflow note/+, tbdflow sync, tbdflow radar (if dirty), and
before the destructive part of tbdflow undosync or undo, tbdflow checks for an in-progress rebase/merge/cherry-pick and halts with a clear message
instead of creating a corrupt stateCommands
tbdflow recover --list # show available snapshots
tbdflow recover <index> # restore a snapshot by index
tbdflow recover <hash> # restore a snapshot by commit hash
Decision Rules
git stash apply (not pop), so they remain available for repeated recoveryUse This When
Intent
Set up a repository for Trunk-Based Development, generating .tbdflow.yml and .dod.yml defaults.
Command
tbdflow init # interactive
tbdflow init --yes # non-interactive, accept all defaults
tbdflow init --yes --main-branch trunk
tbdflow init --yes --remote git@github.com:org/repo.git
Decision Rules
--yes (non-interactive) for automated environments, scaffolding scripts, and agent-driven setup--main-branch sets the trunk name (default: main)--remote links a remote URL and pushes the initial commitinit in each subdirectory of a monorepo to enable per-project scopingUse This When
Intent Emit structured JSON for scripting, automation, CI, and GUI frontends instead of human-readable text.
Command
tbdflow --json <command>
Supported commands
info, status, radar, sync, recover --list, task show, and note --show.
Output envelope
{ "success": true, "data": { ... } }
On failure the envelope includes a stable code for programmatic handling:
{ "success": false, "error": "Working directory is not clean", "code": "dirty_worktree" }
Stable error codes
missing_args, dirty_worktree, ci_failing, not_a_repo, unborn_no_commits, branch_not_found,
tag_exists, not_on_main, cannot_complete_main, git_failed.
Decision Rules
--json whenever the user asks for machine-readable output, or when driving an integration/GUI--json is a global flag and must precede the subcommand (e.g. tbdflow --json status)success field first; on false, branch on the code field rather than the human messagestatus output is enriched with ahead/behind counts and trunk_ci; sync returns a blocked response
(success: false, code: ci_failing) instead of prompting when CI is redUse This When
tbdflow| User Input | Action |
|---|---|
| "Commit this as a bug fix for login." | tbdflow commit -t fix -s login -m "resolve timeout issue" |
| "Start working on API-456: Add user profile." | tbdflow branch -t feat -n add-user-profile --issue API-456 |
| "Merge my current work back to main." | tbdflow complete -t <current_type> -n <current_name> |
| "Sync me up." | tbdflow sync |
| "Anyone else working on this file?" | tbdflow radar |
| "Revert commit abc1234, it broke the build." | tbdflow undo abc1234 |
| "I switched from Factory to Trait." | tbdflow + "switched from Factory to Trait: Factory felt over-engineered for this scope" |
| "Start a task for the auth refactor." | tbdflow task start "Refactor auth module" |
| "Request a review of the latest commit." | tbdflow review --trigger |
| "Approve commit abc1234." | tbdflow review --approve abc1234 |
| "I lost my changes, recover them." | tbdflow recover --list then tbdflow recover <index> |
| "Set up this repo for TBD non-interactively." | tbdflow init --yes |
| "Give me the status as JSON." | tbdflow --json status |
| "What changed since the last version?" | tbdflow changelog --unreleased |
main (trunk) as sacred