tinystruct-patterns
Expert guidance for developing with the tinystruct Java framework. Use when working on the tinystruct codebase or any project built on tinystruct — including creating Application classes, @Action-mapped routes, unit tests, ActionRegistry, HTTP/CLI dual-mode handling, the built-in HTTP server, the event system, JSON with Builder/Builders, database persistence with AbstractData, POJO generation, Server-Sent Events (SSE), file uploads, and outbound HTTP networking.
Security Assessment
Detected risks:
About tinystruct-patterns
This skill provides expert guidance for developing with the tinystruct Java framework, a lightweight, high-performance framework whose core philosophy is that CLI and HTTP are equal citizens. It solves the problem of building applications that must run identically from a terminal and a web browser without a main() method and with minimal configuration. Every method annotated with @Action becomes a routable endpoint for both environments, and applications are created by extending AbstractApplication, which provides lifecycle hooks like init() and access to the per-request Context.
Concretely, the skill covers routing via the ActionRegistry, which maps path segments to method arguments; HTTP mode disambiguation using @Action with mode = Mode.HTTP_POST; native zero-dependency JSON serialization with the Builder and Builders components; and database persistence using AbstractData POJOs paired with XML mapping files, including POJO generation from tables via the generate command. It documents Server-Sent Events through SSEPushManager (push and broadcast), file uploads via FileEntity and request.getAttachments(), and outbound HTTP with URLRequest and HTTPHandler. It also details native Model Context Protocol support starting with SDK version 1.7.26, showing how to build an MCPTool with @Argument-declared parameters, register tools on an MCPServer via registerTool(), and run everything through bin/dispatcher, while warning strongly about sanitizing tool inputs to prevent prompt injection.
The skill targets Java developers working on the tinystruct codebase or projects built on it, especially those creating Application modules, defining routes and CLI actions, writing unit tests, and configuring the built-in HTTP server. Configuration is managed in src/main/resources/application.properties, covering database driver and URL, server.port, default.home.page, default.language, and session settings. It is best activated when debugging routing conflicts, parsing CLI arguments, or wiring database connections and system settings.
FAQ
What makes tinystruct different from other Java frameworks?
Its core principle is that CLI and HTTP are equal citizens: every @Action-annotated method should be runnable from both a terminal and a web browser without modification, and applications need no main() method and minimal configuration.
How do I create an application and define routes?
Extend AbstractApplication, which provides lifecycle hooks like init() and access to the request Context, then annotate methods with @Action to expose them as routable endpoints. The ActionRegistry maps path segments to method arguments.
How is JSON and database persistence handled?
Use the native Builder and Builders components for zero-dependency JSON serialization. Database persistence uses AbstractData POJOs paired with XML mapping files for CRUD, and POJOs can be generated from tables with the generate command.
Does tinystruct support the Model Context Protocol?
Yes, natively starting with SDK version 1.7.26. You create tools by extending org.tinystruct.mcp.MCPTool with @Argument-declared parameters, register them on an MCPServer via registerTool(), and run via bin/dispatcher. Tool inputs must be validated and sanitized to prevent prompt injection.
Where is configuration stored?
In src/main/resources/application.properties, covering settings such as the database driver and database.url, server.port, default.home.page, default.language, and session configuration.
Install tinystruct-patterns
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/everything-claude-code