惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
WordPress大学
WordPress大学
小众软件
小众软件
云风的 BLOG
云风的 BLOG
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
T
Tailwind CSS Blog
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
宝玉的分享
宝玉的分享
博客园 - Franky
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
D
Docker
博客园 - 聂微东
C
Check Point Blog
H
Help Net Security

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders
Why I built a reference Go project (and taught an AI agen...
aranw · 2026-05-14 · via Hacker News - Newest: "AI"

·3 mins

I get asked about how to structure a Go project often. Not the big architectural questions about microservices versus monoliths, but the mundane stuff: where does the config go, why isn’t there a pkg/ directory, what’s the difference between internal/books/ and internal/database/books/.

I used to answer with a wall of text. Then I started linking to specific repos I’d worked on, which helped but came with baggage — real projects accumulate weird one-off decisions that don’t generalise. So I built a reference instead: example-project-structure, a minimal Go HTTP/RPC service backed by PostgreSQL. A fake bookstore with just enough domain (books, authors, genres) to show joins and type conversions without drowning in features.

That was reason one. Reason two turned out to be more interesting.

Structure as a document an agent can read #

I’ve been spending time with AI coding agents lately, and I kept running into the same friction: every time I start a new project, I want it in a structure I already know and like. But AI output is non-deterministic. Ask an agent to scaffold a project twice and you’ll get two different structures with the odd similarity. One run gives you models/, the next gives you entities/, neither matches what you actually want. So I thought: why not give it a concrete example to bootstrap from instead of hoping it guesses right?

So I wrote the reference repo with a second reader in mind. The docs/ directory isn’t just for humans — layout.md maps every directory and explains what lives where, design-decisions.md captures the reasoning behind choices like “Service not Repository” and “package-by-feature not package-by-layer”, and adding-an-entity.md is a step-by-step walkthrough an agent can follow mechanically.

Then I took it a step further. The repo includes a BOOTSTRAP.md file that’s written specifically for an AI agent. It assumes the agent has already cloned the repo and copied its contents into a new project directory. From there it walks through every rename, every file to strip, every conditional based on what the user actually wants (OpenAPI only? ConnectRPC only? No database?). Each step lists what to change and every place it appears so the agent doesn’t need to rediscover the structure on its own.

I’ve paired this with a Claude Code skill (not open source yet, still refining it) that asks the user a handful of questions (project name, module path, API style, database choice) and then follows BOOTSTRAP.md to scaffold a new project. When paired with some details about what you’re building, the AI can produce a fairly decent starting point for a project.

What the structure actually looks like #

The project is small by design — just enough to show the patterns without drowning in features:

.
├── api/              # protobuf & OpenAPI schemas
├── apigen/           # generated API stubs
├── cmd/bookstore/    # binary entry point
└── internal/
    ├── books/        # domain package (one per feature)
    ├── database/     # data access, separated from transport
    └── server/       # HTTP/RPC wiring

There’s no pkg/, no models/, no handlers/ directory. Each of those absences is a deliberate choice, and I’ve written up the reasoning in the repo’s docs.

Rather than cramming everything into one post, I’m breaking the details into separate pieces:

  • The structure itself — the directory tree, what each package owns, the layering rules, and what’s deliberately missing
  • Design decisions — why Service over Repository, why package-by-feature wins over time, why manual DI in runner.go
  • The BOOTSTRAP.md approach — writing documentation that serves both humans and AI agents, how the Claude Code skill works, and what I’ve learnt about making repos agent-friendly

For now, the repo is public and the docs are thorough. Have a look at example-project-structure — I’ll dig into the design decisions and the BOOTSTRAP.md approach in follow-up posts.