Command Palette

Search for a command to run...

Назад к скиллам
скилл № 42834

scala-play

Use when the user asks about Play Framework, Scala Play controllers, Play JSON Reads/Writes, Slick, Guice DI in Play or Pekko streams in Play 3. Produces Play…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить scala-play в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Scala Play Framework

Purpose

Build Play Framework applications with clean MVC architecture, Slick database access, Play JSON serialization, async actions, and comprehensive testing.

Agent Protocol

Trigger

User request includes: Play Framework, Play Scala, Play controller, Play Slick, Play JSON, Play action, Play test, Play routes.

Input Context

  • Scala version (2.13, 3)
  • Play version (3.x)
  • Database (PostgreSQL via Slick)
  • JSON library (Play JSON, Circe)
  • Testing (ScalaTest, Specs2)

Output Artifact

Controller, model, Slick table definition, JSON reads/writes, routes, test.

Response Format

Produce artifact directly. No preamble, no postamble, no explanations.

Completion Criteria

  • Controller action returns Future[Result]
  • Slick table mapped to case class
  • JSON Format (Reads/Writes/OFormat) defined
  • Routes file with HTTP method binding
  • Service layer for business logic

Max Response Length

4096 tokens

Architecture Decision Trees

Play vs Pekko HTTP vs http4s vs ZIO HTTP

Play 3.x is built on Apache Pekko (org.apache.pekko.*); Play 2.9 is the last Akka-based line. Import Pekko packages in Play 3 code.

Criterion Play Pekko / Akka HTTP http4s ZIO HTTP
Ecosystem Full (MVC, Slick, JSON) HTTP + Pekko/Akka ecosystem Functional + Cats ZIO ecosystem
Async Future-based Pekko/Akka Streams IO/Cats Effect ZIO
Type level Moderate Moderate High (functional) High
Learning curve Low-Moderate Moderate High (FP concepts) High (ZIO)
Community Large (Scala standard) Medium Medium Growing

Decision: Full framework (MVC, DB, JSON) → Play. Lightweight HTTP → http4s. Streaming-first HTTP → Pekko HTTP. ZIO stack → ZIO HTTP.

Slick vs Doobie vs Quill

Criterion Slick Doobie Quill
Approach Scala query DSL Free monad (SQL strings) Macro-based Quill DSL
Type safety High High High
SQL control Medium (DSL maps to SQL) Full (raw SQL) Medium (Quill DSL)
Migration Play Evolutions + Flyway Flyway/Liquibase Manual
Learning curve Moderate High (Free monad) Moderate

Decision: Play integration → Slick. Raw SQL / JDBC → Doobie. Compile-time query generation → Quill.

Workflow

Step 1: Project Structure (Play)

app/
  controllers/
    UserController.scala
    OrderController.scala
  models/
    User.scala
    Order.scala
  services/
    UserService.scala
    OrderService.scala
  repositories/
    UserRepository.scala
  views/
    (not in API mode)
  dto/
    CreateUserRequest.scala
    UserResponse.scala
  error/
    ErrorHandler.scala
    AppError.scala
conf/
  routes
  application.conf
  evolutions/
    default/
      1.sql
project/
  build.properties
  plugins.sbt
build.sbt
test/
  controllers/
    UserControllerSpec.scala
  services/
    UserServiceSpec.scala

Step 2: build.sbt

name := "my-api"
version := "1.0.0"
scalaVersion := "2.13.12"

lazy val root = (project in file("."))
  .enablePlugins(PlayScala)
  .settings(
    libraryDependencies ++= Seq(
      guice,
      "org.playframework" %% "play-slick" % "6.0.0",
      "org.playframework" %% "play-slick-evolutions" % "6.0.0",
      "org.postgresql" % "postgresql" % "42.7.0",
      "org.mindrot" % "jbcrypt" % "0.4",
      "com.github.jwt-scala" %% "jwt-play" % "9.4.0",
      "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.0" % Test,
    )
  )

Step 3: Model and Slick Table

// app/models/User.scala
package models

import java.time.Instant
import java.util.UUID

case class User(
  id: UUID,
  email: String,
  name: String,
  role: String,
  active: Boolean,
  createdAt: Instant,
)

// app/repositories/UserRepository.scala
package repositories

import javax.inject.{Inject, Singleton}
import models.User
import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfigProvider}
import slick.jdbc.JdbcProfile
import slick.lifted.ProvenShape
import java.time.Instant
import java.util.UUID
import scala.concurrent.Future

@Singleton
class UserRepository @Inject()(
  protected val dbConfigProvider: DatabaseConfigProvider
) extends HasDatabaseConfigProvider[JdbcProfile] {

  import profile.api._

  class UserTable(tag: Tag) extends Table[User](tag, "users") {
    def id = column[UUID]("id", O.PrimaryKey)
    def email = column[String]("email", O.Unique)
    def name = column[String]("name")
    def role = column[String]("role", O.Default("user"))
    def active = column[Boolean]("active", O.Default(true))
    def createdAt = column[Instant]("created_at")
    def * : ProvenShape[User] = (id, email, name, role, active, createdAt) <> (User.tupled, User.unapply)
  }

  val users = TableQuery[UserTable]

  def findById(id: UUID): Future[Option[User]] =
    db.run(users.filter(_.id === id).result.headOption)

  def findByEmail(email: String): Future[Option[User
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/play-architecture.md
  • references/play-framework-rest-api.md
  • references/play-performance.md
  • references/play-rest-api.md
  • references/play-security.md
  • references/play-setup.md
  • references/play-testing.md
  • references/scala-concurrent-streaming.md

FAQ

Что делает скилл scala-play?

Use when the user asks about Play Framework, Scala Play controllers, Play JSON Reads/Writes, Slick, Guice DI in Play or Pekko streams in Play 3. Produces Play 3 services with async actions and tests. Not for Scala language basics (use lang-scala).

Как установить скилл scala-play?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл scala-play запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить scala-play с