一键导入
repo-initialization
Interactive repository creation flow. Orchestrator gathers requirements from human, devops-engineer creates repo with standard configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Interactive repository creation flow. Orchestrator gathers requirements from human, devops-engineer creates repo with standard configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Browser-based visual companion for showing mockups, diagrams, and interactive options during brainstorming, brief creation, and architecture design. Runs a local Node.js server that watches for HTML files and serves them with live reload. Optional — requires Node.js.
Write a verified HANDOFF.md (9 base required fields) and an atomically co-committed wave-state.yaml (6 required fields) to the factory-artifacts branch at wave close. Provides the lossless wave-boundary checkpoint required by BC-5.41.001 and BC-5.41.002.
Computes wave-based implementation order from story dependencies. Groups stories into waves for parallel execution within each wave.
Diagnostic check of STATE.md — validates structure, size, phase numbering, frontmatter, and content routing compliance. Reports HEALTHY, WARNINGS, or NEEDS-COMPACT.
Extract historical content from STATE.md into cycle files (burst logs, adversary passes, session checkpoints, lessons). Slims STATE.md to <200 lines.
Rehydrate session context at the start of a new session after a wave-boundary reset. Reads wave-state.yaml EXCLUSIVELY from the factory-artifacts branch via git show, injects exactly the listed spec files (Set(stories[*].spec_files) ∪ Set(arch_files) ∪ {state_pointer}), and pauses for operator confirmation before any pipeline work begins. Satisfies BC-6.24.001 postconditions 1–8 and VP-088 §1–§4.
| name | repo-initialization |
| description | Interactive repository creation flow. Orchestrator gathers requirements from human, devops-engineer creates repo with standard configuration. |
Delegation Reference: This skill describes work the orchestrator delegates to specialist agents via the Agent tool. Each step names the target agent. The orchestrator does NOT execute these steps directly.
When the orchestrator detects that no repository exists for a new project:
.git/gh CLI installed and authenticated (gh auth status)The orchestrator asks the human:
GitHub organization?
gh api user/orgs --jq '.[].login'Repository name?
Visibility?
Default branch name?
develop (not main)After the business-analyst produces the L2 Domain Spec and the architect begins system design, the architect analyzes the product structure:
| Signal | Weight | Example |
|---|---|---|
| Multiple deployment targets | HIGH | API server + frontend + SDK |
| Different tech stacks | HIGH | Rust backend + Next.js frontend |
| Independent release cycles | MEDIUM | API v2 ships before frontend catches up |
| Team boundaries | MEDIUM | Backend team vs frontend team |
| Shared contract layer | MEDIUM | Types/schemas consumed by multiple services |
| Service-oriented architecture | HIGH | Microservices, API gateway pattern |
| Signal | Weight | Example |
|---|---|---|
| Single deployment target | HIGH | CLI tool, single binary |
| Single tech stack | MEDIUM | Pure Rust, pure TypeScript |
| Tight coupling between components | HIGH | Shared memory, function calls |
| Single team | LOW | One developer or small team |
| Simple product | HIGH | Library, CLI utility |
Human confirms or overrides. If multi-repo, devops-engineer creates all repos.
The devops-engineer executes the repo creation protocol:
WORKSPACE ISOLATION GUARD (BLOCKING): Before ANY repo or git commands, verify you are NOT operating inside the dark-factory engine directory:
CWD=$(pwd)
if [[ "$CWD" == *"dark-factory"* ]]; then
echo "FATAL: Running in dark-factory engine directory ($CWD). Refusing to proceed."
echo "Fix: orchestrator must set cwd to the resolved project path in Agent tool."
exit 1
fi
Create GitHub repo:
gh repo create ORG/REPO --private --description "PRODUCT_DESCRIPTION"
Clone locally (into the target path, never into dark-factory):
git clone git@github.com:ORG/REPO.git TARGET_PATH
cd TARGET_PATH
Configure git:
git config rerere.enabled true
git config rerere.autoupdate true
Create initial structure:
mkdir -p .factory .worktrees
Create .gitignore:
.factory/
.factory-project/
.worktrees/
.env
.env.local
*.bak
Create minimal README.md placeholder.
Initial commit and push:
git add -A
git commit -m "chore: initialize project"
git branch -M develop
git push -u origin develop
Configure branch protection:
gh api repos/ORG/REPO/branches/develop/protection -X PUT -f \
required_status_checks='{"strict":true,"contexts":[]}' \
required_pull_request_reviews='{"required_approving_review_count":0}' \
enforce_admins=false \
restrictions=null
Create merge-config.yaml:
Copy templates/merge-config-template.yaml to .factory/merge-config.yaml
and customize for this project.
Set up .factory/ as git worktree on factory-artifacts orphan branch:
Pre-check: Verify git remote is the target project (NOT dark-factory):
REMOTE_URL=$(git remote get-url origin)
if [[ "$REMOTE_URL" == *"dark-factory"* ]]; then
echo "FATAL: git remote points to dark-factory. Wrong repo."
exit 1
fi
git checkout --orphan factory-artifacts
git rm -rf .
git commit --allow-empty -m "chore: initialize factory artifacts branch"
git push origin factory-artifacts
git checkout develop
git worktree add .factory factory-artifacts
Verify worktree is valid (BLOCKING — do not proceed if this fails):
git -C .factory rev-parse --git-dir # Must succeed
git -C .factory branch --show-current # Must show "factory-artifacts"
# Verify .git file points to THIS repo, not the engine
GITDIR=$(cat .factory/.git | sed 's/gitdir: //')
[[ "$GITDIR" != *"dark-factory"* ]] || { echo "FATAL: .factory/.git points to engine"; exit 1; }
Report to orchestrator:
"Repository ORG/REPO created at TARGET_PATH.
Branch: develop (protected). Git rerere enabled.
merge-config.yaml created with autonomy level 4.
factory-artifacts orphan branch created. .factory/ mounted as worktree."
CI/CD pipeline creation is deferred until after architecture is produced (Phase 1, P1-05).
At repo init time, the language, stack, and service topology are unknown. The devops-engineer
creates CI/CD workflows as a separate mandatory step (phase-1-cicd-setup) after the
architect determines the tech stack.
When architect's architecture output includes deployment_topology: multi-service
and human confirms multi-repo:
The primary repo holds project-level coordination artifacts. Set up an orphan
branch + worktree for .factory-project/, just like .factory/:
Pre-check: Verify git remote is the target project (NOT dark-factory):
REMOTE_URL=$(git remote get-url origin)
[[ "$REMOTE_URL" != *"dark-factory"* ]] || { echo "FATAL: git remote points to dark-factory"; exit 1; }
git checkout --orphan factory-project-artifacts
git rm -rf .
git commit --allow-empty -m "chore: initialize factory-project artifacts branch"
git push origin factory-project-artifacts
git checkout develop
git worktree add .factory-project factory-project-artifacts
Verify:
git -C .factory-project rev-parse --git-dir # Must succeed
git -C .factory-project branch --show-current # Must show "factory-project-artifacts"
# Verify .git file points to THIS repo, not the engine
GITDIR=$(cat .factory-project/.git | sed 's/gitdir: //')
[[ "$GITDIR" != *"dark-factory"* ]] || { echo "FATAL: .factory-project/.git points to engine"; exit 1; }
Update .gitignore to include .factory-project/.
For each service identified by the architect:
gh repo create ORG/REPO-NAME --private./repos/REPO-NAME.factory/ worktree on factory-artifacts orphan branch (same as Step 3 item 8)Create project.yaml in the primary repo from the architect's service map:
project:
name: PRODUCT_NAME
primary_repo: ORG/PRODUCT_NAME
repos:
- name: product-api
path: ./repos/product-api
tech: rust
role: service
- name: product-frontend
path: ./repos/product-frontend
tech: typescript
role: service
- name: product-sdk
path: ./repos/product-sdk
tech: typescript
role: generated
dependency_graph:
product-api: []
product-frontend: [product-api]
product-sdk: [product-api]
Spawn state-manager to create the project-level directory structure:
.factory-project/
STATE.md — project-level pipeline state
cost/ — cross-repo cost tracking
integration/ — cross-repo integration gate results
specs/ — unified L1 brief, L2 domain spec, L3 PRD (project-level)
wave-plans/ — repo-wave ordering from dependency graph
The unified Phase 1 specs from .factory/specs/ are moved to .factory-project/specs/
since they represent the product as a whole, not a single service.
After repo is created, orchestrator spawns dx-engineer for environment setup:
Install direnv (if not present):
brew install direnv # macOS
# Or: sudo apt install direnv # Linux
Create .envrc (committed):
echo 'dotenv .env' > .envrc
git add .envrc
Create .env.example (committed, empty at init):
cat > .env.example << 'EOF'
# ============================================================
# PRODUCT RUNTIME -- keys your product needs to function
# Populated when DTU assessment identifies external services
# ============================================================
# (empty at init -- filled during Phase 1 DTU assessment)
# ============================================================
# RELEASE -- added before first release (Phase 6+)
# ============================================================
# CARGO_REGISTRY_TOKEN= # crates.io publish
# NPM_TOKEN= # npm publish
# DOCKER_PASSWORD= # Docker Hub / GHCR push
EOF
git add .env.example
Note: Factory LLM keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.) are NOT in the product repo's .env. They live in the dark-factory repo's .env.
Update .gitignore to include:
.env
.env.local
Run direnv allow:
direnv allow .
Install mcporter (MCP CLI for sub-agent access):
npm install -g mcporter
clawhub install mcporter
Configure MCP servers via mcporter:
mcporter config add perplexity --transport stdio \
--command "npx" --args "-y @perplexity-ai/mcp-server"
mcporter config add context7 --transport stdio \
--command "npx" --args "-y @upstash/context7-mcp"
mcporter config add playwright --transport stdio \
--command "npx" --args "-y @playwright/mcp@latest"
LLM health check: Verify all 3 model families are reachable via LiteLLM proxy. Block if any model is unavailable.
MCP preflight: Verify mcporter can reach Perplexity, Context7, Playwright. Spawn test to confirm sub-agent MCP access works.
.gitignore with .factory/, .worktrees/, .env, .env.local excluded.factory/merge-config.yaml from template.envrc created and direnv allowed.env.example created (empty at init, populated incrementally).factory/ set up as worktree on factory-artifacts branchFor UI/full-stack products:
mcporter config add excalidraw --url https://mcp.excalidraw.com