ワンクリックで
build
Build a requirement with full task details and optional instructions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Build a requirement with full task details and optional instructions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | build |
| description | Build a requirement with full task details and optional instructions |
Fetch a requirement's complete implementation plan and start building it with additional context.
Use BrainGrid CLI Skill:
If the bg-cli skill is available, invoke it for detailed workflow guidance and best practices. The skill provides comprehensive context about BrainGrid commands, auto-detection features, and recommended workflows.
About This Command:
Use this command to fetch a requirement's complete implementation plan using braingrid requirement show. This retrieves the requirement details along with all task prompts in markdown format (perfect for AI coding tools). You can optionally provide additional instructions or context to guide the implementation.
IMPORTANT INSTRUCTIONS:
--format markdown for AI-ready outputParse Arguments:
Get Requirement ID (first argument):
REQ-123 (canonical)req-123 (lowercase)123 (number only)Get Additional Instructions (remaining arguments):
/build REQ-123 focus on security and add comprehensive testsActivate Build Sentinel:
Before running any build commands or creating tasks, create the sentinel file that activates build-specific hooks:
mkdir -p .braingrid/temp
Then write the requirement ID to the sentinel file:
echo "REQ-{id}" > .braingrid/temp/build-active.local
If the requirement ID is not yet known (auto-detection), create the sentinel after the build command resolves the ID. The sentinel MUST exist before any TaskCreate calls so hooks are active.
Run Build Command:
Execute Build Command:
braingrid requirement show [REQ-ID] --format markdown
--format markdown for AI-ready output (default)Save requirement to temp file:
Write the full markdown build output to .braingrid/temp/REQ-{id}-requirement.md using the Write tool.
This persists the requirement so the agent can re-read it if context is compressed.
Handle Errors Reactively:
CLI not installed (command not found):
npm install -g @braingrid/clibraingrid --versionNot authenticated:
braingrid loginbraingrid whoamiNo project initialized (error mentions project not found):
braingrid init.braingrid/project.json to track the active projectRequirement not found:
braingrid requirement list to see available requirements/specifyNo git branch/ID: Ask user to provide requirement ID or create git branch
Network/API errors: Show full error message and suggest retry
Branch Setup:
Check the current branch before doing anything else:
git rev-parse --abbrev-ref HEAD
Skip branch creation if any of these are true — go straight to Task Creation:
REQ-{id} (e.g., tyler/REQ-12-some-feature, feature/REQ-12-foo)CONV-* pattern (Conductor conversation branch — already has an isolated workspace)Otherwise, create a BrainGrid branch:
Use braingrid requirement create-branch — not git checkout -b. The CLI creates the branch on GitHub AND registers it with BrainGrid for tracking.
braingrid requirement create-branch REQ-{id}
Then checkout using the branch name from the output:
git fetch origin && git checkout {branch-name}
Fallback — only if create-branch fails (not found, network error, GitHub not configured):
git checkout -b feature/REQ-{id}-{slug}
Warn: "⚠️ Branch created locally only. Not tracked in BrainGrid. Run braingrid requirement create-branch REQ-{id} later to register it."
Extract Acceptance Criteria:
After fetching the build plan, extract the acceptance criteria into a checklist file for tracking during implementation.
Parse acceptance criteria from the build output:
## Acceptance Criteria heading in the requirement content### sub-headings that group related criteria — ignore all headings- Given or - **Given** (bullet-prefixed)- )Write checklist file using the Write tool:
File path: .braingrid/temp/REQ-{id}-acceptance-criteria.md
Format — ## Acceptance Criteria heading followed by - [] lines, no subheadings, no blank lines between items:
## Acceptance Criteria
- [] Given a user visits the root URL, When the page loads, Then the hero section displays the tagline and CTA.
- [] Given a valid JWT and allowed model, When POST to messages endpoint, Then request is forwarded to Anthropic and response returned.
- [] Given stream: true in request body, When request succeeds, Then SSE response is piped through to client.
Rules:
## Acceptance Criteria heading- [] (dash, space, brackets, space)**Given** → Given)## Acceptance Criteria heading and - [] lines## Acceptance Criteria section exists in the requirement, skip this step silentlyConfirm: "📋 Extracted {count} acceptance criteria to .braingrid/temp/REQ-{id}-acceptance-criteria.md"
Create Verification State File:
After extracting acceptance criteria (only if criteria count > 0), create the verification state file that enables the Stop hook to enforce acceptance criteria verification after all tasks complete.
Write .braingrid/temp/REQ-{id}-build-verification.local.md using the Write tool:
---
active: true
iteration: 0
max_iterations: 15
requirement_id: REQ-{id}
criteria_file: .braingrid/temp/REQ-{id}-acceptance-criteria.md
started_at: "{ISO timestamp}"
---
Continue verifying acceptance criteria for REQ-{id}.
Read the acceptance criteria at `.braingrid/temp/REQ-{id}-acceptance-criteria.md`.
If you need to re-read the full requirement, it is saved at `.braingrid/temp/REQ-{id}-requirement.md`.
For each unchecked criterion (line starting with `- []`):
1. Examine the implementation code to verify the criterion is satisfied
2. Run relevant tests or check behavior if applicable
3. Change `- []` to `- [x]`
4. Add a `Proof:` line immediately below explaining HOW it's satisfied
Keep going until ALL criteria show `[x]` with proof.
Replace {id} with the actual requirement ID and {ISO timestamp} with the current ISO 8601 timestamp.
Important: Only create this file if acceptance criteria were extracted. If no ## Acceptance Criteria section was found (step was skipped), do NOT create the verification state file.
Task Discovery & Mode Selection (After Branch Setup):
After ensuring you're on the correct branch, discover tasks and choose implementation mode BEFORE creating Claude Code tasks:
Fetch requirement with JSON format (to check for tasks):
braingrid requirement show [REQ-ID] --format json
Parse the JSON response to check if tasks array exists and has items.
Determine task list:
TaskCreate yetCount tasks and choose implementation mode:
a. Check for agent teams: Run echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS in Bash.
b. If output is 1 (or any non-empty value) AND there are 3+ tasks: use Parallel Mode.
c. Otherwise: use Sequential Mode.
Use Additional Instructions:
If additional instructions were provided in $ARGUMENTS:
Task Creation (After Mode Selection):
Now create the Claude Code tasks. If parallel mode was selected, create the team FIRST so tasks land in the team's task list.
If Parallel Mode: Call TeamCreate with name build-REQ-{id} (e.g., build-REQ-123) BEFORE creating any tasks.
If Sequential Mode: Skip team creation; tasks go into the default session list.
IMPORTANT — Create tasks ONE AT A TIME (sequentially, not in parallel). Hook scripts run on each TaskCreate and TaskUpdate call. Issuing multiple task tool calls in a single parallel batch causes hook runner errors. Create each task, wait for the response, then create the next. Same for TaskUpdate calls (e.g., setting blockedBy) — issue them one at a time after all tasks exist.
Then create the tasks:
If tasks EXIST in BrainGrid:
For each task in the BrainGrid response:
a. Create local Claude Code task with TaskCreate:
TaskCreate:
subject: "TASK {N}: {type}: {description}"
description: [Task content/prompt from BrainGrid]
activeForm: "{type}: {description}"
Where:
{N} = sequential number (1, 2, 3...){type} = conventional commit type inferred from the task (feat/fix/test/refactor/docs/chore/style/perf){description} = lowercase imperative derived from the BrainGrid task titleb. Capture the Claude Code task ID from TaskCreate response (e.g., "1", "2", etc.)
c. Update the BrainGrid task with external_id to link it to the Claude Code task:
braingrid task update TASK-X -r REQ-Y --external-id "[Claude task ID]"
This links the BrainGrid task to the local Claude Code task via external_id.
The status sync hook will use this to automatically sync status updates.
If NO tasks exist in BrainGrid (Claude creates them):
For EACH task identified during the discovery phase:
a. Create local Claude Code task FIRST with TaskCreate:
TaskCreate:
subject: "TASK {N}: {type}: {description}"
description: [Detailed implementation instructions]
activeForm: "{type}: {description}"
Where {N}, {type}, {description} follow the same convention as above.
b. Capture the task ID from TaskCreate response (e.g., "1", "2", etc.)
c. Create in BrainGrid with external_id:
braingrid task create -r [REQ-ID] --title "Task Title" --content "Detailed implementation instructions..." --external-id "[Claude task ID]"
This links the BrainGrid task to the local Claude Code task via external_id.
The status sync hook will use this to automatically sync status updates.
Show task list:
After creating tasks, call TaskList to show the user their work queue.
Update requirement status to IN_PROGRESS:
braingrid requirement update REQ-{id} --status IN_PROGRESS
Since building a requirement means work is starting, automatically update the status.
Task Creation Guidelines (when no tasks exist):
TASK N: type: description (lowercase imperative description)TASK N: type(scope): description(blocked by N,N,...) to subjecttype: description portion (shown as spinner text)TASK N (hash): type: descriptionStatus Mapping (for synchronization):
| Claude Code Status | BrainGrid Status |
|---|---|
pending | PLANNED |
in_progress | IN_PROGRESS |
completed | COMPLETED |
How status sync works:
When you update a local task status using TaskUpdate, a PostToolUse hook automatically:
feature/REQ-4-description)external_id (the Claude task ID)Important:
--external-id for status sync to workREQ-X in the name (e.g., feature/REQ-4-auth)main or branches without a requirement IDParallel Mode (Agent Teams):
Use this mode when CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS is set and there are 3+ tasks. The team was already created in the Task Creation step above.
Determine teammate count: min(independent_task_count, 3) — cap at 3 teammates to avoid merge conflicts and resource exhaustion.
Spawn teammates: Use the Task tool with team_name and name params (braingrid-builder-1, braingrid-builder-2, braingrid-builder-3). Each teammate's spawn prompt MUST include:
TaskList → claim an unowned/unblocked task with TaskUpdate (set owner to your name) → implement → mark completed → call TaskList again → repeat until no tasks remain.braingrid/temp/REQ-{id}-requirement.md — re-read if you need contextgit pull --rebase before starting each new task (to pick up other teammates' commits)$ARGUMENTS if providedLead coordinates (do NOT implement): The lead monitors TaskList, resolves blockers, and nudges idle teammates. The lead MUST NOT implement tasks itself — this avoids merge conflicts with teammates working in the same repo.
Verify completion: When all tasks show completed in TaskList, run the test suite once more to catch integration issues from parallel work.
Shutdown & cleanup: Send shutdown_request via SendMessage to each teammate, then call TeamDelete to clean up the team.
Acceptance criteria verification: The lead proceeds to the existing "Acceptance Criteria Verification Phase" below. The Stop hook continues to work as-is since it only fires for the lead's session.
Sequential Mode (Default):
Use this mode when agent teams are NOT enabled, or when there are fewer than 3 tasks.
If additional instructions were provided in $ARGUMENTS:
Apply to Implementation:
Start Immediately:
Begin Implementation Immediately:
After successfully fetching the build plan and creating tasks, start implementing immediately. Do NOT wait for user confirmation.
Start First Task:
in_progress using TaskUpdateIterate Through ALL Tasks Sequentially:
in_progress before starting, then completed when doneOnly Pause for Genuine Blockers:
Workflow Context:
The typical workflow with /build:
/specify/build REQ-X (this command)Example Interactions:
Basic: Fetch build plan
User runs: /build REQ-123
(User is on main branch)
Claude:
1. Runs: braingrid requirement show REQ-123 --format markdown
2. Shows complete requirement and all task prompts
3. Creates branch via BrainGrid CLI:
- Runs: braingrid requirement create-branch REQ-123
- On success: git fetch origin && git checkout tyler/REQ-123-user-authentication-system
- On error: Last resort fallback to local git checkout -b (warns about missing BrainGrid tracking)
4. Creates local Claude Code tasks using TaskCreate with naming convention:
- TASK 1: feat: implement user login endpoint
- TASK 2: feat: add session management
- TASK 3: test: add authentication tests
- TASK 4: feat(auth): add OAuth support (blocked by 1,2)
- TASK 5: docs: add authentication API docs
5. Creates BrainGrid tasks with --external-id linking to Claude task IDs
6. Reports: "REQ-123: User Authentication System (5 tasks)"
7. Ready to start implementing
With additional instructions
User runs: /build REQ-123 focus on security best practices and add extensive error handling
Claude:
1. Runs: braingrid requirement show REQ-123 --format markdown
2. Shows complete build plan
3. Acknowledges: "I'll focus on security best practices and add extensive error handling"
4. Reviews tasks and highlights security-related ones
5. Immediately starts implementing TASK 1 (e.g., "TASK 1: feat: implement login endpoint") with security context applied
6. Iterates through all tasks without stopping
Auto-detect from branch
User runs: /build
(User is on branch: feature/REQ-123-user-auth)
Claude:
1. Runs: braingrid requirement show --format markdown
2. CLI auto-detects REQ-123 from branch name
3. Shows build plan for REQ-123
4. Immediately starts implementing tasks sequentially
With instructions, auto-detect ID
User runs: /build add comprehensive logging and monitoring
(User is on branch: feature/REQ-456-api-integration)
Claude:
1. Detects no requirement ID in arguments
2. Runs: braingrid requirement show --format markdown
3. CLI auto-detects REQ-456 from branch
4. Shows build plan
5. Acknowledges: "I'll add comprehensive logging and monitoring"
6. Immediately starts implementing TASK 1 with logging/monitoring focus
7. Continues through all tasks without stopping
Parallel mode (agent teams enabled)
User runs: /build REQ-789
(CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, requirement has 6 tasks)
Claude:
1. Fetches build plan, creates branch, extracts acceptance criteria
2. Discovers 6 tasks (3 independent, 3 with dependencies)
3. Detects teams enabled + 6 tasks → Parallel Mode
4. Creates team "build-REQ-789" FIRST, then creates 6 tasks with naming convention:
- TASK 1: feat: implement endpoint handler
- TASK 2: feat: add data models
- TASK 3: test: add unit tests (blocked by 1,2)
- etc.
5. Spawns 3 braingrid-builder teammates
6. Teammates self-claim wave-1 tasks, implement in parallel
7. As blockers complete, wave-2 tasks unlock and get claimed
8. Lead monitors progress, resolves any blockers
9. All tasks completed → lead shuts down teammates, deletes team
10. Acceptance criteria verification phase runs
Error Handling:
If the command fails, handle reactively based on the error:
/specifySuccess Criteria: ✅ BrainGrid CLI is installed and authenticated ✅ Requirement exists and build plan fetched successfully ✅ On feature branch with REQ-{id} pattern (auto-created if needed) ✅ Local Claude Code tasks created ✅ BrainGrid tasks created with external_id linking to Claude tasks ✅ Requirement status updated to IN_PROGRESS ✅ All tasks shown with full prompts ✅ Additional instructions acknowledged and applied (if provided) ✅ Implementation started on first task immediately ✅ All acceptance criteria verified with proof in temp file
If parallel mode used: ✅ Team created and teammates spawned successfully ✅ All teammates claimed and completed their tasks independently ✅ No merge conflicts from parallel file edits ✅ Final test suite passes after all parallel commits ✅ Teammates shut down cleanly, team deleted
Final Output:
After successful build fetch, show:
Note: Extract the requirement UUID from the command output to construct the URLs.
If additional instructions provided:
Automatic Implementation:
After displaying the final output summary, immediately begin implementing tasks:
in_progress and start working on itDo NOT ask "Would you like me to start implementing the first task?" — just start.
Sync Task Statuses to BrainGrid (Fallback):
After ALL tasks are marked completed in Claude Code (and before acceptance criteria verification), run a bulk sync to catch any statuses the PostToolUse hook missed (network errors, teammate shutdown races, sentinel issues):
Fetch current BrainGrid task states:
braingrid task list -r REQ-{id} --format json
For each BrainGrid task with an external_id:
Look up the matching Claude Code task (by ID from TaskList)
If the Claude Code task is completed but the BrainGrid task is NOT COMPLETED, sync it:
braingrid task update TASK-X -r REQ-{id} --status COMPLETED
Report results:
This is a safety net — most statuses should already be synced by the PostToolUse hook. Check /tmp/braingrid-hook-debug.log if any were missed to diagnose root cause.
Acceptance Criteria Verification Phase:
After ALL tasks are marked completed, the Stop hook will prevent you from stopping until every acceptance criterion is verified. This ensures nothing slips through.
.braingrid/temp/REQ-{id}-acceptance-criteria.md- []:
- [] to - [x]Proof: [explanation] on the next line immediately below the criterion[x] with proofIf the verification loop needs to be cancelled, the user can run /cancel-build-verification.
Post-Verification: Update Requirement in BrainGrid:
After ALL acceptance criteria show [x] with proof (verification loop complete):
Read the verified criteria file:
Read .braingrid/temp/REQ-{id}-acceptance-criteria.md
Fetch current requirement content:
braingrid requirement show REQ-{id} --format json
Parse the JSON to get the current content field.
Replace the acceptance criteria section:
## Acceptance Criteria in the current content## heading (or end of content) with the verified criteria file contents## Acceptance Criteria heading exists, append it at the end.braingrid/temp/REQ-{id}-updated-content.mdUpdate the requirement via CLI:
braingrid requirement update REQ-{id} --content "$(cat .braingrid/temp/REQ-{id}-updated-content.md)"
Update requirement status to REVIEW:
braingrid requirement update REQ-{id} --status REVIEW
Clean up temp files:
rm -f .braingrid/temp/build-active.local .braingrid/temp/REQ-*.md
Confirm: "🧹 Cleaned up build temp files"
Confirm: "✅ Requirement REQ-{id} updated with verified acceptance criteria and moved to REVIEW"
Available Output Formats:
While markdown is default and best for AI coding tools, the build command supports:
markdown - Full content with task prompts (default, best for AI)json - Structured data for scriptingxml - Alternative structured formattable - Compact view for quick referenceIf user wants a different format, they can specify it in additional instructions.
Resolve merge conflicts between the current branch and main. Use when the workspace is in CONFLICT state after an automatic rebase failed. Detects, resolves, commits, and pushes — no feature work.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
Design excellent UX for digital products (web, mobile, CLI). Use when: (1) designing new features/flows, (2) creating information architecture, (3) specifying interaction patterns, (4) planning screen states/transitions. Complements frontend-design (visuals) by focusing on structure and behavior.
Use this skill when defining work, specifying requirements, or planning features. It helps turn messy ideas into detailed specifications and AI-ready tasks. This skill teaches how to plan using BrainGrid CLI commands for spec-driven development, including creating requirements, breaking them into tasks, and tracking work progress. Apply this skill when users mention requirements, specifications, task breakdowns, or when they have vague project ideas that need structuring.