Load comprehensive context about Fresh + ConnectRPC full-stack architecture with project-specific analysis
<codex_skill_adapter>
$context-web-context-load-fresh-connect-stack.$context-web-context-load-fresh-connect-stack as {{SC_ARGS}}.{{SC_ARGS}} as empty.spawn_agent(...) patterns to Codex spawn_agent(...).update_plan.config.toml when the original command mentions MCP.context:web:context-load-fresh-connect-stack.$context-web-context-load-fresh-connect-stack.STEP 1: Initialize comprehensive Fresh + ConnectRPC context loading session
/tmp/fresh-connect-context-$SESSION_ID.json{
"sessionId": "$SESSION_ID",
"timestamp": "$(date -Iseconds)",
"phase": "initialization",
"architecture_type": "auto-detect",
"frontend_detected": false,
"backend_detected": false,
"integration_patterns": [],
"documentation_loaded": {},
"project_analysis": {},
"context_areas": [
"architecture_overview",
"project_structure",
"development_workflow",
"integration_patterns",
"production_features"
],
"checkpoints": []
}
/tmp/fresh-connect-context-$SESSION_ID/STEP 2: Project architecture detection and analysis
TRY:
Think deeply about the optimal Fresh + ConnectRPC architecture patterns based on the detected project structure
ANALYZE project structure from Context section
DETERMINE Fresh + ConnectRPC architecture type:
IF Fresh indicators found AND Go backend indicators found:
ELSE IF Fresh indicators found AND NOT Go backend:
ELSE IF Go backend indicators found AND NOT Fresh:
ELSE:
CATCH (project_analysis_failed):
STEP 3: Adaptive documentation loading based on detected architecture
CASE architecture_type: WHEN "full_stack_fresh_connect":
/tmp/fresh-connect-context-$SESSION_ID/fresh-architecture.json/tmp/fresh-connect-context-$SESSION_ID/connectrpc-integration.json/tmp/fresh-connect-context-$SESSION_ID/api-proxy-patterns.json/tmp/fresh-connect-context-$SESSION_ID/dev-workflow.json/tmp/fresh-connect-context-$SESSION_ID/production-patterns.jsonWHEN "fresh_frontend_only":
WHEN "connectrpc_backend_only":
WHEN "greenfield_setup":
STEP 4: Comprehensive documentation fetching and context synthesis
TRY:
Core Framework Documentation:
Fresh Framework Context
https://fresh.deno.dev/docs/introductionFresh 2.0 Evolution
https://deno.com/blog/an-update-on-freshConnectRPC Go Documentation
https://connectrpc.com/docs/go/getting-startedConnectRPC Web Integration
https://connectrpc.com/docs/web/getting-startedProtocol Buffers Schema Design
https://developers.google.com/protocol-buffers/docs/proto3CATCH (documentation_fetch_failed):
STEP 5: Project-specific context organization and synthesis
Think deeply about integrating all loaded context into actionable guidance for the specific project architecture
ORGANIZE loaded context by architecture domains:
SYNTHESIZE project-specific guidance with comprehensive analysis:
STEP 6: Session state management and context completion
/tmp/fresh-connect-context-cache-$SESSION_ID.jsonFINALLY:
/tmp/fresh-connect-temp-$SESSION_ID-*Core Architecture Components (loaded into context):
Buf.build Package Integration:
# Install from Buf Schema Registry
deno install npm:@buf/wcygan_hello.bufbuild_es
Dependencies Configuration Pattern:
// deno.json imports section
{
"imports": {
"@fresh/core": "jsr:@fresh/core@^2.0.0-alpha.22",
"@preact/signals": "npm:@preact/signals@^1.3.0",
"@connectrpc/connect": "npm:@connectrpc/connect@^2.0.0",
"@connectrpc/connect-web": "npm:@connectrpc/connect-web@^2.0.0",
"@buf/your_org_schema.bufbuild_es": "npm:@buf/your_org_schema.bufbuild_es@^2.5.2"
},
"nodeModulesDir": "auto"
}
// frontend/routes/api/[...path].ts
import { type FreshContext } from "@fresh/core";
const BACKEND_URL = Deno.env.get("BACKEND_URL") || "http://localhost:3007";
export async function handler(req: Request, _ctx: FreshContext) {
const url = new URL(req.url);
const backendUrl = `${BACKEND_URL}${url.pathname.replace("/api", "")}`;
const response = await fetch(backendUrl, {
method: req.method,
headers: req.headers,
body: req.body,
});
// Clone response with CORS headers
const corsHeaders = new Headers(response.headers);
corsHeaders.set("Access-Control-Allow-Origin", "*");
corsHeaders.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
corsHeaders.set("Access-Control-Allow-Headers", "Content-Type, Connect-Protocol-Version");
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: corsHeaders,
});
}
// frontend/islands/GreeterApp.tsx
import { useSignal } from "@preact/signals";
import { createClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-web";
import { GreeterService } from "@buf/wcygan_hello.bufbuild_es/hello/v1/hello_connect";
const transport = createConnectTransport({
baseUrl: "/api",
useBinaryFormat: false,
});
const client = createClient(GreeterService, transport);
export function GreeterApp() {
const name = useSignal("");
const greeting = useSignal("");
const loading = useSignal(false);
const handleSubmit = async (e: Event) => {
e.preventDefault();
loading.value = true;
try {
const response = await client.sayHello({ name: name.value });
greeting.value = response.message;
} catch (error) {
greeting.value = `Error: ${error.message}`;
} finally {
loading.value = false;
}
};
return (
<form onSubmit={handleSubmit}>
<input
type="text"
value={name.value}
onInput={(e) => name.value = e.currentTarget.value}
placeholder="Enter your name"
/>
<button type="submit" disabled={loading.value}>
{loading.value ? "Loading..." : "Say Hello"}
</button>
{greeting.value && <p>{greeting.value}</p>}
</form>
);
}
// backend/cmd/server/main.go
package main
import (
"log"
"net/http"
"github.com/connectrpc/connect-go"
hellov1 "buf.build/gen/go/wcygan/hello/protocolbuffers/go/hello/v1"
"buf.build/gen/go/wcygan/hello/connectrpc/go/hello/v1/hellov1connect"
)
type GreeterService struct{}
func (s *GreeterService) SayHello(
ctx context.Context,
req *connect.Request[hellov1.SayHelloRequest],
) (*connect.Response[hellov1.SayHelloResponse], error) {
name := req.Msg.Name
if name == "" {
name = "World"
}
return connect.NewResponse(&hellov1.SayHelloResponse{
Message: fmt.Sprintf("Hello, %s!", name),
}), nil
}
func main() {
greeter := &GreeterService{}
path, handler := hellov1connect.NewGreeterServiceHandler(greeter)
mux := http.NewServeMux()
mux.Handle(path, handler)
// Add CORS middleware
corsHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Connect-Protocol-Version")
if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK)
return
}
mux.ServeHTTP(w, r)
})
log.Fatal(http.ListenAndServe(":3007", corsHandler))
}
NPM Registry Setup:
# .npmrc configuration
@buf:registry=https://buf.build/gen/npm/v1/
Project Structure Integration:
project/
├── frontend/ # Fresh 2.0 application
│ ├── deno.json # Dependencies and tasks
│ ├── .npmrc # Buf.build registry config
│ ├── routes/
│ │ └── api/[...path].ts # API proxy for ConnectRPC
│ └── islands/ # Interactive components
├── backend/ # Go ConnectRPC service
│ ├── go.mod # Go dependencies
│ ├── cmd/server/ # Main server implementation
│ └── internal/ # Service logic
├── proto/ # Protocol Buffer schemas
├── docker-compose.yml # Development orchestration
└── deno.json # Root task automation
# docker-compose.yml