tinystruct-patterns
Qué hace
Esta guía enseña a usar el framework de Java tinystruct para crear aplicaciones. Se centra en que tus aplicaciones funcionen tanto en la terminal (línea de comandos) como en la web, sin necesidad de configuraciones adicionales.
Cuándo usarla
- ✓Cuando empiezas un proyecto nuevo con tinystruct.
- ✓Cuando quieres que tu aplicación funcione en la línea de comandos y en la web.
- ✓Cuando generas los scripts de arranque (bin/dispatcher) de tu proyecto.
Link de la skill
https://github.com/affaan-m/ECC/blob/main/skills/tinystruct-patterns/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Cómo creo un script de arranque para mi proyecto de tinystruct?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
tinystruct usa un script llamado `bin/dispatcher` (o `bin/dispatcher.cmd` en Windows) como herramienta principal. Permite que tus funciones se ejecuten tanto en la terminal como en un servidor web, de forma integrada.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
tinystruct Development Patterns
Architecture and implementation patterns for building modules with the tinystruct Java framework – a lightweight, high-performance framework that treats CLI and HTTP as equal citizens, requiring no main() method and minimal configuration.
Core Principle
CLI and HTTP are equal citizens. Every method annotated with @Action should ideally be runnable from both a terminal and a web browser without modification. This "dual-mode" capability is the core design philosophy of tinystruct.
Primary Development Tool: bin/dispatcher
bin/dispatcher is the default, highest-priority tool for developing, running, testing, and debugging a tinystruct application — reach for it before an IDE run configuration, a hand-written main(), curl, or a browser. Because every @Action is dual-mode by design, bin/dispatcher lets you exercise routing, argument binding, and business logic directly from the terminal, with the fastest possible feedback loop and no server/browser required.
# Run any @Action directly - the fastest way to verify a new action works
# (the class must be imported; see --import or default.import.applications in application.properties)
bin/dispatcher greet/James --import com.example.MyService
bin/dispatcher echo --words "Praise the Lord"
# Start the HTTP server when you need the web-facing counterpart
bin/dispatcher start --import org.tinystruct.system.HttpServer
# Import additional Application/MCP classes for the current run
# (one --import per class; a comma-separated list fails with ClassNotFoundException)
bin/dispatcher start --import org.tinystruct.system.HttpServer --import com.example.MyService
# Discover what's available
bin/dispatcher --help
bin/dispatcher --version
Default to this workflow: implement the @Action, run it immediately via bin/dispatcher <action> to confirm it behaves correctly in CLI mode, and only start the HTTP server (also via bin/dispatcher start ...) once you need to verify the web-facing path (e.g. mode = Mode.HTTP_POST, sessions, file uploads). Never hardcode a main(String[] args) as an app's entry point — bin/dispatcher (or bin/dispatcher.cmd on Windows) is the one entry point for every module.
Generating bin/dispatcher and bin/dispatcher.cmd
Every tinystruct project needs its launcher in bin/. The framework generates it — never write it by hand, and never copy it from another project or substitute a main(). ApplicationManager.init() writes the launcher for the current operating system into bin/ under the working directory whenever it is missing, from templates inside the tinystruct jar, with that jar's version filled in. Line endings and the executable bit are already right.
1. Find the tinystruct version the project builds against: the <tinystruct.version> property or the org.tinystruct:tinystruct dependency in pom.xml. The jar must be reachable, in ~/.m2/repository/org/tinystruct/tinystruct/<version>/ (run mvn dependency:resolve if it is not) or in the project's lib/.
2. From the project root, run the framework once:
java -cp ~/.m2/repository/org/tinystruct/tinystruct/<version>/tinystruct-<version>.jar \
org.tinystruct.system.Dispatcher --version
Replace <version> with the version found in step 1. On Windows use %USERPROFILE%\.m2\repository\org\tinystruct\tinystruct\<version>\tinystruct-<version>.jar and the same class. This creates only the script for the OS you ran it on, and only if it is not already there:
| Run on | Creates |
|---|---|
| Linux, macOS | bin/dispatcher (executable, LF) |
| Windows | bin\dispatcher.cmd (CRLF) |
3. Verify. From the project root run bin/dispatcher --version (Windows: bin\dispatcher.cmd --version). It prints Dispatcher (cli) (built on tinystruct-<version>), and the VERSION inside the script equals the jar's version. Then bin/dispatcher --help lists the commands and every imported action. Show the user the file you created.
4. Get both scripts by running step 2 on each OS, or let a teammate or CI on the other OS run it and commit the result. Commit both, so a checkout on either OS works. Do not try to fake the other OS with -Dos.name=…: on Windows it fails (UnsupportedOperationException from setPosixFilePermissions) and leaves an empty bin/dispatcher. Recommended .gitattributes, so a checkout does not corrupt the line endings:
…
Preguntas frecuentes
¿Qué es `bin/dispatcher`?
Es un script que arranca tu aplicación de tinystruct. Es la forma recomendada de ejecutar, probar y depurar tu código, y funciona tanto para la línea de comandos como para la web.
¿Por qué usar `bin/dispatcher` en lugar de un método `main()`?
`bin/dispatcher` está pensado para tinystruct y asegura que tus funciones se ejecuten en ambos modos (terminal y web) sin cambios. Simplifica el desarrollo y la configuración.
¿Cómo se crea `bin/dispatcher`?
El propio framework tinystruct lo genera automáticamente cuando no existe. Solo tienes que ejecutar una vez un comando de Java concreto y crea el script para tu sistema operativo.
Detalles
Descripción original del autor
Expert guidance for developing with the tinystruct Java framework. Use when working on the tinystruct codebase or any project built on tinystruct — including generating the bin/dispatcher and bin/dispatcher.cmd launcher scripts when a project lacks them, creating Application classes, @Action-mapped routes, unit tests, ActionRegistry, HTTP/CLI dual-mode handling, the built-in HTTP server, the event
repo: affaan-m/ECC
Popularidad
- Estrellas en GitHub
- 280 mil
- Posición en el ranking
- #424
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
accessibility
280 milAyuda a tu agente a crear interfaces accesibles para todos. Asegura que webs y apps funcionen bien para personas con discapacidad, como ciegas o con movilidad reducida.
agent-architecture-audit
280 milHace que tu agente compruebe que todo funciona bien. Encuentra y corrige problemas en sistemas de IA para que se comporten como se espera.
agent-eval
280 milAyuda a tu agente a comparar distintas herramientas de programación con IA. Mide cuál es más rápida, más barata y más fiable para tareas concretas.
agent-harness-construction
280 milHace que tu agente entienda mejor cómo realizar tareas. Optimiza las herramientas e instrucciones que usa para aumentar sus probabilidades de éxito.
Skills parecidas
shopify
260 milPermite que tu agente lea y actualice datos de una tienda Shopify, como productos, inventario, pedidos y clientes, a través de la API GraphQL de Shopify.
rest-graphql-debug
260 milAyuda a tu agente a descubrir por qué falla una llamada a una API REST o GraphQL, revisando la conexión, el inicio de sesión, el formato de la solicitud y la respuesta, capa por capa.
har-derived-api-client
260 milAyuda a tu agente a grabar el tráfico de red de un sitio web una vez y luego construir un cliente directo de API, para dejar de hacer clic en la página cada vez.