AI Agent Workspace, Rules, Commands & Skills
Every project scaffolded from goforge-template ships with AGENT.md and .agent/ — an agent-agnostic workspace specification designed so AI coding assistants (Antigravity, Claude Code, Cursor, Codex, etc.) understand GoForge's architecture, boundaries, and workflows from the first prompt.
Workspace Layout
<project>/
├── AGENT.md # Master project & workflow guide for AI agents
└── .agent/
├── settings.json # Workspace metadata & default entrypoints
├── rules/ # 4 binding architectural & quality rule files
│ ├── architecture.md
│ ├── api-design.md
│ ├── database.md
│ └── testing.md
├── commands/ # 6 structured session & delivery workflows
│ ├── context.md
│ ├── next.md
│ ├── review.md
│ ├── ship-feature.md
│ ├── state.md
│ └── session-end.md
└── skills/ # 10 domain skills + 12 automation scripts
├── cli-commands/ # new-service.sh, remove-service.sh
├── configuration/
├── database-migrations/ # migrate.sh, rollback.sh, sqlc.sh
├── error-handling/
├── goforge-core/
├── http-grpc/ # proto.sh
├── limen-auth/ # scaffold.sh, install-deps.sh, migrate.sh, test-endpoints.sh
├── testing/ # run.sh
├── tls/ # gen-cert.sh
└── validation/.agent/settings.json
Provides machine-readable discovery paths for AI tools:
{
"version": 1,
"project": "goforge-template",
"description": "Agent-agnostic workspace guidance for working inside the GoForge generated application template.",
"commands_dir": ".agent/commands",
"rules_dir": ".agent/rules",
"skills_dir": ".agent/skills",
"default_entrypoints": [
"README.md",
".agent/commands/context.md",
".agent/rules/architecture.md"
],
"module_path": "github.com/mmycin/goforge"
}The 10 Non-Negotiable Rules (AGENT.md)
- No package-level mutable state in
internal/orcore/. - Constructor-based dependency injection — prefer
New*functions wired viacore/di. - Imports must use
<module>/boot/...or<module>/core/.... - Never edit
boot/orcore/— application logic belongs ininternal/services/. - Keep transport thin — business logic lives in
service.go, nothandler.go. - Always validate at the handler edge using
core/validator. - Never write raw
c.JSON(...)for errors — pass errors via_ = c.Error(appErr). - Keep route registration local to the owning service package (
routes.go). - Run
goforge migrateafter any model change — schema drift causes runtime errors. internal/services/kernel.gois auto-regenerated bygoforge gen:service/rem:service— usemodule.goso regeneration preserves your wiring.
Binding Rules (.agent/rules/)
| Rule File | Key Constraints |
|---|---|
architecture.md | Enforces boot/ & core/ immutability vs internal/ ownership, constructor DI, no mutable globals, and stopping to confirm if a change belongs in goforge-cli. |
api-design.md | Thin HTTP/gRPC transport, core/validator at handler edge, _ = c.Error(...) routed to ErrorHandler, local route registration, graceful gRPC shutdown, additive API changes. |
database.md | Deliberate model updates, immediate migration awareness, safe GetGorm() error handling, keeping SQLC generated code synced with internal/database/queries/. |
testing.md | Run targeted tests for touched packages first, broaden runs when startup/transport/shared wiring changes, test public behavior over internals, explicitly report unrun tests. |
Agent Commands (.agent/commands/)
Structured workflows that an agent follows at key points in a session:
| Command | Purpose & Checklist |
|---|---|
context | Session start reading order: README.md → .agent/rules/architecture.md → .agent/rules/testing.md → target service/package. |
next | 6-step decision order to locate the owning package (internal/services/<name>/, boot/, or core/) and prefer editing existing files. |
review | Pre-merge review priority: 1. Bugs → 2. Regressions → 3. Security/config risks → 4. Missing tests → 5. Maintainability. |
ship-feature | 5-step end-to-end delivery: read context.md → pick matching .agent/skills/ → implement smallest coherent change → update wiring/config/migrations/tests in one pass → run targeted then broad tests. |
state | Maps current behavior before editing: where it is wired, what dependencies are injected, what env keys affect it, and what tests cover it. |
session-end | Clean handoff: summarize changes, list follow-ups, record tests run/unrun, call out config/migration/deployment impact, and note any CLI template sync needed. |
Agent Skills & Automation Scripts (.agent/skills/)
Each skill contains a SKILL.md instruction file and optional executable bash helpers:
| Skill | Scope | Included Scripts |
|---|---|---|
cli-commands | goforge CLI lifecycle, scaffolding, and feature workflows | new-service.sh <name>, remove-service.sh <name> |
configuration | Adding/renaming Viper settings in core/config/ and .env.example | — |
database-migrations | Model changes → Atlas SQL diffs → SQLC regeneration → rollbacks | migrate.sh <name>, rollback.sh, sqlc.sh |
error-handling | *apperrors.AppError constructors (400–503), Wrap, c.Error() | — |
goforge-core | boot/kernel.go, core/di, internal/services/kernel.go, app/main.go | — |
http-grpc | Gin routes, gRPC interceptors, internal/proto/<name>/<name>.proto | proto.sh [name|--clean] |
limen-auth | Limen session auth (User, Session, Verification, Account, /register, /login, /me, /logout) | scaffold.sh, install-deps.sh, migrate.sh, test-endpoints.sh [base-url] |
testing | Scoped test execution across unit/, http/, grpc/, integration/ | run.sh [http|grpc|integration|unit|all] |
tls | HTTP/gRPC TLS config & self-signed dev certificate generation | gen-cert.sh [days] [CN] (defaults: 365 days, CN=localhost) |
validation | validate: tags, core/validator.Validate, RegisterRule | — |
Common Skill Script Workflows
# Scaffold a new service + generate & apply its initial migration
bash .agent/skills/cli-commands/new-service.sh billing
# Scaffold Limen authentication & install dependencies
bash .agent/skills/limen-auth/scaffold.sh
bash .agent/skills/limen-auth/migrate.sh
bash .agent/skills/limen-auth/test-endpoints.sh http://127.0.0.1:3000
# Compile gRPC proto definitions (or pass --clean to remove generated pb.go)
bash .agent/skills/http-grpc/proto.sh task
# Generate self-signed dev TLS certs (cert.pem / key.pem)
bash .agent/skills/tls/gen-cert.sh 365 localhost
# Run scoped tests
bash .agent/skills/testing/run.sh unit
bash .agent/skills/testing/run.sh alllimen-auth with DI & X-App-Key
When using limen-auth on goforge-template (d666864+), wire NewAuthService and the 4 Limen models inside internal/services/auth/module.go (as shown in Tutorial Ch. 2) and pass -H "X-App-Key: $APP_KEY" when calling endpoints.
