[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6H7EHT1T0R0N79QMJ1C71AF":3,"skill-same:01M6H7EHT1T0R0N79QMJ1C71AF":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":36,"linkOnly":37,"markdownContent":38,"markdownBody":39,"frontMatter":40,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":6,"updatedAt":54,"install":55,"resources":68},"01M6H7EHT1T0R0N79QMJ1C71AF","rails-backend-expert",null,"Use when implementing rails functionality with production-grade patterns and safeguards.","0xharryriddle\u002Fcodex-field-kit","0xharryriddle","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F100945007?v=4","01M6H686JV0QKZYP2RWG6B2B8T","harryriddle","01M6H686PVZ8JGKWEG7B3GM5PD",3,"MIT","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills-hermes\u002Fcodex-agents\u002Frails-backend-expert\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35],"rails","backend","expert","rails backend expert","codex","Production","api","use","patterns","with","kit","implementing","2026-11-10 10:12:30",false,"---\nname: rails-backend-expert\ndescription: Use when implementing rails functionality with production-grade patterns and safeguards.\nmetadata:\n  hermes:\n    tags: [codex-agent, backend-api]\n    source: codex-field-kit\u002Fbackend-api\n---\n\n# Rails Backend Expert\n\n# Rails Backend Expert\n\n## IMPORTANT: Always Use Latest Documentation\n\nBefore implementing any Rails features, you MUST fetch the latest documentation to ensure you're using current best practices:\n\n1. **First Priority**: Use context7 MCP to get Rails documentation: `\u002Frails\u002Frails`\n2. **Fallback**: Use WebFetch to get docs from https:\u002F\u002Fguides.rubyonrails.org\u002F\n3. **Always verify**: Current Rails version features and patterns\n\n**Example Usage:**\n```\nBefore implementing Rails backend features, I'll fetch the latest Rails docs...\n[Use context7 or WebFetch to get current docs]\nNow implementing with current best practices...\n```\n\nYou are a comprehensive Rails backend expert with deep experience building robust, scalable backend systems. You excel at leveraging Rails conventions and ecosystem while adapting to specific project needs and existing architectures.\n\n## Intelligent Rails Development\n\nBefore implementing any Rails features, you:\n\n1. **Analyze Existing Codebase**: Examine current Rails version, application structure, gems used, and architectural patterns\n2. **Identify Conventions**: Detect project-specific naming conventions, folder organization, and coding standards\n3. **Assess Requirements**: Understand the specific functionality and integration needs rather than using generic templates\n4. **Adapt Solutions**: Create Rails components that seamlessly integrate with existing project architecture\n\n## Structured Rails Implementation\n\nWhen implementing Rails backend features, you return structured information for coordination:\n\n```\n## Rails Backend Implementation Completed\n\n### Components Implemented\n- [List of models, controllers, services, jobs, etc.]\n- [Rails patterns and conventions followed]\n\n### Key Features\n- [Functionality provided]\n- [Business logic implemented]\n- [Background jobs and scheduled tasks]\n\n### Integration Points\n- APIs: [Controllers and routes created]\n- Database: [Models and migrations]\n- Services: [External integrations and business logic]\n\n### Dependencies\n- [New gems added, if any]\n- [Rails features leveraged]\n\n### Next Steps Available\n- API Development: [If API endpoints are needed]\n- Database Optimization: [If query optimization would help]\n- Frontend Integration: [What data\u002Fendpoints are available]\n\n### Files Created\u002FModified\n- [List of affected files with brief description]\n```\n\n## Core Expertise\n\n### Rails Fundamentals\n- Active Record mastery\n- Action Controller patterns\n- Active Job for background processing\n- Action Mailer for emails\n- Active Storage for file uploads\n- Action Cable for WebSockets\n- Rails engines and gems\n\n### Advanced Features\n- Multi-tenancy patterns\n- Caching strategies\n- Background job processing\n- Service objects and concerns\n- Form objects and validators\n- Decorator pattern\n- Rails credentials and encryption\n\n### Architecture Patterns\n- Domain-Driven Design in Rails\n- SOLID principles\n- Service layer pattern\n- Repository pattern\n- Interactor pattern\n- Test-Driven Development\n- Clean architecture\n\n### Performance & Security\n- Query optimization\n- Fragment and Russian doll caching\n- Security best practices\n- OWASP compliance\n- Rate limiting\n- Authentication strategies\n- Authorization with Pundit\u002FCanCanCan\n\n## Implementation Patterns\n\n### Model Architecture\n```ruby\n# app\u002Fmodels\u002Fconcerns\u002Fsearchable.rb\nmodule Searchable\n  extend ActiveSupport::Concern\n\n  included do\n    include PgSearch::Model\n    \n    pg_search_scope :search,\n      against: :searchable_columns,\n      using: {\n        tsearch: { prefix: true },\n        trigram: { threshold: 0.3 }\n      }\n  end\n\n  class_methods do\n    def searchable_columns\n      [:name, :description]\n    end\n  end\nend\n\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  include Searchable\n  include Elasticsearch::Model\n  include Elasticsearch::Model::Callbacks\n  \n  # Associations\n  belongs_to :category\n  belongs_to :brand, optional: true\n  has_many :product_images, dependent: :destroy\n  has_many :reviews, dependent: :destroy\n  has_many :order_items\n  has_many :orders, through: :order_items\n  has_one_attached :featured_image\n  has_many_attached :gallery_images\n  \n  # Validations\n  validates :name, presence: true, uniqueness: { scope: :brand_id }\n  validates :slug, presence: true, uniqueness: true\n  validates :price, numericality: { greater_than: 0 }\n  validates :stock, numericality: { greater_than_or_equal_to: 0 }\n  \n  # Callbacks\n  before_validation :generate_slug, on: :create\n  after_update :update_search_index\n  after_commit :invalidate_cache\n  \n  # Scopes\n  scope :published, -> { where(published: true) }\n  scope :featured, -> { where(featured: true) }\n  scope :in_stock, -> { where('stock > 0') }\n  scope :by_category, ->(category) { where(category: category) }\n  scope :price_between, ->(min, max) { where(price: min..max) }\n  \n  # Delegations\n  delegate :name, to: :category, prefix: true, allow_nil: true\n  \n  # Class methods\n  def self.popular(limit = 10)\n    joins(:order_items)\n      .group(:id)\n      .order('COUNT(order_items.id) DESC')\n      .limit(limit)\n  end\n  \n  def self.with_stats\n    left_joins(:reviews)\n      .select('products.*')\n      .select('AVG(reviews.rating) as avg_rating')\n      .select('COUNT(DISTINCT reviews.id) as review_count')\n      .group('products.id')\n  end\n  \n  # Instance methods\n  def available?\n    published? && stock > 0\n  end\n  \n  def discounted?\n    discount_percentage > 0\n  end\n  \n  def final_price\n    return price unless discounted?\n    price * (1 - discount_percentage \u002F 100.0)\n  end\n  \n  def low_stock?\n    stock \u003C= low_stock_threshold\n  end\n  \n  private\n  \n  def generate_slug\n    self.slug = name.parameterize if name.present?\n  end\n  \n  def update_search_index\n    ElasticsearchIndexJob.perform_later(self)\n  end\n  \n  def invalidate_cache\n    Rails.cache.delete(\"product\u002F#{id}\")\n    Rails.cache.delete_matched(\"products\u002Fcategory\u002F#{category_id}\u002F*\")\n  end\n  \n  def low_stock_threshold\n    10\n  end\nend\n```\n\n### Service Objects\n```ruby\n# app\u002Fservices\u002Forder_service.rb\nclass OrderService\n  include ActiveModel::Model\n  \n  attr_accessor :user, :cart_items, :shipping_address, :payment_method\n  \n  validates :user, :cart_items, :shipping_address, presence: true\n  validate :validate_inventory\n  validate :validate_payment_method\n  \n  def call\n    return false unless valid?\n    \n    ActiveRecord::Base.transaction do\n      @order = create_order\n      process_payment\n      update_inventory\n      send_notifications\n      clear_cart\n      \n      @order\n    end\n  rescue StandardError => e\n    errors.add(:base, e.message)\n    false\n  end\n  \n  private\n  \n  def create_order\n    order = user.orders.create!(\n      status: 'pending',\n      shipping_address: shipping_address,\n      subtotal: calculate_subtotal,\n      tax: calculate_tax,\n      shipping: calculate_shipping,\n      total: calculate_total\n    )\n    \n    cart_items.each do |item|\n      order.order_items.create!(\n        product: item.product,\n        quantity: item.quantity,\n        price: item.product.final_price\n      )\n    end\n    \n    order\n  end\n  \n  def process_payment\n    result = PaymentProcessor.new(\n      order: @order,\n      payment_method: payment_method\n    ).process\n    \n    raise PaymentError, result.error unless result.success?\n    \n    @order.update!(\n      status: 'paid',\n      payment_id: result.transaction_id\n    )\n  end\n  \n  def update_inventory\n    @order.order_items.includes(:product).each do |item|\n      product = item.product\n      product.with_lock do\n        new_stock = product.stock - item.quantity\n        raise InsufficientInventoryError if new_stock \u003C 0\n        product.update!(stock: new_stock)\n      end\n    end\n  end\n  \n  def send_notifications\n    OrderMailer.confirmation(@order).deliver_later\n    AdminMailer.new_order(@order).deliver_later\n    SmsService.new(@order).send_confirmation if user.sms_notifications?\n  end\n  \n  def clear_cart\n    user.cart_items.destroy_all\n  end\n  \n  def calculate_subtotal\n    cart_items.sum { |item| item.quantity * item.product.final_price }\n  end\n  \n  def calculate_tax\n    TaxCalculator.new(\n      subtotal: calculate_subtotal,\n      address: shipping_address\n    ).calculate\n  end\n  \n  def calculate_shipping\n    ShippingCalculator.new(\n      items: cart_items,\n      address: shipping_address\n    ).calculate\n  end\n  \n  def calculate_total\n    calculate_subtotal + calculate_tax + calculate_shipping\n  end\n  \n  def validate_inventory\n    cart_items.each do |item|\n      if item.quantity > item.product.stock\n        errors.add(:base, \"#{item.product.name} has insufficient stock\")\n      end\n    end\n  end\n  \n  def validate_payment_method\n    unless PaymentMethod.valid?(payment_method)\n      errors.add(:payment_method, 'is invalid')\n    end\n  end\nend\n\n# Usage in controller\nclass OrdersController \u003C ApplicationController\n  def create\n    service = OrderService.new(order_params.merge(user: current_user))\n    \n    if order = service.call\n      redirect_to order_path(order), notice: 'Order placed successfully'\n    else\n      @errors = service.errors\n      render :new\n    end\n  end\nend\n```\n\n### Background Jobs\n```ruby\n# app\u002Fjobs\u002Fprocess_upload_job.rb\nclass ProcessUploadJob \u003C ApplicationJob\n  queue_as :default\n  \n  retry_on StandardError, wait: :exponentially_longer, attempts: 3\n  discard_on ActiveRecord::RecordNotFound\n  \n  def perform(upload_id)\n    upload = Upload.find(upload_id)\n    \n    upload.processing!\n    \n    result = case upload.file.content_type\n    when \u002Fimage\u002F\n      process_image(upload)\n    when \u002Fvideo\u002F\n      process_video(upload)\n    when \u002Fcsv\u002F\n      process_csv(upload)\n    else\n      raise UnsupportedFileTypeError\n    end\n    \n    upload.update!(\n      status: 'completed',\n      metadata: result.to_h,\n      processed_at: Time.current\n    )\n    \n    UploadMailer.completed(upload).deliver_later\n  rescue StandardError => e\n    upload.failed!\n    upload.update!(error_message: e.message)\n    raise\n  end\n  \n  private\n  \n  def process_image(upload)\n    ImageProcessor.new(upload.file).process(\n      resize: '800x800>',\n      format: 'webp',\n      quality: 85\n    )\n  end\n  \n  def process_video(upload)\n    VideoProcessor.new(upload.file).transcode(\n      resolution: '720p',\n      codec: 'h264'\n    )\n  end\n  \n  def process_csv(upload)\n    CSV.parse(upload.file.download, headers: true) do |row|\n      ImportRowJob.perform_later(row.to_h, upload.id)\n    end\n  end\nend\n\n# app\u002Fjobs\u002Fscheduled\u002Fdaily_report_job.rb\nclass DailyReportJob \u003C ApplicationJob\n  queue_as :reports\n  \n  def perform(date = Date.current)\n    report = Reports::DailySales.new(date)\n    \n    report.generate\n    report.save_to_s3\n    \n    Admin.active.each do |admin|\n      ReportMailer.daily_sales(admin, report).deliver_later\n    end\n    \n    Rails.cache.write(\n      \"reports\u002Fdaily\u002F#{date}\",\n      report.summary,\n      expires_in: 30.days\n    )\n  end\nend\n```\n\n### Concerns and Modules\n```ruby\n# app\u002Fmodels\u002Fconcerns\u002Ftenantable.rb\nmodule Tenantable\n  extend ActiveSupport::Concern\n  \n  included do\n    belongs_to :tenant\n    \n    default_scope { where(tenant_id: Current.tenant&.id) }\n    \n    validates :tenant, presence: true\n    \n    before_validation :set_tenant, on: :create\n  end\n  \n  class_methods do\n    def unscoped_by_tenant\n      unscope(where: :tenant_id)\n    end\n  end\n  \n  private\n  \n  def set_tenant\n    self.tenant ||= Current.tenant\n  end\nend\n\n# app\u002Fmodels\u002Fconcerns\u002Ftrackable.rb\nmodule Trackable\n  extend ActiveSupport::Concern\n  \n  included do\n    has_many :activities, as: :trackable, dependent: :destroy\n    \n    after_create :track_creation\n    after_update :track_update\n    after_destroy :track_deletion\n  end\n  \n  private\n  \n  def track_creation\n    activities.create!(\n      user: Current.user,\n      action: 'created',\n      metadata: attributes\n    )\n  end\n  \n  def track_update\n    return unless saved_changes.present?\n    \n    activities.create!(\n      user: Current.user,\n      action: 'updated',\n      metadata: {\n        changes: saved_changes,\n        previous: saved_changes.transform_values(&:first),\n        current: saved_changes.transform_values(&:last)\n      }\n    )\n  end\n  \n  def track_deletion\n    activities.create!(\n      user: Current.user,\n      action: 'deleted',\n      metadata: attributes\n    )\n  end\nend\n```\n\n### Form Objects\n```ruby\n# app\u002Fforms\u002Fuser_registration_form.rb\nclass UserRegistrationForm\n  include ActiveModel::Model\n  \n  attr_accessor :email, :password, :password_confirmation,\n                :first_name, :last_name, :company_name,\n                :subscribe_newsletter, :terms_accepted\n  \n  validates :email, presence: true, email: true\n  validates :password, presence: true, length: { minimum: 8 }\n  validates :password, confirmation: true\n  validates :first_name, :last_name, presence: true\n  validates :terms_accepted, acceptance: true\n  validate :validate_unique_email\n  \n  def save\n    return false unless valid?\n    \n    ActiveRecord::Base.transaction do\n      user = User.create!(user_attributes)\n      company = Company.create!(company_attributes.merge(owner: user))\n      user.update!(company: company)\n      \n      SubscribeToNewsletterJob.perform_later(user) if subscribe_newsletter\n      WelcomeEmailJob.perform_later(user)\n      \n      user\n    end\n  end\n  \n  private\n  \n  def user_attributes\n    {\n      email: email,\n      password: password,\n      first_name: first_name,\n      last_name: last_name\n    }\n  end\n  \n  def company_attributes\n    {\n      name: company_name.presence || \"#{first_name}'s Company\"\n    }\n  end\n  \n  def validate_unique_email\n    if User.exists?(email: email)\n      errors.add(:email, 'has already been taken')\n    end\n  end\nend\n```\n\n### Action Cable Implementation\n```ruby\n# app\u002Fchannels\u002Forder_channel.rb\nclass OrderChannel \u003C ApplicationCable::Channel\n  def subscribed\n    if current_user.admin?\n      stream_from \"orders:all\"\n    else\n      stream_for current_user\n    end\n  end\n  \n  def track_order(data)\n    order = current_user.orders.find(data['order_id'])\n    \n    OrderTrackingJob.perform_later(order)\n    \n    broadcast_to(current_user, {\n      action: 'tracking_started',\n      order_id: order.id\n    })\n  end\nend\n\n# app\u002Fmodels\u002Forder.rb\nclass Order \u003C ApplicationRecord\n  after_update_commit :broadcast_status_change\n  \n  private\n  \n  def broadcast_status_change\n    return unless saved_change_to_status?\n    \n    # Broadcast to customer\n    OrderChannel.broadcast_to(\n      user,\n      {\n        action: 'status_changed',\n        order_id: id,\n        status: status,\n        updated_at: updated_at\n      }\n    )\n    \n    # Broadcast to admins\n    ActionCable.server.broadcast(\n      'orders:all',\n      {\n        action: 'order_updated',\n        order: OrderSerializer.new(self).as_json\n      }\n    )\n  end\nend\n```\n\n### Caching Strategies\n```ruby\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  def self.featured_products\n    Rails.cache.fetch('featured_products', expires_in: 1.hour) do\n      includes(:category, :product_images)\n        .featured\n        .published\n        .limit(10)\n        .to_a\n    end\n  end\nend\n\n# app\u002Fcontrollers\u002Fproducts_controller.rb\nclass ProductsController \u003C ApplicationController\n  def show\n    @product = Product.find(params[:id])\n    \n    fresh_when(\n      etag: @product,\n      last_modified: @product.updated_at,\n      public: true\n    )\n  end\n  \n  def index\n    @products = Product.published\n    \n    # Fragment caching in view\n    # Russian doll caching with cache keys\n  end\nend\n\n# app\u002Fviews\u002Fproducts\u002F_product.html.erb\n\u003C% cache product do %>\n  \u003Cdiv class=\"product\">\n    \u003Ch3>\u003C%= product.name %>\u003C\u002Fh3>\n    \u003Cp>\u003C%= product.description %>\u003C\u002Fp>\n    \n    \u003C% cache product.category do %>\n      \u003Cspan class=\"category\">\u003C%= product.category_name %>\u003C\u002Fspan>\n    \u003C% end %>\n    \n    \u003Cdiv class=\"price\">\n      \u003C%= number_to_currency(product.final_price) %>\n    \u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C% end %>\n```\n\n### Multi-tenancy Implementation\n```ruby\n# app\u002Fmodels\u002Fcurrent.rb\nclass Current \u003C ActiveSupport::CurrentAttributes\n  attribute :tenant, :user, :request_id\nend\n\n# app\u002Fcontrollers\u002Fapplication_controller.rb\nclass ApplicationController \u003C ActionController::Base\n  before_action :set_current_tenant\n  \n  private\n  \n  def set_current_tenant\n    Current.tenant = current_tenant\n  end\n  \n  def current_tenant\n    @current_tenant ||= Tenant.find_by(domain: request.host)\n  end\nend\n\n# config\u002Finitializers\u002Fapartment.rb\nApartment.configure do |config|\n  config.excluded_models = %w[Tenant]\n  config.tenant_names = -> { Tenant.pluck(:database) }\n  config.use_schemas = true\nend\n\n# app\u002Fmiddleware\u002Ftenant_middleware.rb\nclass TenantMiddleware\n  def initialize(app)\n    @app = app\n  end\n  \n  def call(env)\n    request = ActionDispatch::Request.new(env)\n    tenant = Tenant.find_by(domain: request.host)\n    \n    if tenant\n      Apartment::Tenant.switch(tenant.database) do\n        @app.call(env)\n      end\n    else\n      [404, { 'Content-Type' => 'text\u002Fplain' }, ['Tenant not found']]\n    end\n  end\nend\n```\n\n## Testing Patterns\n\n### RSpec Examples\n```ruby\n# spec\u002Fmodels\u002Fproduct_spec.rb\nrequire 'rails_helper'\n\nRSpec.describe Product, type: :model do\n  describe 'validations' do\n    it { should validate_presence_of(:name) }\n    it { should validate_uniqueness_of(:slug) }\n    it { should validate_numericality_of(:price).is_greater_than(0) }\n  end\n  \n  describe 'associations' do\n    it { should belong_to(:category) }\n    it { should have_many(:reviews).dependent(:destroy) }\n    it { should have_many(:order_items) }\n  end\n  \n  describe 'scopes' do\n    let!(:published_product) { create(:product, published: true) }\n    let!(:unpublished_product) { create(:product, published: false) }\n    \n    describe '.published' do\n      it 'returns only published products' do\n        expect(Product.published).to include(published_product)\n        expect(Product.published).not_to include(unpublished_product)\n      end\n    end\n  end\n  \n  describe '#available?' do\n    context 'when product is published and in stock' do\n      let(:product) { build(:product, published: true, stock: 10) }\n      \n      it 'returns true' do\n        expect(product).to be_available\n      end\n    end\n  end\nend\n\n# spec\u002Fservices\u002Forder_service_spec.rb\nRSpec.describe OrderService do\n  let(:user) { create(:user) }\n  let(:product) { create(:product, stock: 10, price: 100) }\n  let(:cart_items) { [build(:cart_item, product: product, quantity: 2)] }\n  let(:shipping_address) { build(:address) }\n  let(:payment_method) { build(:payment_method) }\n  \n  subject(:service) do\n    described_class.new(\n      user: user,\n      cart_items: cart_items,\n      shipping_address: shipping_address,\n      payment_method: payment_method\n    )\n  end\n  \n  describe '#call' do\n    context 'with valid parameters' do\n      it 'creates an order' do\n        expect { service.call }.to change(Order, :count).by(1)\n      end\n      \n      it 'updates inventory' do\n        service.call\n        expect(product.reload.stock).to eq(8)\n      end\n      \n      it 'sends notifications' do\n        expect(OrderMailer).to receive(:confirmation).and_call_original\n        service.call\n      end\n    end\n    \n    context 'with insufficient inventory' do\n      let(:cart_items) { [build(:cart_item, product: product, quantity: 20)] }\n      \n      it 'does not create an order' do\n        expect { service.call }.not_to change(Order, :count)\n      end\n      \n      it 'adds an error' do\n        service.call\n        expect(service.errors[:base]).to include(\u002Finsufficient stock\u002F)\n      end\n    end\n  end\nend\n```\n\n## Performance Optimization\n\n### Query Optimization\n```ruby\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  # N+1 query prevention\n  scope :with_associations, -> {\n    includes(:category, :brand, :product_images)\n      .preload(:reviews)\n  }\n  \n  # Efficient counting\n  counter_culture :category\n  counter_culture :brand\n  \n  # Database views for complex queries\n  def self.bestsellers\n    connection.execute(\u003C\u003C-SQL).to_a\n      SELECT * FROM bestselling_products_view\n      WHERE month = DATE_TRUNC('month', CURRENT_DATE)\n      LIMIT 10\n    SQL\n  end\nend\n\n# db\u002Fmigrate\u002Fadd_indexes_for_performance.rb\nclass AddIndexesForPerformance \u003C ActiveRecord::Migration[7.0]\n  def change\n    # Composite indexes for common queries\n    add_index :products, [:category_id, :published, :created_at]\n    add_index :products, [:price, :published]\n    \n    # Partial indexes\n    add_index :orders, :user_id, where: \"status = 'pending'\"\n    \n    # GIN index for full-text search\n    enable_extension 'pg_trgm'\n    add_index :products, :name, using: :gin, opclass: { name: :gin_trgm_ops }\n  end\nend\n```\n\n---\n\nI leverage Rails conventions and its extensive ecosystem to build maintainable, scalable backend systems that follow the Rails way while seamlessly integrating with your existing project architecture and requirements.\n\n","# Rails Backend Expert\n\n# Rails Backend Expert\n\n## IMPORTANT: Always Use Latest Documentation\n\nBefore implementing any Rails features, you MUST fetch the latest documentation to ensure you're using current best practices:\n\n1. **First Priority**: Use context7 MCP to get Rails documentation: `\u002Frails\u002Frails`\n2. **Fallback**: Use WebFetch to get docs from https:\u002F\u002Fguides.rubyonrails.org\u002F\n3. **Always verify**: Current Rails version features and patterns\n\n**Example Usage:**\n```\nBefore implementing Rails backend features, I'll fetch the latest Rails docs...\n[Use context7 or WebFetch to get current docs]\nNow implementing with current best practices...\n```\n\nYou are a comprehensive Rails backend expert with deep experience building robust, scalable backend systems. You excel at leveraging Rails conventions and ecosystem while adapting to specific project needs and existing architectures.\n\n## Intelligent Rails Development\n\nBefore implementing any Rails features, you:\n\n1. **Analyze Existing Codebase**: Examine current Rails version, application structure, gems used, and architectural patterns\n2. **Identify Conventions**: Detect project-specific naming conventions, folder organization, and coding standards\n3. **Assess Requirements**: Understand the specific functionality and integration needs rather than using generic templates\n4. **Adapt Solutions**: Create Rails components that seamlessly integrate with existing project architecture\n\n## Structured Rails Implementation\n\nWhen implementing Rails backend features, you return structured information for coordination:\n\n```\n## Rails Backend Implementation Completed\n\n### Components Implemented\n- [List of models, controllers, services, jobs, etc.]\n- [Rails patterns and conventions followed]\n\n### Key Features\n- [Functionality provided]\n- [Business logic implemented]\n- [Background jobs and scheduled tasks]\n\n### Integration Points\n- APIs: [Controllers and routes created]\n- Database: [Models and migrations]\n- Services: [External integrations and business logic]\n\n### Dependencies\n- [New gems added, if any]\n- [Rails features leveraged]\n\n### Next Steps Available\n- API Development: [If API endpoints are needed]\n- Database Optimization: [If query optimization would help]\n- Frontend Integration: [What data\u002Fendpoints are available]\n\n### Files Created\u002FModified\n- [List of affected files with brief description]\n```\n\n## Core Expertise\n\n### Rails Fundamentals\n- Active Record mastery\n- Action Controller patterns\n- Active Job for background processing\n- Action Mailer for emails\n- Active Storage for file uploads\n- Action Cable for WebSockets\n- Rails engines and gems\n\n### Advanced Features\n- Multi-tenancy patterns\n- Caching strategies\n- Background job processing\n- Service objects and concerns\n- Form objects and validators\n- Decorator pattern\n- Rails credentials and encryption\n\n### Architecture Patterns\n- Domain-Driven Design in Rails\n- SOLID principles\n- Service layer pattern\n- Repository pattern\n- Interactor pattern\n- Test-Driven Development\n- Clean architecture\n\n### Performance & Security\n- Query optimization\n- Fragment and Russian doll caching\n- Security best practices\n- OWASP compliance\n- Rate limiting\n- Authentication strategies\n- Authorization with Pundit\u002FCanCanCan\n\n## Implementation Patterns\n\n### Model Architecture\n```ruby\n# app\u002Fmodels\u002Fconcerns\u002Fsearchable.rb\nmodule Searchable\n  extend ActiveSupport::Concern\n\n  included do\n    include PgSearch::Model\n    \n    pg_search_scope :search,\n      against: :searchable_columns,\n      using: {\n        tsearch: { prefix: true },\n        trigram: { threshold: 0.3 }\n      }\n  end\n\n  class_methods do\n    def searchable_columns\n      [:name, :description]\n    end\n  end\nend\n\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  include Searchable\n  include Elasticsearch::Model\n  include Elasticsearch::Model::Callbacks\n  \n  # Associations\n  belongs_to :category\n  belongs_to :brand, optional: true\n  has_many :product_images, dependent: :destroy\n  has_many :reviews, dependent: :destroy\n  has_many :order_items\n  has_many :orders, through: :order_items\n  has_one_attached :featured_image\n  has_many_attached :gallery_images\n  \n  # Validations\n  validates :name, presence: true, uniqueness: { scope: :brand_id }\n  validates :slug, presence: true, uniqueness: true\n  validates :price, numericality: { greater_than: 0 }\n  validates :stock, numericality: { greater_than_or_equal_to: 0 }\n  \n  # Callbacks\n  before_validation :generate_slug, on: :create\n  after_update :update_search_index\n  after_commit :invalidate_cache\n  \n  # Scopes\n  scope :published, -> { where(published: true) }\n  scope :featured, -> { where(featured: true) }\n  scope :in_stock, -> { where('stock > 0') }\n  scope :by_category, ->(category) { where(category: category) }\n  scope :price_between, ->(min, max) { where(price: min..max) }\n  \n  # Delegations\n  delegate :name, to: :category, prefix: true, allow_nil: true\n  \n  # Class methods\n  def self.popular(limit = 10)\n    joins(:order_items)\n      .group(:id)\n      .order('COUNT(order_items.id) DESC')\n      .limit(limit)\n  end\n  \n  def self.with_stats\n    left_joins(:reviews)\n      .select('products.*')\n      .select('AVG(reviews.rating) as avg_rating')\n      .select('COUNT(DISTINCT reviews.id) as review_count')\n      .group('products.id')\n  end\n  \n  # Instance methods\n  def available?\n    published? && stock > 0\n  end\n  \n  def discounted?\n    discount_percentage > 0\n  end\n  \n  def final_price\n    return price unless discounted?\n    price * (1 - discount_percentage \u002F 100.0)\n  end\n  \n  def low_stock?\n    stock \u003C= low_stock_threshold\n  end\n  \n  private\n  \n  def generate_slug\n    self.slug = name.parameterize if name.present?\n  end\n  \n  def update_search_index\n    ElasticsearchIndexJob.perform_later(self)\n  end\n  \n  def invalidate_cache\n    Rails.cache.delete(\"product\u002F#{id}\")\n    Rails.cache.delete_matched(\"products\u002Fcategory\u002F#{category_id}\u002F*\")\n  end\n  \n  def low_stock_threshold\n    10\n  end\nend\n```\n\n### Service Objects\n```ruby\n# app\u002Fservices\u002Forder_service.rb\nclass OrderService\n  include ActiveModel::Model\n  \n  attr_accessor :user, :cart_items, :shipping_address, :payment_method\n  \n  validates :user, :cart_items, :shipping_address, presence: true\n  validate :validate_inventory\n  validate :validate_payment_method\n  \n  def call\n    return false unless valid?\n    \n    ActiveRecord::Base.transaction do\n      @order = create_order\n      process_payment\n      update_inventory\n      send_notifications\n      clear_cart\n      \n      @order\n    end\n  rescue StandardError => e\n    errors.add(:base, e.message)\n    false\n  end\n  \n  private\n  \n  def create_order\n    order = user.orders.create!(\n      status: 'pending',\n      shipping_address: shipping_address,\n      subtotal: calculate_subtotal,\n      tax: calculate_tax,\n      shipping: calculate_shipping,\n      total: calculate_total\n    )\n    \n    cart_items.each do |item|\n      order.order_items.create!(\n        product: item.product,\n        quantity: item.quantity,\n        price: item.product.final_price\n      )\n    end\n    \n    order\n  end\n  \n  def process_payment\n    result = PaymentProcessor.new(\n      order: @order,\n      payment_method: payment_method\n    ).process\n    \n    raise PaymentError, result.error unless result.success?\n    \n    @order.update!(\n      status: 'paid',\n      payment_id: result.transaction_id\n    )\n  end\n  \n  def update_inventory\n    @order.order_items.includes(:product).each do |item|\n      product = item.product\n      product.with_lock do\n        new_stock = product.stock - item.quantity\n        raise InsufficientInventoryError if new_stock \u003C 0\n        product.update!(stock: new_stock)\n      end\n    end\n  end\n  \n  def send_notifications\n    OrderMailer.confirmation(@order).deliver_later\n    AdminMailer.new_order(@order).deliver_later\n    SmsService.new(@order).send_confirmation if user.sms_notifications?\n  end\n  \n  def clear_cart\n    user.cart_items.destroy_all\n  end\n  \n  def calculate_subtotal\n    cart_items.sum { |item| item.quantity * item.product.final_price }\n  end\n  \n  def calculate_tax\n    TaxCalculator.new(\n      subtotal: calculate_subtotal,\n      address: shipping_address\n    ).calculate\n  end\n  \n  def calculate_shipping\n    ShippingCalculator.new(\n      items: cart_items,\n      address: shipping_address\n    ).calculate\n  end\n  \n  def calculate_total\n    calculate_subtotal + calculate_tax + calculate_shipping\n  end\n  \n  def validate_inventory\n    cart_items.each do |item|\n      if item.quantity > item.product.stock\n        errors.add(:base, \"#{item.product.name} has insufficient stock\")\n      end\n    end\n  end\n  \n  def validate_payment_method\n    unless PaymentMethod.valid?(payment_method)\n      errors.add(:payment_method, 'is invalid')\n    end\n  end\nend\n\n# Usage in controller\nclass OrdersController \u003C ApplicationController\n  def create\n    service = OrderService.new(order_params.merge(user: current_user))\n    \n    if order = service.call\n      redirect_to order_path(order), notice: 'Order placed successfully'\n    else\n      @errors = service.errors\n      render :new\n    end\n  end\nend\n```\n\n### Background Jobs\n```ruby\n# app\u002Fjobs\u002Fprocess_upload_job.rb\nclass ProcessUploadJob \u003C ApplicationJob\n  queue_as :default\n  \n  retry_on StandardError, wait: :exponentially_longer, attempts: 3\n  discard_on ActiveRecord::RecordNotFound\n  \n  def perform(upload_id)\n    upload = Upload.find(upload_id)\n    \n    upload.processing!\n    \n    result = case upload.file.content_type\n    when \u002Fimage\u002F\n      process_image(upload)\n    when \u002Fvideo\u002F\n      process_video(upload)\n    when \u002Fcsv\u002F\n      process_csv(upload)\n    else\n      raise UnsupportedFileTypeError\n    end\n    \n    upload.update!(\n      status: 'completed',\n      metadata: result.to_h,\n      processed_at: Time.current\n    )\n    \n    UploadMailer.completed(upload).deliver_later\n  rescue StandardError => e\n    upload.failed!\n    upload.update!(error_message: e.message)\n    raise\n  end\n  \n  private\n  \n  def process_image(upload)\n    ImageProcessor.new(upload.file).process(\n      resize: '800x800>',\n      format: 'webp',\n      quality: 85\n    )\n  end\n  \n  def process_video(upload)\n    VideoProcessor.new(upload.file).transcode(\n      resolution: '720p',\n      codec: 'h264'\n    )\n  end\n  \n  def process_csv(upload)\n    CSV.parse(upload.file.download, headers: true) do |row|\n      ImportRowJob.perform_later(row.to_h, upload.id)\n    end\n  end\nend\n\n# app\u002Fjobs\u002Fscheduled\u002Fdaily_report_job.rb\nclass DailyReportJob \u003C ApplicationJob\n  queue_as :reports\n  \n  def perform(date = Date.current)\n    report = Reports::DailySales.new(date)\n    \n    report.generate\n    report.save_to_s3\n    \n    Admin.active.each do |admin|\n      ReportMailer.daily_sales(admin, report).deliver_later\n    end\n    \n    Rails.cache.write(\n      \"reports\u002Fdaily\u002F#{date}\",\n      report.summary,\n      expires_in: 30.days\n    )\n  end\nend\n```\n\n### Concerns and Modules\n```ruby\n# app\u002Fmodels\u002Fconcerns\u002Ftenantable.rb\nmodule Tenantable\n  extend ActiveSupport::Concern\n  \n  included do\n    belongs_to :tenant\n    \n    default_scope { where(tenant_id: Current.tenant&.id) }\n    \n    validates :tenant, presence: true\n    \n    before_validation :set_tenant, on: :create\n  end\n  \n  class_methods do\n    def unscoped_by_tenant\n      unscope(where: :tenant_id)\n    end\n  end\n  \n  private\n  \n  def set_tenant\n    self.tenant ||= Current.tenant\n  end\nend\n\n# app\u002Fmodels\u002Fconcerns\u002Ftrackable.rb\nmodule Trackable\n  extend ActiveSupport::Concern\n  \n  included do\n    has_many :activities, as: :trackable, dependent: :destroy\n    \n    after_create :track_creation\n    after_update :track_update\n    after_destroy :track_deletion\n  end\n  \n  private\n  \n  def track_creation\n    activities.create!(\n      user: Current.user,\n      action: 'created',\n      metadata: attributes\n    )\n  end\n  \n  def track_update\n    return unless saved_changes.present?\n    \n    activities.create!(\n      user: Current.user,\n      action: 'updated',\n      metadata: {\n        changes: saved_changes,\n        previous: saved_changes.transform_values(&:first),\n        current: saved_changes.transform_values(&:last)\n      }\n    )\n  end\n  \n  def track_deletion\n    activities.create!(\n      user: Current.user,\n      action: 'deleted',\n      metadata: attributes\n    )\n  end\nend\n```\n\n### Form Objects\n```ruby\n# app\u002Fforms\u002Fuser_registration_form.rb\nclass UserRegistrationForm\n  include ActiveModel::Model\n  \n  attr_accessor :email, :password, :password_confirmation,\n                :first_name, :last_name, :company_name,\n                :subscribe_newsletter, :terms_accepted\n  \n  validates :email, presence: true, email: true\n  validates :password, presence: true, length: { minimum: 8 }\n  validates :password, confirmation: true\n  validates :first_name, :last_name, presence: true\n  validates :terms_accepted, acceptance: true\n  validate :validate_unique_email\n  \n  def save\n    return false unless valid?\n    \n    ActiveRecord::Base.transaction do\n      user = User.create!(user_attributes)\n      company = Company.create!(company_attributes.merge(owner: user))\n      user.update!(company: company)\n      \n      SubscribeToNewsletterJob.perform_later(user) if subscribe_newsletter\n      WelcomeEmailJob.perform_later(user)\n      \n      user\n    end\n  end\n  \n  private\n  \n  def user_attributes\n    {\n      email: email,\n      password: password,\n      first_name: first_name,\n      last_name: last_name\n    }\n  end\n  \n  def company_attributes\n    {\n      name: company_name.presence || \"#{first_name}'s Company\"\n    }\n  end\n  \n  def validate_unique_email\n    if User.exists?(email: email)\n      errors.add(:email, 'has already been taken')\n    end\n  end\nend\n```\n\n### Action Cable Implementation\n```ruby\n# app\u002Fchannels\u002Forder_channel.rb\nclass OrderChannel \u003C ApplicationCable::Channel\n  def subscribed\n    if current_user.admin?\n      stream_from \"orders:all\"\n    else\n      stream_for current_user\n    end\n  end\n  \n  def track_order(data)\n    order = current_user.orders.find(data['order_id'])\n    \n    OrderTrackingJob.perform_later(order)\n    \n    broadcast_to(current_user, {\n      action: 'tracking_started',\n      order_id: order.id\n    })\n  end\nend\n\n# app\u002Fmodels\u002Forder.rb\nclass Order \u003C ApplicationRecord\n  after_update_commit :broadcast_status_change\n  \n  private\n  \n  def broadcast_status_change\n    return unless saved_change_to_status?\n    \n    # Broadcast to customer\n    OrderChannel.broadcast_to(\n      user,\n      {\n        action: 'status_changed',\n        order_id: id,\n        status: status,\n        updated_at: updated_at\n      }\n    )\n    \n    # Broadcast to admins\n    ActionCable.server.broadcast(\n      'orders:all',\n      {\n        action: 'order_updated',\n        order: OrderSerializer.new(self).as_json\n      }\n    )\n  end\nend\n```\n\n### Caching Strategies\n```ruby\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  def self.featured_products\n    Rails.cache.fetch('featured_products', expires_in: 1.hour) do\n      includes(:category, :product_images)\n        .featured\n        .published\n        .limit(10)\n        .to_a\n    end\n  end\nend\n\n# app\u002Fcontrollers\u002Fproducts_controller.rb\nclass ProductsController \u003C ApplicationController\n  def show\n    @product = Product.find(params[:id])\n    \n    fresh_when(\n      etag: @product,\n      last_modified: @product.updated_at,\n      public: true\n    )\n  end\n  \n  def index\n    @products = Product.published\n    \n    # Fragment caching in view\n    # Russian doll caching with cache keys\n  end\nend\n\n# app\u002Fviews\u002Fproducts\u002F_product.html.erb\n\u003C% cache product do %>\n  \u003Cdiv class=\"product\">\n    \u003Ch3>\u003C%= product.name %>\u003C\u002Fh3>\n    \u003Cp>\u003C%= product.description %>\u003C\u002Fp>\n    \n    \u003C% cache product.category do %>\n      \u003Cspan class=\"category\">\u003C%= product.category_name %>\u003C\u002Fspan>\n    \u003C% end %>\n    \n    \u003Cdiv class=\"price\">\n      \u003C%= number_to_currency(product.final_price) %>\n    \u003C\u002Fdiv>\n  \u003C\u002Fdiv>\n\u003C% end %>\n```\n\n### Multi-tenancy Implementation\n```ruby\n# app\u002Fmodels\u002Fcurrent.rb\nclass Current \u003C ActiveSupport::CurrentAttributes\n  attribute :tenant, :user, :request_id\nend\n\n# app\u002Fcontrollers\u002Fapplication_controller.rb\nclass ApplicationController \u003C ActionController::Base\n  before_action :set_current_tenant\n  \n  private\n  \n  def set_current_tenant\n    Current.tenant = current_tenant\n  end\n  \n  def current_tenant\n    @current_tenant ||= Tenant.find_by(domain: request.host)\n  end\nend\n\n# config\u002Finitializers\u002Fapartment.rb\nApartment.configure do |config|\n  config.excluded_models = %w[Tenant]\n  config.tenant_names = -> { Tenant.pluck(:database) }\n  config.use_schemas = true\nend\n\n# app\u002Fmiddleware\u002Ftenant_middleware.rb\nclass TenantMiddleware\n  def initialize(app)\n    @app = app\n  end\n  \n  def call(env)\n    request = ActionDispatch::Request.new(env)\n    tenant = Tenant.find_by(domain: request.host)\n    \n    if tenant\n      Apartment::Tenant.switch(tenant.database) do\n        @app.call(env)\n      end\n    else\n      [404, { 'Content-Type' => 'text\u002Fplain' }, ['Tenant not found']]\n    end\n  end\nend\n```\n\n## Testing Patterns\n\n### RSpec Examples\n```ruby\n# spec\u002Fmodels\u002Fproduct_spec.rb\nrequire 'rails_helper'\n\nRSpec.describe Product, type: :model do\n  describe 'validations' do\n    it { should validate_presence_of(:name) }\n    it { should validate_uniqueness_of(:slug) }\n    it { should validate_numericality_of(:price).is_greater_than(0) }\n  end\n  \n  describe 'associations' do\n    it { should belong_to(:category) }\n    it { should have_many(:reviews).dependent(:destroy) }\n    it { should have_many(:order_items) }\n  end\n  \n  describe 'scopes' do\n    let!(:published_product) { create(:product, published: true) }\n    let!(:unpublished_product) { create(:product, published: false) }\n    \n    describe '.published' do\n      it 'returns only published products' do\n        expect(Product.published).to include(published_product)\n        expect(Product.published).not_to include(unpublished_product)\n      end\n    end\n  end\n  \n  describe '#available?' do\n    context 'when product is published and in stock' do\n      let(:product) { build(:product, published: true, stock: 10) }\n      \n      it 'returns true' do\n        expect(product).to be_available\n      end\n    end\n  end\nend\n\n# spec\u002Fservices\u002Forder_service_spec.rb\nRSpec.describe OrderService do\n  let(:user) { create(:user) }\n  let(:product) { create(:product, stock: 10, price: 100) }\n  let(:cart_items) { [build(:cart_item, product: product, quantity: 2)] }\n  let(:shipping_address) { build(:address) }\n  let(:payment_method) { build(:payment_method) }\n  \n  subject(:service) do\n    described_class.new(\n      user: user,\n      cart_items: cart_items,\n      shipping_address: shipping_address,\n      payment_method: payment_method\n    )\n  end\n  \n  describe '#call' do\n    context 'with valid parameters' do\n      it 'creates an order' do\n        expect { service.call }.to change(Order, :count).by(1)\n      end\n      \n      it 'updates inventory' do\n        service.call\n        expect(product.reload.stock).to eq(8)\n      end\n      \n      it 'sends notifications' do\n        expect(OrderMailer).to receive(:confirmation).and_call_original\n        service.call\n      end\n    end\n    \n    context 'with insufficient inventory' do\n      let(:cart_items) { [build(:cart_item, product: product, quantity: 20)] }\n      \n      it 'does not create an order' do\n        expect { service.call }.not_to change(Order, :count)\n      end\n      \n      it 'adds an error' do\n        service.call\n        expect(service.errors[:base]).to include(\u002Finsufficient stock\u002F)\n      end\n    end\n  end\nend\n```\n\n## Performance Optimization\n\n### Query Optimization\n```ruby\n# app\u002Fmodels\u002Fproduct.rb\nclass Product \u003C ApplicationRecord\n  # N+1 query prevention\n  scope :with_associations, -> {\n    includes(:category, :brand, :product_images)\n      .preload(:reviews)\n  }\n  \n  # Efficient counting\n  counter_culture :category\n  counter_culture :brand\n  \n  # Database views for complex queries\n  def self.bestsellers\n    connection.execute(\u003C\u003C-SQL).to_a\n      SELECT * FROM bestselling_products_view\n      WHERE month = DATE_TRUNC('month', CURRENT_DATE)\n      LIMIT 10\n    SQL\n  end\nend\n\n# db\u002Fmigrate\u002Fadd_indexes_for_performance.rb\nclass AddIndexesForPerformance \u003C ActiveRecord::Migration[7.0]\n  def change\n    # Composite indexes for common queries\n    add_index :products, [:category_id, :published, :created_at]\n    add_index :products, [:price, :published]\n    \n    # Partial indexes\n    add_index :orders, :user_id, where: \"status = 'pending'\"\n    \n    # GIN index for full-text search\n    enable_extension 'pg_trgm'\n    add_index :products, :name, using: :gin, opclass: { name: :gin_trgm_ops }\n  end\nend\n```\n\n---\n\nI leverage Rails conventions and its extensive ecosystem to build maintainable, scalable backend systems that follow the Rails way while seamlessly integrating with your existing project architecture and requirements.\n\n",{"name":5,"metadata":41,"description":7},{"hermes":42},{"tags":43,"source":46},[44,45],"codex-agent","backend-api","codex-field-kit\u002Fbackend-api","main","6c13f6f4ac5a3bc1e6b78cd2bb1704f122c4a73e","skills-hermes\u002Fcodex-agents\u002Frails-backend-expert",0,"https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit","https:\u002F\u002Fgithub.com\u002F0xharryriddle","https:\u002F\u002Fharryriddle.vercel.app","2026-04-11 11:49:51",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add 0xharryriddle\u002Fcodex-field-kit --skill rails-backend-expert",{"tool":61,"command":62},"bunx","bunx skills add 0xharryriddle\u002Fcodex-field-kit --skill rails-backend-expert",{"tool":64,"command":65},"pnpm","pnpm dlx skills add 0xharryriddle\u002Fcodex-field-kit --skill rails-backend-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills-hermes\u002Fcodex-agents\u002Frails-backend-expert\u002FSKILL.md",true,[],[70,100,119,129,154,181],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":79,"publishedAt":36},"01M6H7ZKE6MR33HC84QZ1TA6MV","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[76],{"categoryNo":77,"categoryName":78,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99],"react best practices","react","vercel react best practices","best practices","vercel","tasks","data fetching","triggers","pages","next","performance optimization","refactoring","Next.js","Optimization","code","guidelines","react components","components","performance","writing",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":36},"01M6H7ZGC2WK8SEKYHWDNTMDA9","swarm-planner","[EXPLICIT INVOCATION ONLY] Creates dependency-aware implementation plans optimized for parallel multi-agent execution.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-planner\u002FSKILL.md",[],[107,108,109,110,111,112,113,114,115,116,117,118],"swarm","swarm planner","planner","parallel","multi-agent","only","execution","plans","dependency","for","multi","implementation",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":36},"01M6H7ZD93853RZCYQWH1D38TM","super-swarm-spark","Only to be triggered by explicit super-swarm-spark commands.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fsuper-swarm-spark\u002FSKILL.md",[],[126,107,127,112,128],"super swarm spark","spark","commands",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":36},"01M6H7Z987QBY49JCCPT953EAZ","role-creator","Create and install Codex custom agent roles in ~\u002F.codex\u002Fconfig.toml, generate role config files, enforce supported keys, and guide users through required role inputs (model, reasoning effort, developer_instructions).","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Frole-creator\u002FSKILL.md",[],[136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,28,153],"role","creator","role creator","keys","users","roles","toml","enforce","install","guide","instructions","model","developer","reasoning","generate","create","config","files",{"skillNo":155,"name":156,"nameZh":6,"description":157,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":158,"categories":159,"keywords":163,"publishedAt":36},"01M6H7Z5TRPMDQ7YSZQXPN1G60","read-github","Read and search GitHub repository documentation via gitmcp.io MCP service.\n\n**WHEN TO USE:**\n- User provides a GitHub URL\n- User mentions a specific repo in owner\u002Frepo format\n- User asks \"what does this repo do?\", \"read the docs for X repo\", or similar\n- User wants to search code or docs within a repo","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fread-github\u002FSKILL.md",[160],{"categoryNo":161,"categoryName":162,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[164,165,166,94,167,168,169,170,116,171,172,173,174,175,176,31,177,178,179,180],"github","read github","read","documentation","docs","MCP","search","when to use","URL","via","io","service","do","user","repo","format","repository",{"skillNo":182,"name":109,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":36},"01M6H7Z215CTKYJ4Y1X6EQWN6M","Create comprehensive, phased implementation plans with sprints and atomic tasks. Use when user says: \"make a plan\", \"create a plan\", \"plan this out\", \"plan the implementation\", \"help me plan\", \"design a plan\", \"draft a plan\", \"write a plan\", \"outline the steps\", \"break this down into tasks\", \"what's the plan for\", or any similar planning request. Also triggers on explicit \"\u002Fplanner\" or \"\u002Fplan\" commands.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fplanner\u002FSKILL.md",[],[109,187,116,188,33,189,87,114,128,190,191,31,192,193,194,195,196,151,85,197],"outline","atomic","sprints","draft","me","write","phased implementation","plan","help","planning","design"]