Agent skill

Tinystruct Patterns

by affaan-m in affaan-m/ECC

Expert guidance for developing with the tinystruct Java framework.

MITAuto-check passedBackend & APIs

Install Tinystruct Patterns

skills CLI
$ npx skills add affaan-m/ECC --skill tinystruct-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install affaan-m/ECC tinystruct-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/tinystruct-patterns .claude/skills/tinystruct-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tinystruct-patterns
GitHub stars
274k
Used in
1 other repo
Token cost
~3k tokens
SKILL.md length
777 words
Files
7 (incl. references)
Skills in repo
657
Repo updated
First seen
Licence
MIT

At a glance

Expert guidance for developing with the tinystruct Java framework.

  • Works in 3 steps: Extend org.tinystruct.mcp.MCPTool. → Annotate operations with @Action and… → Accept parameters as explicit method…
  • Working on the tinystruct codebase
  • SKILL.md covers Core Principle, When to Activate, How It Works and Examples, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Tinystruct Patterns is an agent skill from affaan-m/ECC. 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.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/architecture.md`, `references/data-handling.md` and `references/database.md`).

It sits in Backend & APIs, covering Realtime and WebSockets, File uploads and storage and Unit testing. It works with Java and Model Context Protocol. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.

When your agent uses it

  • Working on the tinystruct codebase
  • Any project built on tinystruct — including creating Application classes
  • @Action-mapped routes
  • HTTP/CLI dual-mode handling

Example prompts

  • “/tinystruct-patterns”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Extend org.tinystruct.mcp.MCPTool.
  2. Annotate operations with @Action and declare parameters using @Argument within the arguments array.
  3. Accept parameters as explicit method arguments matching the keys in @Argument. (Do not use getContext().getAttribute(...) for tool…

What it can do on your machine

Read from SKILL.md and the folder at commit ef648e0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java, xml, bash and properties).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Tinystruct Patterns loads about 3k tokens when it runs, and up to ~6.9k if it reads all its reference files. Until then it costs about 122 tokens; SKILL.md has 777 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~122
When it runs · the whole SKILL.md, loaded when a task matches
~3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from affaan-m/ECC at commit ef648e0, republished under its MIT licence (© affaan-m). 777 words, ~2,959 tokens.

Download SKILL.mdSave it as .claude/skills/tinystruct-patterns/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
tinystruct-patterns
description
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.
metadata.origin
ECC

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.

When to Activate

When to Use
  • Creating new Application modules by extending AbstractApplication.
  • Defining routes and command-line actions using @Action.
  • Handling per-request state via Context.
  • Performing JSON serialization using the native Builder and Builders components.
  • Working with database persistence via AbstractData POJOs.
  • Generating POJOs from database tables using the generate command.
  • Implementing Server-Sent Events (SSE) for real-time push.
  • Handling file uploads via multipart data.
  • Making outbound HTTP requests with URLRequest and HTTPHandler.
  • Configuring database connections or system settings in application.properties.
  • Debugging routing conflicts (Actions) or CLI argument parsing.

How It Works

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.

Examples

Basic Application (MyService)
java
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 + "!";
    }
}
HTTP Mode Disambiguation (login)
java
@Action(value = "login", mode = Mode.HTTP_POST)
public String doLogin(Request<?, ?> request) throws ApplicationException {
    request.getSession().setAttribute("userId", "42");
    return "Logged in";
}
Native JSON Data Handling (Builder + Builders)
java
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"}]}
}
SSE (Server-Sent Events)
java
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);
File Upload
java
import org.tinystruct.data.FileEntity;

@Action(value = "upload", mode = Mode.HTTP_POST)
public String upload(Request<?, ?> request) throws ApplicationException {
    List<FileEntity> files = request.getAttachments();
    if (files != null) {
        for (FileEntity file : files) {
            System.out.println("Uploaded: " + file.getFilename());
        }
    }
    return "Upload OK";
}

MCP Server and Tools Integration

tinystruct provides native support for the Model Context Protocol (MCP) starting with SDK version 1.7.26. The MCP APIs (e.g., org.tinystruct.mcp.MCPTool, org.tinystruct.mcp.MCPServer, org.tinystruct.mcp.MCPException) are included directly in the core dependency:

xml
<dependency>
    <groupId>org.tinystruct</groupId>
    <artifactId>tinystruct</artifactId>
    <version>1.7.26</version>
</dependency>

SECURITY WARNING (Prompt Injection): Tool return values are fed directly back into the AI model's context window. You MUST validate and sanitize all caller-supplied arguments before including them in the tool's return string. Failure to sanitize inputs can allow an attacker to inject adversarial instructions (Prompt Injection) that override the model's behavior. Always validate length, character sets, and nullity.

To create an MCP Tool:

  1. Extend org.tinystruct.mcp.MCPTool.
  2. Annotate operations with @Action and declare parameters using @Argument within the arguments array.
  3. Accept parameters as explicit method arguments matching the keys in @Argument. (Do not use getContext().getAttribute(...) for tool arguments).
java
import org.tinystruct.mcp.MCPTool;
import org.tinystruct.mcp.MCPException;
import org.tinystruct.system.annotation.Action;
import org.tinystruct.system.annotation.Argument;

public class MyCustomTool extends MCPTool {
    public MyCustomTool() {
        super("custom", "A custom tool for demonstrating MCP");
    }

    @Action(
        value = "custom/hello",
        description = "Say hello to someone",
        arguments = {
            @Argument(key = "name", description = "The name to greet", type = "string", optional = false)
        }
    )
    public String hello(String name) throws MCPException {
        // SECURITY: Validate/sanitize tool inputs before returning to the model
        // to prevent prompt injection vulnerabilities.
        if (name == null || name.length() > 50 || !name.matches("^[a-zA-Z0-9 ]+$")) {
            throw new MCPException("Invalid name provided");
        }
        return "Hello, " + name + "!";
    }
}

To deploy an MCP Server:

  1. Extend org.tinystruct.mcp.MCPServer.
  2. Override init() and register your tools using this.registerTool(). The framework automatically scans and maps the @Action methods.
java
import org.tinystruct.mcp.MCPServer;

public class MyMCPServer extends MCPServer {
    @Override
    public void init() {
        super.init();
        this.registerTool(new MyCustomTool());
    }

    @Override
    public String version() {
        return "1.0.0";
    }
}

Run the server via the dispatcher:

bash
bin/dispatcher start --import org.tinystruct.system.HttpServer --import com.example.MyMCPServer

Configuration

Settings are managed in src/main/resources/application.properties.

properties
# Database
driver=org.h2.Driver
database.url=jdbc:h2:~/mydb
database.user=sa
database.password=

# Server
default.home.page=hello
server.port=8080

# Locale
default.language=en_US

# Session (Redis for clustered environments)
# default.session.repository=org.tinystruct.http.RedisSessionRepository
# redis.host=127.0.0.1
# redis.port=6379

Access config values in your application:

java
String port = this.getConfiguration("server.port");
Show full SKILL.md (325 more words)Show less

Red Flags & Anti-patterns

SymptomCorrect Pattern
Importing com.google.gson or com.fasterxml.jacksonUse org.tinystruct.data.component.Builder / Builders.
Using List<Builder> for JSON arraysUse Builders to avoid generic type erasure issues.
ApplicationRuntimeException: template not foundCall setTemplateRequired(false) in init() for API-only apps.
Annotating private methods with @ActionActions must be public to be registered by the framework.
Hardcoding main(String[] args) in appsUse bin/dispatcher as the entry point for all modules.
Manual ActionRegistry registrationPrefer the @Action annotation for automatic discovery.
Action not found at runtimeEnsure class is imported via --import or listed in application.properties.
CLI arg not visiblePass with --key value; access via getContext().getAttribute("--key").
Two methods same path, wrong one firesSet explicit mode (e.g., HTTP_GET vs HTTP_POST) to disambiguate.

Best Practices

  1. Granular Applications: Break logic into smaller, focused applications rather than one monolithic class.
  2. Setup in init(): Leverage init() for setup (config, DB) rather than the constructor. Do NOT call setAction() — use @Action annotation.
  3. Mode Awareness: Use the Mode parameter in @Action to restrict sensitive operations to CLI only or specific HTTP methods.
  4. Context over Params: For optional CLI flags, use getContext().getAttribute("--flag") rather than adding parameters to the method signature.
  5. Asynchronous Events: For heavy tasks triggered by events, use CompletableFuture.runAsync() inside the event handler.

Technical Reference

Detailed guides are available in the references/ directory:

Reference Source Files (Internal)

  • src/main/java/org/tinystruct/AbstractApplication.java — Core base class with lifecycle hooks
  • src/main/java/org/tinystruct/system/annotation/Action.java — Annotation & Modes
  • src/main/java/org/tinystruct/application/ActionRegistry.java — Routing Engine
  • src/main/java/org/tinystruct/data/component/Builder.java — JSON object serializer
  • src/main/java/org/tinystruct/data/component/Builders.java — JSON array serializer
  • src/main/java/org/tinystruct/data/component/AbstractData.java — Base POJO class with CRUD
  • src/main/java/org/tinystruct/data/Mapping.java — Mapping XML parser
  • src/main/java/org/tinystruct/data/tools/MySQLGenerator.java — POJO generator reference
  • src/main/java/org/tinystruct/data/component/FieldType.java — SQL-to-Java type mappings
  • src/main/java/org/tinystruct/data/component/Condition.java — Fluent SQL query builder
  • src/main/java/org/tinystruct/http/SSEPushManager.java — SSE connection management
  • src/test/java/org/tinystruct/application/ActionRegistryTest.java — Registry test examples
  • src/test/java/org/tinystruct/system/HttpServerHttpModeTest.java — HTTP integration test patterns

© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/tinystruct-patterns of affaan-m/ECC.

  • SKILL.md
  • references/architecture.md
  • references/data-handling.md
  • references/database.md
  • references/routing.md
  • references/system-usage.md
  • references/testing.md

Open the folder on GitHubat commit ef648e0

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in affaan-m/ECC, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Tinystruct Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Tinystruct Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tinystruct Patterns this skillaffaan-m/ECC274k1 repos~3kAutomated safety check: PassMIT
System Bridge Testing Workflowtimmo001/system-bridge356—~843Automated safety check: PassApache-2.0
Edt MCP Build TestDitriXNew/EDT-MCP295—~1.4kAutomated safety check: PassAGPL-3.0
Eclipse Testgradusnikov/eclipse-chatgpt-plugin171—~1kAutomated safety check: PassMIT
Durable Objectshodgef/apiker1274 repos~1.5kAutomated safety check: PassMIT
Debug DashboardBlackBeltTechnology/pi-agent-dashboard316—~1.6kAutomated safety check: PassMIT

Similar skills

  • System Bridge Testing Workflow

    timmo001/system-bridge

    How to test System Bridge - Go table-driven tests and commands, web-client quality checks (lint/typecheck/format, no unit tests), the Chrome DevTools MCP interactive test loop for UI and WebSocket…

    356 GitHub stars~843 tokensUpdated today
    Testing & QAAuto-check passed
  • Edt MCP Build Test

    DitriXNew/EDT-MCP

    How to build the EDT-MCP Eclipse plugin (Tycho/Maven) and run its unit and e2e tests, plus the test conventions for this repo.

    295 GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Eclipse Test

    gradusnikov/eclipse-chatgpt-plugin

    Run JUnit tests in Eclipse projects — all tests, by package, by class, or individual test methods.

    171 GitHub stars~1k tokensUpdated 9 days ago
    Testing & QAAuto-check passed
  • Durable Objects

    hodgef/apiker

    Create and review Cloudflare Durable Objects. An agent skill from hodgef/apiker.

    127 GitHub starsUsed in 4 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Debug Dashboard

    BlackBeltTechnology/pi-agent-dashboard

    Diagnose problems in the running pi-agent-dashboard system: server.log, /api/health, bridge WebSocket connectivity, vitest triage, known-issue FAQ entries.

    316 GitHub stars~1.6k tokensUpdated today
    Backend & APIsAuto-check passed
  • Official

    General Supabase skill for database, auth, Edge Functions, Realtime and storage work, plus client libraries, migrations, security audits, debugging and reading logs.

    2.7k GitHub starsUsed in 3 repos~3.6k tokens
    Backend & APIsAuto-check passed

More from affaan-m/ECC

All 657 skills in this repo
  • Skill Stocktake

    affaan-m/ECC

    Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.

    274k GitHub starsUsed in 5 repos~1.9k tokens
    Auto-check passed
  • Videodb

    affaan-m/ECC

    Ingest, index, search, edit, and monitor video and audio with the VideoDB Python SDK — upload from files, URLs, or RTSP feeds, build spoken and scene indexes with timestamped search and playable…

    274k GitHub starsUsed in 3 repos~3.5k tokens
    Auto-check: notes
  • Rules Distillation

    affaan-m/ECC

    Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.

    274k GitHub starsUsed in 2 repos~2.3k tokens
    Auto-check passed
  • Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.

    274k GitHub stars~2.9k tokensUpdated 2 days ago
    Auto-check passed
  • Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.

    274k GitHub starsUsed in 1 repo~623 tokens
    Auto-check passed
  • Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

    274k GitHub stars~3.5k tokensUpdated 2 days ago
    Auto-check passed

Questions about Tinystruct Patterns

What does Tinystruct Patterns do?

Expert guidance for developing with the tinystruct Java framework. Tinystruct Patterns is an agent skill from affaan-m/ECC. Expert guidance for developing with the tinystruct Java framework.

When should I use Tinystruct Patterns?

Tinystruct Patterns fits situations like: working on the tinystruct codebase; any project built on tinystruct — including creating Application classes; @Action-mapped routes; HTTP/CLI dual-mode handling.

How do I install Tinystruct Patterns in Claude Code?

Run `npx skills add affaan-m/ECC --skill tinystruct-patterns -a claude-code`. Or copy the skill folder (skills/tinystruct-patterns in affaan-m/ECC) into .claude/skills/tinystruct-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Tinystruct Patterns in Codex?

Run `npx skills add affaan-m/ECC --skill tinystruct-patterns -a codex`. Or copy the skill folder (skills/tinystruct-patterns in affaan-m/ECC) into .agents/skills/tinystruct-patterns in your project. Codex loads it when a task matches its description.

Can I use Tinystruct Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill tinystruct-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tinystruct-patterns, .gemini/skills/tinystruct-patterns, .github/skills/tinystruct-patterns and .opencode/skills/tinystruct-patterns in your project.

What does Tinystruct Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Tinystruct Patterns is instructions for the agent only.

Does Tinystruct Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Tinystruct Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Tinystruct Patterns use?

Tinystruct Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Tinystruct Patterns use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4k tokens, read only when the agent opens those files.

What are the alternatives to Tinystruct Patterns?

Skills that share tags, products or a category with Tinystruct Patterns: System Bridge Testing Workflow (timmo001/system-bridge, 356 stars), Edt MCP Build Test (DitriXNew/EDT-MCP, 295 stars), Eclipse Test (gradusnikov/eclipse-chatgpt-plugin, 171 stars) and Durable Objects (hodgef/apiker, 127 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tinystruct Patterns?

affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 274,360 GitHub stars. The repository holds 657 skills in this directory. The repository was last updated on October 5, 2026.

Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.