skills/formae-fix-code-drift/SKILL.md
Use when the user wants to check for infrastructure drift, see what changed out-of-band, or absorb/overwrite out-of-band changes into their IaC codebase
npx skillsauth add platform-engineering-labs/formae-mcp formae-fix-code-driftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
When absorbing drift, you MUST run a reconcile simulation immediately after editing the PKL file — in the same turn, without asking, without pausing, without reporting success. An absorption is only complete when the simulation confirms no changes required. Telling the user "done" after an edit without simulating is WRONG.
Ask the user whether they want to check a specific stack or all stacks. Then call list_changes_since_last_reconcile with the appropriate stack parameter (or omit it for all stacks).
The drift endpoint reports modifications since the last reconcile. However, drift may have already been absorbed into the IaC code without a reconcile having been run since. To distinguish true drift from already-absorbed drift:
list_changes_since_last_reconcile returns modifications, ask the user for the path to their main forma fileapply_forma with mode: reconcile, simulate: true, force: true on that fileOnly present true drift to the user. For already-absorbed drift, mention that those resources were previously absorbed and will clear on the next reconcile.
If no true drift: Report that all stacks are clean — any reported drift has already been absorbed and will clear on the next reconcile.
If true drift is detected: Present the modifications grouped by stack, showing:
AWS::S3::Bucket)update = properties changed, delete = resource was removed outside formae)For each drifted resource (or group of resources), ask the user what action to take:
When the user chooses absorb, you MUST execute all of (a) through (e) in a single uninterrupted sequence:
(a) Call extract_resources with a query matching the drifted resource
(b) Read the existing IaC codebase to understand how the resource is currently defined
(c) Edit the PKL source to match the extracted (actual) state — only change what drifted
(d) In the SAME turn, without pausing: call apply_forma with mode: reconcile, simulate: true, force: true on the main forma file. Then call get_command_status to check the result.
(e) Evaluate the simulation:
For resources the user wants to overwrite:
apply_forma with mode: reconcile, simulate: true, force: true on the main forma fileapply_forma with mode: reconcile, simulate: false, force: trueget_command_status to monitor progress:
sleep 5). Do NOT poll in a tight loop.After handling all drifted resources, re-run the verification from step 2 to confirm all remaining drift has been absorbed. Note that list_changes_since_last_reconcile alone may still report drift for absorbed resources — this is expected and will clear on the next reconcile.
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.development
Use when the user wants to set, remove, or inspect a TTL or auto-reconcile policy on a stack — e.g. 'expire X in 20 minutes', 'reject out-of-band changes on Y', 'auto-reconcile production every 5 minutes', 'remove the TTL on dev', 'what policies are on lifeline?'
devops
Use when the user asks about their cloud targets, configured regions, provider accounts, or which cloud accounts are set up
devops
Use when the user asks about running commands, deployment progress, recent operations, command history, or what failed
devops
Use when the user asks about their infrastructure stacks, how infrastructure is organized, or needs a stack overview with resource counts