### Quick Start Commands Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/components/lsp/packages/lsp-tools-mcp/README.md Installs dependencies, runs checks, tests, builds the project, and demonstrates sending a JSON-RPC request to the MCP server. ```bash npm install npm run check npm test npm run build printf '%s ' '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node dist/cli.js mcp ``` -------------------------------- ### Install pwndbg from Source Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md Instructions for installing pwndbg on macOS and Linux by cloning the repository and running the setup script. ```bash git clone https://github.com/pwndbg/pwndbg cd pwndbg && ./setup.sh ``` -------------------------------- ### Set up a gRPC Server in Go Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/grpc-connect.md Implement a gRPC server using the standard grpc-go library. This example shows how to create a server, register a service, and start listening on a TCP port with a unary interceptor. ```go import "google.golang.org/grpc" lis, _ := net.Listen("tcp", ":8080") srv := grpc.NewServer( grpc.UnaryInterceptor(loggingUnaryInterceptor), ) myservicev1.RegisterUserServiceServer(srv, &userServer{}) _ = srv.Serve(lis) ``` -------------------------------- ### Example integration test for user creation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/sqlc-pgx.md Demonstrates a typical integration test scenario using a test database setup, creating a user, and verifying retrieval. ```go func TestUserStore_Create_returns_new_user(t *testing.T) { // Given pool := newTestDB(t) s := store.NewUserStore(pool) ctx := context.Background() // When user, err := s.Create(ctx, domain.User{ ID: domain.UserID(uuid.Must(uuid.NewV7())), Email: mustEmail("a@b.com"), Username: mustUsername("alice"), }) // Then require.NoError(t, err) require.NotEmpty(t, user.ID) fetched, err := s.Get(ctx, user.ID) require.NoError(t, err) require.Equal(t, user.Email, fetched.Email) } ``` -------------------------------- ### Cargo-Fuzz Setup Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust-ub/miri-sanitizers-loom.md Install `cargo-fuzz` globally using `cargo install cargo-fuzz` and then initialize a fuzzing target in your project with `cargo fuzz init`. ```bash cargo install cargo-fuzz cargo fuzz init ``` -------------------------------- ### SQL migration file example Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/sqlc-pgx.md An example SQL migration file demonstrating the Up and Down statements for creating and dropping a 'users' table. ```sql -- migrations/20260101000001_create_users.sql -- +goose Up CREATE TABLE users ( id UUID PRIMARY KEY, email TEXT NOT NULL UNIQUE, username TEXT NOT NULL UNIQUE, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); -- +goose Down DROP TABLE users; ``` -------------------------------- ### Install Textual Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/textual-tui.md Install Textual and its development dependencies using uv. ```bash uv add textual uv add --dev textual-dev # textual console + run --dev for hot reload ``` -------------------------------- ### Project Initialization and Dependency Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/bootstrap.md Commands to create a new project directory, initialize Bun, and install core dependencies for Hono, OpenAPI, and development tools like Biome and TypeScript. ```bash mkdir my-api && cd my-api bun init -y bun add hono hono-openapi @scalar/hono-api-reference @hono/swagger-ui zod bun add --dev @biomejs/biome typescript bun biome init ``` -------------------------------- ### Install Connect/Protobuf Go Tools Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/bootstrap.md Install additional global Go tools required for projects using Connect and Protocol Buffers. These are for buf and protobuf code generation. ```bash go install github.com/bufbuild/buf/cmd/buf@latest go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest ``` -------------------------------- ### Install sqlc and goose Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/sqlc-pgx.md Installs the sqlc code generator and goose migration tool globally using go install. ```bash go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest go install github.com/pressly/goose/v3/cmd/goose@latest ``` -------------------------------- ### Install Go Toolchain with Buf Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/grpc-connect.md Installs the necessary Go tools including Buf, protoc-gen-go, protoc-gen-connect-go, and protoc-gen-go-vtproto. These tools are essential for managing Protobuf definitions and generating code. ```bash go install github.com/bufbuild/buf/cmd/buf@latest go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest go install github.com/bufbuild/protovalidate/cmd/protoc-gen-go-vtproto@latest ``` -------------------------------- ### Install LazyCodex Source: https://github.com/code-yeongyu/lazycodex/blob/main/packages/web/content/docs/installation.md Run this command to install LazyCodex. It is equivalent to a more verbose OpenCode installation command. ```bash bunx lazycodex-ai install ``` -------------------------------- ### GolangCI-Lint Configuration Example Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/golangci-strict.md Example configuration for golangci-lint, specifying enabled linters, performance settings, formatter preferences, and issue exclusion rules. ```yaml linters: disable-all: true enable: - errcheck - gosimple - govet - staticcheck - unused - typecheck - varcheck - structcheck - deadcode - errors - goconst - gofmt - goimports - goprintffuncname - lll - misspell - nakedret - nolintlint - rowserrcheck - scopelint - sqlclosecheck - stylecheck - unconvert - unparam - whitespace - wsl - errname - errorlint - exhaustive - exportloopref - forcify - funlen - gci - gochecknoglobals - gochecknoinits - goconvet - gocritic - gomoddirectives - gomodstderrcheck - ifshort - importascheck - makezero - nilerr - nilloop - nonamedreturn - paralleltest - predeclared - proptypes - testpackage - thelper - tparallel - unlocallint - unmarksafety - varnamelen - wrapcheck - asasalint - bidichk - contextcheck - deepcopyspec - dogsled - durationzero - errchklen - errfmt - errorlint - errorsset - execinmain - exhaustive - exportloopref - forbidif - forcify - funlen - gci - gochecknoglobals - gochecknoinits - goconvet - gocritic - gomoddirectives - gomodstderrcheck - ifshort - importascheck - interface{}: - maintidx - makezero - mirror - nilerr - nilloop - no-self-import - nonamedreturn - paralleltest - predeclared - proptypes - testpackage - thelper - tparallel - unlocallint - unmarksafety - varnamelen - wrapcheck - asasalint - bidichk - contextcheck - deepcopyspec - dogsled - durationzero - errchklen - errfmt - errorlint - errorsset - execinmain - exhaustive - exportloopref - forbidif - forcify - funlen - gci - gochecknoglobals - gochecknoinits - goconvet - gocritic - gomoddirectives - gomodstderrcheck - ifshort - importascheck - makezero - nilerr - nilloop - nonamedreturn - paralleltest - predeclared - proptypes - testpackage - thelper - tparallel - unlocallint - unmarksafety - varnamelen - wrapcheck - asasalint - bidichk - contextcheck - deepcopyspec - dogsled - durationzero - errchklen - errfmt - errorlint - errorsset - execinmain - exhaustive - exportloopref - forbidif - forcify - funlen - gci - gochecknoglobals - gochecknoinits - goconvet - gocritic - gomoddirectives - gomodstderrcheck - ifshort - importascheck - makezero - nilerr - nilloop - nonamedreturn - paralleltest - predeclared - proptypes - testpackage - thelper - tparallel - unlocallint - unmarksafety - varnamelen - wrapcheck # Use fmt.Errorf instead of errors.New(fmt.Sprintf) - name: errorf # Use if err != nil { return err } instead of if err != nil { return err } - name: if-return # Indent error flow - name: indent-error-flow # Use value from range in closure - name: range-val-in-closure # Redefines built-in id - name: redefines-builtin-id # Superfluous else - name: superfluous-else # Unhandled error - name: unhandled-error arguments: - "fmt.Print.*" - "fmt.Fprint.*" perfsprint: integer-format: true error-format: true bool-format: true string-format: true goimports: local-prefixes: - github.com/your-org issues: max-issues-per-linter: 0 max-same-issues: 0 exclude-rules: # Tests get a longer leash on funlen + lll - path: _test\.go linters: - funlen - lll - dupl - gosec # Generated code never lints - path: \.pb\.go$ linters: [all] - path: \.connect\.go$ linters: [all] - path: ^.*sqlc/.*\.sql\.go$ linters: [all] formatters: enable: - gofumpt - goimports ``` -------------------------------- ### Install pwntools Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwntools.md Installs pwntools using pip. Includes verification step. ```bash pip install pwntools # Or in a venv: python -m venv .venv && source .venv/bin/activate pip install pwntools # Verify python -c 'from pwn import *; print("ok")' ``` -------------------------------- ### Install Playwright CLI Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/playwright-cli.md Installs Playwright and downloads browser binaries for a project. Use `npm init playwright@latest` for interactive setup or `npx playwright install` to download browsers if Playwright is already a dependency. ```bash npm init playwright@latest # interactive; picks TS/JS + browsers + config # Or if Playwright is already a dep: npx playwright install # downloads browsers npx playwright install chromium # just chromium npx playwright install --with-deps # also installs OS deps (Linux) ``` ```bash pip install playwright playwright install ``` -------------------------------- ### pwndbg Telescope Command Example Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md Demonstrates the 'telescope' command in pwndbg for walking pointers recursively from a given address. ```text 00:0000│ 0x7ffd... → 0x601010 (heap) → 0x2a (unknown, i.e. a number 42) 01:0008│ 0x7ffd... → 0x7fff... (stack) → 'hello world' ``` -------------------------------- ### Usage Examples for httpx2 Client Factories Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/httpx2-optimization.md Demonstrates how to use the `create_async_client` and `create_client` factory functions for both asynchronous and synchronous HTTP requests. These examples show basic client instantiation and usage. ```python # Async — the common case async with create_async_client(base_url="https://api.example.com") as client: r = await client.get("/users") # Sync with create_client() as client: r = client.get("https://api.example.com/health") ``` -------------------------------- ### Configuring Reqwest HTTP Client in Rust Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/libraries.md Demonstrates how to build a `reqwest` client with custom configurations like timeout, user agent, and connection pooling. Includes an example of making a GET request and deserializing the JSON response. ```rust let client = reqwest::Client::builder() .timeout(std::time::Duration::from_secs(30)) .user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"))) .https_only(true) .pool_max_idle_per_host(8) .build()?; #[derive(serde::Deserialize)] struct Repo { full_name: String, stargazers_count: u64 } let repo: Repo = client .get("https://api.github.com/repos/rust-lang/rust") .send().await? .error_for_status()? .json().await?; ``` -------------------------------- ### pwndbg Context View Example Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md An example of the 'context' view in pwndbg, which displays registers, disassembly, stack, and backtrace in a single, organized output. ```text ──── registers ──── RAX 0x0 RBX 0x7ffffffde158 RCX 0x7fffff7abf10 ... ──── disasm ──── ► 0x401234 mov rdi, rax 0x401237 call 0x401190 ... ──── stack ──── 00:0000│ rsp 0x7ffffffde0a0 → 0x7fffff7c4000 01:0008│ 0x7ffffffde0a8 → 0x0 ... ──── backtrace ──── ► f 0 0x401234 parse_input+0x3c f 1 0x401180 main+0x120 f 2 0x7fffff7a5083 __libc_start_main+0xf3 ``` -------------------------------- ### Install Local Codex Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/components/comment-checker/README.md Installs the local Codex environment, including building and copying the plugin, registering marketplaces, and installing dependencies. ```bash bunx lazycodex install ``` -------------------------------- ### Install rust-script Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/one-liners.md Install the `rust-script` tool globally using Cargo. ```bash cargo install rust-script ``` -------------------------------- ### Install httpx2 with HTTP/2 and Content Encoding Extras Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/httpx2-optimization.md Install httpx2 with the necessary extras for HTTP/2, Brotli, and Zstandard support. These are essential for optimal performance. ```toml # pyproject.toml dependencies = [ "httpx2[http2,brotli,zstd]", ] ``` -------------------------------- ### Verify pwndbg Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md Commands to verify that pwndbg has been installed correctly by checking the gdb version and launching gdb with a binary. ```bash gdb --version gdb ./any-binary ``` -------------------------------- ### Project Bootstrap and Tool Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/cargo-strict.md Commands to create a new Rust binary project, install essential cargo tools (nextest, machete, deny, edit, watch), and set up the nightly toolchain with Miri component. ```bash cargo new --bin my-app --edition 2024 cd my-app cargo install cargo-nextest cargo-machete cargo-deny cargo-edit cargo-watch rustup install nightly rustup component add miri --toolchain nightly # drop the configs above git add . && git commit -m "chore: bootstrap strict toolchain" ``` -------------------------------- ### Install Miri and Rust Source Components Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust-ub/miri-sanitizers-loom.md Installs the nightly Rust toolchain and adds the Miri component and Rust source code. This is a prerequisite for using Miri. ```bash rustup install nightly rustup component add miri rust-src --toolchain nightly ``` -------------------------------- ### Database Dependencies Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/libraries.md Installs the necessary Go packages and tools for database operations: pgx/v5 for PostgreSQL, sqlc for SQL code generation, and goose for migrations. ```bash go get github.com/jackc/pgx/v5 go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest go install github.com/pressly/goose/v3/cmd/goose@latest ``` -------------------------------- ### FastAPI Application Setup Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/fastapi-stack.md Configures the main FastAPI application, including lifespan management and router inclusion. ```python from contextlib import asynccontextmanager from collections.abc import AsyncIterator from fastapi import FastAPI from myapi.config import get_settings from myapi.routers import users @asynccontextmanager async def lifespan(_: FastAPI) -> AsyncIterator[None]: # Startup: warm up engine pool, run migrations check, etc. yield # Shutdown: close engine from myapi.db import _engine await _engine.dispose() def create_app() -> FastAPI: settings = get_settings() app = FastAPI( title="My API", debug=settings.debug, lifespan=lifespan, ) app.include_router(users.router) return app app = create_app() ``` -------------------------------- ### Remote Debugging Setup with pwndbg Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md Steps for setting up remote debugging using gdbserver on the target machine and connecting with pwndbg. ```bash gdbserver :2345 ./target # on the target box gdb ./target # on your box (gdb) target remote :2345 ``` -------------------------------- ### Root Command Setup and Logger Configuration Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/cobra-stack.md Defines the root command for the CLI application, including persistent flags for verbosity and log format, and sets up the slog logger based on these flags. Uses `PersistentPreRunE` for setup and `SilenceUsage`/`SilenceErrors` for cleaner output. ```go package cmd import ( "context" "log/slog" "os" "github.com/spf13/cobra" ) var ( verbose bool logFormat string configPath string ) var rootCmd = &cobra.Command{ Use: "mytool", Short: "Short description of mytool", Long: `Long description, prose; cobra wraps it for --help.`, PersistentPreRunE: func(c *cobra.Command, args []string) error { return setupLogger() }, SilenceUsage: true, // don't print --help on every error SilenceErrors: true, // we log them ourselves in Execute } func init() { rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "enable debug logging") rootCmd.PersistentFlags().StringVar(&logFormat, "log-format", "text", "log format: text or json") rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", "", "path to config file (optional)") } func Execute(ctx context.Context) error { return rootCmd.ExecuteContext(ctx) } func setupLogger() error { level := slog.LevelInfo if verbose { level = slog.LevelDebug } opts := &slog.HandlerOptions{Level: level} var h slog.Handler switch logFormat { case "json": h = slog.NewJSONHandler(os.Stderr, opts) case "text": h = slog.NewTextHandler(os.Stderr, opts) default: return fmt.Errorf("invalid log-format %q", logFormat) } slog.SetDefault(slog.New(h)) return nil } ``` -------------------------------- ### Create a Vite React TypeScript App Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/bootstrap.md Scaffolds a new React TypeScript project using Vite. After creation, navigate to the project directory, install dependencies, and start the development server. ```bash bun create vite my-app -- --template react-ts cd my-app bun install bun run dev ``` -------------------------------- ### Gin HTTP Framework Setup Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/libraries.md Sets up a basic Gin server with recovery and custom middleware. Use when a large ecosystem and framework-blessed request-scoped objects are needed. ```go import "github.com/gin-gonic/gin" func main() { r := gin.New() r.Use(gin.Recovery(), middleware.RequestLogger(), middleware.RequestID()) r.GET("/healthz", func(c *gin.Context) { c.JSON(200, gin.H{"ok": true}) }) _ = r.Run(":8080") } ``` -------------------------------- ### Setup OpenAPI Specification and Scalar UI with Hono Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/backend-hono.md Example of setting up OpenAPI spec endpoint and Scalar UI using `hono-openapi` and `@scalar/hono-api-reference`. Mounts the spec at `/openapi/spec.json` and UI at `/openapi/ui`. ```typescript import type { Hono } from 'hono' import { Scalar } from '@scalar/hono-api-reference' import { openAPIRouteHandler } from 'hono-openapi' export function setupOpenAPI(app: Hono, prefix = '/openapi') { app.get( `${prefix}/spec.json`, openAPIRouteHandler(app, { documentation: { info: { title: `starter-monorepo's backend`, version: '1.0.0', description: 'My amazing API', }, }, }), ) app.get( `${prefix}/ui`, Scalar({ theme: 'deepSpace', url: `${prefix}/spec.json`, }), ) } ``` -------------------------------- ### Axum Web Framework Setup in Rust Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/libraries.md Illustrates setting up a basic `axum` web server with a health check endpoint. It demonstrates state management with `Arc` and `sqlx` for database interaction, along with common middleware like tracing and compression. ```rust use axum::{Router, routing::get, extract::State, response::Json}; use std::sync::Arc; #[derive(Clone)] struct AppState { db: sqlx::PgPool } async fn health(State(state): State>) -> Json { let ok = sqlx::query_scalar!("SELECT 1::int4").fetch_one(&state.db).await.is_ok(); Json(serde_json::json!({ "ok": ok })) } #[tokio::main] async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); let state = Arc::new(AppState { db: sqlx::PgPool::connect(&env_db()).await? }); let app = Router::new() .route("/health", get(health)) .with_state(state) .layer(tower_http::trace::TraceLayer::new_for_http()) .layer(tower_http::compression::CompressionLayer::new()); let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await?; axum::serve(listener, app).await?; Ok(()) } ``` -------------------------------- ### GitHub Actions CI Workflow Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/bootstrap.md Sets up a CI workflow for pull requests and pushes to the main branch, including Go version setup, tool installation, and running checks like formatting, linting, nilaway, testing, and building. ```yaml name: ci on: pull_request: push: branches: [main] jobs: ci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: '1.23' cache: true - name: Install tools run: | go install mvdan.cc/gofumpt@latest go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.0.0 go install go.uber.org/nilaway/cmd/nilaway@latest go install github.com/go-task/task/v3/cmd/task@latest - name: Format check run: gofumpt -l . | (! grep .) - name: Lint run: golangci-lint run --timeout 5m ./... - name: Nilaway run: nilaway ./... - name: Test run: go test -race -shuffle=on -count=1 ./... - name: Build run: go build -trimpath ./... ``` -------------------------------- ### Complete Hono App with OpenAPI and UI Integrations Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/backend-hono.md This TypeScript code sets up a Hono application, defining schemas with Zod, documenting routes with `hono-openapi`, and integrating Scalar and Swagger UI for API documentation. It includes examples for health checks, a GET route with query validation, and a POST route with JSON body validation. ```typescript import { Hono } from 'hono' import { describeRoute, openAPIRouteHandler, resolver, validator } from 'hono-openapi' import { Scalar } from '@scalar/hono-api-reference' import { swaggerUI } from '@hono/swagger-ui' import { z } from 'zod' // ─────────────────────────────────────────────────────────────── // 1. Schema definitions (Zod v4 — Standard Schema native) // ─────────────────────────────────────────────────────────────── const QuerySchema = z.object({ name: z.string().optional(), }) const ResponseSchema = z.object({ message: z.string(), }) const JsonBodySchema = z.object({ name: z.string(), age: z.number().int().min(0), }) // ─────────────────────────────────────────────────────────────── // 2. Hono app with described routes // ─────────────────────────────────────────────────────────────── const app = new Hono() // Health check (no validation) app.get('/health', (c) => c.json({ status: 'ok' })) // A fully-documented route app.get( '/hello', describeRoute({ tags: ['Greetings'], summary: 'Say hello', description: 'Returns a greeting message', responses: { 200: { description: 'Successful greeting', content: { 'application/json': { schema: resolver(ResponseSchema), }, }, }, }, }), validator('query', QuerySchema), (c) => { const query = c.req.valid('query') return c.json({ message: `Hello ${query.name ?? 'Hono'}!` }) }, ) // A POST route with JSON body validation app.post( '/users', describeRoute({ tags: ['Users'], summary: 'Create a user', responses: { 200: { description: 'User created', content: { 'application/json': { schema: resolver(ResponseSchema), }, }, }, }, }), validator('json', JsonBodySchema), (c) => { const body = c.req.valid('json') return c.json({ message: `Created user ${body.name}` }) }, ) // ─────────────────────────────────────────────────────────────── // 3. OpenAPI spec endpoint // ─────────────────────────────────────────────────────────────── app.get( '/openapi.json', openAPIRouteHandler(app, { documentation: { info: { title: 'Hono API', version: '1.0.0', description: 'Example Hono API with OpenAPI', }, servers: [ { url: 'http://localhost:3000', description: 'Local server' }, ], }, }), ) // ─────────────────────────────────────────────────────────────── // 4. Scalar API Reference UI // ─────────────────────────────────────────────────────────────── app.get( '/scalar', Scalar({ url: '/openapi.json', theme: 'saturn', pageTitle: 'Hono API Reference', }), ) // ─────────────────────────────────────────────────────────────── // 5. Swagger UI (parallel mount) // ─────────────────────────────────────────────────────────────── app.get( '/swagger', swaggerUI({ url: '/openapi.json', title: 'Swagger UI', }), ) // ─────────────────────────────────────────────────────────────── // 6. Bun canonical entrypoint // ─────────────────────────────────────────────────────────────── export default app ``` -------------------------------- ### CLI Application Initialization with Cobra Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/libraries.md Demonstrates the basic commands to initialize a new CLI application using the Cobra framework and add a new command. Cobra is the de facto standard for Go CLI development. ```bash go install github.com/spf13/cobra-cli@latest cobra-cli init mytool cobra-cli add server ``` -------------------------------- ### Main Server Entrypoint Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/backend-stack.md The main function sets up context with signal handling for graceful shutdown and executes the application's entrypoint command. It logs any fatal errors and exits. ```go package main import ( "context" "log/slog" "os" "os/signal" "syscall" "github.com/your-org/myservice/internal/cmd" ) func main() { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer stop() if err := cmd.Execute(ctx); err != nil { slog.Error("fatal", slog.Any("err", err)) os.Exit(1) } } ``` -------------------------------- ### Main Function with Tracing and Graceful Shutdown Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/axum-stack.md Sets up the main entry point for the application, including configuration loading, state initialization, router setup, and graceful shutdown handling for SIGINT and SIGTERM signals. ```rust // src/main.rs use my_app::{config::Settings, routes, state::AppState}; #[tokio::main] async fn main() -> color_eyre::Result<()> { color_eyre::install()?; init_tracing(); let config = Settings::load()?; let state = AppState::new(config.clone()).await?; let app = routes::router(state); let listener = tokio::net::TcpListener::bind(&config.bind).await?; tracing::info!(addr = %config.bind, "listening"); axum::serve(listener, app) .with_graceful_shutdown(shutdown_signal()) .await?; Ok(()) } fn init_tracing() { use tracing_subscriber::{fmt, EnvFilter}; let filter = EnvFilter::try_from_default_env() .unwrap_or_else(|_| EnvFilter::new("info,sqlx=warn,hyper=warn,tower_http=info")); fmt().with_env_filter(filter).with_target(false).json().init(); } async fn shutdown_signal() { let ctrl_c = async { tokio::signal::ctrl_c().await.expect("ctrl_c handler"); }; #[cfg(unix)] let terminate = async { tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate()) .expect("signal handler").recv().await; }; #[cfg(not(unix))] let terminate = std::future::pending::<()>(); tokio::select! { _ = ctrl_c => {}, _ = terminate => {} } tracing::info!("shutting down"); } ``` -------------------------------- ### Install LazyCodex CLI Source: https://github.com/code-yeongyu/lazycodex/blob/main/packages/web/DESIGN.md Use `bunx` to install the LazyCodex CLI without global installation. The `--no-tui` flag enables the autonomous variant. ```bash bunx lazycodex-ai install ``` ```bash bunx lazycodex-ai install --no-tui --codex-autonomous ``` -------------------------------- ### Install Ghidra on macOS and Linux Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/ghidra.md Install Ghidra using Homebrew on macOS or by downloading the release ZIP for Linux. Ensure you have JDK 21 or later installed. ```bash # macOS brew install --cask ghidra # OR download the release ZIP from the repo and ./ghidraRun # Linux # Download from https://github.com/NationalSecurityAgency/ghidra/releases # Requires JDK 21+ ./ghidraRun # Dependency java -version # must be 21+ ``` -------------------------------- ### Launch pwndbg with Arguments Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/debugging/references/tools/pwndbg.md How to launch pwndbg to debug an existing binary with command-line arguments. ```bash gdb --args ./target arg1 arg2 ``` -------------------------------- ### Set up a test PostgreSQL database with testcontainers Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/sqlc-pgx.md Initializes a PostgreSQL instance using testcontainers, runs migrations, and returns a pgxpool.Pool for integration tests. ```go package store_test import ( "context" "testing" "github.com/stretchr/testify/require" "github.com/testcontainers/testcontainers-go/modules/postgres" ) func newTestDB(t *testing.T) *pgxpool.Pool { t.Helper() ctx := context.Background() pgC, err := postgres.Run(ctx, "postgres:16-alpine", postgres.WithDatabase("test"), postgres.WithUsername("test"), postgres.WithPassword("test"), postgres.BasicWaitStrategies(), ) require.NoError(t, err) t.Cleanup(func() { _ = pgC.Terminate(ctx) }) dsn, err := pgC.ConnectionString(ctx, "sslmode=disable") require.NoError(t, err) pool, err := store.NewPool(ctx, dsn) require.NoError(t, err) t.Cleanup(pool.Close) require.NoError(t, goose.UpContext(ctx, /* sql.DB from pool */, "../migrations")) return pool } ``` -------------------------------- ### Initialize Gin Server Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/backend-stack.md Sets up a new Gin server with custom middleware and routes. Uses gin.New() to avoid default middleware and configures explicit timeouts for http.Server. ```go package api import ( "context" "fmt" "log/slog" "net/http" "github.com/gin-gonic/gin" "github.com/your-org/myservice/internal/api/handlers" "github.com/your-org/myservice/internal/api/middleware" "github.com/your-org/myservice/internal/config" ) type Server struct { cfg config.Config srv *http.Server logger *slog.Logger } func New(cfg config.Config, logger *slog.Logger, h *handlers.Handler) *Server { gin.SetMode(gin.ReleaseMode) r := gin.New() // Middleware order matters — see "Middleware ordering" below. r.Use( middleware.RequestID(), // 1. assign request_id first middleware.Recovery(logger), // 2. recovery wraps everything middleware.RequestLogger(logger), middleware.CORS(), ) h.Mount(r) return &Server{ cfg: cfg, logger: logger, srv: &http.Server{ Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port), Handler: r, ReadTimeout: cfg.ReadTimeout, WriteTimeout: cfg.WriteTimeout, }, } } func (s *Server) Run(ctx context.Context) error { errCh := make(chan error, 1) go func() { s.logger.InfoContext(ctx, "server starting", slog.String("addr", s.srv.Addr)) if err := s.srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { errCh <- err } close(errCh) }() select { case <-ctx.Done(): s.logger.InfoContext(ctx, "shutdown signal received") shutdownCtx, cancel := context.WithTimeout( context.Background(), s.cfg.ShutdownTimeout) defer cancel() return s.srv.Shutdown(shutdownCtx) case err := <-errCh: return err } } ``` -------------------------------- ### Start task and wait for readiness with start Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/async-anyio.md Use `tg.start` when a task needs to signal its readiness before the caller proceeds, such as starting a server and then connecting to it. The task must call `task_status.started()` to unblock the `tg.start()` call. ```python from anyio import TASK_STATUS_IGNORED, create_task_group, run from anyio.abc import TaskStatus async def start_server(port: int, *, task_status: TaskStatus[None] = TASK_STATUS_IGNORED) -> None: listener = await anyio.create_tcp_listener(local_host="127.0.0.1", local_port=port) task_status.started() # unblocks tg.start() await listener.serve(handler) async def main() -> None: async with create_task_group() as tg: await tg.start(start_server, 8080) # blocks until task_status.started() # server is guaranteed ready here async with await anyio.connect_tcp("127.0.0.1", 8080) as client: ... run(main) ``` -------------------------------- ### Install Hono Dependencies Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/backend-hono.md Installs Hono and related packages for OpenAPI and API reference UIs. ```bash bun add hono hono-openapi @scalar/hono-api-reference @hono/swagger-ui zod ``` -------------------------------- ### Create and Initialize a New Hono Project with Bun Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/typescript/backend-hono.md Basic commands to create a new project directory, navigate into it, and initialize a new Bun project. ```bash # 1. Create project mkdir my-api && cd my-api bun init -y ``` -------------------------------- ### Verify Miri Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust-ub/miri-sanitizers-loom.md Checks if the Miri component has been successfully installed and is accessible via the nightly toolchain. ```bash cargo +nightly miri --version ``` -------------------------------- ### ConnectRPC Server and Client Setup Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/libraries.md Demonstrates setting up a ConnectRPC server handler and a client for making requests. ConnectRPC offers wire compatibility with gRPC and supports multiple protocols. ```go // Server mux := http.NewServeMux() mux.Handle(elizav1connect.NewElizaServiceHandler(&elizaServer{})) _ = http.ListenAndServe(":8080", h2c.NewHandler(mux, &http2.Server{})) // Client client := elizav1connect.NewElizaServiceClient( http.DefaultClient, "http://localhost:8080", ) res, err := client.Say(ctx, connect.NewRequest(&elizav1.SayRequest{Sentence: "hi"})) ``` -------------------------------- ### Safe Indexing with `get()` Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust-ub/ub-taxonomy.md Prefer using the safe `get()` method for slice indexing over direct bracket notation (`[]`) when dealing with potentially out-of-bounds indices. `get()` returns an `Option`, preventing panics and allowing for graceful handling of invalid accesses. ```rust let data = [10, 20, 30]; let index = 5; match data.get(index) { Some(value) => println!("Value at index {}: {}", index, value), None => println!("Index {} is out of bounds.", index), } ``` -------------------------------- ### Go gRPC-Connect Server Setup Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/go/grpc-connect.md Sets up a gRPC-Connect server with logging and validation interceptors. The handler can be mounted alongside REST routes. ```go package main import ( "context" "log/slog" "net/http" "connectrpc.com/connect" "buf.build/go/protovalidate" validateinterceptor "connectrpc.com/validate" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" myservicev1 "github.com/your-org/myservice/gen/myservice/v1" "github.com/your-org/myservice/gen/myservice/v1/myservicev1connect" ) type UserServer struct { svc *UserService } func (s *UserServer) CreateUser( ctx context.Context, req *connect.Request[myservicev1.CreateUserRequest], ) (*connect.Response[myservicev1.CreateUserResponse], error) { // protovalidate already ran via the interceptor below. // req.Msg is guaranteed to satisfy the .proto constraints. user, err := s.svc.Create(ctx, req.Msg.Email, req.Msg.Username, req.Msg.Age) if err != nil { return nil, mapError(err) } return connect.NewResponse(&myservicev1.CreateUserResponse{ User: userToProto(user), }), nil } func main() { validator, _ := protovalidate.New() interceptors := connect.WithInterceptors( loggingInterceptor(), validateinterceptor.NewInterceptor(validator), ) mux := http.NewServeMux() mux.Handle(myservicev1connect.NewUserServiceHandler( &UserServer{svc: newUserService()}, interceptors, )) // h2c lets the server speak HTTP/2 cleartext for gRPC clients. srv := &http.Server{ Addr: ":8080", Handler: h2c.NewHandler(mux, &http2.Server{}), } slog.Info("rpc server listening", slog.String("addr", srv.Addr)) if err := srv.ListenAndServe(); err != nil { slog.Error("rpc", slog.Any("err", err)) } } ``` -------------------------------- ### Create Goals from Brief Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/ultragoal/SKILL.md Initiates goal creation using a brief description. Supports direct brief text, a file path, or standard input. State should be written through the CLI. ```sh omo ultragoal create-goals --brief "" --json ``` ```sh omo ultragoal create-goals --brief-file --json ``` ```sh cat | omo ultragoal create-goals --from-stdin --json ``` -------------------------------- ### Command Card Examples Source: https://github.com/code-yeongyu/lazycodex/blob/main/packages/web/DESIGN.md Examples of commands used within LazyCodex, including a self-referential loop, a planner, and a plan executor. ```bash $ulw-loop — self-referential loop ``` ```bash $ulw-plan — Prometheus planner ``` ```bash $start-work — plan executor ``` -------------------------------- ### Install Nightly Toolchain for Miri Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/cargo-strict.md Installs the nightly Rust toolchain and adds the Miri component for running memory safety checks. ```bash rustup install nightly rustup component add miri rust-src --toolchain nightly ``` -------------------------------- ### Autonomous LazyCodex Installation Source: https://github.com/code-yeongyu/lazycodex/blob/main/packages/web/content/docs/installation.md Use this command for an autonomous installation without a Text User Interface, enabling Codex autonomous mode. ```bash bunx lazycodex-ai install --no-tui --codex-autonomous ``` -------------------------------- ### Bootstrap Project Initialization with uv Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/pyproject-strict.md Initializes a new Python project as either an application or a library using uv, and adds development tools like basedpyright, ruff, and pytest. ```bash # Application uv init --app myproject cd myproject # Library (publishable to PyPI) uv init --lib mylibrary cd mylibrary # Add dev tools uv add --dev basedpyright ruff pytest ``` -------------------------------- ### Application State Initialization with SQLx and Reqwest Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/axum-stack.md Sets up the `AppState` struct, which holds shared resources like a database connection pool (`PgPool`), application configuration, and an HTTP client. It also runs database migrations. ```rust // src/state.rs use std::sync::Arc; use sqlx::PgPool; #[derive(Clone)] pub struct AppState { pub db: PgPool, pub config: Arc, pub http: reqwest::Client, } impl AppState { pub async fn new(config: crate::config::Settings) -> anyhow::Result { let db = sqlx::postgres::PgPoolOptions::new() .max_connections(config.db.max_connections) .acquire_timeout(std::time::Duration::from_secs(3)) .connect(config.db.url.expose_secret()) .await?; sqlx::migrate!("./migrations").run(&db).await?; let http = reqwest::Client::builder() .timeout(std::time::Duration::from_secs(15)) .user_agent(concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"))) .build()?; Ok(Self { db, config: Arc::new(config), http }) } } ``` -------------------------------- ### Cargo-script Example with Inline Dependencies Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/one-liners.md An example of a script using `cargo-script` syntax, featuring inline `Cargo.toml` definitions for dependencies and package metadata. ```rust #!/usr/bin/env -S cargo +nightly -Zscript --- package: name = "fetch" edition = "2024" dependencies: anyhow = "1" reqwest = { version = "0.12", features = ["blocking"] } --- fn main() -> anyhow::Result<()> { let url = std::env::args().nth(1).context("url required")?; println!("{}", reqwest::blocking::get(&url)?.text()?.len()); Ok(()) } ``` -------------------------------- ### Rust SAFETY Comment Good Examples Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/rust/unsafe-discipline.md Provides examples of well-formed SAFETY comments that clearly state the invariant and its justification within the code. ```rust // SAFETY: `len <= self.capacity` was checked at line 87 and `self.ptr` was // allocated by the same allocator we are reading through. ``` ```rust // SAFETY: `read_volatile` requires alignment and non-null; both hold because // `self.inner` is an `InitPtr` whose constructor enforced them. ``` ```rust // SAFETY: We hold `&mut self`, so no concurrent reader exists. The slice // reference is dropped before the next `&self` borrow because we shrink the // returned scope manually. ``` -------------------------------- ### Scaffold New Project with Defaults Source: https://github.com/code-yeongyu/lazycodex/blob/main/plugins/omo/skills/programming/references/python/README.md Use this command to create a new project with all strict defaults pre-configured. It sets up type checking, linting, and testing configurations. ```bash uv run ../../scripts/python/new-project.py myproject ``` ```bash uv run ../../scripts/python/new-project.py myproject --path ./workspace ``` ```bash uv run ../../scripts/python/new-project.py myproject --lib ```