From memex
Migrate existing markdown documentation into the memex docs/ structure. Auto-detects .md files throughout the repo, enables interactive categorization (core/features/working), preserves git history with git mv, and reformats to comply with memex size limits. Use when a user installs memex in a repo with existing documentation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/memex:migrate-docsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill guides migration of existing markdown files into the memex documentation structure.
This skill guides migration of existing markdown files into the memex documentation structure.
.md filesExecute these phases in order, asking user questions at each step.
Scan for markdown files outside the memex structure:
# Use Glob tool to find all .md files, then filter
find . -name "*.md" -type f
Default exclusions (skip these automatically):
| Path | Reason |
|---|---|
docs/ | Already in memex structure |
.git/ | Git internal |
.claude/ | Claude config |
node_modules/ | Dependencies |
vendor/ | Dependencies |
.venv/, venv/ | Python virtualenv |
dist/, build/ | Build output |
CHANGELOG.md | Standard file, not docs |
SECURITY.md | Standard file |
CODE_OF_CONDUCT.md | Standard file |
LICENSE.md | Standard file |
.github/*.md | GitHub templates |
Present results as table:
Found X markdown files outside docs/:
| # | File | Lines | First Heading |
|---|------|-------|---------------|
| 1 | README.md | 326 | Project Name |
| 2 | api/README.md | 892 | API Documentation |
For each file, show a preview and ask where it should go:
--- File 1/5: api/README.md (892 lines) ---
Preview (first 30 lines):
# API Documentation
## Overview
This document describes the REST API...
Where should this file go?
Use AskUserQuestion with these options:
| Option | Destination | Use For |
|---|---|---|
core | docs/core/ | Architecture, database, API, system-level |
features | docs/features/ | Feature-specific documentation |
working | docs/working/ | Temporary notes (gitignored) |
skip | (no action) | Don't migrate this file |
Before moving each file, check:
1. Size check - If file exceeds 800 lines:
This file has 892 lines (exceeds 800 limit).
Proposed split based on ## headers:
| Output File | Sections | Lines |
|-------------|----------|-------|
| API.md | Overview, Auth | 180 |
| API_ENDPOINTS.md | All endpoints | 450 |
| API_ERRORS.md | Error codes | 262 |
Proceed with split? [yes/no/custom]
2. Conflict check - If target path exists:
Target docs/core/API.md already exists.
Options:
- merge: Append new sections to existing file
- replace: Overwrite existing file
- rename: Use different name (e.g., API_V2.md)
- skip: Don't migrate this file
3. Duplicate filename check - If same filename in different source dirs:
Multiple files named README.md found:
- api/README.md
- scripts/README.md
Suggest unique names based on content/path.
For each approved file:
1. Move with git history:
git mv source/path/FILE.md docs/{category}/NEWNAME.md
2. For splits, move original first, then create new files:
git mv api/README.md docs/core/API.md
# Edit API.md to contain only overview sections
# Write new files for split content
git add docs/core/API_ENDPOINTS.md docs/core/API_ERRORS.md
3. Update internal cross-references - Find and fix links within migrated files that reference old paths.
Apply these transformations to migrated content:
1. Add section anchors - Ensure headers are anchor-friendly:
## Main Section -> #main-section
### API Endpoints -> #api-endpoints
2. Convert paragraphs to tables where data is tabular:
# Before:
The timeout is 30 seconds, with max 20 connections and 5 minimum.
# After:
| Setting | Value |
|---------|-------|
| Timeout | 30s |
| Max connections | 20 |
| Min connections | 5 |
3. Truncate oversized sections - If a section exceeds 150 lines:
See [Full Details](FILE_SECTION.md)After migration, generate GLOSSARY.md entries:
Extract keywords from headers:
Proposed entry format:
### Category Name
- **keyword** -> `docs/core/FILE.md#section` - Brief description
Present to user for confirmation:
Proposed GLOSSARY.md entries:
### API
- **api** -> `docs/core/API.md` - API overview
- **authentication** -> `docs/core/API.md#authentication` - Auth methods
- **endpoints** -> `docs/core/API_ENDPOINTS.md` - Available endpoints
Add these entries? [yes/edit/skip]
After migration completes, verify and report:
Run checks:
git log --follow works)Show summary:
Migration Complete!
| Metric | Count |
|--------|-------|
| Files migrated | 4 |
| Files split | 1 (into 3) |
| Files skipped | 2 |
| GLOSSARY entries added | 12 |
Warnings:
- docs/core/API_ENDPOINTS.md section "DELETE" has 142 lines (close to limit)
Next steps:
1. Review migrated files
2. Add keyword entries to docs/GLOSSARY.md so the context-enricher can auto-load them
3. Commit: git commit -m "Migrate documentation to memex structure"
When a file exceeds 800 lines:
## headers to find section boundariesORIGINAL_SECTION.mdNaming convention:
API.md (892 lines) splits into:
├── API.md (overview, 180 lines)
├── API_ENDPOINTS.md (450 lines)
└── API_ERRORS.md (262 lines)
| Case | Handling |
|---|---|
| Empty .md file | Skip with notice |
| Binary file with .md extension | Skip with warning |
| File only has code blocks | Flag for user review |
| Symlinks | Resolve to actual file |
| Files in .gitignore | Skip (not versioned) |
| Non-UTF8 encoding | Warn, attempt conversion |
Remind user to:
docs/GLOSSARY.md (- **keyword** -> \path``); the context-enricher boosts these, but retrieval also works without themnpx claudepluginhub 0-to-1-labs/claude-marketplace --plugin memexCreates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.