iota-sdk
Copilot instructions471 starsChanged 30 days agoApache-2.0View on GitHub
This document provides context and guidelines for GitHub Copilot when working on this codebase. Multi-tenant business management platform built on the IOTA SDK framework. Provides modular solutions for financial management, CRM, warehouse operations, project management, and HR functionality. Run these commands to verify code quality: Every database query MUST include tenant filtering: Use composables.UseTenantID(ctx) to get the current tenant ID. Always wrap errors with operation context: Use di.H pattern for all service dependencies:
We split this copilot-instructions.md into the rules it gives an agent
16 rules. About 1 is common, 6 are distinctive, and 9 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Multi-tenant: All data is isolated via organization_id - every query MUST include tenant filtering
- Distinctive: line 60
Run these commands to verify code quality:
- Distinctive: line 93
Every database query MUST include tenant filtering:
- Very specific: line 103
Use composables.UseTenantID(ctx) to get the current tenant ID.
- Common: line 107
Always wrap errors with operation context:
- Very specific: line 118
Use di.H pattern for all service dependencies:
- Very specific: line 132
Use composables.UseTx(ctx) for transactions
- Distinctive: line 133
Use parameterized queries ($1, $2) - never string concatenation
- Very specific: line 144
Use templ.URL() for dynamic URLs
- Very specific: line 145
Never use @templ.Raw() with user input (XSS risk)
- Very specific: line 147
Use CamelCase for form field names (e.g., FirstName, not first_name)
- Very specific: line 151
Update all 3 locale files: en.toml, ru.toml, uz.toml
- Distinctive: line 152
Avoid TOML reserved keywords (OTHER, ID, DESCRIPTION)
- Distinctive: line 159
Use StatementBegin/StatementEnd for PL/pgSQL functions/triggers
- Very specific: line 160
Always include organization_id with ON DELETE CASCADE for multi-tenant tables
- Distinctive: line 161
Test reversibility: Up→Down→Up cycle
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
IOTA SDK Multi-Tenant Business Management Platform
This document provides context and guidelines for GitHub Copilot when working on this codebase.
Project Overview
Multi-tenant business management platform built on the IOTA SDK framework. Provides modular solutions for financial management, CRM, warehouse operations, project management, and HR functionality.
Core Business Domains
- Financial Management: Payments, expenses, debts, transactions, counterparties, money accounts
- Customer Relations: Client management, communication, message templates
- Warehouse Operations: Inventory, products, orders, positions, units
- Project Management: Project tracking, stage management, task coordination
- Human Resources: Employee management, organizational structure
- Billing & Subscriptions: Payment processing, subscription management, Stripe integration
Technology Stack
- Backend: Go 1.24.10, IOTA SDK framework, GraphQL
- Database: PostgreSQL 13+ (multi-tenant with organization_id)
- Frontend: HTMX + Alpine.js + Templ + Tailwind CSS
- Auth: Cookie-based sessions with RBAC
- Payments: Stripe subscriptions
Architecture
Design Principles
- DDD (Domain-Driven Design): Strict layer separation between domain, service, repository, and presentation
- Multi-tenant: All data is isolated via
organization_id- every query MUST include tenant filtering - HTMX-First: Server-side rendering with HTMX + Alpine.js + Templ
- Dual Servers:
- Main (
cmd/server/main.go): Multi-tenant platform, all modules - SuperAdmin (
cmd/superadmin/main.go): Admin-only server (port 4000)
- Main (
Code Organization
modules/{module}/
domain/
aggregates/ # Domain entities
*/repository.go # Repository interfaces
presentation/
controllers/{page}_controller.go
viewmodels/{entity}_viewmodel.go
templates/pages/{page}/
locales/{lang}.toml
services/{domain}_service.go
infrastructure/persistence/{entity}_repository.goEnvironment Branches
- Production:
mainbranch - Staging:
stagingbranch
Verification Commands
Run these commands to verify code quality:
# Code Quality
go vet ./... # After Go changes (prefer over go build)
make check lint # Run golangci-lint
make check deadcode # Detect unreachable/unused code
# Testing (Note: Full test suite is SLOW - use sparingly)
go test -v ./path/to/package -run TestName # Single test by name (fast)
make test # Run all tests
make test coverage # Run tests with coverage report
# Template & CSS
make generate # Generate templ templates
make css # Compile CSS with minification
# Migrations
make db migrate up # Apply migrations
make db migrate down # Rollback migrations
# Translations
make check tr # Validate translations
# E2E Tests
make e2e ci # Run Playwright E2E tests (headless)
make e2e run # Run Playwright E2E tests (UI mode)Critical Code Rules
Multi-Tenant Isolation (CRITICAL)
Every database query MUST include tenant filtering:
// CORRECT - Always include organization_id
SELECT * FROM payments WHERE organization_id = $1 AND id = $2
// WRONG - Security vulnerability
SELECT * FROM payments WHERE id = $1Use composables.UseTenantID(ctx) to get the current tenant ID.
Error Handling
Always wrap errors with operation context:
const op = serrors.Op("service.PaymentService.GetByID")
if err != nil {
return nil, serrors.Wrap(op, err)
}Dependency Injection
Use di.H pattern for all service dependencies:
func NewController(h di.H) *Controller {
return &Controller{
paymentService: di.Get[PaymentService](h),
}
}Repository Pattern
- Interfaces in domain layer (
modules/*/domain/*/repository.go) - Implementations in infrastructure (
modules/*/infrastructure/persistence/*) - Use
composables.UseTx(ctx)for transactions - Use parameterized queries ($1, $2) - never string concatenation
Controllers
- Auth middleware via
middleware.Authorize() - Form parsing:
composables.UseForm[DTO](r) - Query params:
composables.UseQuery[DTO](r) - HTMX helpers: Use
pkg/htmxpackage functions
Templates (Templ)
- Use
templ.URL()for dynamic URLs - Never use
@templ.Raw()with user input (XSS risk) - Include CSRF tokens in all forms
- Use CamelCase for form field names (e.g.,
FirstName, notfirst_name)
Translations
- Update all 3 locale files:
en.toml,ru.toml,uz.toml - Avoid TOML reserved keywords (OTHER, ID, DESCRIPTION)
- Validate with
make check tr
Migrations
See .claude/guides/backend/migrations.md for comprehensive patterns. Key rules:
- Include both Up and Down sections (Down must reverse Up)
- Use StatementBegin/StatementEnd for PL/pgSQL functions/triggers
- Always include
organization_idwithON DELETE CASCADEfor multi-tenant tables - Test reversibility: Up→Down→Up cycle
Documentation
For detailed implementation patterns, see these guide files:
.claude/guides/backend/domain-service.md- DDD, services, entities.claude/guides/backend/repository.md- Repository patterns, query optimization.claude/guides/backend/testing.md- ITF testing framework.claude/guides/backend/presentation.md- Controllers, ViewModels, templates.claude/guides/backend/migrations.md- SQL migration patterns.claude/guides/backend/i18n.md- Translation management.claude/guides/backend/routing.md- Module registration, DI
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/guides/claude-code/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- Database ConnectionSkill
- E2E TestingSkill
- Railway CLISkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

