diff --git a/README.md b/README.md index 2665999..e8c6eb7 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,23 @@ steps: require_files: ["deploy-receipt.txt"] ``` +### Workflow Templates + +Pre-built workflows for common project types in `workflows/templates/`: + +| Template | Use Case | +|----------|----------| +| `api-wrapper.yml` | REST API client library (auth, endpoints, tests, docs) | +| `k8s-service.yml` | Containerized K8s service (Dockerfile, manifests, CI) | +| `cli-tool.yml` | Command-line tool (arg parsing, output, tests, packaging) | +| `project-onboarding.yml` | Bootstrap new project (git, CI, publish.json, first spec) | + +```bash +# Start from a template +cp workflows/templates/api-wrapper.yml workflows/my-api.yml +bash ~/.claude/shtd-flow/scripts/shtd-workflow.sh start my-api +``` + ## Multi-Tab Task Negotiation When multiple Claude Code sessions work on the same project: diff --git a/workflows/templates/api-wrapper.yml b/workflows/templates/api-wrapper.yml new file mode 100644 index 0000000..65381ec --- /dev/null +++ b/workflows/templates/api-wrapper.yml @@ -0,0 +1,46 @@ +name: api-wrapper +description: Build a REST API wrapper library (client SDK, tests, docs) +version: 1 +steps: + - id: spec + name: Write API spec (endpoints, auth, error handling) + gate: + require_files: [] + completion: + require_files: ["specs/001-api-wrapper/spec.md"] + - id: plan + name: Plan implementation (modules, dependencies, test strategy) + gate: + require_step: spec + completion: + require_files: ["specs/001-api-wrapper/plan.md"] + - id: tasks + name: Generate task list from plan + gate: + require_step: plan + completion: + require_files: ["specs/001-api-wrapper/tasks.md"] + - id: client + name: Implement API client (auth, endpoints, error handling) + gate: + require_step: tasks + completion: + require_files: ["src/client.*"] + - id: tests + name: Write and run tests (unit + integration) + gate: + require_step: client + completion: + require_files: [".test-results/api-wrapper.passed"] + - id: docs + name: Write usage docs (README, examples) + gate: + require_step: tests + completion: + require_files: ["README.md"] + - id: publish + name: Package and publish (npm/pypi/github release) + gate: + require_step: docs + completion: + require_files: [".github/publish.json"] diff --git a/workflows/templates/cli-tool.yml b/workflows/templates/cli-tool.yml new file mode 100644 index 0000000..d2292f1 --- /dev/null +++ b/workflows/templates/cli-tool.yml @@ -0,0 +1,52 @@ +name: cli-tool +description: Build a command-line tool (arg parsing, output, tests, packaging) +version: 1 +steps: + - id: spec + name: Write tool spec (commands, flags, input/output format) + gate: + require_files: [] + completion: + require_files: ["specs/001-cli-tool/spec.md"] + - id: plan + name: Plan implementation (modules, dependencies, UX) + gate: + require_step: spec + completion: + require_files: ["specs/001-cli-tool/plan.md"] + - id: tasks + name: Generate task list from plan + gate: + require_step: plan + completion: + require_files: ["specs/001-cli-tool/tasks.md"] + - id: core + name: Implement core logic (arg parsing, main commands) + gate: + require_step: tasks + completion: + require_files: ["src/main.*"] + - id: output + name: Add output formatting (text, JSON, table modes) + gate: + require_step: core + completion: + require_files: ["src/output.*"] + - id: tests + name: Write and run tests (unit + CLI integration) + gate: + require_step: output + completion: + require_files: [".test-results/cli-tool.passed"] + - id: docs + name: Write usage docs (README, --help text, examples) + gate: + require_step: tests + completion: + require_files: ["README.md"] + - id: package + name: Package for distribution (npm/pip/brew/binary) + gate: + require_step: docs + completion: + require_files: [".github/publish.json"] diff --git a/workflows/templates/k8s-service.yml b/workflows/templates/k8s-service.yml new file mode 100644 index 0000000..4b4a6c6 --- /dev/null +++ b/workflows/templates/k8s-service.yml @@ -0,0 +1,52 @@ +name: k8s-service +description: Deploy a containerized service to Kubernetes (Dockerfile, manifests, CI) +version: 1 +steps: + - id: spec + name: Write service spec (purpose, endpoints, dependencies) + gate: + require_files: [] + completion: + require_files: ["specs/001-service/spec.md"] + - id: plan + name: Plan implementation (container design, K8s resources, networking) + gate: + require_step: spec + completion: + require_files: ["specs/001-service/plan.md"] + - id: tasks + name: Generate task list from plan + gate: + require_step: plan + completion: + require_files: ["specs/001-service/tasks.md"] + - id: dockerfile + name: Build Dockerfile (multi-stage, minimal base, health check) + gate: + require_step: tasks + completion: + require_files: ["Dockerfile"] + - id: manifests + name: Write K8s manifests (deployment, service, configmap, secrets) + gate: + require_step: dockerfile + completion: + require_files: ["k8s/deployment.yaml"] + - id: scripts + name: Create deploy and health check scripts + gate: + require_step: manifests + completion: + require_files: ["scripts/deploy.sh"] + - id: test + name: Build image, deploy to test namespace, verify health + gate: + require_step: scripts + completion: + require_files: [".test-results/k8s-deploy.passed"] + - id: ci + name: Add CI pipeline (build, test, push to registry) + gate: + require_step: test + completion: + require_files: [".github/workflows/ci.yml"] diff --git a/workflows/templates/project-onboarding.yml b/workflows/templates/project-onboarding.yml new file mode 100644 index 0000000..c1163b1 --- /dev/null +++ b/workflows/templates/project-onboarding.yml @@ -0,0 +1,52 @@ +name: project-onboarding +description: Bootstrap a new project with SHTD workflow (git, CI, first spec) +version: 1 +steps: + - id: init + name: Initialize git repo and basic structure + gate: + require_files: [] + completion: + require_files: [".git/HEAD"] + - id: publish + name: Configure GitHub account and visibility + gate: + require_step: init + completion: + require_files: [".github/publish.json"] + - id: gitconfig + name: Set local git user matching publish.json account + gate: + require_step: publish + completion: + require_files: [".git/config"] + - id: ci + name: Add secret-scan CI workflow + gate: + require_step: gitconfig + completion: + require_files: [".github/workflows/secret-scan.yml"] + - id: gitignore + name: Create .gitignore (archive/, node_modules/, .env, etc.) + gate: + require_step: ci + completion: + require_files: [".gitignore"] + - id: spec + name: Write first feature spec + gate: + require_step: gitignore + completion: + require_files: ["specs/001-*/spec.md"] + - id: branch + name: Create feature branch and push + gate: + require_step: spec + completion: + require_files: [] + - id: readme + name: Write project README + gate: + require_step: branch + completion: + require_files: ["README.md"]