Intelligently onboards brownfield projects by merging existing CLAUDE.md backups into SpecWeave structure. Extracts project-specific knowledge, domain context, team conventions, and technical details from backup CLAUDE.md files, then distributes content to appropriate SpecWeave folders without bloating CLAUDE.md. Activates for: merge docs, merge claude, onboard brownfield, import existing docs, claude backup, specweave merge-docs.
Merges existing CLAUDE.md backups into SpecWeave's structure without bloating the main file. Activates when you run "merge docs", "merge claude", or "onboard brownfield" commands.
/plugin marketplace add anton-abyzov/specweave/plugin install sw@specweaveThis skill inherits all available tools. When active, it can use any tool Claude has access to.
MEMORY.mdPurpose: Intelligently merge existing CLAUDE.md backups into SpecWeave's structure without bloating the main CLAUDE.md file.
When to Use: After installing SpecWeave into an existing project that had CLAUDE.md
Philosophy: Keep CLAUDE.md as a concise guide, distribute detailed content to appropriate SpecWeave folders.
Modes: Supports both Quick Start (incremental) and Comprehensive (upfront) approaches π
The brownfield-onboarder works differently based on the chosen documentation path:
Philosophy: Merge only essential context, defer detailed docs to per-increment
What to merge immediately:
What to defer (document per increment):
Result: Minimal upfront merge (30-60 minutes), detailed docs grow incrementally
Philosophy: Merge everything upfront for complete context
What to merge:
Result: Complete merge (1-3 hours), full context available immediately
Auto-detection:
// Settings auto-detected
const mode = config.brownfield?.mode || 'auto';
if (mode === 'auto') {
// Use complexity from brownfield-analyzer
const complexity = await readComplexityAssessment();
mode = complexity.recommendedPath === 'Quick Start' ? 'incremental' : 'comprehensive';
}
User can override:
# Force Quick Start mode
brownfield-onboarder --mode quick-start
# Force Comprehensive mode
brownfield-onboarder --mode comprehensive
When installing SpecWeave into an existing project:
CLAUDE.md with valuable project-specific contextCLAUDE.md as the development guideCLAUDE.md is backed up to .claude/backups/CLAUDE-backup-{timestamp}.mdInstead of bloating CLAUDE.md, distribute content to appropriate folders:
Project-specific content β SpecWeave folders:
# Internal Documentation (strategic, team-only)
Architecture details β .specweave/docs/internal/architecture/existing-system.md
Technology stack β .specweave/docs/internal/architecture/tech-stack.md
Business rules β .specweave/docs/internal/strategy/business-rules.md
Team workflows β .specweave/docs/internal/processes/team-workflows.md
Deployment process β .specweave/docs/internal/processes/deployment.md
Domain knowledge β .specweave/increments/{####-name}/docs/domain/{domain}.md
# Public Documentation (user-facing, can be published)
Project conventions β .specweave/docs/public/guides/project-conventions.md
API conventions β .specweave/docs/public/guides/api-conventions.md
Code style β .specweave/docs/public/guides/code-style.md
Only add to CLAUDE.md: High-level project summary (1-2 paragraphs max)
Trigger: User runs specweave merge-docs or asks "merge my old CLAUDE.md"
Auto-detection:
.claude/backups/CLAUDE-backup-*.md existsExtract sections:
interface ParsedCLAUDEmd {
projectName: string;
projectDescription: string;
techStack: TechStack;
architecture: ArchitectureSection[];
conventions: Convention[];
workflows: Workflow[];
domainKnowledge: DomainSection[];
teamGuidelines: TeamGuideline[];
deploymentProcess: DeploymentSection[];
apiDesign: APISection[];
businessRules: BusinessRule[];
codeExamples: CodeExample[];
customInstructions: Instruction[];
}
Section Detection Keywords:
For each section, determine:
Generic or Project-Specific?
Overlap with SpecWeave CLAUDE.md?
Essential or Detailed? π
Mode-Based Decision π
Target Destination
Classification Matrix π:
| Content Type | Essential? | Quick Start Action | Comprehensive Action |
|---|---|---|---|
| Core Architecture | β Yes | Merge immediately | Merge immediately |
| Tech Stack | β Yes | Merge immediately | Merge immediately |
| Critical Patterns (auth, payment) | β Yes | Merge immediately | Merge immediately |
| Team Conventions | β Yes | Merge immediately | Merge immediately |
| Project Summary | β Yes | Merge immediately | Merge immediately |
| Detailed Business Rules | β No | Defer to increment | Merge immediately |
| Module Documentation | β No | Defer to increment | Merge immediately |
| API-Level Docs | β No | Defer to increment | Merge immediately |
| Code Examples | β No | Defer to increment | Merge immediately |
Example (Quick Start):
Analyzing CLAUDE.md backup (Quick Start mode)...
Found sections:
β
Core Architecture (merge now)
β
Tech Stack (merge now)
β
Auth Pattern (merge now - critical)
βΈοΈ Payment Business Rules (defer - extract when working on payments)
βΈοΈ User Module API (defer - extract when modifying user code)
βΈοΈ Code Examples (defer - extract as needed)
Merging 3 sections immediately, deferring 3 for incremental extraction.
Indicators: Business concepts, entities, domain terminology
Example:
# Old CLAUDE.md
## Domain Model
Our platform manages **patient appointments** with **healthcare providers**.
Key entities:
- Patient (demographics, insurance, medical history)
- Provider (specialties, availability, credentials)
- Appointment (time slot, status, notes)
- Clinic (location, services, staff)
Business rules:
- Appointments must be 15-60 minutes
- Patients can cancel up to 24 hours before
- Providers can override cancellation policy
Destination: specifications/modules/appointments/domain-model.md
CLAUDE.md addition: None (link from CLAUDE.md to specifications)
Indicators: System design, component descriptions, data flow
Example:
# Old CLAUDE.md
## System Architecture
We use a microservices architecture:
- API Gateway (Kong) - routing, authentication
- Booking Service (Node.js) - appointment management
- Notification Service (Python) - email/SMS
- Payment Service (Node.js) - Stripe integration
- Database (PostgreSQL) - shared across services
Destination: .specweave/docs/internal/architecture/existing-system.md
CLAUDE.md addition:
## Project-Specific Architecture
See [Existing System Architecture](.specweave/docs/internal/architecture/existing-system.md) for complete microservices architecture.
Indicators: Naming conventions, code style, patterns
Example:
# Old CLAUDE.md
## Naming Conventions
- API endpoints: `/api/v1/{resource}/{action}` (kebab-case)
- Database tables: `{domain}_{entity}` (snake_case)
- TypeScript interfaces: `I{Name}` prefix (PascalCase)
- React components: `{Name}Component.tsx` suffix
Destination: .specweave/docs/public/guides/project-conventions.md
CLAUDE.md addition: None (standard conventions, no need to clutter CLAUDE.md)
Indicators: Deployment process, CI/CD, release workflow
Example:
# Old CLAUDE.md
## Deployment Process
1. Create feature branch from `main`
2. Implement feature with tests
3. Create PR (requires 2 approvals)
4. Merge β auto-deploy to staging
5. Manual approval β deploy to production
6. Rollback via GitHub Actions if needed
Destination: .specweave/docs/internal/processes/deployment.md
CLAUDE.md addition:
## Deployment
See [Deployment Guide](.specweave/docs/internal/processes/deployment.md).
Indicators: Validation rules, policies, constraints
Example:
# Old CLAUDE.md
## Business Rules
### Appointment Booking
- Patients can book up to 3 months in advance
- Maximum 5 active appointments per patient
- Same-day appointments require $50 deposit
- Insurance verification required before booking
Destination: .specweave/docs/internal/strategy/appointments/business-rules.md
CLAUDE.md addition: None (specifications are source of truth)
Indicators: Technologies, frameworks, tools
Example:
# Old CLAUDE.md
## Tech Stack
- Frontend: Next.js 14, React, Tailwind CSS
- Backend: Node.js 20, Express, TypeScript
- Database: PostgreSQL 16, Prisma ORM
- Cache: Redis
- Queue: BullMQ
- Infrastructure: Hetzner Cloud, Terraform
- Monitoring: Grafana, Prometheus
Destination: .specweave/docs/internal/architecture/tech-stack.md
CLAUDE.md addition:
## Tech Stack
Next.js 14 + Node.js 20 + PostgreSQL 16 + Hetzner Cloud
See [Tech Stack Details](.specweave/docs/internal/architecture/tech-stack.md).
Indicators: API conventions, authentication, error handling
Example:
# Old CLAUDE.md
## API Design
All APIs follow REST conventions:
- Authentication: JWT in Authorization header
- Errors: Standard structure { error, message, details }
- Pagination: page, limit query params
- Filtering: field[operator]=value
- Versioning: /api/v1, /api/v2
Destination: .specweave/docs/public/guides/api-conventions.md
CLAUDE.md addition: None (guide covers it)
Indicators: Code snippets, example implementations
Decision:
Example:
# Old CLAUDE.md - Generic React pattern
function UserList() {
const [users, setUsers] = useState([]);
// ... standard React code
}
Action: Discard (generic React, not project-specific)
Example:
# Old CLAUDE.md - Custom authentication pattern
// Our custom auth hook (wraps Supabase)
function useCustomAuth() {
const { session } = useSupabase();
const { roles } = useRoleProvider();
return { user: session?.user, hasRole: (role) => roles.includes(role) };
}
Action: Extract to .specweave/docs/public/guides/authentication.md (project-specific pattern)
ONLY add high-level project summary to SpecWeave's CLAUDE.md:
---
## Project-Specific Context
**Project**: Healthcare Appointment Booking Platform
**Domain**: Healthcare, Patient Management, Provider Scheduling
### Quick Links
- [Domain Model](.specweave/increments/####-name/docs/domain/appointments/domain-model.md)
- [Existing System Architecture](.specweave/docs/internal/architecture/existing-system.md)
- [Tech Stack](.specweave/docs/internal/architecture/tech-stack.md)
- [Business Rules](.specweave/docs/internal/strategy/appointments/business-rules.md)
- [Deployment Guide](.specweave/docs/internal/processes/deployment.md)
- [Project Conventions](.specweave/docs/public/guides/project-conventions.md)
**Note**: All project-specific details are in linked documents. This keeps CLAUDE.md concise.
---
Total addition: ~15 lines max
Never add to CLAUDE.md:
Only add to CLAUDE.md:
Before creating files, check if similar content exists:
// Check if domain model already exists
if (exists("specifications/modules/appointments/domain-model.md")) {
// Compare content
existingContent = read("specifications/modules/appointments/domain-model.md");
newContent = extractDomainModel(backupCLAUDEmd);
if (similarity(existingContent, newContent) > 0.8) {
// Skip, already documented
skip();
} else {
// Merge unique content
mergedContent = merge(existingContent, newContent);
write("specifications/modules/appointments/domain-model.md", mergedContent);
}
}
When extracting content:
Before writing files, show user:
I found the following project-specific content in your backup CLAUDE.md:
π¦ Domain Model (Healthcare Appointments)
β .specweave/increments/####-name/docs/domain/appointments/domain-model.md
ποΈ Microservices Architecture
β .specweave/docs/internal/architecture/existing-system.md
π οΈ Tech Stack (Next.js + Node.js + PostgreSQL)
β .specweave/docs/internal/architecture/tech-stack.md
π Business Rules (Booking policies)
β .specweave/docs/internal/strategy/appointments/business-rules.md
π§ Project Conventions (Naming, code style)
β .specweave/docs/public/guides/project-conventions.md
π Deployment Process (CI/CD workflow)
β .specweave/docs/internal/processes/deployment.md
π CLAUDE.md Update
β Add 12-line project summary with links
Total files to create: 6
Total lines added to CLAUDE.md: 12
Proceed with merge? (y/n)
After merge, generate mode-specific report:
# CLAUDE.md Merge Report - Quick Start Mode
**Date**: 2025-10-26
**Backup File**: .claude/backups/CLAUDE-backup-20251026-143022.md
**Merge Status**: β
Complete (Essential content only)
**Mode**: Quick Start (Incremental Documentation)
---
## Files Created (Essential Only)
1. β
`.specweave/docs/internal/architecture/core-architecture.md` (120 lines)
2. β
`.specweave/docs/internal/architecture/tech-stack.md` (80 lines)
3. β
`.specweave/docs/internal/architecture/critical-patterns.md` (100 lines)
4. β
`.specweave/docs/public/guides/project-conventions.md` (90 lines)
5. β
`.specweave/docs/internal/processes/deployment.md` (70 lines)
**Total**: 5 files, 460 lines (essential content)
---
## CLAUDE.md Updated
**Added**: 10 lines (project summary + links)
**Location**: Lines 850-860
---
## Content Distribution (Quick Start)
| Content Type | Lines | Status | Destination |
|--------------|-------|--------|-------------|
| Core Architecture | 120 | β
Merged | .specweave/docs/internal/architecture/ |
| Tech Stack | 80 | β
Merged | .specweave/docs/internal/architecture/ |
| Critical Patterns | 100 | β
Merged | .specweave/docs/internal/architecture/ |
| Conventions | 90 | β
Merged | .specweave/docs/public/guides/ |
| Deployment | 70 | β
Merged | .specweave/docs/internal/processes/ |
| **CLAUDE.md** | **10** | β
**Updated** | **Root** |
| **Subtotal Merged** | **470** | | |
| | | | |
| Domain Model (detailed) | 450 | βΈοΈ Deferred | Extract when working on appointments |
| Business Rules (detailed) | 280 | βΈοΈ Deferred | Extract when working on payments |
| User Module API | 150 | βΈοΈ Deferred | Extract when modifying user code |
| Code Examples | 200 | βΈοΈ Deferred | Extract as needed per increment |
| **Subtotal Deferred** | **1,080** | | **Document incrementally** |
**Result**: 470 lines merged now, 1,080 lines to extract per increment
**Benefit**: Start in 30-60 minutes, not 1-3 hours
---
## Deferred Content (Extract Per Increment)
The following content remains in the backup and will be extracted when you work on related features:
### π¦ Domain Documentation
- `appointments/domain-model.md` (450 lines)
β Extract when creating increment for appointments feature
### π Business Rules
- `payments/business-rules.md` (280 lines)
β Extract when creating increment for payment modifications
### π API Documentation
- `users/api-endpoints.md` (150 lines)
β Extract when creating increment for user service changes
### π» Code Examples
- Various code snippets (200 lines)
β Extract as needed
**How to extract later**:
```bash
# When starting increment for appointments
/inc "Refactor appointment booking"
# In spec.md, reference:
# "See backup: .claude/backups/CLAUDE-backup-*.md (appointments section)"
# Or ask:
# "Extract appointment documentation from CLAUDE.md backup"
Total skipped: 80 lines (generic content)
Time saved: ~2 hours (vs comprehensive upfront)
### Comprehensive Mode Report
```markdown
# CLAUDE.md Merge Report - Comprehensive Mode
**Date**: 2025-10-26
**Backup File**: .claude/backups/CLAUDE-backup-20251026-143022.md
**Merge Status**: β
Complete (All content)
**Mode**: Comprehensive (Upfront Documentation)
---
## Files Created
1. β
`.specweave/increments/####-name/docs/domain/appointments/domain-model.md` (450 lines)
2. β
`.specweave/docs/internal/architecture/existing-system.md` (320 lines)
3. β
`.specweave/docs/internal/architecture/tech-stack.md` (180 lines)
4. β
`.specweave/docs/internal/strategy/appointments/business-rules.md` (280 lines)
5. β
`.specweave/docs/public/guides/project-conventions.md` (200 lines)
6. β
`.specweave/docs/internal/processes/deployment.md` (150 lines)
**Total**: 6 files, 1,580 lines
---
## CLAUDE.md Updated
**Added**: 12 lines (project summary + links)
**Location**: Lines 850-862 (after "Living Documentation Principles")
---
## Content Distribution
| Content Type | Lines | Destination |
|--------------|-------|-------------|
| Domain Model | 450 | .specweave/increments/####-name/docs/domain/ |
| Architecture | 320 | .specweave/docs/internal/architecture/ |
| Tech Stack | 180 | .specweave/docs/internal/architecture/ |
| Business Rules | 280 | .specweave/docs/internal/strategy/ |
| Conventions | 200 | .specweave/docs/public/guides/ |
| Deployment | 150 | .specweave/docs/internal/processes/ |
| **CLAUDE.md** | **12** | **Root** |
**Result**: 99.2% of content distributed to appropriate folders, not bloating CLAUDE.md
---
## Skipped Content
- Generic React patterns (25 lines) - Already covered in SpecWeave
- Standard git workflow (15 lines) - Common knowledge
- TypeScript basics (40 lines) - Not project-specific
**Total skipped**: 80 lines (generic content)
---
## Next Steps
1. β
Review generated files in `.specweave/docs/internal/` and `.specweave/docs/public/`
2. β
SpecWeave uses auto-detection
3. β
Run `npm run docs:dev` to preview documentation
4. β
Create features from specifications: `specweave plan-feature {name}`
---
## Backup Preserved
Original backup remains at:
`.claude/backups/CLAUDE-backup-20251026-143022.md`
You can reference it anytime.
---
**Merge Complete! π**
Your project-specific knowledge is now integrated into SpecWeave's structure.
User: "I installed SpecWeave and it backed up my CLAUDE.md. Can you merge the important parts?"
I'll analyze your backup CLAUDE.md and intelligently merge project-specific content.
π Analyzing: .claude/backups/CLAUDE-backup-20251026-143022.md
Found:
- Project: Healthcare Appointment Booking Platform
- Domain model: Patients, Providers, Appointments, Clinics
- Architecture: Microservices (4 services)
- Tech stack: Next.js + Node.js + PostgreSQL
- Business rules: Booking policies, cancellation rules
- Conventions: Naming, API design
- Deployment: CI/CD workflow
π¦ Content Distribution Plan:
1. Domain Model β specifications/modules/appointments/domain-model.md
2. Architecture β .specweave/docs/architecture/existing-system.md
3. Tech Stack β .specweave/docs/architecture/tech-stack.md
4. Business Rules β specifications/modules/appointments/business-rules.md
5. Conventions β .specweave/docs/guides/project-conventions.md
6. Deployment β .specweave/docs/guides/deployment.md
CLAUDE.md: Add 12-line summary with links (no bloat!)
Total: 6 files, ~1,580 lines
CLAUDE.md additions: 12 lines (99.2% distributed to folders)
Proceed with merge? (y/n)
β
Merge complete!
Created:
1. .specweave/increments/####-name/docs/domain/appointments/domain-model.md
2. .specweave/docs/internal/architecture/existing-system.md
3. .specweave/docs/internal/architecture/tech-stack.md
4. .specweave/docs/internal/strategy/appointments/business-rules.md
5. .specweave/docs/public/guides/project-conventions.md
6. .specweave/docs/internal/processes/deployment.md
Updated:
- CLAUDE.md (added 12-line project summary)
Report saved: ai-logs/reports/CLAUDE-MERGE-REPORT-20251026.md
Your project knowledge is now integrated! π
Next: Review files and run `npm run docs:dev` to preview.
Scan for backups:
const backups = glob(".claude/backups/CLAUDE-backup-*.md");
const latestBackup = backups.sort().reverse()[0]; // Most recent
Parse content:
const content = read(latestBackup);
const sections = parseSections(content); // Split by headers
const classified = classifyContent(sections); // Domain, Architecture, etc.
Avoid duplicates:
if (exists(targetPath)) {
const existing = read(targetPath);
if (similarity(existing, newContent) > 0.8) {
skip(); // Already documented
}
}
See test-cases/ directory for validation scenarios.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.