Tbdflow

From cladam/tbdflow · View interactive version

Tbdflow is an AI agent skill from the GitHub repository cladam/tbdflow. Manage Trunk-Based Development workflows using the tbdflow CLI. Use this skill to create short-lived branches, make standardised commits, sync with trunk, merge completed work, generate changelogs, log intent notes, run non-blocking reviews, recover WIP snapshots, and emit machine-readable JSON outp

How to use this skill

Skill file

tbdflow Skill

Overview

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:

tbdflow is the only interface the agent should use for Git workflow actions covered by this skill.


When to Use

Use this skill when the user wants to:

Typical trigger phrases include:


When *Not* to Use

Do not use this skill to:

If an action cannot be performed via tbdflow, explain the limitation instead of falling back to raw Git commands.


Prerequisites

Before invoking any tbdflow command, the agent must verify that the CLI is installed and accessible.

Installation Check

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.

Installation Strategies (in order of preference)

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:

tbdflow is 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.

Post-Install Verification

After installation, always confirm:

tbdflow --version

If the version is outdated, suggest:

tbdflow update

Instructions

Follow the instructions below exactly. Each capability defines intent, constraints, and decision rules.


1. Standardised Committing

Intent

Create a structured, conventional commit on trunk or a short-lived branch.

Staging Behaviour

Preconditions

Command

tbdflow commit -t <type> [-s <scope>] -m "<message>" [--body "<body>"] [--issue <issue>] [-b] [--tag <tag>]

File-Based Input (automation-friendly)

Decision Rules

checklist will appear. Unchecked items will result in a TODO: footer being appended to the commit message.

Use This When


2. Creating Short-Lived Branches

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

Use This When


3. Workflow Completion & Integration

Intent

Safely merge completed work back into trunk and clean up the branch.

Preconditions

Command

tbdflow complete -t <type> -n <name>

Decision Rules

1. The current Git branch name

2. Fallback: the most recent tbdflow branch invocation

Use This When


4. Syncing & Status

Intent

Keep the local workspace aligned with trunk and provide situational awareness.

Commands

tbdflow sync
tbdflow status

Decision Rules

Use This When


5. Radar — Situational Awareness

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

Detection 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


6. Undo — The Panic Button

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

Use This When


Pre-Commit Workflow

Always run tbdflow sync before tbdflow commit.

The sync command:

This prevents conflicts and ensures commits are based on the latest trunk state.


Validation & Linting Behaviour

tbdflow enforces workflow correctness using an internal linter. The agent must understand and respect these rules.


Commit Message Rules

Subject Line (`-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 ✓ |

Commit Body (Optional)

| Rule | Requirement |

|-------------|------------------------------------------------|

| Line Length | Each line must not exceed 80 characters |

| Separation | Must be separated from subject by a blank line |

Issue Key (`--issue`)

| Rule | Requirement | Example |

|--------|-------------------------------------|----------------------------|

| Format | Uppercase project key, dash, number | PROJ-123 ✓, proj-123 ✗ |


Branch Name Rules

| 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 ✓ |


Error Handling

If tbdflow rejects input:

  1. Read the error message carefully
  2. Correct the input based on the rules above
  3. Retry with valid parameters
  4. Do not fall back to raw Git commands

The agent should prefer generating valid inputs over relying on linter errors.


7. Breadcrumbs — Low-Friction Intent Logging

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

Storage & 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.

This gives the human auditor context on what you didn't do and why.

Use breadcrumbs to show the evolution of the logic — the dead ends, the trade-offs, the pivots.

at least 1–2 breadcrumbs explaining the major structural decisions.

slightly messier one with a clear reasoning trail.

"Velocity is nothing without observability. The trunk is live, the struggle is logged, the audit is parallel."

Agent Behaviour

Examples

| 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


8. Changelog Generation

Intent

Summarise changes using structured commit history.

Command

tbdflow changelog [--unreleased] [--from <ref>]

Decision Rules

Use This When


9. Non-Blocking Reviews

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

Commands

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

encourage fix-forward rather than blocking the trunk

configured reviewers

Use This When


10. WIP Guard & Recovery

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

persist in the object store until garbage collection (typically 14–30 days)

before the destructive part of tbdflow undo

instead of creating a corrupt state

Commands

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

Use This When


11. Repository Initialisation

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

Use This When


12. Machine-Readable JSON Output

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

(success: false, code: ci_failing) instead of prompting when CI is red

Use This When


Output Format


Examples

| 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 |


Notes

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.