Hive Hive
Sign in

feat(specs): expose a write_spec MCP prompt with the house style guide

GitHub issue · Closed

Metadata
Source
tuist/hive #42
Updated
Jun 24, 2026
Domains
Hive
Details

Summary

While iterating on the feedback Marek left on spec 2, it became clear that the writing-and-review patterns that make Tuist RFCs and Hive specs work well are codifiable. The recurring critiques map onto a small set of rules: hold altitude (a spec is a contract, not an implementation walkthrough), name decisions and give them reasons, lean don’t dump on open questions, and pre-empt the things reviewers consistently push on (security posture, capacity, reuse claims, cross-surface consistency).

To make those rules reach the people drafting specs, this PR exposes them as a first-class MCP prompt on the Hive MCP server. Clients (Claude Code, Cursor, anything that speaks prompts/get) pull write_spec on demand before drafting, and the guidelines land in the agent’s context with no extra plumbing.

I considered two homes for the text: a markdown file under docs/, or an Elixir module parallel to Hive.Agents.StyleGuide. I went with the module, since the same body can later feed an internal Condukt agent that drafts specs (parallel to how RevisionSummaryAgent consumes Hive.Agents.StyleGuide) without duplicating the text. The MCP prompt module composes the guide from Hive.Specs.StyleGuide and accepts an optional topic argument that gets woven into the lede so the model is primed before the guidelines load.

For agents that never call prompts/list, a one-line nudge in the create_spec and update_spec tool descriptions points at the prompt as a belt-and-suspenders fallback. The prompt only helps if the client pulls it; the tool-description hint is the cheap backup.

  • Hive.Specs.StyleGuide (lib/hive/specs/style_guide.ex) holds the guide text with body/0 and write_spec_prompt/1 (optional topic woven into the lede). Mirrors the shape of Hive.Agents.StyleGuide.
  • Hive.MCP.Components.Prompts.WriteSpec (lib/hive/mcp/components/prompts/write_spec.ex) implements EMCP.Prompt, exposing the guide as the write_spec MCP prompt with an optional topic argument.
  • Registered in Hive.MCP.Server via the EMCP prompts: option (first prompt on the Hive MCP server).
  • create_spec and update_spec tool descriptions append a one-line hint pointing at write_spec so agents that bypass prompts/list still get nudged.

Testing

  • mise exec -- mix format on the touched files
  • mise exec -- mix compile --warnings-as-errors
  • mise exec -- mix test test/hive/specs/style_guide_test.exs test/hive/mcp/components/prompts/write_spec_test.exs (11/11 pass)
  • mise exec -- mix test test/hive/mcp/ (23/23 pass; confirms the tool-description edits didn’t break neighbouring tests)
  • mise exec -- mix credo --strict lib/hive/specs/style_guide.ex lib/hive/mcp/components/prompts/write_spec.ex (clean)
Comments

No GitHub comments yet.