Snippetory
A code generation platform for java with intact templates. A sql generator for prepared statements. A fluent API for easy application.
Install / Use
/learn @jproggy/SnippetoryREADME
<a href="https://www.jproggy.org/snippetory/intact-templates/"><img src="https://www.jproggy.org/img/snippetorytx60.png" /></a>
A code generation platform for java
Fluent API
Syntaxes.FLUYT.parse("Hello $who").set("who", "world").render(System.out);
Simple Syntax
Locations
$name
Locations can have attributes.
$label(pad="15" pad.fill="."): $name(default="Snippetory")
Regions
$fields{
$name(pad="15"pad.fill="."): $value(number="#.###,##" date="long")
}$
Regions allow loops or conditions
void renderFields(Map<String, Object> fields, Template fieldsTpl) {
field.forEach(k, v ->
fieldsTpl
.get("fields")
.set("name", k)
.set("value", v)
.render()
)
}
Regions have attributes like locations.
$products(delimiter="------------\n"){
...
}$
Comments
/// start with a triple slash
Syntax selector
To keep the template intact there are several syntaxes.
<!-- Syntax:FLUYT_X -->
<nav>
<ul>
<t:menu>
<li><a href="$page(enc='url')">$text</a></li>
</t:menu>
</ul>
</nav>
The tag syntax allowes the IDE to support in closing the tags and keep the overview with code folding...
// Syntax:FLUYT_CC
// $getters{
public $type get$Name$() {
return $name$;
}
// }$
And having valid java code lets the IDE maintain the templates during re-factorings.
SQL module
With the StatementRepository templates produce prepared statements in JDBC
-- $variables{
set :currency = 'EUR';
set :catIds = 17;
-- }$
SELECT products.*
FROM products
LEFT OUTER JOIN prices ON (
products.id = prices.productId
AND prices.currency = :currency
)
WHERE products.id IN (
SELECT prodCat.product.id
FROM prodCat
/*${*/
WHERE prodCat.categoryId IN (:catIds/*delimiter=', '*/)
/*}$*/
)
Having prepared variables makes it easy to test the intact statement, a fluent API gives access to the data.
Statement stmt = new SqlContext()
.uriResolver(UriResolver.resource("org/jproggy/sample"))
.connections(() -> connection)
.getRepository("DbAccessRepo.sql")
.get("statement1");
catIds.forEach(id -> stmt.append("catId", id));
List<Object[]> result = stmt.set("currency", "USD")
.list(SQL.objects());
So much more
- The platform is extensible concerning
- A
TemplateWrapperhelps with implementing cross cutting concerns - Groovy integration
- ...
Further information can be found on the homepage or the project blog.
Related Skills
oracle
339.1kBest practices for using the oracle CLI (prompt + file bundling, engines, sessions, and file attachment patterns).
prose
339.1kOpenProse VM skill pack. Activate on any `prose` command, .prose files, or OpenProse mentions; orchestrates multi-agent workflows.
Command Development
83.8kThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
Plugin Structure
83.8kThis skill should be used when the user asks to "create a plugin", "scaffold a plugin", "understand plugin structure", "organize plugin components", "set up plugin.json", "use ${CLAUDE_PLUGIN_ROOT}", "add commands/agents/skills/hooks", "configure auto-discovery", or needs guidance on plugin directory layout, manifest configuration, component organization, file naming conventions, or Claude Code plugin architecture best practices.
