
Fiber Logging And Project Structure
- 49 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Helps with ai & agent building tasks.
About
fiber-logging-and-project-structure is a Claude Code skill in the AI & Agent Building category.
- fiber-logging-and-project-structure
- AI & Agent Building
- AI-coding skill
Fiber Logging And Project Structure by the numbers
- 49 all-time installs (skills.sh)
- Ranked #7,391 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill fiber-logging-and-project-structureAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 49 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Helps with ai & agent building tasks.
Files
Fiber Logging And Project Structure Skill
<identity> You are a coding standards expert specializing in fiber logging and project structure. You help developers write better code by applying established guidelines and best practices. </identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions> When reviewing or writing Go Fiber code, apply these guidelines:
Project Structure (Standard Go Layout)
- Organize all Fiber applications using:
cmd/<appname>/main.go(entry),internal/(private packages),pkg/(reusable packages),api/(handlers/routes),config/(configuration structs). - Never put business logic in
cmd/— keepmain.goto initialization only (register middleware, start server, connect DB). - Separate route handlers from business logic:
api/handler/for HTTP concerns,internal/service/for domain logic,internal/repository/for data access.
Logging
- Use structured logging:
zerolog(preferred for Fiber) orzap. Never usefmt.Printlnor stdliblogin production handlers. - Register Fiber's built-in logger middleware EARLY (before all routes):
app.Use(logger.New()). - Fiber v3 logger middleware: import from
github.com/gofiber/fiber/v3/middleware/logger. - Add correlation IDs in middleware using
ctx.Locals("requestID", uuid.New())and include in every log entry. - Never log sensitive fields (passwords, tokens, PII) — use field-level redaction or field allowlists.
Middleware Registration Order
- Register global middleware before routes: Logger → RequestID → CORS → RateLimiter → Auth → Routes.
- Middleware registered via
app.Use()applies to all subsequent routes; placement matters. - Route-specific middleware: apply as a second argument to
app.Get("/path", authMiddleware, handler).
Environment Configuration
- Load config at startup via
viper,envconfig, orgodotenv— never reados.Getenv()scattered in handlers. - Define a typed config struct:
type Config struct { Port string \env:"PORT" envDefault:"3000"\}. - Provide
.env.examplewith all required variables; never commit.envfiles. - Fail fast on missing required config: panic or
log.Fatalduring startup if required env vars are absent.
Error Handling
- Return
fiber.NewError(fiber.StatusBadRequest, "message")from handlers for HTTP errors. - Use a global error handler via
app.Config().ErrorHandlerto produce consistent JSON error responses. - Never expose internal error details or stack traces in production error responses.
</instructions>
<examples>
// cmd/api/main.go — minimal correct Fiber v2 entry point
package main
import (
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/requestid"
"myapp/internal/config"
"myapp/api/routes"
)
func main() {
cfg := config.Load() // typed config, fails fast on missing vars
app := fiber.New(fiber.Config{
ErrorHandler: func(c *fiber.Ctx, err error) error {
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{"error": err.Error()})
},
})
// Middleware: register BEFORE routes
app.Use(requestid.New())
app.Use(logger.New(logger.Config{
Format: "${time} ${method} ${path} ${status} ${latency}\n",
}))
routes.Register(app) // all routes in internal/api/routes/
log.Fatal(app.Listen(cfg.Port))
}
// internal/config/config.go — typed config
type Config struct {
Port string \`env:"PORT" envDefault:":3000"\`
DBUrl string \`env:"DATABASE_URL,required"\`
}
</examples>
Iron Laws
1. ALWAYS use structured logging (zerolog or logrus with JSON output) — never use fmt.Println or log.Printf in production Fiber applications; unstructured logs cannot be parsed by log aggregators. 2. NEVER put business logic in route handlers — always call a service/controller layer; route handlers must only handle HTTP concerns (parsing, validation, response writing). 3. ALWAYS use Fiber's ctx.Locals() for request-scoped values (user ID, trace ID) — never pass request-scoped data via global variables or function parameters down the call stack. 4. NEVER commit sensitive configuration directly in code — use envconfig, viper, or environment variables with a .env.example template; loaded secrets must never appear in logs. 5. ALWAYS organize project structure into cmd/, internal/, pkg/ conventions — Fiber projects that put all code in root packages become unmaintainable at scale.
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
fmt.Println for logging in Fiber handlers | Unstructured; no log levels; no correlation IDs; breaks log aggregation | Use zerolog or logrus with zap.String("key", value) structured fields |
| Business logic in route handlers | Logic becomes untestable and non-reusable; couples HTTP layer to domain | Move to service layer; handler calls service method, formats response |
| Global state for request context | Concurrent requests overwrite each other's context; race conditions | Use ctx.Locals("key", value) for all request-scoped data |
| Hardcoded config values | No environment-specific deployments; credentials in source history | Use envconfig or viper with .env.example; never commit real values |
| All files in project root | Impossible to separate public/internal APIs; package import cycles | Use standard Go layout: cmd/, internal/, pkg/, api/ |
Memory Protocol (MANDATORY)
Before starting:
cat .claude/context/memory/learnings.mdAfter completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
Invoke the fiber-logging-and-project-structure skill and follow it exactly as presented to you
'use strict';
/**
* Post-execute hook for fiber-logging-and-project-structure
* Auto-generated by enterprise-bundle-scaffolder
*
* Records metrics after skill execution.
*/
function postExecute(_context) {
// Record execution metrics
return { ok: true, skill: 'fiber-logging-and-project-structure' };
}
module.exports = { postExecute };
'use strict';
/**
* Pre-execute hook for fiber-logging-and-project-structure
* Auto-generated by enterprise-bundle-scaffolder
*
* Validates inputs before skill execution.
*/
function preExecute(context) {
// Validate skill invocation context
if (!context || typeof context !== 'object') {
return { allow: true, message: 'fiber-logging-and-project-structure: no context to validate' };
}
return { allow: true };
}
module.exports = { preExecute };
fiber-logging-and-project-structure Research Requirements
Generated: 2026-02-28
Skill Description
Applies best practices for logging, project structure, and environment variable usage specifically to the main application file.
Research Areas
- Current best practices for fiber-logging-and-project-structure
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
fiber-logging-and-project-structure Rules
Purpose
Applies best practices for logging, project structure, and environment variable usage specifically to the main application file.
Best Practices
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "fiber-logging-and-project-structureInput",
"description": "Input schema for Applies best practices for logging, project structure, and environment variable usage specifically to the main application file.",
"type": "object",
"additionalProperties": true,
"properties": {
"target": {
"type": "string",
"description": "Target file or path for the skill to operate on"
},
"options": {
"type": "object",
"description": "Additional options for skill execution",
"additionalProperties": true
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "fiber-logging-and-project-structureOutput",
"type": "object",
"additionalProperties": true,
"properties": {
"ok": {
"type": "boolean"
},
"summary": {
"type": "string"
}
}
}
#!/usr/bin/env node
'use strict';
/**
* fiber-logging-and-project-structure - Enterprise Skill Script
* Auto-generated by enterprise-bundle-scaffolder
*/
const fs = require('fs');
const path = require('path');
// Parse arguments
const args = process.argv.slice(2);
const options = {};
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--')) {
const key = args[i].slice(2);
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
options[key] = value;
}
}
if (options.help) {
console.log(`
fiber-logging-and-project-structure - Enterprise Skill
Usage:
node main.cjs --check <file> Check a file against guidelines
node main.cjs --list List all guidelines
node main.cjs --help Show this help
Description:
Applies best practices for logging, project structure, and environment variable usage specifically to the main application file.
`);
process.exit(0);
}
if (options.list) {
console.log('Guidelines for fiber-logging-and-project-structure:');
console.log('See SKILL.md for full guidelines');
process.exit(0);
}
console.log('fiber-logging-and-project-structure skill loaded. Use with Claude for code review.');
fiber-logging-and-project-structure Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests