Add Feature
You are executing a slash command in the current Claude Code session. You will create a GitHub Project linked to the current repo…
Claude CodeGeneric
# /add-feature — Multi-Agent Feature Design Command
You are executing a slash command in the current Claude Code session. You will create a GitHub Project linked to the current repository, prepare shared context, then sequentially spawn independent agents for each design step. **This command blocks the current session until all agents complete or a blocker is hit.**
**Feature Idea:** $ARGUMENTS
---
## Your Responsibilities (Command — Current Session)
You own the **project lifecycle**, not the design work. You:
1. Create a GitHub Project under `@me` and link it to the current repo
2. Add a "Plans" status option to the built-in Status field
3. Write a shared context file for sub-agents
4. Spawn Step 1 agent → block until done → verify output
5. Spawn Step 2 agent → block until done → verify output
6. Commit all artifacts and report final status
You do NOT write drafts, critiques, brainstorms, or syntheses. That work belongs to the spawned agents operating in their own context windows.
---
## Phase 0: Setup — Create the GitHub Project
### 0A. Ensure Auth Scope
```bash
gh auth status
# If 'project' scope is missing:
gh auth refresh -s project
0B. Derive Feature Summary
Generate a concise summary (≤10 words) of the feature idea. Store it as FEATURE_SUMMARY.
0C. Detect Repository Info
GH_REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
GH_USER=$(gh api user -q '.login')
REPO_NUMBER=$(gh repo view --json id -q '.id')
echo "Repository: ${GH_REPO}"
echo "User: ${GH_USER}"
0D. Check for Existing Project (Idempotency)
Before creating a new project, check if one with the same title already exists:
EXISTING_PROJECT=$(gh project list --owner "@me" --format json | jq -r \
--arg title "Feature: ${FEATURE_SUMMARY}" \
'.projects[] | select(.title == $title) | .number')
if [ -n "$EXISTING_PROJECT" ] && [ "$EXISTING_PROJECT" != "null" ]; then
PROJECT_NUMBER=$EXISTING_PROJECT
echo "Found existing project #${PROJECT_NUMBER} — resuming."
else
# Create the project (see 0E)
echo "No existing project found — creating new one."
fi
0E. Create the Project & Link to Repo
# Create the project under the authenticated user
PROJECT_URL=$(gh project create \
--owner "@me" \
--title "Feature: ${FEATURE_SUMMARY}" \
--format json | jq -r '.url')
PROJECT_NUMBER=$(echo "$PROJECT_URL" | grep -oP '\d+$')
# Get the project node ID
PROJECT_JSON=$(gh project view ${PROJECT_NUMBER} \
--owner "@me" \
--format json)
PROJECT_ID=$(echo "$PROJECT_JSON" | jq -r '.id')
echo "Project #${PROJECT_NUMBER} created: ${PROJECT_URL}"
# Link the project to the current repository so it appears on the repo's Projects tab
gh project link ${PROJECT_NUMBER} --owner "@me" --repo "${GH_REPO}"
echo "Project linked to ${GH_REPO}"
0F. Add "Plans" Status Option
The built-in Status field has Todo, In Progress, and Done. Add a fourth: Plans.
FIELDS_JSON=$(gh project field-list ${PROJECT_NUMBER} \
--owner "@me" \
--format json)
STATUS_FIELD_ID=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .id')
# Check if "Plans" already exists
HAS_PLANS=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .options[] | select(.name == "Plans") | .id')
if [ -z "$HAS_PLANS" ] || [ "$HAS_PLANS" = "null" ]; then
# Build updated options array: existing + Plans
EXISTING_OPTIONS=$(echo "$FIELDS_JSON" | jq -c \
'[.fields[] | select(.name == "Status") | .options[] | {name: .name, color: .color, description: .description}]')
UPDATED_OPTIONS=$(echo "$EXISTING_OPTIONS" | jq -c \
'. + [{"name": "Plans", "color": "PURPLE", "description": "Design planning complete"}]')
gh api graphql -f query='
mutation($projectId: ID!, $fieldId: ID!, $options: [ProjectV2SingleSelectFieldOptionInput!]!) {
updateProjectV2Field(input: {
projectId: $projectId
fieldId: $fieldId
singleSelectOptions: $options
}) {
projectV2Field {
... on ProjectV2SingleSelectField {
options { id name }
}
}
}
}' \
-f projectId="${PROJECT_ID}" \
-f fieldId="${STATUS_FIELD_ID}" \
--argjson options "${UPDATED_OPTIONS}"
echo "Added 'Plans' status option."
else
echo "'Plans' status already exists."
fi
0G. Capture All Status Option IDs
Re-fetch after the mutation to get the Plans option ID:
FIELDS_JSON=$(gh project field-list ${PROJECT_NUMBER} \
--owner "@me" \
--format json)
PLANS_OPTION_ID=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .options[] | select(.name == "Plans") | .id')
TODO_OPTION_ID=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .options[] | select(.name == "Todo") | .id')
IN_PROGRESS_OPTION_ID=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .options[] | select(.name == "In Progress") | .id')
DONE_OPTION_ID=$(echo "$FIELDS_JSON" | jq -r \
'.fields[] | select(.name == "Status") | .options[] | select(.name == "Done") | .id')
echo "Status IDs captured: Plans=${PLANS_OPTION_ID}"
0H. Write Shared Context File
This is the data handoff mechanism. Agents read this file instead of re-querying GitHub.
mkdir -p .projects/${PROJECT_NUMBER}
cat > .projects/${PROJECT_NUMBER}/context.json << CONTEXT_EOF
{
"project_number": ${PROJECT_NUMBER},
"project_id": "${PROJECT_ID}",
"project_url": "${PROJECT_URL}",
"feature_summary": "${FEATURE_SUMMARY}",
"feature_description": $(echo "$ARGUMENTS" | jq -Rs .),
"gh_repo": "${GH_REPO}",
"gh_user": "${GH_USER}",
"status_field_id": "${STATUS_FIELD_ID}",
"plans_option_id": "${PLANS_OPTION_ID}",
"todo_option_id": "${TODO_OPTION_ID}",
"in_progress_option_id": "${IN_PROGRESS_OPTION_ID}",
"done_option_id": "${DONE_OPTION_ID}",
"steps_completed": [],
"created_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
CONTEXT_EOF
echo "Context w
Maintain Add Feature?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Add Feature on getagentictools](https://getagentictools.com/loops/sysreq-add-feature-multi-agent-feature-design-command?ref=badge)