feat: add tinystruct-patterns skill and bootstrapping guidance#1336
feat: add tinystruct-patterns skill and bootstrapping guidance#1336m0ver wants to merge 7 commits intoaffaan-m:mainfrom
Conversation
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
📝 WalkthroughWalkthroughAdds documentation under Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
skills/tinystruct-patterns/references/system-usage.md (1)
20-31: Mark authentication/session values as illustrative-only.Line 22 hardcodes
"42"asuserId; add a short note that this is demo code and must be replaced by authenticated identity resolution in real usage to avoid insecure copy/paste.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/tinystruct-patterns/references/system-usage.md` around lines 20 - 31, The login/profile example hardcodes a demo session value ("42") in the login(Request) method and reads it in profile(Request) via request.getSession().setAttribute/getAttribute; update the comments to mark the hardcoded userId as illustrative-only and add a short note in or above the login(Request) method (and optionally above profile(Request)) stating this must be replaced with real authenticated identity resolution (e.g., verified user id from authentication token or user service) in production to prevent insecure copy/paste.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/tinystruct-patterns/references/architecture.md`:
- Around line 1-82: Add three top-level sections "When to Use", "How It Works",
and "Examples" to this reference and reorganize content under them: put a short
decision guide (when to pick tinystruct, target use-cases) under "When to Use";
move the Core Architecture, Key Abstractions (mentioning AbstractApplication,
`@Action`, ActionRegistry, Action, Context, Dispatcher, HttpServer) and Package
Map into "How It Works" with a brief explanation of dispatch flow and template
behavior (include templateRequired and getContext()/setVariable usage); and
create "Examples" that show minimal usage scenarios referencing
AbstractApplication.init(), setTemplateRequired(false), using `@Action-annotated`
methods and dispatcher invocation (bin/dispatcher) as concrete examples. Ensure
headings are Markdown-level (e.g., ## When to Use) and keep each section
concise.
In `@skills/tinystruct-patterns/references/data-handling.md`:
- Around line 1-34: Add the required skill-structure headings to this doc:
insert "When to Use", "How It Works", and "Examples" sections; move the existing
"Serialization" and "Parsing" content under "Examples" and keep the code
snippets as-is, add a short "When to Use" paragraph explaining scenarios to
prefer org.tinystruct.data.component.Builder (e.g., lightweight, zero external
deps) and a concise "How It Works" paragraph describing the Builder behavior and
integration with AbstractApplication result handling; ensure you mention Builder
and AbstractApplication by name so the guidance is explicit.
In `@skills/tinystruct-patterns/references/routing.md`:
- Around line 1-57: Normalize this reference by restructuring it into the
required skill-doc format: add a "When to Use" section explaining scenarios to
use the `@Action` annotation (e.g., routing CLI/HTTP commands, parameterized
paths), a "How It Works" section that summarizes Mode values, path parameter
type-to-regex mapping, automatic injection via ActionRegistry/Context (mention
Request and Response injection), and the regex generation behavior shown by
getUser and search; and add an "Examples" section that preserves the existing
code samples (the `@Action` declaration, getUser, search, and upload examples)
with brief captions. Ensure headings are exactly "When to Use", "How It Works",
and "Examples" and keep all referenced symbols (`@Action`, Mode, Request,
Response, ActionRegistry, Context, getUser, search, upload) so the content
remains identical but reorganized.
In `@skills/tinystruct-patterns/references/system-usage.md`:
- Around line 1-72: Add three required top-level sections "When to Use", "How It
Works", and "Examples" to this skill markdown and reorganize the existing
content into them: put a short guidance sentence about appropriate scenarios
(e.g., CLI vs HTTP modes, session use) under "When to Use"; move the explanation
of mechanics (Context CLI flags, session management examples using `@Action`
methods like echo(), login(), profile(), and the Event system with
OrderCreatedEvent and EventDispatcher usage) into "How It Works"; and
consolidate runnable snippets and commands (CLI usages, HTTP server start,
generate/sql examples, and the code examples shown) under "Examples". Preserve
all current text and code blocks (including symbols like `@Action`, getContext(),
Request.getSession(), OrderCreatedEvent, EventDispatcher.getInstance()) but
re-label and reorder them into these three headings to meet the required skill
format.
In `@skills/tinystruct-patterns/references/testing.md`:
- Around line 1-55: Add the required top-level sections "When to Use", "How It
Works", and "Examples" to the existing markdown: move the guidance about JUnit 5
and singleton ActionRegistry into "When to Use" as usage guidance, explain the
testing approach and test setup (Settings, setUp(), why fresh ActionRegistry
state) under "How It Works", and place the current code blocks and the "Testing
via ActionRegistry" snippet under "Examples" (keep the reference to
ActionRegistryTest). Ensure headings are exact: "When to Use", "How It Works",
and "Examples" and preserve the existing code samples and explanatory text
beneath the appropriate headings.
In `@skills/tinystruct-patterns/SKILL.md`:
- Around line 11-196: Rename the top-level heading "## When to Activate" to "##
When to Use" and insert two new top-level sections "## How It Works" and "##
Examples"; move or duplicate relevant explanatory content into "How It Works"
(describe framework behavior: Application extending AbstractApplication,
Context, `@Action` routing, Builder JSON handling, dispatcher generation via
ApplicationManager.init()) and create a concise "Examples" section that reuses
the existing code snippets (MyService, getUser, login, getData) as illustrative
examples. Ensure headings are exactly "## When to Use", "## How It Works", and
"## Examples" so the file conforms to the skills/*.md contract and retain
existing guidance about configuration, testing, and anti-patterns under
appropriate sections.
---
Nitpick comments:
In `@skills/tinystruct-patterns/references/system-usage.md`:
- Around line 20-31: The login/profile example hardcodes a demo session value
("42") in the login(Request) method and reads it in profile(Request) via
request.getSession().setAttribute/getAttribute; update the comments to mark the
hardcoded userId as illustrative-only and add a short note in or above the
login(Request) method (and optionally above profile(Request)) stating this must
be replaced with real authenticated identity resolution (e.g., verified user id
from authentication token or user service) in production to prevent insecure
copy/paste.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: aaf3dd05-cee8-496a-993d-9dfc02b3ad22
📒 Files selected for processing (6)
skills/tinystruct-patterns/SKILL.mdskills/tinystruct-patterns/references/architecture.mdskills/tinystruct-patterns/references/data-handling.mdskills/tinystruct-patterns/references/routing.mdskills/tinystruct-patterns/references/system-usage.mdskills/tinystruct-patterns/references/testing.md
Greptile SummaryThis PR adds a new Confidence Score: 4/5The skill files contain multiple still-unresolved P1 code example errors that will produce compile failures or silent test gaps for developers copying them verbatim. Several P1 findings from prior review rounds remain (API name mismatch, routing syntax inconsistency, empty-registry test), and a new P1 was found this round (missing
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming Request] --> B{Dispatcher}
B -->|CLI: bin/dispatcher path/args| C[CLI Mode]
B -->|HTTP: GET/POST/PUT/DELETE| D[HTTP Mode]
C --> E[ActionRegistry.getAction]
D --> E
E --> F{Mode Filter}
F -->|Mode.DEFAULT| G[Any trigger]
F -->|Mode.CLI| H[CLI only]
F -->|Mode.HTTP_GET / POST / etc.| I[HTTP method match]
G --> J[Inject Context / Request / Response]
H --> J
I --> J
J --> K[Invoke @Action method]
K --> L{Return type}
L -->|Builder| M[Auto-serialize to JSON]
L -->|String / primitive| N[Write to response / stdout]
Reviews (4): Last reviewed commit: "Update skills/tinystruct-patterns/refere..." | Re-trigger Greptile |
There was a problem hiding this comment.
2 issues found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/tinystruct-patterns/references/routing.md">
<violation number="1" location="skills/tinystruct-patterns/references/routing.md:16">
P2: The routing example incorrectly suggests `--id` argument metadata binds to `int id` without a route parameter, which is inconsistent with documented path-segment binding.</violation>
</file>
<file name="skills/tinystruct-patterns/references/data-handling.md">
<violation number="1" location="skills/tinystruct-patterns/references/data-handling.md:17">
P2: Serialization example contradicts the skill’s framework-native pattern by returning `response.toString()` instead of returning `Builder` directly.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
…ormat - Reorganize SKILL.md and all reference documents into "When to Use", "How It Works", and "Examples" sections to conform to project standards. - Refine data-handling.md example to return Builder objects directly, leveraging framework auto-serialization. - Simplify @action examples in routing.md for better readability. - Clarify framework mechanics including CLI bootstrapping via ApplicationManager.init(), event-driven architecture, and regex-based routing.
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
There was a problem hiding this comment.
2 issues found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/tinystruct-patterns/references/routing.md">
<violation number="1" location="skills/tinystruct-patterns/references/routing.md:34">
P2: Example mixes `Mode.HTTP_POST` with a CLI dispatcher command, contradicting mode semantics and likely misleading users.</violation>
</file>
<file name="skills/tinystruct-patterns/references/testing.md">
<violation number="1" location="skills/tinystruct-patterns/references/testing.md:50">
P2: Routing test example omits required app/bootstrap setup before querying singleton `ActionRegistry`, making the example potentially order-dependent.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/tinystruct-patterns/references/testing.md">
<violation number="1" location="skills/tinystruct-patterns/references/testing.md:28">
P2: Java test example is malformed: duplicated app initialization and missing closing brace leave `setUp()` unterminated.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR. |
What Changed
Introduced a new skill module:
skills/tinystruct-patterns/. This provides production-grade, pattern-based guidance for the tinystruct Java framework, following the repository's convention for framework-specific patterns.New files added:
Key Patterns & Breakthroughs:
bin/dispatcherentry point viaApplicationManager.init(), solving the primary "first-run" friction point for new users.@Actionmethods are built to run in both environments seamlessly.Buildercomponent, preventing runtime issues common when developers attempt to use external JSON libraries like Jackson.Why This Change
This change adds a critical piece of domain knowledge for Java developers using lightweight alternatives to Spring. The tinystruct framework treats terminal commands and web requests as identical primitives, a model that requires specific AI guidance to:
Contextobject.ApplicationManagergeneration utility, we automate the creation of the project's execution environment.This new module provides the high-level architectural constraints and "Red Flags" necessary for Claude to act as an expert pair programmer in this ecosystem.
Testing Done
ApplicationManagergeneration logic against the latest tinystruct source.@Actionregistration and Regex group mapping logic.bin/dispatchervsbin/dispatcher.cmdlogic matches the framework's platform-aware implementation.SKILL.mdagainst ECC's 800-line recommended maximum (this module is ~200 lines).Type of Change
fix:Bug fixfeat:New feature entryrefactor:Code refactoringdocs:Documentation expansiontest:Tests additionSecurity & Quality Checklist
feat: add tinystruct-patterns skillfollows repo standard.Builderfor JSON to avoid third-party dependency creep.Documentation
Summary by cubic
Adds a new
skills/tinystruct-patterns/module with production-ready patterns for the tinystruct Java framework, covering CLI bootstrapping, dual CLI/HTTP routing, native JSON, and testing. The routing guide adds parameter-to-regex mapping,Request/Responseinjection, and a clear HTTP mode matrix; the testing guide now showsSettingsinit,app.init()/app.invoke(), and registry path matching.New Features
skills/tinystruct-patterns/withSKILL.mdand reference guides.ApplicationManager.init()to generatebin/dispatcher(Windows/macOS/Linux).@Actionrouting (parameter → regex, dependency injection, mode coverage).org.tinystruct.data.component.Builder; JUnit 5 guide expanded with proper setup andActionRegistrymatching.Refactors
Builderdirectly; clarified event bus, context handling, and regex-based routing.Written for commit 722c052. Summary will update on new commits.
Summary by CodeRabbit