/proschi:code-to-usecasesfrom Proschi
Reads application code to generate Proschi usecase blocks that trace request flows, async messages, parallel calls, and failure scenarios. Works across Spring, Express, FastAPI, Go, Rails, and other stacks.
Ships in Proschi. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Goal: one usecase per important entry point (endpoint, RPC, consumer,
scheduled job), each tracing the calls the code really makes, with an alt
branch per outcome the code handles, passing npx proschi@latest check and
test, and a share link for the user.
Syntax, arrows and the CLI: references/proschi-cheatsheet.md.
Use cases play over nodes and connections. If the repo has a .proschi file
with the architecture, put the use cases in it or in a new file that starts
with import "architecture.proschi". If there is none, write the nodes
first (the infra-to-proschi skill; minimum: a client, each service, each
store, each external API) and connect them, declared in reading order
(the cheat-sheet's Layout section).
OpenAPI shortcut. With a spec, scaffold one use case per operation, then
replace api with the real node id and fill in the downstream calls:
npx proschi@latest import openapi openapi.yaml -o api-usecases.proschi
| Stack | Entry points | Outbound calls to look for |
|---|---|---|
| Spring / Kotlin | @RestController + @GetMapping/@PostMapping, @KafkaListener, @RabbitListener, @SqsListener, @Scheduled, gRPC *ImplBase | JpaRepository/JdbcTemplate, RedisTemplate/@Cacheable, KafkaTemplate.send, RestTemplate/WebClient/@FeignClient |
| Express / NestJS | app.get/post, router.*, @Controller + @Get()/@Post(), @MessagePattern, @EventPattern, @Cron | pg/knex/Prisma/TypeORM, ioredis, kafkajs/amqplib/SQS send, fetch/axios, SDKs (stripe, @sendgrid/mail) |
| FastAPI / Django | @app.get/@router.post, Django urls.py → views/DRF viewsets, Celery @shared_task, management commands | SQLAlchemy/ORM .objects, redis, .delay()/apply_async, boto3, httpx/requests |
| Go | http.HandleFunc, mux.HandleFunc, gin/echo/chi routes, gRPC Register*Server, consumer loops | database/sql/sqlx/gorm, go-redis, sarama/franz-go, http.Client, generated gRPC clients |
| Rails | config/routes.rb → controller actions, ActiveJob/Sidekiq perform, ActionCable channels | ActiveRecord, Rails.cache, perform_later, Net::HTTP/Faraday |
| Anything else | route tables, main loops, queue subscriptions, cron | DB drivers, cache clients, producers, HTTP/gRPC clients |
Prioritise: the endpoints a user hits most, anything that writes or takes money, and every consumer. Skip health checks, metrics and admin CRUD unless asked. Keep it to 3–10 use cases; a use case may have up to 32 scenarios.
Walk the handler top to bottom, following calls into services and repositories, and write one step per network call:
| Code | Step |
|---|---|
| The incoming request | client -> svc : POST /orders {"sku": "A1"} (path params as {id}; a small realistic JSON body) |
| SQL / ORM read, write | svc -> db : SELECT order, svc -> db : INSERT order (start with the verb: it decides read vs write) |
| Cache get / set | svc -> cache : LOOKUP product:{id} / svc -> cache : SET product:{id}. Don't start a non-HTTP label with an HTTP verb: GET key is read as an HTTP GET to path key |
| Synchronous HTTP / gRPC to another service | svc -> other : GET /users/{id} then other --> svc : 200 {…} |
Publish / enqueue / .delay() / send (not awaited for a result) | svc ->> queue : PUBLISH OrderPlaced {"orderId": "o-1"} |
| The consumer of that message | after the entry response: queue ->> worker : OrderPlaced, then the worker's own steps |
Promise.all, CompletableFuture.allOf, asyncio.gather, goroutines + WaitGroup | par { … } around those steps |
| Loop of N calls | x<N> prefix: svc -> db : x20 SELECT item |
| Upload / download of a big payload | ~<size> prefix: client -> blobs : ~5MB PUT /files/{id} |
return res.status(201).json(…) | svc --> client : 201 {…} |
if (!valid) return 400, catch (e) { return 502 }, not found, timeouts | one alt branch each, with when "…" naming the condition |
| A call that times out / is refused, with a fallback | svc -x dep : … inside a branch, then what the code does next |
Responses are optional for internal hops (add them when the body matters),
but the entry request must be answered in every branch with a status:
a scenario is an error path only when that first request gets a 4xx/5xx or
a -x. If the request passes through a proxy or gateway, answer each hop
inside each branch (api --> gw : 404, gw --> user : 404).
Step rules (the cheat-sheet has the arrows):
GET /orders/{id} sets method and path (standard verbs only),
then a JSON body (may span lines until brackets balance) or json/xml/
text …. Responses start with a status: 201 {"id": 1}. Other text is a
step name: SELECT order, INCR rate:42, OrderPlaced {…}.x200 (fan-out), ~2MB (payload size), in either order.--> answers the latest unanswered request from the other side; -x is
never answered. par blocks do not nest.alt blocks that touch (} alt "B" {) are one set of alternatives; steps
before a set are shared, steps after it are appended to every branch.
Nested sets multiply (max 32 scenarios); a nested scenario is A › B.events ->> worker : OrderPlaced, with
the connection events -> worker (or worker -> events).Mark anything you inferred rather than read with a comment:
# GUESS: retries handled by the SDK.
Add a test block for behaviour that should not regress. Lines (U = a use
case name, optional scenario "S" after it; X/Y = id, [Tech],
any <kind>, any strong store, any eventual store, X or Y):
U calls X, U every scenario calls X, U never calls X, U calls X before Y,
U never waits for X, U writes X before responding, U responds 2xx|4xx|201,
U has scenario "S", U handles failure of X (a success scenario survives a
-x to X), U starts at X, [in U] X calls Y, no path from X to Y,
X has replicas >= n. For example:
test "Checkout stays fast" {
"Place order" never waits for any external or any queue
"Place order" writes db before responding
"Place order" has scenario "Payment failed"
"Get product" calls cache before db
}
npx proschi@latest fmt usecases.proschi
npx proschi@latest check usecases.proschi
npx proschi@latest test usecases.proschi
Fix until clean. Common fixes: No connection between 'a' and 'b' → add
a -> b to the architecture (or you used the wrong node); Response has no matching request from 'b' to 'a' → the --> goes back the way the request
came (b --> a answers a -> b); a test that fails because the code really does
wait on something → tell the user, don't weaken the test silently. If the
spec is available, npx proschi@latest check --openapi svc=openapi.yaml usecases.proschi
also checks paths, status codes and bodies against it.
If you added or changed nodes or connections, render the architecture and
look at it before handing over (mandatory; the cheat-sheet's Render and
review checklist): npx proschi@latest render --out /tmp/proschi-review usecases.proschi.
A new node goes next to its tier in the file, not at the end.
npx proschi@latest share-link usecases.proschi
Give the user the file, the link (it opens the diagram with playback of every scenario; the content travels in the link), which handlers each use case came from, and the guesses to confirm.
src/app.js (Express):
app.post('/orders', async (req, res) => {
if (!req.body.productId) return res.status(400).json({ error: 'productId required' });
try { charge = await stripe.paymentIntents.create({ /* … */ }); }
catch (e) { return res.status(402).json({ error: 'payment_failed' }); }
const { rows } = await db.query('INSERT INTO orders … RETURNING id', [/* … */]);
channel.sendToQueue('order-created', Buffer.from(JSON.stringify({ orderId: rows[0].id })));
res.status(201).json({ id: rows[0].id, status: 'paid' });
});
// src/worker.js: consume('order-created') → SELECT email, sendgrid.send, UPDATE orders
title "Shop"
user "Customer" [Browser]
api "Shop API" [Node.js]
db "Shop DB" [PostgreSQL]
rabbit "Order events" [RabbitMQ]
worker "Order worker" [Node.js]
stripe "Stripe" [Stripe]
sendgrid "SendGrid" [SendGrid]
user -> api : HTTPS
api -> db : SQL
api -> stripe : HTTPS
api -> rabbit : Publish
rabbit -> worker : Consume
worker -> db : SQL
worker -> sendgrid : HTTPS
# src/app.js: app.post('/orders'); src/worker.js: consume('order-created')
usecase "Place order" {
user -> api : POST /orders {"productId": "p-1", "quantity": 2}
alt "Paid" {
api -> stripe : CHARGE payment intent
stripe --> api : succeeded
api -> db : INSERT order
api ->> rabbit : PUBLISH order-created {"orderId": "o-1"}
api --> user : 201 {"id": "o-1", "status": "paid"}
rabbit ->> worker : order-created {"orderId": "o-1"}
worker -> db : SELECT order and user email
worker -> sendgrid : SEND confirmation email
worker -> db : UPDATE orders SET confirmation_sent
} alt "Invalid" when "productId missing" {
api --> user : 400 {"error": "productId required"}
} alt "Payment failed" when "Stripe declines or errors" {
api -> stripe : CHARGE payment intent
stripe --> api : card_declined
api --> user : 402 {"error": "payment_failed"}
}
}
test "Checkout does not wait for the email" {
"Place order" never waits for sendgrid
"Place order" writes db before responding
}
What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/image-to-proschiTurn an image of an architecture diagram (a screenshot, PNG, JPG or PDF export from draw.io, Lucidchart, Miro, Excalidraw, Visio or a whiteboard photo) into a Proschi (.proschi) model that keeps the source's components, groups, arrows, legend and reading order, passes `proschi check` and renders cleanly. Use when the user shares or points at a picture of a system diagram and asks to convert, recreate, redraw, digitise or "make this diagram as code" in Proschi./infra-to-proschiTurn an existing architecture description into a Proschi (.proschi) model that renders, simulates and passes `proschi check`. Use when the user asks to diagram, model, visualise or "convert to Proschi" their system from what already exists - prose or wiki docs, a README architecture section, Mermaid diagrams, Terraform, CloudFormation, CDK, Pulumi, Kubernetes manifests, Helm charts or docker-compose files - or asks for an architecture diagram as code of the current repository./proschi-capacity-planSize a Proschi design for its load - add `traffic`, `requirements` (p99 latency, availability, durability, failure survival, cost) and replicas, shards and capacity overrides from stated SLOs or expected load, then run `proschi analyze` and `proschi test`, explain the bottlenecks and fix them until the requirements pass. Use when the user asks whether a .proschi design scales, how many replicas or shards it needs, what it costs, what its p99 or availability is, or wants to turn traffic numbers, SLOs or a back-of-the-envelope estimate into a checked capacity plan./proschi-design-reviewReview an existing Proschi (.proschi) system design like a senior engineer in a design review - run `proschi check`, `test` and `analyze`, then find single points of failure, saturated or oversized nodes, missing failure scenarios, synchronous calls that should be async, data and consistency risks, cost waste and gaps between the diagram and its requirements, and propose concrete edits (and apply them when asked). Use when the user asks to review, critique, sanity-check or improve a .proschi design, asks "will this hold up?", or wants feedback on a system design interview answer written in Proschi./proschi-hld-docProduce a high-level design (HLD) document from a Proschi (.proschi) file with `proschi render --format hld-md` or `hld-html` (overview, requirements, capacity estimates, components, data model, APIs, scenarios, decisions, risks, with diagrams), after enriching the model with the summary, descriptions, entities and decisions the document is built from. Use when the user asks for a design doc, HLD, architecture document, RFC appendix or design review handout for a system described in Proschi, or wants the diagrams exported as SVG, Markdown or HTML for a wiki or docs site./proschi-keep-in-syncKeep a repository's Proschi (.proschi) architecture files in sync with its code - detect architecture drift in a branch, diff or pull request (a new service, datastore, queue or external API; a new dependency between services; a new or changed endpoint, consumer or status code) and update the nodes, connections, use cases and tests to match, then validate with `proschi check` and `proschi test`. Use when reviewing or preparing a PR in a repo that contains .proschi files, when the user asks whether the diagrams are still accurate, or wants CI that keeps them honest (the gvart/proschi GitHub Action).npx claudepluginhub gvart/proschi --plugin proschiOther plugins' skills for the same job