Skip to content
cccskills
FreePublished on GitHub

architecture-and-stack

Cloudflare-first platform selection. Decision trees for Workers, D1, R2, KV, DO, Queues, Vectorize, Containers, Sandboxes, Flagship, Agent Memory, Workflows v2. Default stack, override conditions, auth, data patterns, reliability.

The English summary is being prepared. Showing the original description.

See how to install

Files included (2)

  • SKILL.md11.2 KB
  • source.json791 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

Submodules

FileDescription
api-design-and-documentation.mdHono v4.12.x RPC mode, error envelope, rate limiting, pagination, OpenAPI, versioning.
shared-api-pool.mdCentralized API key pool. Auto-integrates PostHog, Sentry, Postiz, all services.
drizzle-orm-and-migrations.mdDrizzle ORM v1.0 for D1/Neon. RQBv2, schema-first, auto migrations, type-safe queries.
coolify-docker-proxmox.mdSelf-hosted services on Proxmox via Coolify API. Docker containers, env vars.
mcp-and-cloud-integrations.mdAll MCP servers, cloud APIs, SaaS integrations. Secret discovery, AI API usage.
ai-technology-integration.mdAI APIs/models: GPT-4o vision, Workers AI edge inference, embeddings for RAG.
auth-and-session-management.mdClerk auth: middleware, webhook sync, RBAC, protected routes, session tokens.
background-jobs-and-workflows.mdInngest durable jobs, CF Workflows v2, CF Cron Triggers, CF Queues, email drips, fan-out.
openapi-generation.md@hono/zod-openapi auto-generated specs, Swagger UI, client SDK codegen, versioning.
cf-auto-provision.mdSingle-function CF project bootstrap: D1+KV+R2+DNS+routes+wrangler.toml+integrations via cf CLI.
enterprise-multi-tenancy.mdDB-per-tenant D1, RBAC/ABAC, audit logging (R2 WORM), SSO/SCIM, data residency, rate limiting, white-labeling.
heartbeat-polling.mdCF Workflows heartbeat polling for long-running container jobs — avoids 25min step timeout.

05 — Architecture and Stack

Default Stack

NeedDefaultOverride When
HostingCF Workers + Static AssetsNever
BackendHono v4.12.x on WorkersComplex GraphQL → Yoga
Frontend (simple)Vanilla HTML/CSS/JS>3 interactive pages
Frontend (complex)Angular 21 + Ionic + PrimeNG + NxSimple marketing site
DB (simple)D1 (SQLite, global read replication)Joins >3 tables
DB (complex)Neon PostgreSQLD1 sufficient
CacheKV / Upstash RedisAtomic ops → D1
StorageR2S3-specific SDK
Auth (SaaS)ClerkCustom auth requested
Auth (self-hosted)AuthentikClerk for customer-facing
PaymentsStripe + Stripe LinkNon-card/crypto
Email (transactional)Resend / CF Email ServiceBulk → Listmonk
Email (marketing)Listmonk on CoolifySimple → Resend
RuntimeBunNode.js for incompatible
Package ManagerpnpmLegacy npm
Linting (TS)ESLint + PrettierNever Biome
Linting (Python)Ruff + mypyNever black+isort separately
TestingPlaywright v1.59+ + VitestNever Jest/Cypress
AnalyticsGA4 via GTM + PostHogPrivacy-first → PostHog only
ErrorsSentryPostHog errors sufficient
ValidationZod—
SearchAI Search (fka AutoRAG) + VectorizeSimple → D1 LIKE
QueuesCF Queues—
RealtimeDurable Objects + WebSocket (32MiB msg)Simple polling
SchedulingCF Cron Triggers (250 paid)—
AI/MLWorkers AI (Unweight 22% compression)Specific model → OpenAI/Anthropic via AI Gateway
WorkflowsInngest / CF Workflows v2Simple cron → Cron Triggers
AI AgentsCF Agents SDK (Project Think on DO)No agent needed
Agent MemoryCF Agent Memory (managed)Custom → DO+SQLite
SandboxesCF Sandboxes (GA)Simple → Dynamic Workers
ContainersCF Containers (GA)Simple → Workers
Feature FlagsFlagship (sub-ms eval)PostHog flags sufficient
IaCcf CLI (3000 ops) + wrangler.jsoncMulti-cloud → Pulumi
CI/CDWorkers Builds / GitHub ActionsComplex → GH Actions

Key reasoning: Hono over NestJS (native CF Workers, 12KB). Angular over React (Brian's background, signals stable). Neon over Supabase (multi-DB, lower cost). Drizzle over Prisma (5KB vs 40KB, edge-native, passed Prisma in downloads). ESLint over Biome (angular-eslint, typescript-eslint, massive plugin library).

CF-Only Assumption (DEFAULT)

Every feature MUST try CF-native first. Never reach for external services when CF has an equivalent. Template: megabytespace/saas-starter has stubs for all CF primitives. AI→Workers AI (not OpenAI). Cache→KV/Cache API (not Redis). DB→D1 (not Postgres). Storage→R2 (not S3). Queue→CF Queues (not SQS). Realtime→DO+WebSocket (not Pusher). Schedule→Cron Triggers (not external cron). Search→AI Search+Vectorize (not Algolia). Email→CF Email Service (not SES). Feature flags→Flagship (not LaunchDarkly). Sandbox→CF Sandboxes (not Docker). Only escape to external when CF primitive insufficient (complex joins→Neon, specific model→OpenAI/Anthropic via AI Gateway).

CF Platform Decision Trees

Run code: Static→Workers Static Assets. API→Workers(Hono). Long-running→Workers+Queues/Workflows v2. Stateful→DO. Container workload→CF Containers(GA). Scheduled→Cron Triggers. Browser→Browser Run(Live View+HitL). Sandboxed exec→Dynamic Workers(100x faster than containers). Full isolation→CF Sandboxes(GA, persistent shell+fs).

Store data: Config→KV. Relational simple→D1(global read replication, 1TB). Relational complex→Neon. Files→R2. Session→DO/KV. Search→AI Search(hybrid retrieval). Vectors→Vectorize. Messages→Queues. Cache→KV(CACHE binding, TTL). Versioned objects→Artifacts(git-compatible). Agent state→Agent Memory(managed).

Security: Bots→Turnstile. DDoS→always-on free. WAF→CF WAF. Auth→Clerk. Agent auth→Managed OAuth(RFC 9728). Rate limit→KV counters. Secrets→wrangler secret put. Admin→CF Access. Private networking→CF Mesh.

Feature management: Flags→Flagship(sub-ms eval). Rollout→percentage+cohort+property. Kill switch→instant disable.

Architecture Patterns

Marketing Site: Worker(Hono) → Static Assets + R2 images + KV config + GA4+GTM + Turnstile + Resend

SaaS App: Workers Static Assets(Angular 21+Ionic) → Workers API(Hono) → D1(global replicas)/Neon + R2 + KV + Queues + DO + Clerk + Stripe + Resend + Listmonk + Flagship + PostHog+Sentry+GA4 + Playwright+Vitest

API Service: Worker(Hono) → D1/Neon + KV(rate limit/cache) + R2 + Queues + Workers AI + Sentry + PostHog

AI Agent Service: Worker(Hono) → Agents SDK(Project Think) + Agent Memory + Dynamic Workers + Browser Run + AI Search + DO(stateful sessions)

Service Boundaries

Start monolith. Split when: different scaling needs, different deploy cadence, Worker size exceeded (10MB compressed paid), isolation required. Angular frontend = separate Worker. Webhook handlers = separate. Cron = shared via scheduled handler. Service bindings for zero-cost Worker-to-Worker RPC.

Auth: Clerk

User → Clerk widget → JWT → Worker middleware verifies → proceed. Metadata in D1 (Clerk ID as FK). Roles in D1, not Clerk metadata. Not needed for: public marketing, OSS docs, public APIs with rate limiting only.

Data: Drizzle ORM v1.0

Schema in TypeScript, type-safe queries, auto migrations. RQBv2 (363 commits, 9K+ tests). 10x faster introspection. D1 conventions: id=TEXT(ULID), created_at/updated_at=TEXT(ISO8601), deleted_at=TEXT(soft delete), explicit FKs, indexes on FKs+frequent columns. D1 batch API for transactions (no BEGIN support).

Neon when D1 isn't enough: >3 table joins, full-text search, jsonb, complex aggregations, RLS, >1TB. D1 global read replication eliminates most Neon arguments for read-heavy apps.

API Keys

All keys: project .env.local or get-secret KEY (chezmoi+age encrypted) GCP: ~/.config/emdash/gcp-service-account.json CF: get-secret CLOUDFLARE_EMAIL / get-secret CLOUDFLARE_API_TOKEN / get-secret CLOUDFLARE_ACCOUNT_ID

| Service | Env Var | Free Tier | |---------|---------|-----------|| | Cloudflare | CLOUDFLARE_API_TOKEN | Yes | | Stripe | STRIPE_API_KEY | Test free | | Resend | RESEND_API_KEY | 100/day | | PostHog | POSTHOG_API_KEY | 1M events/mo | | Sentry | SENTRY_AUTH_TOKEN | 5K errors/mo | | OpenAI | OPENAI_API_KEY | Pay-per-use | | Anthropic | ANTHROPIC_API_KEY | Pay-per-use | | Ideogram | IDEOGRAM_API_KEY | Pay-per-use | | Unsplash | UNSPLASH_ACCESS_KEY | 50 req/hr | | Pexels | PEXELS_API_KEY | 200 req/hr | | GA4 | GCP service account | Free | | Clerk | CLERK_SECRET_KEY | 10K MAU |

Reliability

Error handler: app.onError() → log + Sentry + JSON envelope. Retry: idempotent 3x exponential backoff, non-idempotent no retry. Health: GET /health (version+timestamp), /health/db, /health/services. D1 Time Travel: 30-day PIT recovery (paid), 7-day (free). D1→R2 daily backup workflow for 90+ day retention.

CF Infrastructure

Zone (megabyte.space): get-secret CLOUDFLARE_ZONE_ID. Deploy+purge always together (see CONVENTIONS.md).

ProductFree LimitPaid Limit
Workers100K req/day, 10ms CPUUnlimited, 5min CPU
Static Assets20K files/version100K files/version
D15M rows read, 5GB25B rows, 1TB
R210GB, 10M req/moZero egress
KV100K reads/day10M reads/day
Queues1M msg/moPay-per-use
DO100K req/dayPay-per-use
Vectorize5M vectorsPay-per-use
Workers AI10K neurons/dayPay-per-use
WebSocket msg32 MiB32 MiB
Worker size3MB compressed10MB compressed
Cron Triggers5250
Containers—GA (DO-based)

Security headers, Turnstile, rate limiting, DNS management, wrangler.jsonc template — see CONVENTIONS.md.

AI Agent Patterns (CF Agents SDK + Project Think, April 2026)

Think class on DO: addressable entity with SQLite, zero compute when hibernated. Durable execution via Fibers (survives crashes). Dynamic Workers for sandboxed V8 isolates (100x faster, 100x more memory-efficient than containers). Execution ladder: Workspace → Dynamic Worker → npm resolution → headless browser → CF Sandbox(GA). Sub-agent coordination via Facets (colocated, typed RPC).

Agent Memory: managed persistent memory service — recall what matters, forget what doesn't. Browser Run: enhanced browser rendering with Live View, Human-in-the-Loop, CDP access, 4x concurrency. CF Email Service (public beta): native send/receive/process from agents. Managed OAuth: RFC 9728 agent authentication. CF Mesh: secure private networking for agents+Workers with scoped DB/API access. AI Search: dynamic instances with hybrid retrieval + relevance boosting (fka AutoRAG).

Code Mode MCP: 2 tools + <1K tokens (81% reduction vs traditional MCP). cf CLI: unified CLI covering ~3000 API operations.

Traffic reality: agentic actors = ~10% CF network (up 60% YoY). Design every API for human+agent consumers.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

007

Free

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

Guides the creation of agile user stories and Gherkin feature files. Use when the user wants to create a user story, write acceptance criteria, define Gherkin scenarios, or author BDD feature files. This should trigger for requests such as Create a user story; Write a user story; I need to write a user story. Part of cursor-rules-java project

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

Facilitates conversational discovery to create Architectural Decision Records (ADRs) for non-functional requirements using the ISO/IEC 25010:2023 quality model. Use when the user wants to document quality attributes, NFR decisions, security/performance/scalability architecture, or design systems with measurable quality criteria. This should trigger for requests such as Create ADR for Non-functional requirements; Document Non-functional requirements; Capture Non-functional requirements; Generate Non-functional requirements in an ADR. Part of cursor-rules-java project

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

Run a health check on an existing project: dependency audit, security scan, test runner detection, CI/CD evaluation, and missing configuration analysis. Maps the three execution gates (pre/in/post) from /10x-bootstrapper to an assessment framework for existing codebases. Reads optional context/foundation/stack-assessment.md from /10x-stack-assess to focus checks on identified gaps. Writes context/foundation/health-check.md with findings, prioritized fixes, and an agent-readiness verdict. Use when the user has an existing project and wants to verify its health before working with an agent. Trigger phrases: "health check", "check my project", "audit my project", "is my project healthy", "sprawdź projekt", "audyt projektu", "health-check", "project health". Use AFTER /10x-stack-assess (brownfield chain), BEFORE agent onboarding (m1-l4).

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

You MUST use this when building projects end-to-end. Orchestrates all 12 team roles — automatically switches between CTO, architect, PM, engineers, SRE, security, DBA, QA, and EM based on the current phase of work. Starts with brainstorming before any implementation.

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. This should trigger for requests such as Add Maven plugins in pom.xml; Improve Maven plugins in pom.xml. Part of cursor-rules-java project

The English summary is being prepared. Showing the original description.

aibot88/sec_skill_store5Updated May 27, 2026

See all skills by aibot88

Report a problem with this skill