بنقرة واحدة
create-doc
Create new documentation pages interactively. Searches codebase to ensure accuracy.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create new documentation pages interactively. Searches codebase to ensure accuracy.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Analyze documentation for duplicates, outdated content, and discrepancies with codebase
Expert-level documentation bootstrap using Diátaxis framework and audience-driven planning.
Quick health check for documentation issues. Verifies content against actual source files.
Commit documentation changes to git after reviewing and confirming.
Delete documentation pages interactively with confirmation.
Import and configure API specification (OpenAPI, GraphQL, AsyncAPI) for documentation
استنادا إلى تصنيف SOC المهني
| name | create-doc |
| description | Create new documentation pages interactively. Searches codebase to ensure accuracy. |
When user wants to create documentation:
Read .devdoc/context.json if it exists:
product.name for product referencesterminology.glossary for correct termsdocumentation.codeExamples.primaryLanguage for codedocumentation.templatesAsk the user:
"What would you like to document?
Based on their choice:
{spec}. Should I generate docs from it?"ALWAYS search and read actual files before generating content:
# Find files related to the topic
git ls-files | grep -iE "(auth|login|session)" # for auth docs
# Search file contents for specific terms
rg -l "export.*function.*createUser" --type ts
rg -l "class.*Authentication" --type ts
# Find types and interfaces
rg -l "interface.*User|type.*User" --type ts
# Find examples
git ls-files | grep -iE "(example|test|spec)"
For each relevant file:
┌─────────────────────────────────────────────┐
│ ASSESSMENT │
├─────────────────────────────────────────────┤
│ ✅ Sufficient - Found source files │
│ → Proceed with real data │
│ │
│ ⚠️ Partial - Some gaps │
│ → Generate with TODOs for gaps │
│ │
│ ❌ Insufficient - No relevant files │
│ → FLAG and offer options │
└─────────────────────────────────────────────┘
If files not found, present options:
⚠️ UNCLEAR TOPIC: [topic]
Searched for:
- src/**/*auth*.ts → Not found
- lib/**/*auth*.ts → Not found
Options:
1. 🔄 **Skip this doc** - Remove from plan
2. ✏️ **Different topic** - Document something else
3. 📝 **Mark as TODO** - Create placeholder
4. ❓ **Ask for path** - "Where is [topic] implemented?"
Choose an option (1-4):
Search for feature flags:
# Find feature flag patterns
rg -l "featureFlag|feature_flag|isEnabled|FF_" --type ts
rg "if.*\(.*feature|process\.env\.FEATURE" --type ts
rg "LaunchDarkly|Unleash|Split|flagsmith" --type ts
Search for duplicate/similar features:
# Find similar function names
rg "export.*(login|authenticate|signIn)" --type ts -l
rg "export.*(createUser|addUser|registerUser)" --type ts -l
Flag findings for user guidance:
⚠️ FEATURE FLAGS DETECTED:
📍 src/lib/auth/index.ts:45
if (featureFlags.newAuthFlow) { ... }
This feature has TWO implementations:
- OLD: lines 50-80 (current default)
- NEW: lines 82-120 (behind feature flag)
Question: Document which version?
1. Current (old) implementation
2. New implementation (feature flagged)
3. Both with toggle notice
⚠️ DUPLICATE FEATURES DETECTED:
Found similar functions:
- src/lib/auth/login.ts → login()
- src/lib/auth/v2/authenticate.ts → authenticate()
- src/lib/legacy/signIn.ts → signIn()
Question: Which should be documented?
1. Document primary (login.ts)
2. Document all with comparison
3. Mark legacy as deprecated
📂 FILES FOUND for [topic]:
✓ src/lib/auth/index.ts (main auth module)
- login(email, password): Promise<Token>
- logout(): void
- verifyToken(token): boolean
✓ src/lib/auth/types.ts
- interface User { id, email, role }
- type AuthToken { token, expiresAt }
✓ tests/auth.test.ts
- Example usage patterns
⚠️ FEATURE FLAGS: newAuthFlow (src/lib/auth/index.ts:45)
⚠️ DUPLICATES: authenticate() in v2/, signIn() in legacy/
Proceed with generating documentation from these files?
Read the appropriate template from .devdoc/templates/:
| Content Type | Template |
|---|---|
| How-to guide | guide.md |
| Tutorial | tutorial.md |
| API endpoint | api-reference.md |
| Quick start | quickstart.md |
| FAQ/Issues | troubleshooting.md |
CRITICAL: Only use data from files you actually read.
Draft the documentation (DO NOT WRITE YET):
NEVER generate content without reading source files first.
ALWAYS show the complete draft for user review before writing:
═══════════════════════════════════════════════════════════
CONTENT REVIEW
═══════════════════════════════════════════════════════════
📄 FILE: docs/guides/authentication.mdx
───────────────────────────────────────────────────────────
DRAFT CONTENT
───────────────────────────────────────────────────────────
---
title: Authentication
description: Learn how to authenticate users in your app
sources: ["src/lib/auth/index.ts", "src/lib/auth/types.ts"]
---
## Overview
Authentication allows users to securely access your application...
## login(email, password)
Authenticate user and return JWT token.
| Parameter | Type | Description |
|-----------|------|-------------|
| email | string | User email address |
| password | string | User password |
**Returns:** `Promise<AuthToken>`
### Example
```typescript
import { login } from '@package/auth';
const token = await login('user@example.com', 'password');
...
─────────────────────────────────────────────────────────── NOTICES ───────────────────────────────────────────────────────────
⚠️ FEATURE FLAG: newAuthFlow This feature has a new implementation behind a flag. Currently documenting: OLD implementation
🔄 DUPLICATE: authenticate() exists in src/lib/auth/v2/ Consider: Document both or mark one as preferred?
─────────────────────────────────────────────────────────── OPTIONS ───────────────────────────────────────────────────────────
Choose an option:
### Step 7: Propose File Location
After content approval, suggest where to save:
"I'll create this page at: `docs/guides/{topic}.mdx`
Does this location work, or would you prefer somewhere else?"
### Step 8: Create and Update Navigation
**Only after user approves content AND location:**
1. Write the MDX file
2. Ask: "Should I add this to the navigation in docs.json?"
3. If yes, update docs.json with the new page
### Step 9: Summary
"Created:
- `docs/guides/{topic}.mdx` - {description}
- Updated `docs.json` navigation
Preview with `npm run dev`
Want me to create another page or make changes to this one?"
---
## Code Documentation Examples
### From TypeScript/JavaScript:
```typescript
// Source: src/utils/auth.ts
export function validateToken(token: string): boolean {
// ... implementation
}
Generates:
## validateToken
Validates an authentication token.
### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `token` | `string` | The JWT token to validate |
### Returns
`boolean` - `true` if valid, `false` otherwise
### Example
```typescript
import { validateToken } from '@package/auth';
const isValid = validateToken(userToken);
if (!isValid) {
throw new Error('Invalid token');
}
### From Python:
```python
# Source: src/auth.py
def validate_token(token: str) -> bool:
"""
Validate an authentication token.
Args:
token: The JWT token to validate
Returns:
True if valid, False otherwise
"""
Generates similar documentation following the template structure.
| Principle | Description |
|---|---|
| Search before generate | ALWAYS search/read files before writing |
| No hallucination | Only use data from actual source files |
| Review before write | ALWAYS show draft to user for approval |
| Flag feature flags | Detect and highlight conditional features |
| Flag duplicates | Identify similar/related features |
| Use mermaid diagrams | Visualize architecture, flows, sequences |
| Cite sources | Note which files information came from |
ALWAYS include mermaid diagrams for:
| Content Type | Diagram | Example |
|---|---|---|
| Architecture | flowchart TB | System components |
| Data flow | flowchart LR | Request processing |
| API calls | sequenceDiagram | Auth flow |
| State machine | stateDiagram-v2 | Lifecycle |
| Data models | erDiagram | Database schema |
Example for architecture docs:
flowchart TB
Client --> API
API --> Auth
API --> Service
Service --> DB[(Database)]
Example for API docs:
sequenceDiagram
Client->>API: POST /login
API->>Auth: Validate
Auth-->>API: Token
API-->>Client: 200 OK