Skip to content

jonbonto/cautious-meme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LMS Go - GitHub Workflow & Standards

Complete agentic workflow setup for production-ready Go backend development.

πŸ“‹ Quick Start

Reference Agentic Workflow

Read agentic-workflow.md for complete pipeline overview.

Request a Feature

Describe your feature with execution mode:

**Feature**: Subscription with Invoice

**Execution Mode**: Full Autonomous

**Functional Requirements**:
- Users can subscribe to plans
- System generates invoices
- Invoice status tracked (pending, paid, overdue)

**Constraints**:
- Must support recurring billing (future)
- Must track payment history

The system will automatically:

  1. Plan the implementation
  2. Architect the design
  3. Migrate the database
  4. Implement the backend
  5. Validate security
  6. Generate tests (92%+ coverage)
  7. Review code quality
  8. Self-correct any issues

πŸ“ Directory Structure

.github/
β”œβ”€β”€ agentic-workflow.md      ← START HERE (phase definitions)
β”œβ”€β”€ copilot-instructions.md  (core orchestration rules)
β”œβ”€β”€ workflows/
β”‚   └── ci.yml               (automated testing + security)
β”œβ”€β”€ aw/                       (execution modes & workflows)
β”‚   β”œβ”€β”€ execution-mode.md     (Plan/Generate/Autonomous)
β”‚   β”œβ”€β”€ full-autonomous.md    (8-phase pipeline)
β”‚   β”œβ”€β”€ self-correction.md    (validation loop)
β”‚   └── ...
β”œβ”€β”€ instructions/             (technical standards)
β”‚   β”œβ”€β”€ architecture.md       (clean architecture rules)
β”‚   β”œβ”€β”€ backend.md            (implementation patterns)
β”‚   β”œβ”€β”€ database.md           (schema standards)
β”‚   β”œβ”€β”€ security.md           (auth/validation/secrets)
β”‚   β”œβ”€β”€ testing.md            (test requirements)
β”‚   β”œβ”€β”€ go-standards.md       (Go conventions)
β”‚   └── ...
β”œβ”€β”€ agents/                   (agent role definitions)
β”‚   β”œβ”€β”€ planner.md            (planning agent)
β”‚   β”œβ”€β”€ architect.md          (architecture review)
β”‚   β”œβ”€β”€ backend.md            (implementation)
β”‚   β”œβ”€β”€ test.md               (test generation)
β”‚   β”œβ”€β”€ security.md           (security validation)
β”‚   β”œβ”€β”€ reviewer.md           (code quality)
β”‚   └── ...
└── prompts/                  (request templates)
    β”œβ”€β”€ feature.md            (new features)
    β”œβ”€β”€ bugfix.md             (bug fixes)
    └── ...

πŸ”„ Execution Modes

Plan Only

Scope definition without code generation.

  • Use for: Requirements clarification, design decisions
  • Output: Structured evolution plan
  • Example: "What APIs needed for subscription?"

Plan + Generate

Design + full implementation (no tests/security review).

  • Use for: Pre-approved features, low-risk additions
  • Output: Ready-to-test code
  • Example: "Add user profile endpoint"

Full Autonomous

Complete pipeline with security, tests, and review.

  • Use for: Production features, critical systems
  • Output: Production-ready implementation
  • Guarantees: 92%+ test coverage, security validated, code reviewed

πŸ§ͺ CI/CD Pipeline

Automatically enforces all standards:

Lint & Format      β†’ Code Style Validation
    ↓
Tests & Coverage   β†’ 92% Minimum Coverage Gate
    ↓
Architecture       β†’ Clean Layer Validation
    ↓
Build              β†’ Go Binary Compilation
    ↓
Security Scanning  β†’ Gosec + SAST

Run locally:

make lint          # Run linters
make test          # Run tests with coverage
make coverage       # Generate coverage report
go build ./cmd/api-server  # Build binary

πŸ“ Clean Architecture

Mandatory dependency flow:

Handler (HTTP) β†’ Service (Logic) β†’ Repository (Data) β†’ Database

Violations detected in:

  • Code review phase
  • CI validation
  • Self-correction loop

Layer Responsibilities

Handler:

  • HTTP parsing only
  • User authentication extraction
  • Call service layer
  • Return JSON responses

Service:

  • Business logic & validation
  • Orchestrate repositories
  • Handle transactions
  • Return structured responses

Repository:

  • Database queries only
  • Use parameterized statements
  • Return domain models
  • Handle not-found as nil

Domain:

  • Pure data structures
  • No framework imports
  • Proper type tags (db, json)

πŸ”’ Security Standards

All implementations must pass:

  • Authentication: Proper JWT handling, context usage
  • Authorization: RBAC middleware, ownership validation
  • Input Validation: Service layer validation, no SQL injection
  • Sensitive Data: No logs of passwords/tokens
  • Error Handling: No internal details leaked to client

Enforced in Phase 5 (Security Agent).

βœ… Testing Requirements

Minimum coverage: 92% (CI gate)

By Layer

Layer Coverage Type
Service β‰₯95% Unit (mock repos)
Handler β‰₯90% Integration (mock service)
Repository β‰₯80% Unit (SQL validation)
Overall β‰₯92% CI Gate

Test Files

internal/service/xyz_service_test.go       (unit tests)
internal/api/xyz_handler_test.go           (integration tests)

πŸ“ Development Workflow

1. Develop Locally

# Start with feature request
# Include execution mode and requirements

# Implement according to plan
# Follow clean architecture
# Write tests as you code

make test          # Verify tests pass locally
make coverage      # Check coverage
make lint          # Check code style
go build ./cmd/api-server  # Ensure builds

2. Commit

git add .
git commit -m "feat|fix|refactor: description"

Pre-commit hooks validate:

  • Code formatting
  • Basic linting

3. Push & CI

git push origin feature-branch

CI automatically runs:

  • Full linting & formatting
  • Complete test suite (92% gate)
  • Architecture validation
  • Security scanning
  • Build verification

4. Code Review

Human review validates:

  • Architecture compliance
  • Security review
  • Performance assessment
  • Test adequacy
  • Documentation completeness

5. Merge

Merge to main only after:

  • All CI checks pass
  • Code review approved
  • Coverage β‰₯92%
  • No security issues

πŸ“š Key Standards

Go Code

  • Use int64 for IDs
  • Use float64 for money
  • Use time.Time for timestamps
  • Use pointers for optional fields
  • Accept context.Context as first parameter in service/repo

Database

  • BIGSERIAL for PKs
  • BIGINT with ON DELETE CASCADE for FKs
  • Indexes on foreign keys and filters
  • created_at / updated_at timestamps
  • NOT NULL constraints where needed

APIs

  • RESTful (POST create, GET read, PUT update, DELETE remove)
  • Proper HTTP status codes (201, 400, 401, 403, 404, 500)
  • Structured error responses
  • Consistent request/response format

Error Handling

Use error package for domain errors:

return nil, errors.NewAppError("CODE", "message", 400)

Never:

  • Return bare error strings
  • Use http.StatusInternalServerError for validation
  • Leak stack traces to client

πŸš€ Production Deployment

Code is production-ready when:

βœ“ All 8 phases complete (Full Autonomous) βœ“ 92%+ test coverage βœ“ 0 critical security issues
βœ“ Code review approved βœ“ All CI checks passing

Then merge to main.

πŸ“– Further Reading

❓ FAQ

Q: What if my PR fails CI?
A: Check the CI output. Usually: code formatting, test coverage, or lint issues. Fix and push again.

Q: How do I write tests first?
A: Good practice (TDD). Write test in xyz_test.go, implement service/handler to pass test, run make coverage.

Q: Can I skip security review?
A: Only in Plan + Generate mode. Full Autonomous always includes Phase 5 (Security Agent).

Q: What's the coverage gate?
A: 92% minimum. Check with make coverage. If below, add missing test cases.

Q: How do I run the full agentic pipeline?
A: Submit feature request with "Full Autonomous" mode. The system executes all 8 phases automatically.


Setup Date: February 18, 2026
Version: 1.0
Status: Production-Ready

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages