Buildwright
Spec-driven autonomous development. Humans approve intent; agents handle everything else.
What this skill does
When activated, Buildwright directs the agent to:
- 1. Read your codebase and steering documents
- Write a one-page spec (
docs/specs/[feature]/spec.md) - Stop for human approval — unless INLINECODE1
- Implement the feature with TDD
- Run quality gates: typecheck, lint, test, build
- Run optional security scans (if semgrep / gitleaks / trufflehog are installed)
- Run a Staff Engineer prompt-based code review
- Commit, push, and open a PR via INLINECODE2
Requirements
Credentials (required)
| Credential | Purpose | Scope | How to provide |
|---|
| INLINECODE3 | Push commits and open PRs via INLINECODE4 | INLINECODE5 scope (read/write) | INLINECODE6 or configure in OpenClaw config under INLINECODE7 |
The token must have repo scope to push branches and create pull requests. For minimal privilege, use a fine-grained personal access token scoped to a single repository with "Contents: Read and write" and "Pull requests: Read and write" permissions.
Alternatively, if you use SSH for git push, the GITHUB_TOKEN is still needed for gh pr create. You can use gh auth login to authenticate the GitHub CLI separately.
Binaries (required)
| Binary | Purpose |
|---|
| INLINECODE12 | Commits and pushes |
| INLINECODE13 |
Opens PRs via GitHub CLI |
Optional tools
| Binary | Purpose |
|---|
| INLINECODE14 | SAST security scan |
| INLINECODE15 / INLINECODE16 |
Secrets detection |
Agent Personas (prompt-based, no binaries)
Staff Engineer and Security Engineer are prompt-engineering personas — instructions loaded from .buildwright/agents/ files in the workspace. They are not external tools or binaries. The agent adopts these personas to review specs and code using defined criteria and confidence thresholds. These files contain only prompt instructions and review checklists — no secrets or credentials.
Configuration
BUILDWRIGHTAUTOAPPROVE (optional, not a credential)
This is an optional boolean flag that controls whether the agent waits for human approval at the spec stage. It is not a secret and not declared in requires.env because it is not required to run the skill.
| Value | Behavior |
|---|
| Not set | Interactive (default) — stops and waits for "approved" before building |
| INLINECODE19 |
Interactive — same as default |
|
true |
Autonomous — commits spec to git (audit trail) and proceeds without waiting |
Recommendation for first use: Leave BUILDWRIGHT_AUTO_APPROVE unset until you have reviewed a few specs and are comfortable with the workflow. Start with interactive mode in a sandbox repository to observe behavior before enabling autonomous commits and PRs.
Commands
/bw-new-feature \
Full pipeline for new features. Auto-detects greenfield vs existing projects.
CODEBLOCK0
Flow: Detect (greenfield or existing?) → Research → Spec → Staff Engineer validates → Human approves → TDD build → Verify → Security scan → Code review → PR
Artifacts produced:
- -
docs/specs/[feature]/research.md — what the agent found in your codebase - INLINECODE23 — implementation plan with approaches considered
/bw-claw \
Multi-agent pipeline using the Claw Architecture. Architect decomposes the feature into domain-specific claw tasks (UI, API, DB), defines interface contracts, and coordinates execution.
CODEBLOCK1
Flow: Architect analyzes → Decomposes into claw tasks → Defines interface contract → Claws execute per domain (TDD) → Architect integrates → Buildwright quality gates → PR
Best for: Features that cross domain boundaries (e.g., need DB schema + API endpoint + UI component).
Artifacts produced:
- -
docs/specs/[feature]/claw-plan.md — decomposition plan with interface contracts - INLINECODE25 — per-claw execution report
/bw-quick \
Fast path for bug fixes and small tasks (<2 hrs). No spec, no approval step. Runs security scan and code review on the changed diff before committing.
Flow: Understand → Research → TDD → Verify → Security scan → Code review → Commit
CODEBLOCK2
/bw-ship \[message\]
Quality pipeline for existing work: verify → security → review → PR.
CODEBLOCK3
/bw-verify
Quick checks only: typecheck → lint → test → build.
/bw-analyse
Analyse an existing codebase and write structured docs to .buildwright/codebase/. Creates docs from scratch if missing; auto-refreshes existing docs when BUILDWRIGHT_AUTO_APPROVE=true (only asks in interactive mode). Creates tech.md from template if it doesn't exist, then populates it with the discovered stack and commands. Run this first on any brownfield project to give every subsequent session real context.
CODEBLOCK4
Produces: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md under .buildwright/codebase/.
/bw-plan \
Research a question or topic and produce a written deliverable — no implementation, no commits.
Use when someone asks a question or needs an analysis, plan, or report before (or instead of) writing code.
CODEBLOCK5
Flow: Understand question/task → Clarify if needed → Research (read code + run read-only tools) → Synthesize findings → Write deliverable → Summarize
Accepts two invocation styles:
- - Inline question — describe the question or topic directly; the agent infers scope and writes to INLINECODE34
- Task file — a structured
.md file with Inputs, Rules, Research Areas, and Outputs blocks; the agent parses and executes it exactly
Use /bw-plan when you want: a performance review, architecture decision record, migration plan, technology evaluation, static analysis report, or any "research this and give me a written output" task.
Use /bw-new-feature instead when you want the plan executed (research + spec + implement + ship).
Artifacts produced: whatever the task specifies; at minimum plan.md in the output directory.
Hard constraints: never modifies source files, never commits or creates PRs, every finding must cite evidence.
/bw-help
Show all available commands.
Failure Behavior
If any gate fails after retries, the agent commits completed work, pushes, and opens a PR with a structured failure report. It does not leave orphaned branches or silent failures.
Retry Policy
| Gate | Retries | Rationale |
|---|
| Verify (typecheck, lint, test, build) | 2x | Fixable by the agent |
| Security scan |
None | Requires human judgment |
| Code review | None | Architectural decisions need humans |
Security Considerations
This skill performs autonomous code changes, commits, and pull requests. Understand what it does before enabling it on repositories with sensitive or production code.
What the skill reads: Your repository source code, .buildwright/agents/ persona files (prompt instructions only, no secrets), and .buildwright/steering/ context files.
What the skill writes: Spec files under docs/specs/, source code changes, git commits on feature branches, and pull requests via gh.
What the skill does NOT do: It does not modify .env files, access secrets stores, run destructive git operations (force push, reset), or merge PRs. All changes go to feature branches with PRs for human review.
Recommended setup for first use:
- 1. Start with a fork or sandbox repository, not production code
- Leave
BUILDWRIGHT_AUTO_APPROVE unset (interactive mode) to review specs before builds - Use a fine-grained GitHub token scoped to a single repository with minimal permissions
- Rotate tokens regularly and revoke when no longer needed
- Review generated PRs before merging — the skill creates PRs, it does not merge them
More Information
Full documentation, source code, and setup instructions: https://github.com/raunakkathuria/buildwright
Buildwright
规范驱动的自主开发。人类批准意图;智能体处理其余一切。
此技能的功能
激活后,Buildwright 会指导智能体:
- 1. 读取你的代码库和指导文档
- 编写一页规范(docs/specs/[feature]/spec.md)
- 等待人工批准——除非设置了 BUILDWRIGHTAUTOAPPROVE=true
- 使用 TDD 实现功能
- 运行质量关卡:类型检查、代码检查、测试、构建
- 运行可选的安全扫描(如果安装了 semgrep / gitleaks / trufflehog)
- 运行基于提示词的高级工程师代码审查
- 通过 gh 提交、推送并创建 PR
要求
凭证(必需)
| 凭证 | 用途 | 范围 | 提供方式 |
|---|
| GITHUBTOKEN | 通过 gh 推送提交并创建 PR | repo 范围(读/写) | export GITHUBTOKEN=ghp_... 或在 OpenClaw 配置的 skills.entries.buildwright.apiKey 下配置 |
该令牌必须具有 repo 范围才能推送分支和创建拉取请求。为最小化权限,请使用限定于单个仓库的细粒度个人访问令牌,并赋予内容:读写和拉取请求:读写权限。
或者,如果你使用 SSH 进行 git 推送,gh pr create 仍需要 GITHUB_TOKEN。你可以使用 gh auth login 单独认证 GitHub CLI。
二进制文件(必需)
通过 GitHub CLI 创建 PR |
可选工具
| 二进制文件 | 用途 |
|---|
| semgrep | SAST 安全扫描 |
| gitleaks / trufflehog |
密钥检测 |
智能体角色(基于提示词,无需二进制文件)
高级工程师和安全工程师是基于提示工程的角色——从工作区中的 .buildwright/agents/ 文件加载的指令。它们不是外部工具或二进制文件。智能体采用这些角色,使用定义的准则和置信度阈值来审查规范和代码。这些文件仅包含提示指令和审查清单——不包含密钥或凭证。
配置
BUILDWRIGHTAUTOAPPROVE(可选,非凭证)
这是一个可选的布尔标志,控制智能体是否在规范阶段等待人工批准。它不是机密,也不在 requires.env 中声明,因为它不是运行此技能所必需的。
| 值 | 行为 |
|---|
| 未设置 | 交互式(默认)——在构建前停止并等待已批准 |
| false |
交互式——与默认相同 |
| true |
自主式——将规范提交到 git(审计追踪)并继续执行,无需等待 |
首次使用建议: 在审查过几个规范并对工作流程感到满意之前,保持 BUILDWRIGHTAUTOAPPROVE 未设置。先在沙盒仓库中使用交互模式观察行为,然后再启用自主提交和 PR。
命令
/bw-new-feature \<描述\>
新功能的完整流水线。自动检测全新项目与现有项目。
/bw-new-feature 添加 OAuth2 登录
流程:检测(全新还是现有?)→ 研究 → 规范 → 高级工程师验证 → 人工批准 → TDD 构建 → 验证 → 安全扫描 → 代码审查 → PR
产生的工件:
- - docs/specs/[feature]/research.md——智能体在你的代码库中发现的内容
- docs/specs/[feature]/spec.md——包含所考虑方法的实现计划
/bw-claw \<功能\>
使用爪型架构的多智能体流水线。架构师将功能分解为特定领域的爪任务(UI、API、DB),定义接口契约,并协调执行。
/bw-claw 为团队成员添加个人资料照片上传
流程:架构师分析 → 分解为爪任务 → 定义接口契约 → 各领域爪执行(TDD)→ 架构师集成 → Buildwright 质量关卡 → PR
最适合: 跨领域边界的功能(例如,需要数据库模式 + API 端点 + UI 组件)。
产生的工件:
- - docs/specs/[feature]/claw-plan.md——包含接口契约的分解计划
- docs/specs/[feature]/claw-[domain].md——每个爪的执行报告
/bw-quick \<任务\>
用于错误修复和小型任务(<2 小时)的快速路径。无需规范,无需批准步骤。在提交前对更改的差异运行安全扫描和代码审查。
流程:理解 → 研究 → TDD → 验证 → 安全扫描 → 代码审查 → 提交
/bw-quick 修复登录超时错误
/bw-ship \[消息\]
现有工作的质量流水线:验证 → 安全 → 审查 → PR。
/bw-ship feat(auth): 添加 OAuth2 支持
/bw-verify
仅快速检查:类型检查 → 代码检查 → 测试 → 构建。
/bw-analyse
分析现有代码库并将结构化文档写入 .buildwright/codebase/。如果缺少则从头创建文档;当 BUILDWRIGHTAUTOAPPROVE=true 时自动刷新现有文档(仅在交互模式下询问)。如果 tech.md 不存在则从模板创建,然后填充发现的栈和命令。在任何棕地项目上首先运行此命令,为后续每次会话提供真实上下文。
/bw-analyse
生成:.buildwright/codebase/ 下的 STACK.md、ARCHITECTURE.md、CONVENTIONS.md、CONCERNS.md。
/bw-plan \<问题或任务文件\>
研究一个问题或主题并生成书面交付物——不实现,不提交。
当有人提出问题或需要在编写代码之前(或代替编写代码)进行分析、计划或报告时使用。
/bw-plan 这个 Flutter 应用存在哪些性能风险?
/bw-plan 规划从单体架构到微服务的迁移
/bw-plan tasks/flutter-perf-review.md
流程:理解问题/任务 → 必要时澄清 → 研究(读取代码 + 运行只读工具)→ 综合发现 → 编写交付物 → 总结
接受两种调用方式:
- - 内联问题——直接描述问题或主题;智能体推断范围并写入 docs/plans///plan.md
- 任务文件——包含 Inputs、Rules、Research Areas 和 Outputs 块的结构化 .md 文件;智能体精确解析并执行
使用 /bw-plan 的场景: 需要性能审查、架构决策记录、迁移计划、技术评估、静态分析报告或任何研究这个并给我书面输出的任务。
使用 /bw-new-feature 替代的场景: 希望执行计划(研究 + 规范 + 实现 + 发布)。
产生的工件: 任务指定的任何内容;至少输出目录中的 plan.md。
硬约束: 从不修改源文件,从不提交或创建 PR,每个发现必须引用证据。
/bw-help
显示所有可用命令。
失败行为
如果任何关卡在重试后失败,智能体提交已完成的工作,推送并打开包含结构化失败报告的 PR。不会留下孤立分支或静默失败。
重试策略
| 关卡 | 重试次数 | 理由 |
|---|
| 验证(类型检查、代码检查、测试、构建) | 2次 | 智能体可修复 |
| 安全扫描 |
无 | 需要人工判断 |
| 代码审查 | 无 | 架构决策需要人工参与 |
安全考虑
此技能执行自主代码更改、提交和拉取请求。在包含敏感或生产代码的仓库上启用前,请理解其功能。
技能读取的内容: 你的仓库源代码、.buildwright/agents/ 角色文件(仅提示指令,无密钥)和 .buildwright/steering/ 上下文文件。
技能写入的内容: docs/specs/ 下的规范文件、源代码更改、功能分支上的 git 提交以及通过 gh 创建的拉取请求。
技能不执行的操作: 不修改 .env 文件、不访问密钥存储、不执行破坏性 git 操作(强制推送、重置)、不合并 PR。所有更改都进入功能分支,通过 PR 供人工审查。
首次使用推荐设置:
- 1. 从分支或沙盒仓库开始,而非生产代码
- 保持 BUILDWRIGHTAUTOAPPROVE 未设置(交互模式),在构建前