2.1 KiB
2.1 KiB
AI Development Guidelines for Hireme
These guidelines provide context to AI assistants working on the hireme repository. Adhere to these principles to maintain the project's architecture and design philosophy.
1. Single Binary & Zero Dependencies
- Goal: The application must compile into a single Go binary.
- Rule: Do NOT introduce external dependencies that require separate build steps, node_modules, or static asset folders unless explicitly authorized.
- Rule: Use Go 1.22+ standard library features wherever possible (e.g.,
net/httpServeMux).
2. UI Philosophy (HTMX + Tailwind)
- Rule: Do NOT introduce React, Vue, or any heavy JS frameworks.
- Rule: All dynamic interactions must be handled via HTMX (
hx-get,hx-post,hx-target). Endpoints should return HTML fragments, not JSON, for UI updates. - Rule: CSS is handled via Tailwind CSS utility classes. Maintain the dark mode aesthetic using
bg-slate-*,text-slate-*, and vibrant accents (indigo,emerald,rose). - Rule: UI templates are stored as constant strings in Go files (
internal/ui/template_*.go) and registered intemplates.go. Do not create external.htmlfiles.
3. Database Integrity
- Rule: Use
go-sqlite3and ensurePRAGMA journal_mode=WAL;is maintained. The application heavily relies on WAL mode to allow concurrent reads (from the UI) and writes (from background workers). - Rule: Avoid long-running transactions that could lock the database.
4. Structured Logging
- Rule: Use
zapstructured logging exclusively. Do NOT use the standard librarylog.Printf. - Rule: Use the
wmethods (Infow,Debugw,Errorw) to pass key-value pairs.- Correct:
logger.Log.Infow("User created", "component", "API", "user_id", id) - Incorrect:
logger.Log.Infof("[API] User created: %d", id)
- Correct:
5. Background Workers
- Rule: Long-running tasks (Crawling, LLM Analysis) must be executed asynchronously via the
internal/workerpool. Do not block HTTP request handlers. Enqueue tasks in the SQLitetaskstable instead.