5.0 KiB
Executable File
5.0 KiB
Executable File
AI Implementation Rules - GPrompt
Project Context
This is a Laravel 13 prompt generation system running in Docker container dockergprompt, project path /home/marco/Dockers/dockergprompt/app, accessible at localhost:16820.
Tech Stack
- Laravel 13 with Blade templates
- PHP 8.3
- MariaDB database
- Bootstrap 5
- SbAdmin 2 dashboard theme (MIT license)
- Laravel Breeze for authentication
- Laravel Boost for AI assistance
Database Credentials
- Host: mysql
- Database: dockergprompt
- Username: admin
- Password: admin123
AI Provider Configuration
Environment variables in .env:
OPENROUTER_API_KEY- OpenRouter API keyOPENROUTER_BASE_URL- https://openrouter.ai/api/v1STEPFUN_API_KEY- StepFun API keySTEPFUN_BASE_URL- https://api.stepfun.ai/v1LLAMACPP_BASE_URL- Local llama.cpp server URL (default: http://localhost:8080)
AI Models Available
OpenRouter:
- inclusionai/ling-3.0-flash:free
- openrouter/free
- deepseek/deepseek-v4-flash
StepFun:
- step-3.5-flash
- step-3.7-flash
Llama.cpp (Local):
- Qwen3-8B-Q4_K_M.gguf
- Llama-3.2-3B-Instruct-uncensored-Q4_K_M.gguf
- ibm-granite_granite-4.1-3b-Q4_K_M.gguf
- qwen2.5-coder-3b-instruct-q4_k_m.gguf
- LiquidAI_LFM2.5-1.2B-Instruct-Q4_0.gguf
User Roles
- SuperAdmin: Full system control + usage
- User: System usage only, requires SuperAdmin approval
File Structure Rules
- Controllers:
app/Http/Controllers/{Module}/{Entity}Controller.php - Models:
app/Models/{Entity}.php - Requests:
app/Http/Requests/{Module}/{Entity}Request.php - Services:
app/Services/{Module}/{Entity}Service.php - Policies:
app/Policies/{Entity}Policy.php - Migrations:
database/migrations/YYYY_MM_DD_HHMMSS_create_{table}_table.php - Views:
resources/views/{module}/{action}.blade.php
Code Standards
- PSR-12 compliance
- PHPDoc comments in English for all methods
- SOLID principles
- Type hints for all method parameters and return types
- Strict typing enabled (
declare(strict_types=1);) - No
varkeyword, useprivate/protected/public - No deprecated functions
- No
dd(),dump(),ray()in production code
Security Rules
- CSRF: All forms must have
@csrfdirective - XSS: Use Blade's automatic escaping, never
{!! !!}unless absolutely necessary - SQL Injection: Use Eloquent ORM or Query Builder with bindings
- Mass Assignment: Use
$fillableor$guardedexplicitly in models - Authorization: Use Policies or Gates for all actions
- Password Security: Hash passwords with Bcrypt, use
password:confirmvalidation rule - Captcha: Native Laravel captcha with arithmetic operations for public forms
- Rate Limiting: Apply appropriate rate limits on forms and API endpoints
Frontend Rules
- Bootstrap 5 with BI icons (MIT license only)
- SbAdmin 2 theme with responsive sidebar (< > toggle)
- Mobile: sidebar only visible on hamburger menu click
- Portuguese (Brazil) for all views
- Breadcrumbs on every page
- Password visibility toggle (eye icon) on all password fields
- Modern, responsive design
Prompt Engineering Form Fields
The prompt creation form must include:
- Objective - What the prompt should achieve
- Context - Background information
- Persona/Role - Who the AI should be
- Tone/Style - Communication style
- Constraints - Limitations and rules
- Output Format - Expected response structure
- Examples - Few-shot examples
- Variables - Dynamic placeholders
- Temperature (0.0-1.0)
- Max Tokens
- Provider selection (dropdown)
- Model selection (dynamic dropdown based on provider)
Testing Requirements
- All tests in
tests/directory - Feature tests for all CRUD operations
- Browser tests with Playwright for UI validation
- Test credentials:
- SuperAdmin: superadmin@sistema.com / superadmin123
- User: user@sistema.com / user123
Prohibited Practices
- No
@sectionstacking in Blade - No inline CSS or JS (use app.css/app.js)
- No hardcoded URLs or paths
- No magic numbers (define constants)
- No commented-out code
- No
TODO,FIXME,XXXcomments - No external scripts except CDN Bootstrap/BI
Performance Rules
- Eager load relationships to prevent N+1
- Use database indexing on foreign keys
- Cache expensive queries
- Paginate large datasets
- Compress images and assets
Documentation Rules
- All documentation in Portuguese (Brazil)
- README.md with installation and usage instructions
- RULES.md (this file) in English
- LICENCE file
- Technical documentation in .md format
Command Execution
Before writing code:
- Check existing routes with
php artisan route:list - Check database schema with migrations
- Review logs with Laravel Boost if errors occur
- Run tests after implementation:
php artisan test - Run Playwright tests:
npm run test:e2e
Deliverable Standards
- 100% production-ready code
- No incomplete implementations
- No mocks or stubs
- Complete error handling
- All validation rules defined
- All policies implemented
- Complete translations (pt-BR)