提供 tinystruct Java 框架开发指导,覆盖路由、测试、持久化与服务端能力。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "tinystruct-patterns" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/tinystruct-patterns/SKILL.md 2. 保存为 ~/.claude/skills/tinystruct-patterns/SKILL.md 3. 装好后重载技能,告诉我可以用了
请基于 tinystruct 演示如何创建一个 Application 类,并定义两个使用 @Action 映射的路由:GET /health 和 POST /users。请给出完整 Java 示例,并说明 ActionRegistry 需要如何注册。
返回可运行的 tinystruct 应用骨架代码,包含 Application、Action 路由实现与注册说明。
我有一个 tinystruct 的 Action,用于处理用户创建请求。请帮我设计单元测试方案,包含成功、参数缺失、JSON 格式错误三种场景,并给出测试代码示例。
返回针对 tinystruct Action 的测试思路与示例代码,覆盖正常与异常分支。
请用 tinystruct 说明如何基于 AbstractData 定义一个 User 实体,完成保存与查询,并在用户创建后触发事件,再通过 SSE 将结果推送给前端。请给出关键代码结构。
返回结合 AbstractData、事件系统与 SSE 的实现方案和核心代码示例。
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.
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.
Application modules by extending AbstractApplication.@Action.Context.Builder and Builders components.AbstractData POJOs.generate command.URLRequest and HTTPHandler.application.properties.The tinystruct framework treats any method annotated with @Action as a routable endpoint for both terminal and web environments. Applications are created by extending AbstractApplication, which provides core lifecycle hooks like init() and access to the request Context.
Routing is handled by the ActionRegistry, which automatically maps path segments to method arguments and injects dependencies. For data-only services, the native Builder and Builders components should be used for JSON serialization to maintain a zero-dependency footprint. The database layer uses AbstractData POJOs paired with XML mapping files for CRUD operations without external ORM libraries.
public class MyService extends AbstractApplication {
@Override
public void init() {
this.setTemplateRequired(false); // Disable .view lookup for data/API apps
}
@Override public String version() { return "1.0.0"; }
@Action("greet")
public String greet() {
return "Hello from tinystruct!";
}
// Path parameter: GET /?q=greet/James OR bin/dispatcher greet/James
@Action("greet")
public String greet(String name) {
return "Hello, " + name + "!";
}
}
@Action(value = "login", mode = Mode.HTTP_POST)
public String doLogin(Request<?, ?> request) throws ApplicationException {
request.getSession().setAttribute("userId", "42");
return "Logged in";
}
import org.tinystruct.data.component.Builder;
import org.tinystruct.data.component.Builders;
@Action("api/data")
public String getData() throws ApplicationException {
Builders dataList = new Builders();
Builder item = new Builder();
item.put("id", 1);
item.put("name", "James");
dataList.add(item);
Builder response = new Builder();
response.put("status", "success");
response.put("data", dataList);
return response.toString(); // {"status":"success","data":[{"id":1,"name":"James"}]}
}
import org.tinystruct.http.SSEPushManager;
@Action("sse/connect")
public String connect() {
return "{\"type\":\"connect\",\"message\":\"Connected to SSE\"}";
}
// Push to a specific client
String sessionId = getContext().getId();
Builder msg = new Builder();
msg.put("text", "Hello, user!");
SSEPushManager.getInstance().push(sessionId, msg);
// Broadcast to all
// Broadcast to all
SSEPushManager.getInstance().broadcast(msg);
import org.tinystruct.data.FileEntity;
…
为生产环境操作和自主代理执行提供破坏性行为防护与风险拦截。
为 Spring Boot 项目执行构建、测试、扫描与变更复核的发布前验证流程
帮助你判断解析结构化文本时何时用正则、何时引入大模型兜底。
端到端编排新功能开发流程,覆盖调研、规划、测试驱动实现、评审与提交把关。
调用 Nutrient DWS API 处理文档转换、OCR提取、脱敏签署与表单填写
帮助开发者快速掌握 Kotlin Ktor 服务端常用架构与测试模式。
连接 Tiny ERP,统一查询和处理商品、库存、订单与应收应付数据
帮助开发者用 Node/TypeScript 快速构建符合规范的 MCP 服务器与工具能力
提供 FastAPI 项目结构、鉴权、事务分层与测试的最佳实践指导
帮助开发者系统学习 Spring AI 与 MCP,构建智能体与大模型应用项目。
帮助智能体创建、编辑、校验并发布 Fine Structure 应用的远程 MCP 工具
帮助你设计与优化 Spring Boot 后端架构、接口与服务实现。