Lesson 12: The specweave init Deep Dive
Time: 40 minutes Goal: Understand every init question and make informed decisions
Why Initialization Mattersβ
The specweave init command is the most important moment in your project. The decisions you make here shape:
- How increments sync with external tools (GitHub, JIRA, ADO)
- How your team collaborates on specs
- How documentation is organized
- What plugins are available
Get it right once. Don't revisit for months.
The Two Init Pathsβ
Path 1: Quick Init (Greenfield)β
specweave init .
For new projects. Asks essential questions, sets up defaults.
Path 2: Strategic Init (Brownfield)β
specweave init . --strategic
For existing projects. AI-powered analysis, compliance detection, architecture recommendations.
This lesson covers both paths.
Phase 1: Project Detectionβ
When you run specweave init, the first thing that happens is automatic detection:
Detecting project configuration...
β Git repository detected
β package.json found (Node.js project)
β TypeScript detected (tsconfig.json)
β GitHub remote: origin β github.com/your-org/your-repo
What Gets Detectedβ
| Detection | Why It Matters |
|---|---|
| Git provider | Determines which sync plugin to suggest |
| Package manager | npm, yarn, pnpm, bun for dependency scripts |
| Language | TypeScript, JavaScript, Python, Go, Rust |
| Framework | React, Next.js, Express, NestJS, Django |
| Existing CI/CD | GitHub Actions, GitLab CI, Azure Pipelines |
What Happens Behind the Scenesβ
// SpecWeave checks for:
- .git/config β GitHub/GitLab/Azure DevOps/Bitbucket
- package.json β Node.js ecosystem
- tsconfig.json β TypeScript
- .github/workflows/ β GitHub Actions
- azure-pipelines.yml β Azure DevOps
- .gitlab-ci.yml β GitLab CI
- Dockerfile β Container deployment
Phase 2: Git Provider Selectionβ
? Which Git provider are you using?
β― GitHub (github.com)
GitHub Enterprise
GitLab (gitlab.com)
GitLab Self-hosted
Azure DevOps (dev.azure.com)
Bitbucket
None / Skip
Why This Question Mattersβ
The Git provider determines:
- Which sync plugin gets installed (specweave-github, specweave-ado, etc.)
- Issue linking format (
#123for GitHub,AB#123for ADO) - CI/CD integration templates
GitHub vs GitHub Enterpriseβ
GitHub (github.com):
API endpoint: api.github.com
Auth: Personal Access Token (PAT)
GitHub Enterprise:
API endpoint: api.your-company.com
Auth: PAT or OAuth app
Extra config: GH_HOST environment variable
Tip: If your company uses GitHub Enterprise, select that option even if the URL looks like github.company.com.
Phase 3: External Issue Trackerβ
? Do you want to sync increments with an external issue tracker?
β― Yes, GitHub Issues
Yes, JIRA
Yes, Azure DevOps Work Items
No, keep everything local
Why This Question Mattersβ
External sync enables:
- Bidirectional progress updates (task completed β checkbox checked)
- Team visibility (PMs see progress without accessing code)
- Integration with existing workflows (JIRA sprints, ADO boards)
What Happens If You Choose Each Optionβ
GitHub Issues:
Additional questions:
? GitHub organization/owner name: your-org
? Repository name: your-repo
? Create issues automatically when increment starts? (Y/n)
Creates:
- .env (gitignored) with GITHUB_TOKEN placeholder
- Installs specweave-github plugin
JIRA:
Additional questions:
? JIRA domain (e.g., company.atlassian.net): your-company.atlassian.net
? JIRA project key: PROJ
? Default issue type: Story
? Map increments to Epics or Stories?
Creates:
- .env with JIRA_EMAIL, JIRA_API_TOKEN, JIRA_BASE_URL
- Installs specweave-jira plugin
Azure DevOps:
Additional questions:
? Azure DevOps organization: your-org
? Project name: your-project
? Team name(s): Frontend, Backend (comma-separated)
? Default work item type: User Story
Creates:
- .env with ADO_PAT, ADO_ORGANIZATION, ADO_PROJECT
- Installs specweave-ado plugin
Phase 4: Team Strategy Selectionβ
If you selected an external tracker, you'll see:
? How is your team organized?
For GitHub:
β― Repository-per-team (microservices)
Team-based (monorepo with team labels)
Team-multi-repo (platform teams)
For JIRA:
β― Project-per-team (separate JIRA projects)
Component-based (one project, components = teams)
Board-based (one project, boards = teams)
For Azure DevOps:
β Teams within project (single strategy)
Why This Question Mattersβ
This determines folder structure and sync mapping:
Repository-per-team:
.specweave/docs/specs/
βββ frontend-app/ β syncs to frontend-app repo
βββ backend-api/ β syncs to backend-api repo
βββ mobile-app/ β syncs to mobile-app repo
Component-based:
.specweave/docs/specs/
βββ Frontend/ β syncs to PROJ with component=Frontend
βββ Backend/ β syncs to PROJ with component=Backend
βββ Mobile/ β syncs to PROJ with component=Mobile
Decision Guideβ
| Scenario | Best Strategy |
|---|---|
| Each team deploys independently | Repository-per-team |
| Monorepo with shared code | Team-based |
| Platform team owns multiple services | Team-multi-repo |
| Simple team, one project | Default (no strategy) |
Phase 5: Documentation Approachβ
? Documentation approach:
β― Simple (recommended for small teams)
Living docs (full feature/epic hierarchy)
Multi-project (separate specs per team)
Simple (Default)β
.specweave/
βββ increments/ β Your work lives here
βββ docs/
βββ internal/ β Minimal structure
Best for: Solo developers, small teams (1-5 people), single-product companies.
Living Docsβ
.specweave/
βββ increments/
βββ docs/
βββ internal/
β βββ specs/
β β βββ _features/
β β βββ FS-001/ β Feature folders
β β βββ FS-002/
β β βββ ...
β βββ architecture/
β β βββ adr/ β Architecture Decision Records
β βββ governance/
βββ external/
βββ api/ β Public API docs
Best for: Medium teams (5-15 people), products with multiple features, enterprises needing traceability.
Multi-Projectβ
.specweave/
βββ increments/
βββ docs/
βββ internal/
βββ specs/
βββ projects/
β βββ frontend/
β β βββ specs/
β βββ backend/
β β βββ specs/
β βββ mobile/
β βββ specs/
βββ _shared/ β Cross-team features
Best for: Large teams (15+ people), multiple products, platform teams.
Phase 6: WIP Limitsβ
? Maximum active increments (WIP limit):
β― 1 (focused - recommended)
2 (parallel work allowed)
3 (large team)
No limit (not recommended)
Why WIP Limits Matterβ
WIP = 1:
- One increment at a time
- Maximum focus
- No context switching
- Recommended for 90% of users
WIP = 2:
- Main feature + hotfix allowed
- Useful for production support
- Still maintains focus
WIP = 3+:
- Only for large teams
- Risk of scattered focus
- Requires discipline
The data: Studies show developers are 40% more productive with WIP limits. Context switching is expensive.
Phase 7: Testing Configurationβ
? Include test configuration?
β― Yes, configure test framework
No, I'll set up tests later
If yes:
? Test framework:
β― Vitest (recommended for modern projects)
Jest
Mocha
Playwright (E2E)
Custom
What Gets Createdβ
// .specweave/config.json
{
"testing": {
"framework": "vitest",
"unitTestPattern": "**/*.test.ts",
"integrationTestPattern": "**/*.integration.test.ts",
"e2eTestPattern": "**/*.e2e.test.ts",
"coverageThreshold": 80
}
}
Phase 8: Plugin Installationβ
Installing plugins...
β specweave-github (GitHub integration)
β specweave-release (Release management)
Optional plugins available:
? Install specweave-kafka? (Kafka infrastructure) [y/N]
? Install specweave-ml? (ML pipeline support) [y/N]
? Install specweave-mobile? (React Native support) [y/N]
Core Plugins (Auto-installed)β
| Plugin | What It Does |
|---|---|
| specweave | Core framework, increment management |
| specweave-github/jira/ado | External tool sync |
| specweave-release | Version bumping, changelog |
Optional Pluginsβ
| Plugin | When to Install |
|---|---|
| specweave-kafka | Building event-driven systems |
| specweave-ml | ML pipelines, model deployment |
| specweave-mobile | React Native mobile apps |
| specweave-kubernetes | K8s deployments |
| specweave-infrastructure | Terraform, cloud infrastructure |
Phase 9: Final Configurationβ
? Language for CLI messages and documentation:
β― English
Spanish (EspaΓ±ol)
German (Deutsch)
French (FranΓ§ais)
Russian (Π ΡΡΡΠΊΠΈΠΉ)
Chinese (δΈζ)
Multilingual Supportβ
SpecWeave supports 30+ languages. Choosing a non-English language:
- Translates CLI messages
- Translates generated documentation headers
- Keeps code and technical terms in English (best practice)
The Config Fileβ
After init, you'll have .specweave/config.json:
{
"project": {
"name": "your-project",
"description": "Your project description"
},
"limits": {
"maxActiveIncrements": 1,
"hardCap": 2
},
"sync": {
"github": {
"enabled": true,
"owner": "your-org",
"repo": "your-repo",
"autoCreateIssues": true
}
},
"testing": {
"framework": "vitest",
"coverageThreshold": 80
},
"language": "en"
}
Secrets Fileβ
Sensitive values go in .env (gitignored):
# GitHub
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx
# JIRA (if configured)
JIRA_EMAIL=you@company.com
JIRA_API_TOKEN=xxxxxxxxxxxx
JIRA_BASE_URL=https://company.atlassian.net
# Azure DevOps (if configured)
ADO_PAT=xxxxxxxxxxxxxxxxxxxx
ADO_ORGANIZATION=your-org
ADO_PROJECT=your-project
Common Init Scenariosβ
Scenario 1: Solo Developer, New Projectβ
specweave init .
# Answers:
# Git provider: GitHub
# External tracker: No (keep local)
# Documentation: Simple
# WIP limit: 1
# Testing: Vitest
Result: Minimal setup, maximum speed.
Scenario 2: Startup Team (5 devs), GitHub-Firstβ
specweave init .
# Answers:
# Git provider: GitHub
# External tracker: GitHub Issues
# Team strategy: Repository-per-team
# Documentation: Living docs
# WIP limit: 2
# Testing: Vitest + Playwright
Result: Full GitHub integration, team visibility.
Scenario 3: Enterprise, JIRA + Azure DevOpsβ
specweave init . --strategic
# Strategic Init phases:
# Phase 0: Vision analysis
# Phase 1: Compliance detection (finds HIPAA, SOC 2)
# Phase 2: Team recommendations (suggests Security Engineer)
# Phase 3: Repository selection
# Phase 4-5: Architecture (recommends traditional, not serverless)
# Phase 6: Project generation
# Regular Init continues:
# Git provider: Azure DevOps
# External tracker: JIRA
# Team strategy: Project-per-team
# Documentation: Multi-project
# WIP limit: 3
Result: Enterprise-grade setup with compliance.
Re-initializing Existing Projectsβ
# Update config without losing data
specweave init . --reconfigure
# Full re-init (preserves increments)
specweave init . --force
# Dangerous: fresh start (DELETES everything)
specweave init . --fresh # Requires confirmation
What Gets Preservedβ
| Item | --reconfigure | --force | --fresh |
|---|---|---|---|
| Increments | β | β | β |
| Living docs | β | β | β |
| Config | β (updated) | β (updated) | β |
| .env | β | β | β |
Troubleshooting Initβ
"Git repository not found"β
# Initialize git first
git init
git remote add origin https://github.com/you/repo.git
specweave init .
"Plugin installation failed"β
# Check npm permissions
npm config get prefix
# Should be user-writable directory
# Or run with sudo (not recommended)
sudo specweave init .
"Token validation failed"β
# Check token permissions
# GitHub: needs 'repo', 'read:org' scopes
# JIRA: needs project read/write
# ADO: needs Work Items read/write
# Test manually:
curl -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/user
Quick Exerciseβ
Initialize a test project:
mkdir specweave-init-test && cd specweave-init-test
npm init -y
git init
specweave init .
# Answer questions, then verify:
ls -la .specweave/
cat .specweave/config.json
Success criteria:
-
.specweave/directory created -
config.jsonreflects your answers - No error messages during init
Key Takeawaysβ
- Init is strategic β Take 5 minutes to answer thoughtfully
- Detection is automatic β SpecWeave finds your stack
- Team strategy matters β Choose based on your org structure
- WIP limits boost productivity β Start with 1 or 2
- Secrets stay local β
.envis gitignored
Glossary Terms Usedβ
- WIP Limits β Work-in-progress constraints
- Living Docs β Auto-synced documentation
- Increment β A unit of work
What's Next?β
Now that your project is initialized, learn how to manage increments through their full lifecycle β from creation to archival.