Prompting

0 TILs · 1 blogmark

All TILs → All blogmarks →

Blogmark

Prompt for a New Codebase Evaluation

One of my favorite LLM tricks lately is asking Claude to write a more detailed, comprehensive version of a prompt for me. Then I can copy/paste that prompt into a new session on the target codebase to see what it comes up with.

Write a prompt that a person would want to run when checking out a new-to-them Ruby on Rails codebase for the first time to get a handle on where things stand, what the setup for local development looks like, any immediate concerns about the app and its dependencies, what the deployment story looks like, etc.

Here is one version of a prompt that Opus 5.5 came up with:

I'm new to this Rails codebase. Do a read-only orientation pass and give me a report. Don't change files, install anything, or run migrations. You can run commands that only read (git log, bundle outdated, bin/rails routes, etc.). Before running anything that writes, touches the network, or hits a database, ask me first.

Cover:

1. **Snapshot**
   - What the app does and who it's for: get this from the README, routes, models and UI copy
   - Ruby, Rails and Node versions: check .ruby-version, .tool-versions, mise.toml, Gemfile, package.json
   - How active the repo is: recent commits, contributors, open branches, last activity, any WIP or TODO markers

2. **Architecture**
   - Domain model: the key models, their associations, and anything unusual (STI, polymorphism, concerns, service objects)
   - Request flow: routes, controllers, auth (Devise, a custom setup, Rails 8 auth), authorization (Pundit, CanCan)
   - Frontend stack: Hotwire, importmap, jsbundling or cssbundling, Tailwind, React, etc.
   - Background jobs (Sidekiq, GoodJob, Solid Queue), mailers, Action Cable, Active Storage and where it stores files
   - Third-party integrations: payments, email, APIs, webhooks. Where credentials are expected to come from

3. **Local dev setup**
   - The exact steps to get running: bin/setup, bin/dev, Procfile.dev, docker-compose, devcontainer
   - Required services (Postgres, MySQL, SQLite, Redis) and their versions
   - Required env vars and credentials: list what's referenced in code against what's documented (.env.example, credentials.yml.enc keys, ENV[] and ENV.fetch calls). Point out anything I'll need from someone else, like master.key
   - Seeds and fixtures: how I get usable data locally
   - Anything that's likely to break setup on macOS

4. **Tests and quality**
   - Test framework, rough coverage of the important areas, and how to run the suite
   - Ask before running the suite. If I approve, report pass/fail counts
   - Linters, formatters and CI config (.github/workflows etc.): what CI enforces

5. **Dependency health**
   - Is Ruby/Rails EOL or close to it? How far behind is it?
   - `bundle outdated` and JS outdated: list the major-version gaps
   - Known vulnerabilities: run bundle-audit, brakeman or npm audit if they're available, or tell me what's missing
   - Abandoned or unmaintained gems, forked or git-sourced gems, monkey patches in config/initializers or lib/

6. **Deployment**
   - Where and how it deploys: Kamal, Heroku, Render, Fly, Capistrano, Docker. Check config/deploy*, Dockerfile, Procfile, app.json, fly.toml, render.yaml
   - Production config: database, cache, job backend, asset handling, SSL, logging, error tracking (Sentry, Honeybadger), monitoring
   - How the release process works: migrations on deploy, release tasks, manual steps
   - What I'd need access to in order to deploy: accounts, secrets, servers

7. **Immediate concerns**
   - Security red flags: secrets committed to git or present in git history, permissive CORS or CSP, unauthenticated admin routes, SQL built from strings, mass assignment gaps, disabled CSRF
   - Data risks: missing indexes or foreign keys, schema.rb that doesn't match migrations, risky migrations that are still pending
   - Fragility: no tests in critical areas, dead code, large god models or controllers, N+1 hotspots
   - Rate each concern high, medium or low, with file:line references

**Output:** a structured report with a TL;DR of 5 bullets max, sections 1–7, and then a "first week" checklist: the top 5 things to fix or ask about, in order. Label every claim as either *verified* (you saw it in code or command output) or *inferred*. Wherever you weren't sure, write down the open question for the previous maintainer instead of guessing.

As I read through this, there are some aspects of it that I would probably tweak before running it. I might prompt those tweaks or I may just hand edit it.

One major aspect of this that I want to address is that it is completely "read-only". A valuable part of this codebase evaluation is (a) can the app run locally and (b) what are the results of running the test suite. I would prompt for that adjustment.