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.