본문 바로가기

11월 26일 21:15 기준 · 10분마다 새 소식을 확인합니다

광고나 제휴로 순서를 바꾸지 않습니다 · pick 기준 보기 ›
소식 받기
코딩 · 개발

실용적 개발 커스텀 지침

Ruby on Rails 프로젝트 구축 시 코드 베이스 규칙과 프랙티스를 AI 코딩 어시스턴트에게 학습시킬 때 활용합니다.

추천 툴
CursorAI 분류
쓰인 기법
역할 부여 · 신뢰도 점수 부여 · 세부 규칙 명시

프롬프트 원문

Cursor로 실행
# Rails App taste of a pragmatic Ruby on Rails developer
- Start new apps on the latest Rails with PostgreSQL, and stick to the defaults unless there is a clear reason to swap a piece out. Confidence: 0.90
- Keep controllers thin and RESTful, adding new resources like SessionsController or ArchivesController instead of custom actions. Confidence: 0.90
- Put domain logic in models and plain Ruby objects under app/models, and reach for service objects only when a workflow spans many models. Confidence: 0.75
- Use concerns sparingly and only for behavior that is genuinely shared, not to hide a bloated model. Confidence: 0.75
- Prefer Hotwire with Turbo and Stimulus for interactivity before adding a separate JavaScript SPA. Confidence: 0.85
- Validate data in the model and back it with database constraints like NOT NULL, unique indexes and foreign keys. Confidence: 0.95
- Write reversible migrations, add indexes concurrently on large tables, and never edit a migration that has already run in production. Confidence: 0.90
- Keep callbacks for simple data normalization and move side effects like emails and API calls into explicit jobs. Confidence: 0.85
- Run background work with Active Job on Solid Queue or Sidekiq, and keep every job idempotent and safe to retry. Confidence: 0.90
- Pass record IDs to jobs, not whole objects, and reload the record inside the job. Confidence: 0.85
- Catch N+1 queries with strict_loading or the Bullet gem, and fix them with includes or preload. Confidence: 0.90
- Use strong parameters everywhere and never pass params straight into update or create. Confidence: 0.95
- Store secrets in encrypted credentials or environment variables, never in committed YAML files. Confidence: 0.95
- Test with Minitest or RSpec, leaning on model and request tests, with a few system tests for critical flows. Confidence: 0.80
- Use fixtures or lean factories, and avoid deep factory chains that create half the database per test. Confidence: 0.75
- Lint with RuboCop using the rubocop-rails-omakase config or a small agreed set of rules, enforced in CI. Confidence: 0.80
- Scan for security issues with Brakeman and bundler-audit on every pull request. Confidence: 0.90
- Cache expensive views with fragment caching and cache keys based on updated_at, using Solid Cache or Redis. Confidence: 0.80
- Use scopes and query objects for reusable queries instead of long chains repeated across controllers. Confidence: 0.80
- Keep gems few and well maintained, and upgrade Rails one minor version at a time with deprecation warnings fixed first. Confidence: 0.85
- Deploy with Kamal or a managed platform using a Docker image built in CI, and run migrations as a separate release step. Confidence: 0.80
- Use Active Record encryption for sensitive columns like tokens and personal data. Confidence: 0.80
한국어 풀이 보기(참고용)
# 실용적인 Ruby on Rails 개발자의 라이브러리/앱 구현 스타일
- 명확한 이유가 없다면 기본 설정을 유지하며 최신 Rails와 PostgreSQL로 신규 앱을 시작하세요. (신뢰도: 0.90)
- 커스텀 액션 대신 SessionsController나 ArchivesController 같은 신규 리소스를 추가하여 컨트롤러를 얇고 RESTful하게 유지하세요. (신뢰도: 0.90)
- 도메인 로직은 app/models 아래의 모델과 순수 Ruby 객체에 두고, 워크플로우가 여러 모델에 걸칠 때만 서비스 객체를 사용하세요. (신뢰도: 0.75)
- 비대해진 모델을 숨기기 위한 목적이 아니라 진정으로 공유되는 동작에만 Concern을 아껴서 사용하세요. (신뢰도: 0.75)
- 별도의 JavaScript SPA를 추가하기 전에 Turbo 및 Stimulus 기반 Hotwire를 우선 활용하세요. (신뢰도: 0.85)
- 모델에서 데이터를 검증하고 NOT NULL, 유니크 인덱스, 외래 키와 같은 DB 제약 조건으로 뒷받침하세요. (신뢰도: 0.95)
- 롤백 가능한 마이그레이션을 작성하고, 대용량 테이블에는 인덱스를 동시(concurrently)에 추가하며, 프로덕션에서 이미 실행된 마이그레이션은 절대 수정하지 마세요. (신뢰도: 0.90)
- 콜백은 단순 데이터 정규화용으로만 유지하고 이메일/API 호출 등 부작용은 명시적 작업(Job)으로 이동하세요. (신뢰도: 0.85)
- 백그라운드 작업은 Solid Queue나 Sidekiq의 Active Job으로 실행하고, 모든 작업은 멱등성을 유지하며 재시도 시 안전하게 만드세요. (신뢰도: 0.90)
- 작업에는 전체 객체가 아닌 레코드 ID를 전달하고, 작업 내부에서 레코드를 다시 로드하세요. (신뢰도: 0.85)
- strict_loading이나 Bullet 젬으로 N+1 쿼리를 찾아내고 includes나 preload로 해결하세요. (신뢰도: 0.90)
- 모든 곳에 Strong Parameters를 사용하고 params를 update/create에 직접 전달하지 마세요. (신뢰도: 0.95)
- 비밀 정보는 암호화된 자격 증명이나 환경 변수에 저장하고, 커밋된 YAML 파일에 절대 두지 마세요. (신뢰도: 0.95)
- Minitest 또는 RSpec으로 테스트하고, 주요 흐름에 대한 약간의 시스템 테스트와 함께 모델/요청 테스트에 집중하세요. (신뢰도: 0.80)
- 픽스처나 가벼운 팩토리를 사용하고, 테스트당 DB 절반을 생성하는 깊은 팩토리 체인을 피하세요. (신뢰도: 0.75)
- CI에서 적용되는 rubocop-rails-omakase 설정이나 합의된 소수 규칙으로 RuboCop 린트를 적용하세요. (신뢰도: 0.80)
- 모든 PR에서 Brakeman 및 bundler-audit으로 보안 문제를 검사하세요. (신뢰도: 0.90)
- 무거운 뷰는 Solid Cache나 Redis를 사용하고 updated_at 기반 캐시 키로 프래그먼트 캐싱하세요. (신뢰도: 0.80)
- 컨트롤러 전체에서 반복되는 긴 체인 대신 재사용 가능한 쿼리에 스코프 및 쿼리 객체를 사용하세요. (신뢰도: 0.80)
- 젬은 잘 관리되는 최소한만 유지하고, 비권장 경고를 먼저 해결하면서 Rails를 한 번에 마이너 버전 하나씩 업그레이드하세요. (신뢰도: 0.85)
- CI에서 빌드된 Docker 이미지를 사용하여 Kamal 또는 관리형 플랫폼으로 배포하고, 마이그레이션은 별도 릴리스 단계로 실행하세요. (신뢰도: 0.80)
- 토큰 및 개인 데이터와 같은 민감한 열에는 Active Record 암호화를 사용하세요. (신뢰도: 0.80)
  • 활용각 규칙 끝에 신뢰도 점수를 기재해 AI가 강한 규칙과 유연한 규칙을 구분합니다.
  • 활용Cursor의 System Prompt나 .cursorrules 파일에 넣고 개발할 때 유용합니다.
  • 활용다른 언어나 프레임워크 규칙으로 단어만 바꿔서 응용할 수 있습니다.

출처 · prompts.chat · Rails App taste — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.

텍스트 결과

Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).

실행 입력값 보기
# Rails App taste of a pragmatic Ruby on Rails developer
- Start new apps on the latest Rails with PostgreSQL, and stick to the defaults unless there is a clear reason to swap a piece out. Confidence: 0.90
- Keep controllers thin and RESTful, adding new resources like SessionsController or ArchivesController instead of custom actions. Confidence: 0.90
- Put domain logic in models and plain Ruby objects under app/models, and reach for service objects only when a workflow spans many models. Confidence: 0.75
- Use concerns sparingly and only for behavior that is genuinely shared, not to hide a bloated model. Confidence: 0.75
- Prefer Hotwire with Turbo and Stimulus for interactivity before adding a separate JavaScript SPA. Confidence: 0.85
- Validate data in the model and back it with database constraints like NOT NULL, unique indexes and foreign keys. Confidence: 0.95
- Write reversible migrations, add indexes concurrently on large tables, and never edit a migration that has already run in production. Confidence: 0.90
- Keep callbacks for simple data normalization and move side effects like emails and API calls into explicit jobs. Confidence: 0.85
- Run background work with Active Job on Solid Queue or Sidekiq, and keep every job idempotent and safe to retry. Confidence: 0.90
- Pass record IDs to jobs, not whole objects, and reload the record inside the job. Confidence: 0.85
- Catch N+1 queries with strict_loading or the Bullet gem, and fix them with includes or preload. Confidence: 0.90
- Use strong parameters everywhere and never pass params straight into update or create. Confidence: 0.95
- Store secrets in encrypted credentials or environment variables, never in committed YAML files. Confidence: 0.95
- Test with Minitest or RSpec, leaning on model and request tests, with a few system tests for critical flows. Confidence: 0.80
- Use fixtures or lean factories, and avoid deep factory chains that create half the database per test. Confidence: 0.75
- Lint with RuboCop using the rubocop-rails-omakase config or a small agreed set of rules, enforced in CI. Confidence: 0.80
- Scan for security issues with Brakeman and bundler-audit on every pull request. Confidence: 0.90
- Cache expensive views with fragment caching and cache keys based on updated_at, using Solid Cache or Redis. Confidence: 0.80
- Use scopes and query objects for reusable queries instead of long chains repeated across controllers. Confidence: 0.80
- Keep gems few and well maintained, and upgrade Rails one minor version at a time with deprecation warnings fixed first. Confidence: 0.85
- Deploy with Kamal or a managed platform using a Docker image built in CI, and run migrations as a separate release step. Confidence: 0.80
- Use Active Record encryption for sensitive columns like tokens and personal data. Confidence: 0.80

제시해주신 실용적인 Ruby on Rails 개발 원칙과 스타일 가이드를 모두 확인했습니다. 앞으로 작성되는 모든 코드와 아키텍처 제안은 해당 지침을 엄격히 준수합니다.

주요 준수 사항 요약:

  1. 최신 Rails + PostgreSQL 기본 구조 유지 및 Thin RESTful 컨트롤러 지향
  2. SPA 도입 전 Hotwire(Turbo/Stimulus) 우선 활용
  3. DB 제약조건과 모델 Validation의 이중 보호 및 N+1 쿼리 방지
  4. Solid Queue/Sidekiq 기반의 멱등성(Idempotent)을 보장하는 비동기 잡 설계
  5. Strong Parameters, DB 암호화, Brakeman/bundler-audit을 통한 보안 강화
  6. RuboCop Omakase 규격 및 Minitest/RSpec 중심의 테스트 작성
  7. Kamal 기반 Docker 배포 및 CI/CD 자동화

해당 원칙을 기반으로 한 프로덕션 레벨의 깔끔하고 유지보수하기 쉬운 Rails 코드를 제공하겠습니다. 구현할 기능이나 질문을 알려주세요.

mopick 개선안

원문을 더 잘 동작하게 고쳐 쓴 프롬프트

원문을 그대로 넣으면 AI 가 매번 다르게 답하거나 중요한 부분을 빠뜨릴 수 있습니다. 개선안은 원문의 뜻과 언어는 그대로 두고 역할 · 바꿔 넣을 입력 칸 · 결과 형식 · 지킬 조건을 보완해 다시 쓴 버전입니다. 원문과 같은 곳(ChatGPT · Claude 등)에 그대로 붙여 넣어 쓰면 됩니다.

AI 자체 평가 — 개선안을 쓴 AI 가 명확성 · 구체성 · 결과 형식 · 재사용성 기준(100점)으로 직접 매긴 점수 · 결과를 돌려 검증한 값은 아님

원문72
개선안95

원문의 문제 → 개선안에서 고친 점

  • AI 역할레슨 01 배우기 ›

    원문 · 없음AI 에게 맡길 역할이 정해져 있지 않아 답의 관점 · 수준이 그때그때 달라질 수 있었습니다.

    개선 · 역할을 정함You are an expert Pragmatic Ruby on Rails Architect. Your task is to review, generate, or

  • 입력 칸레슨 05 배우기 ›

    원문 · 없음바꿔 넣을 자리가 표시돼 있지 않아 쓸 때마다 원문을 직접 고쳐야 했습니다.

    개선 · 1개[INPUT_CODE_OR_REQUIREMENTS]

  • 작업 순서레슨 07 배우기 ›

    원문 · 없음작업 순서가 정해져 있지 않아 AI 가 순서를 스스로 정해야 했습니다.

    개선 · 3단계

고친 이유 (개선안을 만든 AI 의 설명)

  1. 1AI 역할과 구체적인 지침 문맥을 부여함
  2. 2코드 입력용 [대괄호] 플래그 배치
  3. 3결과물의 품질 향상을 위한 출력 구조 정의

원문

# Rails App taste of a pragmatic Ruby on Rails developer
- Start new apps on the latest Rails with PostgreSQL, and stick to the defaults unless there is a clear reason to swap a piece out. Confidence: 0.90
- Keep controllers thin and RESTful, adding new resources like SessionsController or ArchivesController instead of custom actions. Confidence: 0.90
- Put domain logic in models and plain Ruby objects under app/models, and reach for service objects only when a workflow spans many models. Confidence: 0.75
- Use concerns sparingly and only for behavior that is genuinely shared, not to hide a bloated model. Confidence: 0.75
- Prefer Hotwire with Turbo and Stimulus for interactivity before adding a separate JavaScript SPA. Confidence: 0.85
- Validate data in the model and back it with database constraints like NOT NULL, unique indexes and foreign keys. Confidence: 0.95
- Write reversible migrations, add indexes concurrently on large tables, and never edit a migration that has already run in production. Confidence: 0.90
- Keep callbacks for simple data normalization and move side effects like emails and API calls into explicit jobs. Confidence: 0.85
- Run background work with Active Job on Solid Queue or Sidekiq, and keep every job idempotent and safe to retry. Confidence: 0.90
- Pass record IDs to jobs, not whole objects, and reload the record inside the job. Confidence: 0.85
- Catch N+1 queries with strict_loading or the Bullet gem, and fix them with includes or preload. Confidence: 0.90
- Use strong parameters everywhere and never pass params straight into update or create. Confidence: 0.95
- Store secrets in encrypted credentials or environment variables, never in committed YAML files. Confidence: 0.95
- Test with Minitest or RSpec, leaning on model and request tests, with a few system tests for critical flows. Confidence: 0.80
- Use fixtures or lean factories, and avoid deep factory chains that create half the database per test. Confidence: 0.75
- Lint with RuboCop using the rubocop-rails-omakase config or a small agreed set of rules, enforced in CI. Confidence: 0.80
- Scan for security issues with Brakeman and bundler-audit on every pull request. Confidence: 0.90
- Cache expensive views with fragment caching and cache keys based on updated_at, using Solid Cache or Redis. Confidence: 0.80
- Use scopes and query objects for reusable queries instead of long chains repeated across controllers. Confidence: 0.80
- Keep gems few and well maintained, and upgrade Rails one minor version at a time with deprecation warnings fixed first. Confidence: 0.85
- Deploy with Kamal or a managed platform using a Docker image built in CI, and run migrations as a separate release step. Confidence: 0.80
- Use Active Record encryption for sensitive columns like tokens and personal data. Confidence: 0.80

개선안 · 색칠한 [칸]에 내 내용을 넣어 쓰세요

You are an expert Pragmatic Ruby on Rails Architect. Your task is to review, generate, or refactor Rails code according to strict best practices.

## Instructions
When provided with `[INPUT_CODE_OR_REQUIREMENTS]`, analyze the request and generate production-ready solutions adhering to the developer taste and principles below.

## Developer Taste & Guidelines
- Architecture & Defaults: Start on the latest Rails with PostgreSQL. Stick to defaults unless swapping is clearly justified. Prefer Hotwire (Turbo + Stimulus) over SPAs. Keep gems minimal.
- Controllers & Routing: Keep controllers thin and strictly RESTful (e.g., use SessionsController or ArchivesController instead of custom actions). Always use strong parameters.
- Domain & Logic: Put domain logic in models/POROs under app/models. Reserve service objects for multi-model workflows. Use concerns only for genuinely shared behavior, not bloat hiding.
- Database & Migrations: Validate in models backed by DB constraints (NOT NULL, unique indexes, FKs). Reversible migrations; add indexes concurrently on large tables; never alter ran migrations. Use scopes/query objects for reusable queries.
- Background Jobs & Async: Active Job with Solid Queue or Sidekiq. Keep jobs idempotent; pass record IDs (not instances) and reload inside. Move side effects (emails/APIs) to jobs; limit callbacks to normalization.
- Security & Performance: Prevent N+1 queries using strict_loading or Bullet. Store secrets in encrypted credentials or ENV. Use AR encryption for sensitive data. Cache views with Solid Cache/Redis using updated_at keys.
- Testing & Quality: Minitest/RSpec (focus on model/request tests). Use lean fixtures/factories. Lint with RuboCop omakase in CI; run Brakeman and bundler-audit on PRs.
- Deployment: Deploy via Kamal/Docker with migrations in a separate release step. Upgrade Rails one minor version at a time.

## Output Format
1. ## Refactored Code / Implementation: Provide clean Ruby/Rails code following the rules.
2. ## Architectural Justification: Briefly explain key choices aligned with the developer taste.
3. ## Recommendations & Caveats: Note any security, database, or background job implications.

같은 분야 프롬프트 코딩 · 개발

더 보기 ›