Builds streaming, reactive HTTP services in Scala with Akka HTTP: route DSL, JSON marshalling, TestKit testing, and sbt workflows.
Agentic Workflow: Read -> Reason -> Act (akka-http)
You are Akka Http (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for akka-http
- Domain: Builds streaming, reactive HTTP services in Scala with Akka HTTP: route DSL, JSON marshalling, TestKit testing, and sbt workflows.
- project-scaffold: Create an Akka HTTP project from the giter8 template and manage deps. —
sbt new akka/akka-http-quickstart-scala.g8
- test-and-build: Test routes with akka-http-testkit, package, and run in CI. —
sbt test
- Check
knowledge and prerequisites: java, sbt
2. Reason — think for akka-http
- For
project-scaffold: Create an Akka HTTP project from the giter8 template and manage deps. — decide which checks to run
- For
test-and-build: Test routes with akka-http-testkit, package, and run in CI. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with akka-http tools
- Tools:
Glob, Grep, Read, Sbt, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
akka-http:a20e74cf
Akka HTTP
What this skill does
Creates reactive HTTP services in Scala with Akka HTTP: bootstrapping via giter8, route DSL composition, JSON marshalling of case classes, TestKit testing, and sbt-assembly packaging.
When to use
- A streaming, backpressure-aware REST API in Scala
- Adding WebSockets or SSE to an actor system
- Refactoring a Play app into lighter Akka HTTP routes
Real commands
sbt new akka/akka-http-quickstart-scala.g8 --name=my-api
sbt compile
sbt run
curl http://localhost:8080/hello?name=world
sbt test
sbt "testOnly com.acme.UserRouteSpec"
sbt assembly
java -jar target/scala-2.13/my-api-assembly-0.1.0.jar
Route example
import akka.http.scaladsl.server.Directives._
val route =
pathPrefix("api") {
get {
path("users" / LongNumber) { id =>
complete(s"user $id")
}
}
}
Testing
- Use akka-http-testkit + scalatest:
Post("/users") ~> route ~> check
- Assert status and JSON with responseAs[String] or a marshaller
Best practices
- Put routes in traits that can be mixed into tests
- Use typed marshalling instead of raw strings
- Pin Akka versions in build.sbt
- Prefer pipelining/backlog tuning on the HttpServer for production
Capabilities
project-scaffold
Create an Akka HTTP project from the giter8 template and manage deps.
Parameters:
name (string): Project name for the giter8 template
port (number): Port for the HTTP server binding
Commands:
sbt new akka/akka-http-quickstart-scala.g8
sbt update
sbt compile
sbt run
curl http://localhost:8080/hello
Examples:
test-and-build
Test routes with akka-http-testkit, package, and run in CI.
Parameters:
test_filter (string): Test name pattern for testOnly
assembly_output (string): Path to the fat jar
Commands:
sbt test
sbt "testOnly com.acme.RouteSpec"
sbt assembly
sbt clean test assembly
java -jar target/scala-2.13/my-api-assembly-0.1.0.jar
Examples:
- sbt test
- sbt assembly && java -jar target/scala-2.13/my-api-assembly-0.1.0.jar
- sbt "testOnly HealthSpec"
References
1---2name: "akka-http"3description: "Builds streaming, reactive HTTP services in Scala with Akka HTTP: route DSL, JSON marshalling, TestKit testing, and sbt workflows. Use when working with project scaffold, test and build, api or when the user mentions project scaffold, test and build, api."4license: "MIT"5compatibility: "Requires java, sbt. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/akka-http8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(java:*) Bash(sbt:*)"12---1314Builds streaming, reactive HTTP services in Scala with Akka HTTP: route DSL, JSON marshalling, TestKit testing, and sbt workflows.1516## Agentic Workflow: Read -> Reason -> Act (akka-http)1718You are **Akka Http** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `akka-http`21- Domain: Builds streaming, reactive HTTP services in Scala with Akka HTTP: route DSL, JSON marshalling, TestKit testing, and sbt workflows.22- **project-scaffold**: Create an Akka HTTP project from the giter8 template and manage deps. — `sbt new akka/akka-http-quickstart-scala.g8`23- **test-and-build**: Test routes with akka-http-testkit, package, and run in CI. — `sbt test`24- Check `knowledge` and `prerequisites: java, sbt`2526### 2. Reason — think for `akka-http`27- For `project-scaffold`: Create an Akka HTTP project from the giter8 template and manage deps. — decide which checks to run28- For `test-and-build`: Test routes with akka-http-testkit, package, and run in CI. — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `akka-http` tools32- Tools: `Glob`, `Grep`, `Read`, `Sbt`, `Bash` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `akka-http:a20e74cf`3536# Akka HTTP3738## What this skill does3940Creates reactive HTTP services in Scala with Akka HTTP: bootstrapping via giter8, route DSL composition, JSON marshalling of case classes, TestKit testing, and sbt-assembly packaging.4142## When to use4344- A streaming, backpressure-aware REST API in Scala45- Adding WebSockets or SSE to an actor system46- Refactoring a Play app into lighter Akka HTTP routes4748## Real commands4950```bash51sbt new akka/akka-http-quickstart-scala.g8 --name=my-api5253sbt compile54sbt run55curl http://localhost:8080/hello?name=world5657sbt test58sbt "testOnly com.acme.UserRouteSpec"5960sbt assembly61java -jar target/scala-2.13/my-api-assembly-0.1.0.jar62```6364## Route example6566```scala67import akka.http.scaladsl.server.Directives._6869val route =70 pathPrefix("api") {71 get {72 path("users" / LongNumber) { id =>73 complete(s"user $id")74 }75 }76 }77```7879## Testing8081- Use akka-http-testkit + scalatest: `Post("/users") ~> route ~> check`82- Assert status and JSON with responseAs[String] or a marshaller8384## Best practices8586- Put routes in traits that can be mixed into tests87- Use typed marshalling instead of raw strings88- Pin Akka versions in build.sbt89- Prefer pipelining/backlog tuning on the HttpServer for production9091## Capabilities9293### project-scaffold94Create an Akka HTTP project from the giter8 template and manage deps.9596**Parameters:**97- `name` (string): Project name for the giter8 template98- `port` (number): Port for the HTTP server binding99100**Commands:**101- `sbt new akka/akka-http-quickstart-scala.g8`102- `sbt update`103- `sbt compile`104- `sbt run`105- `curl http://localhost:8080/hello`106107**Examples:**108- sbt new akka/akka-http-quickstart-scala.g8 --name=my-api109- sbt "runMain com.acme.Main 8080"110- curl http://localhost:8080/hello?name=world111112### test-and-build113Test routes with akka-http-testkit, package, and run in CI.114115**Parameters:**116- `test_filter` (string): Test name pattern for testOnly117- `assembly_output` (string): Path to the fat jar118119**Commands:**120- `sbt test`121- `sbt "testOnly com.acme.RouteSpec"`122- `sbt assembly`123- `sbt clean test assembly`124- `java -jar target/scala-2.13/my-api-assembly-0.1.0.jar`125126**Examples:**127- sbt test128- sbt assembly && java -jar target/scala-2.13/my-api-assembly-0.1.0.jar129- sbt "testOnly *HealthSpec*"130131## References132- [Akka HTTP Docs](https://doc.akka.io/docs/akka-http/current/)133- [Akka HTTP TestKit](https://doc.akka.io/docs/akka-http/current/routing-dsl/testkit.html)134- [Akka Quickstart](https://doc.akka.io/docs/akka-http/current/introduction.html)