AI Prompt Templates
Template prompts untuk mempercepat development dengan AI assistance (ChatGPT, Claude, Copilot, WindSurf).📁 Folder Structure Template
Prompt untuk Generate Folder Structure
Copy
Tugasmu: buatkan dokumentasi Mintlify untuk proyek "MStore Backend" dengan struktur, gaya, dan konten berikut.
Konteks teknis:
• Frontend: Flutter
• Backend: Go (HTTP API, clean architecture)
• Database: MySQL (OLTP), MongoDB (dokumen)
• Observability: LGTM (Loki, Grafana, Tempo, Mimir)
• DevOps stack ringan berbasis Go: Taskfile, Air (live reload), GoReleaser, Caddy, Cosign
• CI/CD: GitHub Actions
Tujuan dokumentasi:
1. Onboarding cepat (setup lokal ≤15 menit)
2. Pedoman arsitektur dan styleguide API
3. Praktik terbaik schema & migrasi MySQL + pattern Mongo
4. Observability lengkap (logs, metrics, traces) via LGTM
5. Dev workflow Go-native (taskfile, live reload, release)
6. Panduan troubleshoot umum
Struktur & konten yang harus dibuat:
• /docs/00-getting-started/*: intro, prerequisites, local-setup, project-structure
• /docs/10-architecture/*: system-overview, request-flow, domain-model, deployment-topology
• /docs/20-backend-go/*: overview, service-template, api-styleguide, config-secrets, error-handling, testing
• /docs/30-frontend-flutter/*: overview, state-management, api-client, env-config, testing
• /docs/40-database/*: mysql-schema, mysql-migrations, mongo-schema, mongo-patterns, data-seeding, backup-restore
• /docs/50-observability-lgtm/*: lgtm-overview, loki-logs, grafana-dashboards, tempo-traces, mimir-metrics
• /docs/60-devops-go/*: dev-workflow, taskfile, air-live-reload, goreleaser, caddy-reverse-proxy, container-images, security-cosign
• /docs/70-ci-cd/*: github-actions, versioning-release, environments
• /docs/80-guides/*: feature-flags, caching, file-upload, auth-jwt, rate-limiting, troubleshooting
• /docs/90-features/*: transaction-flow, payment-gateway, inventory-flow, approval-flow
• /docs/95-technical-specs/*: api-spec-template, erd-template, business-logic-template
• /docs/99-changelog/changelog.mdx
Persyaratan penulisan:
• Setiap halaman punya frontmatter: title, description, icon
• Sertakan code blocks yang runnable
• Gunakan contoh endpoint: /api/v1/auth/login, /api/v1/users, /api/v1/orders
• Tambahkan diagram mermaid minimal pada: system-overview, request-flow, deployment-topology
• Tulis ringkas, to-the-point, dengan checklist praktis
Terakhir:
• Buat mint.json lengkap dengan navigation
• Pastikan semua tautan halaman valid
• Hasilkan konten MDX/MD final (bukan hanya outline)
📊 Diagram Template
Prompt untuk Generate Mermaid Diagrams
Copy
Buatkan diagram Mermaid untuk dokumentasi MStore Backend:
1. System Flow Diagram
- Tunjukkan alur dari Client → API Gateway → Services → Database
- Include: Authentication, Authorization, Request/Response flow
- Format: flowchart TD
2. Sequence Diagram (Login)
- Tunjukkan interaksi: User → Flutter App → Go API → MySQL → JWT
- Include: Validation, Token generation, Response
- Format: sequenceDiagram
3. Deployment Topology
- Tunjukkan: Docker Compose setup untuk development
- Include: Services (API, MySQL, MongoDB, Redis, LGTM stack)
- Format: graph LR
4. Entity Relationship Diagram
- Tunjukkan relasi: users, transactions, products, inventory
- Include: Foreign keys, cardinality
- Format: erDiagram
Persyaratan:
• Gunakan syntax Mermaid yang valid
• Tambahkan comments untuk clarity
• Gunakan warna untuk grouping (subgraph)
• Include error paths (dashed lines)
🎯 Feature Documentation Template
Prompt untuk Document New Feature
Copy
Buatkan dokumentasi lengkap untuk fitur baru di MStore Backend:
Fitur: [NAMA_FITUR]
Deskripsi: [DESKRIPSI_SINGKAT]
Struktur dokumentasi yang dibutuhkan:
1. Overview
- Deskripsi fitur
- Use cases
- Benefits
- Prerequisites
2. Architecture
- System diagram (Mermaid)
- Components involved
- Data flow
- Integration points
3. API Endpoints
- List all endpoints
- Request/Response examples (cURL, JavaScript, Go)
- Error responses
- Rate limiting
4. Database Schema
- Tables involved
- Relationships (ERD)
- Indexes
- Migrations
5. Implementation Guide
- Backend implementation (Go)
- Frontend implementation (Flutter)
- Configuration
- Environment variables
6. Testing
- Unit test examples
- Integration test scenarios
- E2E test cases
- Performance benchmarks
7. Deployment
- Configuration changes
- Migration steps
- Rollback plan
- Monitoring
8. Troubleshooting
- Common issues
- Error messages
- Solutions
- FAQ
Format:
• MDX dengan frontmatter
• Code examples dengan syntax highlighting
• Mermaid diagrams untuk visualisasi
• Callout boxes untuk warnings/tips
• Cross-references ke dokumentasi lain
🔧 API Spec Template
Prompt untuk Generate API Specification
Copy
Buatkan spesifikasi API lengkap untuk endpoint baru:
Endpoint: [METHOD] [PATH]
Deskripsi: [DESKRIPSI]
Yang harus di-generate:
1. Endpoint Details
- HTTP Method
- Path dengan parameters
- Authentication required
- Rate limit
- Idempotency support
2. Request
- Headers (required & optional)
- Path parameters
- Query parameters
- Request body schema (JSON)
- Validation rules
3. Response
- Success response (200, 201, dll)
- Error responses (400, 401, 404, 500, dll)
- Response body schema (JSON)
- Pagination format (jika applicable)
4. Examples
- cURL example
- JavaScript (Fetch API) example
- Go example
- Flutter (Dio) example
5. Business Logic
- Validation rules
- Processing steps
- Side effects
- Database operations
6. Error Handling
- Error codes
- Error messages
- Retry logic
- Fallback behavior
7. Testing
- Unit test example
- Integration test example
- Test data
- Expected results
Format output:
• MDX format dengan frontmatter
• Code blocks dengan language tags
• Tables untuk parameters
• Mermaid sequence diagram untuk flow
🗄️ Database Schema Template
Prompt untuk Document Database Schema
Copy
Buatkan dokumentasi database schema untuk tabel baru:
Tabel: [NAMA_TABEL]
Deskripsi: [DESKRIPSI]
Yang harus di-generate:
1. Table Structure
- Column definitions (name, type, constraints)
- Primary key
- Foreign keys
- Indexes
- Unique constraints
- Check constraints
2. Relationships
- Parent tables (FK references)
- Child tables (referenced by)
- Many-to-many relationships
- Cardinality
3. ERD Diagram
- Mermaid erDiagram
- Show relationships
- Include cardinality
- Highlight important fields
4. Sample Data
- INSERT statements
- Realistic examples
- Edge cases
5. Queries
- Common SELECT queries
- JOIN examples
- Aggregation queries
- Performance considerations
6. Migration
- Atlas HCL schema
- Migration SQL (up)
- Rollback SQL (down)
- Data migration (if needed)
7. Indexes Strategy
- Index definitions
- Composite indexes
- Covering indexes
- Performance impact
8. Best Practices
- Naming conventions
- Data types
- Normalization
- Denormalization (when needed)
Format:
• MDX dengan frontmatter
• SQL code blocks
• Mermaid ERD
• Tables untuk column definitions
🧪 Testing Template
Prompt untuk Generate Test Cases
Copy
Buatkan test cases lengkap untuk:
Feature: [NAMA_FEATURE]
Component: [HANDLER/SERVICE/REPOSITORY]
Yang harus di-generate:
1. Unit Tests
- Test function names
- Test scenarios (happy path, edge cases, errors)
- Mock dependencies
- Assertions
- Go code examples (using testify)
2. Integration Tests
- Test scenarios
- Setup & teardown
- Database fixtures
- API calls
- Expected results
3. E2E Tests
- User scenarios
- Step-by-step flow
- Test data
- Expected outcomes
- Screenshot points (for UI)
4. Performance Tests
- Load test scenarios
- Concurrent requests
- Response time targets
- Resource usage limits
5. Test Data
- Fixtures (JSON, SQL)
- Mock data generators
- Edge case data
- Invalid data for negative tests
Format:
• Go test code (table-driven tests)
• Comments untuk clarity
• Arrange-Act-Assert pattern
• Error assertions
📝 Code Generation Template
Prompt untuk Generate CRUD Operations
Copy
Generate CRUD operations untuk entity baru:
Entity: [NAMA_ENTITY]
Fields: [LIST_FIELDS]
Yang harus di-generate:
1. Model (Go struct)
- GORM tags
- JSON tags
- Validation tags
- Relationships
- Timestamps (gorm.Model)
2. Repository
- Create
- GetByID
- Find (with filters)
- Update
- Delete (soft delete)
- GORM implementations
3. Service
- Business logic
- Validation
- Error handling
- Transaction management
- Logging
4. Handler
- HTTP endpoints
- Request parsing
- Response formatting
- Error mapping
- OpenTelemetry tracing
5. Payload Structs
- CreateRequest
- UpdateRequest
- Response
- ListResponse (with pagination)
6. Routes
- Route registration
- Middleware
- Path parameters
- Query parameters
7. Tests
- Repository tests
- Service tests
- Handler tests
- Test fixtures
Persyaratan:
• Follow clean architecture
• Idiomatic Go code
• Error handling best practices
• Logging dengan correlation ID
• OpenTelemetry tracing
🎨 Documentation Style Guide
Prompt untuk Consistent Documentation
Copy
Pastikan dokumentasi mengikuti style guide ini:
1. Frontmatter
---
title: 'Clear Title'
description: 'One-line description'
icon: 'relevant-icon'
---
2. Headings
- H1 (#): Page title (once)
- H2 (##): Major sections
- H3 (###): Subsections
- H4 (####): Details
3. Code Blocks
- Always specify language
- Include comments
- Use realistic examples
- Show input & output
4. Callouts
<Info>Informational message</Info>
<Warning>Warning message</Warning>
<Tip>Helpful tip</Tip>
<Note>Additional note</Note>
5. Links
- Use Card components untuk related docs
- Cross-reference dengan relative paths
- External links open in new tab
6. Lists
- Use bullet points untuk unordered
- Use numbers untuk sequential steps
- Bold important terms
- Keep items concise
7. Tables
- Use untuk structured data
- Include headers
- Align columns
- Keep cells short
8. Diagrams
- Use Mermaid untuk flow/sequence
- Add titles
- Include legend jika perlu
- Keep simple & readable
📚 Related Documentation
Internal Flow Diagrams
Handler & service flow diagrams
Knowledge Base
Quick reference & analogies
API Spec Template
API specification templates
AI Development: Template ini dioptimalkan untuk AI-assisted development dengan ChatGPT, Claude, Copilot, dan WindSurf.