
Templated Workflows: Scaffolding Projects with spackle and scaffold
Source:vignettes/articles/templated-workflows.Rmd
templated-workflows.RmdStanding up a new quartifyr project (the repo README’s “Standing up a
new project” walks through this by hand) means copying a handful of
files into a consistent shape: _extensions/, a
_quarto.yml with output-dir: report/shell, a
shell .qmd with the right frontmatter, and
reportifyr’s own
report/standard_footnotes.yaml/
report/config.yaml. That’s a good fit for a
project-template filler rather than copy-paste-and-edit; this page is a
suggested pattern, not a maintained quartifyr
integration. Nothing described here is bundled with the repo.
A2-ai/spackle is
exactly that kind of tool, from the same organization behind
reportifyr, pyro, and rv: a
spackle.toml at a template’s root declares a set of
slots (prompted values, with types and defaults), and any file
with a .j2/.tera extension in the template
gets rendered through Tera
with those slots in scope; spackle fill walks the template,
prompts for each slot, and writes the filled-in project to a target
directory.
Sketch: a quartifyr report starter
A spackle.toml for a quartifyr report template might
declare the handful of values that actually vary per project; everything
else (the extension copies, the filter list, the output-dir
convention) stays fixed:
# spackle.toml
[slots.org_name]
type = "string"
description = "Organization name, shown on the title page"
[slots.reference_doc]
type = "string"
description = "Path to the org's built reference-doc"
default = "../../inst/templates/org-reference.docx"
[slots.project_code]
type = "string"
description = "Project/protocol code (e.g. ACME-001)"
[slots.report_number]
type = "string"
description = "Report number (e.g. RPT-2026-014)"
[slots.lead_scientist]
type = "string"
description = "Lead scientist name and credentials"And a templated shell, report.qmd.tera, pre-filling the
frontmatter a new project always needs while leaving the body for the
author to write:
---
title: "{{ project_code }} Report"
document-status: "draft"
lead-scientist: "{{ lead_scientist }}"
project: "{{ project_code }}"
report_number: "{{ report_number }}"
header-format: "{project} - {report_number}"
title-page-extra:
- label: "Sponsor"
value: "{{ org_name }}"
format: docx
filters:
- quarto-plus
- quartifyr
---
{{< toc >}}
# Introduction
{{< body-start >}}_quarto.yml (setting
project: {output-dir: report/shell}) and the physical
_extensions/ copies can be plain, unfilled files in the
same template; spackle only runs slots through files with a
.j2/.tera extension, so anything that doesn’t
need per-project values just gets copied as-is.
Why this pairs well with quartifyr specifically
- The values that vary are small in number: org name, project code, report number, lead scientist, exactly the shape spackle’s slot model is built for, rather than a general-purpose scaffolding tool that would be overkill here.
-
quartifyr already treats “one project = one directory with a
fixed shape” as load-bearing (the
report/shellconventionrender_report()depends on; seevignette("architecture")). A template filler that reproduces that shape exactly, every time, removes a whole class of “forgot to setoutput-dir” mistakes. -
An org’s reference-doc rarely changes once built
(see
vignette("styling")), soreference_docis a good candidate for a slot with adefault; most new projects accept it as-is, but a project reusing a different org’s styling can override it at fill time.
Trying it
# spackle itself: see https://github.com/A2-ai/spackle for install instructions
spackle info /path/to/your-template
spackle fill /path/to/your-template --out my-new-reportThen follow the rest of the repo README’s “Standing up a new project”
section (installing the extensions, running
reportifyr::initialize_report_project() and
quartifyr::initialize_quartifyr_project()) against the
filled-in directory.
A different shape of repetition: scaffolding inside an existing project
spackle above fills a whole new project directory once, from nothing.
hay-kot/scaffold
covers a complementary case: a pattern that recurs inside a
project you already have, any number of times, as the project grows. It
keeps a .scaffolds/ directory of named generators (each a
scaffold.yaml plus Go-templated files) checked into the
project itself, and scaffold new <name> prompts for
that generator’s values and writes the result, same as spackle but
scoped to one recurring pattern rather than a whole project tree.
The repo README’s “Standing up a new org” section is that shape of
task: copy inst/python/styles/default.yaml to
<org>.yaml, edit it, then run
styling_build_reference_docx()/quartifyr-styling build
with override/out pointed at both new paths.
It’s the same three steps by hand every time a new org needs a look,
unlike “stand up a project,” which happens once per project.
A .scaffolds/org-style/scaffold.yaml sketch, using
scaffold’s template
scaffold mode (rewrites sends a file under the
scaffold’s own templates/ into a path inside the
existing project, rather than a whole new directory):
messages:
pre: |
Adding a new org style override.
post: |
Now build the reference-doc:
quartifyr-styling build --style /path/to/inst/python/styles/default.yaml \
--override {{ .Scaffold.org_slug }}.yaml \
--out {{ .Scaffold.org_slug }}-reference.docx
questions:
- name: "org_slug"
prompt:
message: "Org slug (e.g. acme-pharma)"
rewrites:
- from: templates/org-style.yaml
to: styles/{{ .Scaffold.org_slug }}.yamlwith templates/org-style.yaml seeded from
default.yaml’s own fields (fonts, colors, page setup,
table.header_bold, …), left at their defaults as a starting
point for the new org to edit.
Why the two pair well together
- spackle answers “zero to a new project directory”: org name, project code, report number, filled in once per project.
- scaffold answers “this checkout needs another instance of a pattern
it already has”: another org style, another
examples/entry, repeated as often as the project grows. - Both are optional, external suggestions, same as the rest of this page: nothing here is bundled with or maintained by quartifyr.