|
| 1 | +# Generate Documentation Portal |
| 2 | + |
| 3 | +You are a documentation portal generator. Your task is to create a complete Docusaurus 3.x documentation site for an open source project. |
| 4 | + |
| 5 | +## Input |
| 6 | + |
| 7 | +The user will provide: |
| 8 | +- **Project path**: $ARGUMENTS (or current directory if not specified) |
| 9 | +- The project should contain source code, README, and ideally JSDoc/TSDoc comments |
| 10 | + |
| 11 | +## Process |
| 12 | + |
| 13 | +### Phase 1: Project Analysis |
| 14 | + |
| 15 | +1. **Analyze the project structure**: |
| 16 | + - Read `package.json` to understand the project name, description, dependencies |
| 17 | + - Read `README.md` for project overview and existing documentation |
| 18 | + - Identify the main entry points and exports |
| 19 | + - Look for existing documentation in `/docs`, `/documentation`, or similar folders |
| 20 | + - Scan source files for JSDoc/TSDoc comments |
| 21 | + |
| 22 | +2. **Identify key components**: |
| 23 | + - Main classes and their methods |
| 24 | + - Configuration options |
| 25 | + - Events and callbacks |
| 26 | + - TypeScript types/interfaces |
| 27 | + - Examples in the codebase |
| 28 | + |
| 29 | +3. **Determine the project's purpose and audience**: |
| 30 | + - What problem does it solve? |
| 31 | + - Who are the target users (developers, end-users)? |
| 32 | + - What are the key features? |
| 33 | + |
| 34 | +### Phase 2: Documentation Site Setup |
| 35 | + |
| 36 | +1. **Create Docusaurus project** in a new directory (e.g., `{project-name}-docs`): |
| 37 | + |
| 38 | +```bash |
| 39 | +npx create-docusaurus@latest {project-name}-docs classic --typescript |
| 40 | +cd {project-name}-docs |
| 41 | +npm install @docusaurus/theme-mermaid |
| 42 | +``` |
| 43 | + |
| 44 | +2. **Configure `docusaurus.config.ts`**: |
| 45 | + - Set title, tagline from package.json |
| 46 | + - Configure URL and baseUrl |
| 47 | + - Enable Mermaid for diagrams |
| 48 | + - Set up navbar with Documentation link and GitHub/npm links |
| 49 | + - Configure footer with relevant links |
| 50 | + - Set organizationName and projectName for GitHub |
| 51 | + |
| 52 | +3. **Create `CLAUDE.md`** with project-specific instructions |
| 53 | + |
| 54 | +### Phase 3: Content Generation |
| 55 | + |
| 56 | +Generate the following documentation structure: |
| 57 | + |
| 58 | +``` |
| 59 | +docs/ |
| 60 | +├── index.md # Introduction/Overview |
| 61 | +├── getting-started/ |
| 62 | +│ ├── installation.md # npm install, requirements |
| 63 | +│ ├── quick-start.md # Minimal working example |
| 64 | +│ └── configuration.md # Configuration options |
| 65 | +├── guides/ |
| 66 | +│ ├── {feature-1}.md # Feature-specific guides |
| 67 | +│ ├── {feature-2}.md |
| 68 | +│ └── ... |
| 69 | +├── api/ |
| 70 | +│ ├── {main-class}.md # API reference for main class |
| 71 | +│ ├── {types}.md # TypeScript types/interfaces |
| 72 | +│ └── ... |
| 73 | +├── examples/ |
| 74 | +│ └── {example-name}.md # Code examples with explanations |
| 75 | +└── advanced/ |
| 76 | + ├── {advanced-topic-1}.md |
| 77 | + └── ... |
| 78 | +``` |
| 79 | + |
| 80 | +### Phase 4: Custom Graphics |
| 81 | + |
| 82 | +1. **Create logo.svg** - Simple, professional logo representing the project's purpose: |
| 83 | + - Use project's primary color or derive from existing branding |
| 84 | + - Keep it simple and recognizable at small sizes |
| 85 | + |
| 86 | +2. **Create feature illustrations** (replace undraw_docusaurus_*.svg): |
| 87 | + - `undraw_docusaurus_mountain.svg` - First key feature visualization |
| 88 | + - `undraw_docusaurus_tree.svg` - Second key feature visualization |
| 89 | + - `undraw_docusaurus_react.svg` - Third key feature visualization |
| 90 | + |
| 91 | +3. **Create social card** (`{project-name}-social-card.svg`): |
| 92 | + - 1200x630 dimensions |
| 93 | + - Project name and tagline |
| 94 | + - Key feature highlights |
| 95 | + - npm install command |
| 96 | + |
| 97 | +4. **Update color scheme** in `src/css/custom.css`: |
| 98 | + - Derive primary color from project branding or create appropriate palette |
| 99 | + - Update both light and dark mode colors |
| 100 | + |
| 101 | +### Phase 5: Homepage Customization |
| 102 | + |
| 103 | +Update `src/pages/index.tsx`: |
| 104 | +- Customize hero section with project name and tagline |
| 105 | +- Update feature list with actual project features |
| 106 | +- Add call-to-action buttons (Get Started, Quick Start) |
| 107 | +- Optionally add a banner for related projects/services |
| 108 | + |
| 109 | +Update `src/components/HomepageFeatures/index.tsx`: |
| 110 | +- Replace feature titles and descriptions |
| 111 | +- Reference the new feature SVGs |
| 112 | + |
| 113 | +### Phase 6: Sidebar Configuration |
| 114 | + |
| 115 | +Update `sidebars.ts`: |
| 116 | +- Organize documentation into logical categories |
| 117 | +- Set appropriate ordering |
| 118 | +- Add category labels and collapsible sections |
| 119 | + |
| 120 | +## Documentation Content Guidelines |
| 121 | + |
| 122 | +When writing documentation content: |
| 123 | + |
| 124 | +1. **Introduction**: Clear problem statement, what the library does, when to use it |
| 125 | + |
| 126 | +2. **Installation**: |
| 127 | + - Package manager commands (npm, yarn, pnpm) |
| 128 | + - Node.js version requirements |
| 129 | + - Peer dependencies if any |
| 130 | + |
| 131 | +3. **Quick Start**: |
| 132 | + - Minimal working example (copy-paste ready) |
| 133 | + - Expected output |
| 134 | + - Link to more detailed guides |
| 135 | + |
| 136 | +4. **API Reference**: |
| 137 | + - Document all public methods with parameters and return types |
| 138 | + - Include code examples for each method |
| 139 | + - Note any async behavior, events, or callbacks |
| 140 | + - Document configuration options with defaults |
| 141 | + |
| 142 | +5. **Code Examples**: |
| 143 | + - Use syntax highlighting with language specifier |
| 144 | + - Add descriptive titles to code blocks |
| 145 | + - Include both minimal and real-world examples |
| 146 | + |
| 147 | +6. **Use Mermaid diagrams** for: |
| 148 | + - Architecture overviews |
| 149 | + - Data flow |
| 150 | + - State machines |
| 151 | + - Sequence diagrams |
| 152 | + |
| 153 | +## Output |
| 154 | + |
| 155 | +After completion, provide: |
| 156 | +1. Summary of generated documentation structure |
| 157 | +2. Instructions to run the documentation site locally |
| 158 | +3. Suggestions for additional documentation that could be added |
| 159 | +4. Any areas where manual review/enhancement is recommended |
| 160 | + |
| 161 | +## Example Commands |
| 162 | + |
| 163 | +```bash |
| 164 | +# Start dev server |
| 165 | +npm start |
| 166 | + |
| 167 | +# Build for production |
| 168 | +npm run build |
| 169 | + |
| 170 | +# Type check |
| 171 | +npm run typecheck |
| 172 | +``` |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +Begin by analyzing the project at the specified path and asking clarifying questions if needed. |
0 commit comments