Skip to content

Add rolemodel:agent_docs and run it from core_setup - #233

Merged
OutlawAndy merged 1 commit into
masterfrom
feat/agent-docs-generator
Dec 2, 2026
Merged

OutlawAndy merged 1 commit into
masterfrom
feat/agent-docs-generator

Conversation

@OutlawAndy

Copy link
Copy Markdown
Member

Adds rolemodel:agent_docs and runs it from rolemodel:core_setup (and rolemodel:all), so a new app starts with agent instructions and a set of conventions.

What it writes

  • AGENTS.md, with CLAUDE.md set to @AGENTS.md. It has a "How We Build" section (smallest change, make the change easy first, think like a Rubyist, root causes, testability, names over comments), the "Before Editing" rules, and the Verification commands core_setup's tools provide. The first sentence is a placeholder for the team to fill in.
  • docs/CONVENTIONS.md: a one-line introduction and an index of 14 conventions, each with a <!-- paths: --> glob.
  • docs/conventions/*.md: controllers (which sends agents to the controller-patterns skill), logic in models, guarded callbacks, string enums, scopes, no SQL strings, eager loading, views and forms, partial locals, Turbo before Stimulus, migrations, test layers, reproduce the bug, and system spec assertions.
  • .github/instructions/conventions.instructions.md, which points Copilot, including code review, at the conventions. There's no copilot-instructions.md, because Copilot code review reads AGENTS.md and CLAUDE.md directly.
  • .claude/hooks/surface_conventions.rb, registered in .claude/settings.json. It's downloaded from RoleModel/skills' scaffold-docs skill so there's one copy to maintain. Because it follows main, an upstream change reaches new apps without a gem release.

Where the conventions came from

They started from the agent-docs port in RoleModel/compass#458, the original commit with 22 convention files, and were reviewed one at a time. Files specific to Compass, files the controller-patterns skill already covers, and rules RuboCop can enforce were dropped; the rest were made generic. The RuboCop half of that work shipped in #232.

Verification

  • The new spec checks every file, the project name in AGENTS.md, that the hook is executable and registered, and that the index lists exactly the convention files installed.
  • I ran the generator for real against a copy of the example app. It downloaded the hook, and running the hook with no locale set, the way Claude Code runs hooks, listed the expected conventions for a controller, a Slim partial and a system spec.
  • The core_setup and all generator specs pass.

Also adds controller-patterns to the README's skills table for core_setup, which #232 missed.

🤖 Generated with Claude Code

New apps start with AGENTS.md, a conventions index with 14 convention
files, Copilot instructions pointing at them, and the surface_conventions
hook that shows Claude Code the conventions matching each file it edits.
The conventions were filtered from the Compass agent-docs port down to
the rules every RoleModel app should start with.

The hook is downloaded from RoleModel/skills' scaffold-docs skill so
there is one copy to maintain. Also lists controller-patterns in the
README's skills table, which #232 missed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@OutlawAndy OutlawAndy self-assigned this Dec 2, 2026
@OutlawAndy
OutlawAndy requested a review from wesrich December 2, 2026 01:11
@OutlawAndy
OutlawAndy merged commit e36c44c into master Dec 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant