tinystruct-patterns
하는 일
이 가이드는 tinystruct Java 프레임워크로 애플리케이션을 만드는 방법을 알려 줍니다. 추가 설정 없이 애플리케이션이 명령줄(터미널)과 웹 모두에서 작동하도록 하는 데 중점을 둡니다.
사용하는 경우
- ✓tinystruct로 새 프로젝트를 시작할 때.
- ✓애플리케이션이 명령줄과 웹에서 모두 실행되기를 원할 때.
- ✓프로젝트의 시작 스크립트(bin/dispatcher)를 생성할 때.
스킬 링크
https://github.com/affaan-m/ECC/blob/main/skills/tinystruct-patterns/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“tinystruct 프로젝트의 시작 스크립트를 어떻게 만드나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
Tinystruct는 주요 도구로 `bin/dispatcher`(Windows에서는 `bin/dispatcher.cmd`) 스크립트를 사용합니다. 함수가 터미널과 웹 서버 환경 모두에서 통합된 방식으로 실행될 수 있게 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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:
…
자주 묻는 질문
`bin/dispatcher`란 무엇인가요?
tinystruct 애플리케이션을 시작하는 스크립트입니다. 명령줄과 웹 모두에서 코드를 실행, 테스트, 디버그하는 권장 방법입니다.
`main()` 메서드 대신 `bin/dispatcher`를 쓰는 이유는 무엇인가요?
`bin/dispatcher`는 tinystruct를 위해 만들어졌으며, 함수가 변경 없이 두 모드(터미널과 웹) 모두에서 실행되도록 보장합니다. 개발과 설정을 단순하게 합니다.
`bin/dispatcher`는 어떻게 만들어지나요?
존재하지 않을 때 tinystruct 프레임워크가 자동으로 생성합니다. 특정 Java 명령을 한 번만 실행하면, 사용하는 운영체제에 맞는 스크립트를 만들어 줍니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 280k
- 순위
- #424
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
accessibility
280k에이전트가 모든 사람이 쓸 수 있는 인터페이스를 만들도록 돕습니다. 시각 장애나 운동 장애가 있는 사람도 쓸 수 있게 합니다.
agent-architecture-audit
280k에이전트가 모든 것이 올바르게 작동하는지 점검하도록 돕습니다. AI 시스템의 문제를 찾아 고쳐서 기대대로 작동하게 합니다.
agent-eval
280k에이전트가 서로 다른 AI 코딩 도구를 비교하도록 돕습니다. 특정 작업에서 어느 도구가 더 빠르고, 저렴하고, 믿을 만한지 측정합니다.
agent-harness-construction
280k에이전트가 작업을 더 잘 이해하도록 돕습니다. 에이전트가 쓰는 도구와 지시문을 최적화해 성공 가능성을 높입니다.
비슷한 스킬
shopify
260kShopify GraphQL API로 상품, 재고, 주문, 고객 같은 스토어 데이터를 읽고 업데이트하도록 에이전트를 돕습니다.
rest-graphql-debug
260kREST나 GraphQL API 호출이 실패하는 이유를 찾도록 돕습니다. 연결, 로그인, 요청 형식, 응답을 한 층씩 확인합니다.
har-derived-api-client
260k웹사이트의 네트워크 트래픽을 한 번 기록해 직접 API 클라이언트를 만들도록 돕습니다. 매번 페이지를 클릭하지 않아도 됩니다.