/formae:formae-importfrom formae
Imports unmanaged/discovered cloud resources into formae IaC codebase by extracting them as PKL and merging into existing forma files.
Ships in formae. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Bring only explicitly selected discovered (unmanaged) resources under formae management using the selected maintained or disposable Pkl workspace.
Routing note: The
formae-authorrouter dispatches here when the user wants to bring EXISTING cloud resources under management (as opposed to authoring new infrastructure from scratch).
profile)These tools hit the formae agent's API directly and take an optional profile argument. If the user is working against a specific environment (e.g. prod, staging), pass that profile name as profile on each agent call in this flow (extract_resources, list_resources, apply_forma) so it targets that environment — for this session only, without changing global state. If which environment they mean is unclear and list_profiles shows more than one, ask first. Never use use_profile to "set up" this session — the active profile is global and shared with the user's CLI and any other open sessions. When no profile is named, the active profile is used. Requires formae >= 0.87.0.
Call get_codebase_context with the chosen profile and actual harness working directory, or reuse the operation's selection. Follow formae-author for candidate selection and missing/corrupt registry handling. For none, prepare a complete destination-stack workspace with prepare_authoring; a new destination uses new_stacks and its configured targets. Hosted users do not need to opt into a maintained project. Carry the returned context on every apply. For codebase, use only the selected project's complete main forma.
First call get_agent_stats to get an overview of unmanaged resource counts by provider. Then use targeted list_resources queries with specific type filters (e.g., managed:false type:AWS::S3::Bucket) to drill down. Never call list_resources with just managed:false — on real accounts this returns too much data.
Present a summary of what's available by type and count.
Ask the user which resource(s) they want to import. They may select one, several, or all of a given type.
Call extract_resources with a query that matches the selected resources. This returns the PKL representation of those resources as they exist in the cloud right now.
For a maintained codebase, read the selected project's forma files to understand:
extends "@formae/forma.pkl", or the legacy amends "@formae/forma.pkl", and has the forma {} block), and how helper modules are imported and spread into itvars.pkl), parametrized modules@formae/, @aws/, local importsFor the conventions behind this layout, see formae://docs/forma-structure.
For a disposable workspace, read the complete prepared main forma and PklProject. Merge only the selected import declarations into that full destination scope, adding pinned schema dependencies when necessary. Preserve existing targets, policies, references and generators. The resource extraction is an import fragment, never a full reconcile replacement.
Before writing any code, confirm with the user which stack the imported resources should belong to. Suggest the most appropriate stack based on:
For guidance on stack boundary decisions, see formae://docs/stack-design.
CHECKPOINT: Do not proceed until the user confirms the stack.
Use the target from the extracted resource. It's already known from discovery since the agent discovers per-target.
Merge the extracted PKL into the existing codebase following its conventions:
Critical: match the resource by label, or rename it deliberately via alias. Formae identifies resources by the triplet (stack, type, label). The agent matches an imported resource to its existing unmanaged row by that label.
alias makes formae plan a brand-new create instead of a bring-under-management.vpc-008eef40942ac586b): set alias to the discovered label and label to the desired name. Formae adopts the resource AND renames it in one apply, preserving its identity. Only do this when the user wants a rename — confirm the new name with them first.new vpc.VPC {
label = "production-vpc" // desired name
alias = "vpc-008eef40942ac586b" // the discovered label, verbatim
cidrBlock = "172.31.0.0/16"
}
Critical: PKL module composition. New resources must be part of the module tree rooted at the main forma file. There are two approaches:
imported by the main forma file and its resources spread into the forma {} block (e.g., ...importedModule.resources)A standalone PKL file that defines its own stack and target will not work with reconcile mode — it would be treated as a separate stack declaration and cause existing resources to be destroyed.
Additional guidelines:
vars.pkl with shared config, reference it)label unless the user asked for a rename — and when they do, carry the old label in alias (see above)Run apply_forma with mode: reconcile, simulate: true on the main forma file (not the helper module).
Tell the user you're checking that the import won't cause any unintended changes — only the expected "bring under management" operations for the newly added resources.
Check the simulation result via get_command_status. The stopping criteria are strict:
alias when you deliberately renamed. A bring-under-management that also shows a change label from "<old>" to "<new>" line is expected and correct when the user asked for a rename.alias points at one. The usual cause is an accidental label change with no alias. Either restore the exact discovered label, or — if a rename was intended — add alias set to the discovered label, then re-simulate.Loop until the simulation shows only "bring under management" for the imported resources (plus a change label line on any resource the user chose to rename) and nothing else, or ask the user for help if stuck.
Once the simulation looks correct:
formae-apply, carrying the selected context, optional editable message and any final drift review controlsget_command_status and report the resultIf unrelated actionable drift blocks the import simulation, follow formae-fix-code-drift for all absorb/revert decisions and final combined review; do not force. After terminal outcome, clean up the disposable directory when no retry needs it. Import remains an explicit management choice, never an automatic consequence of desired extraction.
pkl eval to evaluate forma files — ALWAYS use formae eval --output-consumer machine. Forma files use formae-specific extensions that only the formae CLI can resolve, and --output-consumer machine ensures parseable output instead of human-formatted text.alias makes formae plan a create. To rename on purpose, set alias to the discovered label (and confirm the new name with the user first).alias points at one. Fix it.change label line on resources the user chose to rename) and no other changesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
formae@formae-marketplace is listed by platform-engineering-labs/formae-marketplace — review the source before installing
npx claudepluginhub platform-engineering-labs/formae-marketplace --plugin formae23 skills in this plugin
/formae-applyUse when the user wants to deploy infrastructure, apply a forma file, reconcile a stack, update a stack, or make planned infrastructure changes/formae-authorUse when the user wants to start authoring formae infrastructure or deploy something NEW with formae — e.g. 'I want to deploy X with formae', 'build a k8s app with formae', 'set up infrastructure for Y', 'create a new forma file for my service', 'write formae IaC for Z'. The front door that triages where the work happens, sets up plugin schema deps, and dispatches to focused authoring skills. NOT for applying an existing forma file (use formae-apply) or operating existing infra./formae-configUse when the user wants to switch, list, save, edit, delete, or compare formae configuration profiles in ~/.config/formae/Other plugins' skills for the same job