Skip to content

t3chn/flowkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FlowKit

AI-driven development workflow template for projects with backend/frontend split. Extracted from production experience.

Clone, plug in your stack, get a working flow of tasks, agents, and quality gates.

What's Inside

flowkit/
β”œβ”€β”€ CLAUDE.md                            # Root conventions (anti-drift, team workflow)
β”œβ”€β”€ Taskfile.yml                         # Root taskfile β€” delegates to backend/frontend
β”œβ”€β”€ .pre-commit-config.yaml              # Single hook config (repo root)
β”œβ”€β”€ .gitignore                           # OS, IDE, language ignores
β”œβ”€β”€ .editorconfig                        # Consistent formatting (tabs, spaces, line endings)
β”œβ”€β”€ .beads/                              # Task tracking (git-native, no external services)
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ beads_contract_lint.py           # Scope contract validator
β”‚   β”œβ”€β”€ commit_msg_lint.py               # Commit message format validator
β”‚   β”œβ”€β”€ no_cyrillic_lint.py              # Ensures English-only codebase
β”‚   └── secrets_lint.py                  # Detects leaked secrets and credentials
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ CLAUDE.md                        # Backend conventions
β”‚   β”œβ”€β”€ Taskfile.yml                     # Backend commands (dev, check, test, lint)
β”‚   β”œβ”€β”€ .claude/
β”‚   β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”‚   β”œβ”€β”€ dev.md                   # Implements tasks via TDD
β”‚   β”‚   β”‚   β”œβ”€β”€ tester.md                # Verifies implementations
β”‚   β”‚   β”‚   └── reviewer.md              # Code review + security
β”‚   β”‚   └── commands/
β”‚   β”‚       β”œβ”€β”€ new-task.md              # /new-task β€” create task with scope contract
β”‚   β”‚       β”œβ”€β”€ new-adr.md               # /new-adr β€” Architecture Decision Record
β”‚   β”‚       └── dep-review.md            # /dep-review β€” dependency gate
β”‚   β”œβ”€β”€ cmd/api/                         # Entry point (placeholder)
β”‚   β”œβ”€β”€ internal/                        # Business logic (placeholder)
β”‚   └── docs/{plans,adr}/               # Design docs and ADRs
β”‚
└── frontend/
    β”œβ”€β”€ CLAUDE.md                        # Frontend conventions
    β”œβ”€β”€ Taskfile.yml                     # Frontend commands (dev, check, typecheck, lint, test)
    β”œβ”€β”€ .claude/
    β”‚   β”œβ”€β”€ agents/{dev,tester,reviewer}.md
    β”‚   └── commands/{new-task,new-adr,dep-review}.md
    β”œβ”€β”€ src/                             # Source code (placeholder)
    └── docs/{plans,adr}/               # Design docs and ADRs

Dependencies

Required

Tool Purpose Install
Claude Code AI agent (CLI) npm install -g @anthropic-ai/claude-code
Beads (bd) Git-native task tracking cargo install beads or brew install beads
Task Command runner (Make replacement) brew install go-task or sh -c "$(curl -ssL https://taskfile.dev/install.sh)"
pre-commit Git hooks framework pip install pre-commit or brew install pre-commit
Python 3.10+ For lint scripts Usually pre-installed
Git 2.30+ VCS Usually pre-installed

Optional (stack-dependent)

Backend (Go):

Tool Purpose Install
Go 1.22+ Compiler brew install go
golangci-lint Extended linter brew install golangci-lint
golang-migrate SQL migrations brew install golang-migrate

Frontend (Node.js/TypeScript):

Tool Purpose Install
Node.js 20+ Runtime brew install node or fnm
npm / pnpm / bun Package manager Ships with Node.js

Other stacks: Plug in your own tools β€” the template is stack-agnostic.

Quick Start

1. Clone and configure

git clone <this-repo> my-project
cd my-project

# Initialize beads (if cloned without .beads/)
bd init

2. Configure your stack

Open backend/CLAUDE.md and frontend/CLAUDE.md, replace <!-- TODO --> blocks with your stack:

## Active Technologies
- Go 1.22, PostgreSQL, pgx/v5        # backend example
- TypeScript 5.x, React 19, Vite 7   # frontend example

3. Install hooks and dependencies

# From repo root β€” one command sets up everything:
task setup

This installs pre-commit hooks (beads contract lint + commit message lint + secrets detection + Cyrillic check) and runs backend/frontend setup.

4. Uncomment pre-commit hooks for your stack

In the root .pre-commit-config.yaml, uncomment the Backend/Frontend sections:

# Was (commented):
# - id: backend-build
#   entry: bash -c 'cd backend && go build ./...'

# Now:
- id: backend-build
  entry: bash -c 'cd backend && go build ./...'

5. Fill in Taskfile.yml

Replace echo "TODO: ..." with real commands in backend/Taskfile.yml and frontend/Taskfile.yml:

# backend/Taskfile.yml
dev:
  cmd: go run ./cmd/api
test:
  cmd: go test ./... {{.CLI_ARGS}}
lint:
  cmd: golangci-lint run
# frontend/Taskfile.yml
dev:
  cmd: npm run dev
typecheck:
  cmd: npm run typecheck
test:
  cmd: npm test -- --run {{.CLI_ARGS}}

How the Flow Works

Scope Contracts (Anti-Drift)

Every task is a strict contract. The agent cannot exceed its boundaries:

## Objective
Add paginated GET /api/reports endpoint.

## Must-Haves (max 3)
- [ ] Handler in internal/api/reports.go with query params ?page=&limit=
- [ ] SQL query with OFFSET/LIMIT in internal/storage/reports.go
- [ ] Table-driven test cases in internal/api/reports_test.go

## Non-Goals
- Date filtering (separate task)
- Response caching
- OpenAPI specification
- Endpoint authorization

## Constraints
- Go 1.22 stdlib http.ServeMux
- pgx/v5 for PostgreSQL
- Response: JSON `{"items": [...], "total": N, "page": N}`

## Verification
```bash
go build ./...                                    # compiles
go test ./internal/api/... -run TestReports       # tests pass
go vet ./...                                      # no issues
curl localhost:8080/api/reports?page=1&limit=10   # 200 + JSON

Acceptance Criteria

  • go test ./internal/api/... -> PASS, 3+ test cases
  • curl .../api/reports?page=1&limit=10 -> 200, JSON with items/total/page fields

**Why this matters:**
- AI agent gets clear boundaries β€” won't add "helpful" features
- Non-Goals explicitly list what the agent would typically add on its own
- Verification β€” copy-pasteable commands with expected output
- Acceptance Criteria β€” measurable conditions (numbers, status codes, not "works correctly")

### Three Agents

bd ready | v +---------+ +----------+ +-----------+ | dev |---->| tester |---->| reviewer |--> bd close | | | | | | | Writes | | Runs all | | Reads | | code | | Verifi- | | code, | | per | | cation | | checks | | Must- | | commands | | patterns | | Haves | | | | and | | | | | | security | | TDD | | | | | +---------+ +----------+ +-----------+


**Parallelism:** Independent tasks (no `blocked_by`) launch parallel dev agents:

Wave 1: AUTH-1 --> dev-1 DASH-1 --> dev-2 (3 parallel agents) API-1 --> dev-3

Wave 2 (after wave 1): AUTH-2 --> dev-1 DASH-2 --> dev-2 (waited for wave 1 to finish)


### Commit Messages

Format readable by both humans and AI agents:

feat: add paginated reports endpoint

Goal: enable frontend to fetch reports with pagination Why: dashboard needs to display 100+ reports without loading all at once

Refs: beads-a3f2dd Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com


Types: `feat` | `fix` | `refactor` | `docs` | `test` | `chore` | `infra`

`Why:` is mandatory for `feat`, `fix`, `refactor` β€” the linter will reject commits without it.

### Quality Gates (pre-commit)

On every commit, automatically:

1. **beads-contract-lint** β€” validates all open tasks have a complete scope contract
2. **commit-msg-lint** β€” validates message format (`<type>: ...` + `Why:`)
3. **secrets-lint** β€” detects leaked API keys, tokens, passwords, private keys
4. **no-cyrillic-lint** β€” ensures English-only codebase (no accidental Cyrillic)
5. **Stack-specific** (uncomment): build, typecheck, lint, test

### Slash Commands

Available in Claude Code from `.claude/commands/`:

| Command | What it does |
|---------|-------------|
| `/new-task <description>` | Creates a task with full scope contract |
| `/new-adr <decision>` | Creates an Architecture Decision Record |
| `/dep-review <package>` | Evaluates a dependency (default: REJECT) |

### Session Protocol

Before ending every session:

```bash
task done          # 1. Quality gates + beads sync
git add <files>    # 2. Stage changes
git commit         # 3. Commit with proper format
bd sync            # 4. Sync beads
git push           # 5. Push to remote

Adapting for Your Project

Minimal Setup

  1. task setup β€” install hooks
  2. Fill in backend/CLAUDE.md and frontend/CLAUDE.md β€” project description and stack
  3. Uncomment hooks in root .pre-commit-config.yaml
  4. Replace TODO in backend/Taskfile.yml and frontend/Taskfile.yml

Full Setup

  1. CLAUDE.md β€” add specific code patterns, banned practices, approved dependencies
  2. Agents β€” adapt checklists in reviewer.md for your stack (TypeScript strict? Go vet? Python mypy?)
  3. Design docs β€” create first plan in docs/plans/ with architectural decisions
  4. ADR β€” record stack choices via /new-adr
  5. Pre-commit β€” add stack-specific hooks (prettier, black, rustfmt)

Monorepo vs Separate Repos

FlowKit defaults to monorepo (single .beads/ for the whole project). For separate repos:

  1. Copy backend/ and frontend/ into separate git repositories
  2. Run bd init in each
  3. Use **Working directory:** ~/path/to/repo in scope contracts for cross-repo tasks

Core Principles

1. Anti-Drift

Every task is a contract. Don't add what's not in Must-Haves.

AI agents tend toward "helpful additions" β€” adding tests nobody asked for, refactoring adjacent code, adding error handling "for the future". Scope contracts with explicit Non-Goals prevent this.

2. Verification > Trust

Don't trust "done". Run the commands and show the output.

Every task contains copy-pasteable commands with expected results. The tester agent runs them all and reports actual output.

3. Dependency Gate

Default is REJECT. 50 lines of code beats a new dependency.

/dep-review evaluates each dependency formally: size, maintainer, alternatives, CVEs. Approved ones go into CLAUDE.md.

4. Commits = Documentation

A commit is AI-readable history. Goal + Why matters more than the diff.

Future agents (and humans) read git log to understand why changes were made, not just what changed.

5. Wave Parallelism

Independent tasks = parallel agents. Dependent tasks = sequential waves.

bd dep add builds a dependency graph. bd ready shows tasks with no blockers β€” they can run in parallel.

Beads Cheat Sheet

# Find work
bd ready                                  # tasks with no blockers
bd list --status=open                     # all open
bd list --status=in_progress              # in progress

# Create and update
bd create --title="Add X" --type=task --priority=2
bd update <id> --status=in_progress       # claim work
bd update <id> --description="..."        # update description
bd close <id>                             # complete

# Dependencies
bd dep add <task> <depends-on>            # task depends on depends-on
bd blocked                                # show blocked tasks
bd show <id>                              # details + what blocks it

# Sync
bd sync                                   # sync with git
bd stats                                  # project statistics

FAQ

Q: Why beads instead of GitHub Issues / Linear / Jira? A: Beads lives in git (.beads/issues.jsonl). AI agents read and write tasks via CLI without API tokens. Works offline. Merges like code.

Q: Why Taskfile instead of Makefile? A: YAML is more readable, cross-platform, supports task dependencies, CLI_ARGS passthrough. task check instead of make check.

Q: Why three agents instead of one? A: Separation of concerns. Dev doesn't verify its own work. Tester runs Verification commands literally. Reviewer checks patterns and security. Like human code review, but automated.

Q: Can I use this without Claude Code? A: CLAUDE.md, scope contracts, and Taskfile work with any AI assistant. Agents and slash-commands are Claude Code-specific. Beads is a standalone CLI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages