Agent skill

project-conventions

Detects project-specific coding conventions by scanning the codebase — service object style, auth implementation, testing patterns, custom base classes, error handling, job conventions, serialization, frontend setup. Use when generating code that must match the project's existing patterns. Always check CLAUDE.md for intent that overrides detected conventions — CLAUDE.md documents where the project is going; the fingerprint documents where it is now. NOT for stack profile classification (use rails-stack-profiles).

Stars 4
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/ag0os/rails-dev-plugin/tree/main/skills/project-conventions

SKILL.md

Project Conventions Detection

Purpose

Auto-detect project-specific patterns so agents generate code matching the project, not generic Rails. Produces a Convention Fingerprint — a structured summary of observed patterns. Scan the codebase; do not ask the developer what patterns they use.

Convention Categories

Category Detects Key Agents
Service Objects base class, entry point, naming, result type rails-service, rails-architect
Auth strategy, modules, custom controllers, token approach rails-controller, rails-auth
Testing framework specifics, shared examples, custom matchers, spec style rails-test
Base Classes custom ApplicationX classes all agents
Error Handling exception hierarchy, rescue_from patterns rails-controller, rails-service
Jobs base config, queue names, naming pattern, retry strategy rails-jobs
Controllers pagination, authorization, response helpers rails-controller, rails-api
Domain Model key entities, complexity, namespace structure rails-model, rails-architect
Serialization library, envelope format, naming rails-api
Frontend CSS framework, Stimulus patterns, component library, bundler rails-views, rails-hotwire

CLAUDE.md Priority Note

Always check CLAUDE.md for intent that overrides detected conventions. CLAUDE.md documents where the project is going; the fingerprint documents where it is now.

Example: if CLAUDE.md says "migrating from Devise to built-in auth", respect that over the detected Devise convention.

Micro-Scan (for domain agents)

Each domain agent runs a lightweight 2-5 command scan for its relevant categories only. Full detection commands in detection-commands.md.

Service Object detection example:

1. Glob `app/services/**/*.rb` — if empty, skip
2. Read first 20 lines of 2-3 files to detect: base class, entry method (.call/.perform/.run), naming pattern
3. Grep for Result/Success/Failure to identify result type
4. Check Gemfile for `dry-monads`

Convention Fingerprint Output Format

## Convention Fingerprint

**Services:** base=ApplicationService | entry=.call | result=ServiceResult | naming=Module::VerbNoun
**Auth:** strategy=devise | modules=[database_authenticatable,recoverable,trackable] | custom_controllers=yes
**Testing:** framework=rspec | data=factory_bot | style=request_specs | shared_examples=yes
**Base Classes:** ApplicationQuery, ApplicationForm, ApplicationDecorator
**Error Handling:** hierarchy=ApplicationError>ServiceError,ValidationError | rescue_from=yes
**Jobs:** base=ApplicationJob | queues=[default,mailers,critical] | naming=VerbNounJob | retry=3
**Controllers:** pagination=pagy | auth=pundit | response=respond_to
**Domain:** [top 5-8 entities] | namespaced=yes/no | models_count=N
**Serialization:** lib=alba | envelope={data:,meta:} | naming=ModelSerializer
**Frontend:** css=tailwind | stimulus=yes | components=ViewComponent | bundler=importmap

Defaults (when undetectable)

For new or empty projects, assume these defaults:

Category Default
Service Objects VerbNoun naming, .call, Struct-based Result
Auth has_secure_password (Rails 8+)
Testing Match test/ vs spec/ directory
Base Classes None — use standard Rails bases
Error Handling rescue_from in ApplicationController
Jobs ApplicationJob, default queue
Controllers Standard Rails patterns
Serialization to_json or Jbuilder
Frontend Importmap + Stimulus

Reference: See detection-commands.md for complete detection recipes.

Expand your agent's capabilities with these related and highly-rated skills.

ag0os/rails-dev-plugin

rails-caching-patterns

Caching patterns for Rails applications including fragment caching, low-level caching, HTTP caching, Russian doll caching, and cache invalidation strategies. Automatically invoked when working with Rails.cache, cache stores, stale?/fresh_when, fragment caching, cache keys, or performance optimization through caching. Triggers on "cache", "caching", "Rails.cache", "fragment cache", "Russian doll", "stale?", "fresh_when", "cache key", "cache store", "Redis cache", "Solid Cache", "memcached", "ETag", "cache invalidation", "cache bust". NOT for CDN configuration (use rails-devops-patterns) or database query optimization (use rails-model-patterns).

4 0
Explore
ag0os/rails-dev-plugin

rails-graphql-patterns

Analyzes and recommends GraphQL patterns for Rails using graphql-ruby including schema design, types, resolvers, mutations, subscriptions, DataLoader, and query complexity. Use when building GraphQL APIs, defining types, writing mutations, optimizing N+1 queries, or structuring app/graphql. NOT for REST API controllers, ActiveRecord queries outside GraphQL, or Turbo Stream responses.

4 0
Explore
ag0os/rails-dev-plugin

ruby-object-design

Automatically invoked when making decisions about Ruby code structure and organization. Triggers on "class or module", "should this be a class", "struct vs class", "PORO", "data object", "design pattern", "class vs module", "when to use class", "module vs class", "stateless class", "value object", "data container", "object factory", "extend self", "singleton class". Provides guidance on choosing the right Ruby construct (class, module, Struct, Data, Hash). NOT for code smell identification or refactoring (use ruby-refactoring) or Rails-specific framework patterns.

4 0
Explore
ag0os/rails-dev-plugin

rails-views-patterns

Analyzes Rails view templates, partials, layouts, helpers, and form patterns for best practices. Use when reviewing ERB templates, improving view performance with fragment caching, fixing form helpers, organizing partials, adding accessibility attributes, or evaluating collection rendering. NOT for Stimulus/Turbo logic (use hotwire-patterns), controller concerns, or API-only responses.

4 0
Explore
ag0os/rails-dev-plugin

rails-architecture-patterns

Provides architectural planning, design decisions, and coordination guidance for Rails applications. Use when planning new features, choosing between design approaches (STI vs polymorphic, service vs concern, monolith vs engine), evaluating system architecture, or deciding which domain skill or agent to delegate to. NOT for implementation details within a single domain (use the domain-specific skill instead).

4 0
Explore
ag0os/rails-dev-plugin

rails-mailer-patterns

Action Mailer patterns for Rails applications. Automatically invoked when working with email delivery, mailer classes, email templates, mailer previews, interceptors, or delivery configuration. Triggers on "mailer", "email", "ActionMailer", "deliver_later", "deliver_now", "mail template", "email preview", "SMTP", "SendGrid", "Postmark", "notification email". NOT for push notifications, SMS, or in-app messaging.

4 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results