/atmos:atmos-hooksfrom atmos
Configures lifecycle hooks for Atmos components: before/after events for Terraform, Helm, Kubernetes operations, plus store, command, git, and security hook kinds with when conditions and scoping.
Ships in atmos. 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.
Use this skill for lifecycle hooks that run before or after component operations,
for generation hooks declared in a scaffold template, or for repo-level hooks declared under
docs.generate in atmos.yaml.
Hooks can run scanners, policy checks, store writes, Git actions, custom commands, or other toolchain-aware automation around Terraform, Helm, Kubernetes, and other component commands.
| Need | Load |
|---|---|
| Store output hooks | atmos-stores |
Shared step fields and kind: step payloads | atmos-steps |
| Post-deployment smoke tests and integration checks | atmos-tests |
| Git hooks and GitOps repositories | atmos-git |
| Tool installation for hook commands | atmos-toolchain |
| TFLint hooks, standalone linting, and rule configuration | atmos-lint |
| CI summaries and Atmos Pro upload | atmos-ci and atmos-pro |
Hooks are configured in stack manifests at global, component-type, or component scope.
hooks:
store-vpc-outputs:
events:
- after.terraform.apply
kind: store
name: prod/ssm
outputs:
vpc_id: .vpc_id
components:
terraform:
vpc:
hooks:
scan-plan:
events:
- after.terraform.plan
kind: trivy
Modern dotted event names such as after.terraform.plan are preferred. Legacy hyphenated event
names may appear in older stacks; modernize them when editing nearby config.
Use before/after events for component operations, for example:
before.terraform.init, after.terraform.initbefore.terraform.plan, after.terraform.planbefore.terraform.apply, after.terraform.applybefore.terraform.deploy, after.terraform.deploybefore.terraform.test, after.terraform.testbefore.terraform.output, after.terraform.output — fires for atmos terraform output,
useful for backfilling a store from already-deployed infrastructure without an applybefore.terraform.refresh, after.terraform.refreshKubernetes provides before/after events for render, diff/plan, apply/deploy,
delete, and validate. Native Helm provides template, diff, apply/deploy, and
delete; Helmfile provides template, diff, apply/sync/deploy, and destroy.
Use the canonical dotted events and remember that command aliases normalize to their execution
event (deploy to apply, Kubernetes plan to diff, and Helmfile sync to apply).
Scaffold templates use the separate before.scaffold.generate and
after.scaffold.generate events. They reuse the condition vocabulary but can run only
kind: step and kind: steps; do not configure stack-only kinds in spec.hooks.
Documentation generation uses before.docs.generate and after.docs.generate; see
Repo-Level Hooks: docs generate.
Multi-component DAG runs (e.g. --affected, --query, or workflows that fan out across several
components) also fire aggregate events once for the whole run, in addition to the per-component
events fired for each individual component: after.terraform.plan.aggregate,
after.terraform.apply.aggregate, and after.terraform.destroy.aggregate. Use a per-component event
for component-specific behavior (scans, store writes) and an aggregate event for run-level summaries
or notifications that should fire only once.
whenHooks share the same when: condition engine as workflow steps: predicate keywords (ci, local,
always, never, success, failure) or a CEL expression built from runtime facts such as stack
and component. For example, restrict a hook to CI runs against the prod stack:
hooks:
prod-ci-scan:
events:
- after.terraform.plan
kind: trivy
when: stack == "prod" && ci
See atmos-workflows for the full
when:/CEL syntax reference.
For embedded Starlark script hooks, also read atmos-starlark.
Starlark script steps work in kind: step, kind: steps, and type: test hooks.
ctx.component exposes the current component's read-only vars, settings, metadata,
and effective working directory. Use settings to control reusable hook behavior.
ctx.hook exposes name/event; ctx.operation exposes the parent command and outcome.
Call components.get(name, stack, type) with an explicit stack to read another component.
A hook script: !include scripts/x.star resolves its load() calls next to the included file:
Atmos records that file in a script_source key beside the script, which describe component
shows, with a script_source_sha256 fingerprint. Treat both as Atmos-owned provenance and do not
write them by hand. A child stack that overrides only script (for example with an inline body)
keeps the inherited keys in describe output, but Atmos ignores them because the fingerprint no
longer matches.
Before-hook results and uncaptured parent streams are None. Processes launched
inside a hook return their own results. atmos.run, atmos.terraform, and atmos.helm
invoke normal command lifecycles, so avoid re-entering the same hook recursively.
Stack lifecycle hooks support command, store, git, tflint, infracost, trivy, checkov,
kics, and the step bridge. The legacy ci.* hook kinds still parse but are deprecated no-ops;
use the current CI provider bindings instead. Use a named kind when Atmos has one; use command
for a project-specific binary. The legacy command: discriminator and hyphenated events remain
compatibility input only; author new configuration with kind: and dotted events.
Hooks can use dependencies.tools so required scanners or CLIs are installed and placed on PATH
for the hook execution context.
When the hook declares the required binary in dependencies.tools, do not add a separate
atmos toolchain install step. Atmos resolves, installs, and injects the tool before the hook fires.
Hooks can also delegate to the same step-type registry that workflows, custom commands, and cast recordings use, instead of one of the named kinds above:
kind: step runs one registered step type. Set the step type with the hook's type: field and
configure it with with:, exactly like a workflow step.kind: steps runs an ordered list of registered step types, provided as a YAML list under with:.Hook step lists run in order. A type: test group can contain parallel or
matrix checks; see atmos-tests.
The hook envelope owns events, when, env, retry, and on_failure; with: is
decoded and validated as the step's own configuration. kind: step supplies the one
step type through the hook's type:; kind: steps supplies type-bearing objects in its
ordered with: list.
hooks:
check-prereqs:
events:
- before.terraform.plan
kind: step
type: require
with:
tools:
- kubectl
- helm
bring-up-and-plan:
events:
- before.terraform.plan
kind: steps
with:
- type: emulator
command: up
- type: atmos
command: terraform plan vpc
Use kind: step/kind: steps when you need a registered step type (container, emulator,
require, atmos, shell, and other types workflows support) inside a hook; use the older named
kinds (trivy, checkov, kics, infracost) when Atmos already ships a purpose-built scanner
integration for the job.
kind: step/kind: stepsA step's relative paths (source, destination, path, files, context, and other
step-specific fields) resolve against with: { working_directory: ... } when set, or the
component's own working directory when unset. Workflow-level and custom-command directories
resolve against the configured base_path. A relative custom-command step override resolves
against the command's resolved directory; when the command directory is unset, it resolves
against the invocation directory. Relative workflow shell-step overrides resolve against base_path.
An extended step's own working_directory can instead resolve against the invocation directory;
when it inherits a workflow directory, it receives that resolved directory.
An explicit working_directory: value resolves differently depending on its shape:
| Value | Resolves against |
|---|---|
| Not set | The component's working directory (a provisioned/vendored working copy when one exists, otherwise the in-repo source directory) |
., .., ./foo, ../foo | The directory Atmos was run from |
foo, foo/bar | The component's working directory + foo (or foo/bar) |
/absolute/path | Used as-is |
A plain relative value (foo) behaves like the unset default -- component-relative. A ./- or
../-prefixed value is an explicit signal to anchor to the directory Atmos was run from instead.
Scaffold hooks (before.scaffold.generate/after.scaffold.generate) follow the same shape, but
anchor to the scaffold's target/output directory (atmos scaffold generate <template> <target>'s
target) instead of a component's working directory -- there is no component in a scaffold run.
An unset or bare-relative working_directory: defaults to/anchors under target; the target
directory is also exposed to hook templates as {{ .TargetPath }}. Use working_directory: "."
to opt back into running the hook in the directory Atmos was launched from. This default excludes
type: atmos steps: a nested atmos invocation must keep resolving its own atmos.yaml/stacks
against the directory Atmos was launched from, so it keeps the ambient cwd unless
working_directory: is set explicitly.
atmos docs generate <type> has no stack or component, so its hooks are declared in atmos.yaml
as a map of named hooks (not a list) under docs.generate.<type>.hooks. They use the same
kinds and fields as component hooks (kind: command/step/steps, type, events, when,
on_failure, retry, with, env). Hooks belong to one generator: hooks under readme do not
run for another type.
docs:
generate:
readme:
input: ["./README.yaml"]
template: "./README.md.gotmpl"
output: "./README.md"
hooks:
publish-wiki:
kind: step
type: http
events: [after.docs.generate]
when: success
on_failure: fail
with:
url: "https://wiki.example.com/rest/api/content/123456"
method: PUT
headers:
Authorization: "Bearer {{ .env.WIKI_TOKEN }}"
expect:
status: [200]
http step, or a kind: command hook that reads
ATMOS_DOCS_OUTPUT_PATH. Atmos has no wiki-specific integration.events: omitted means the hook fires on both events. Hooks run in name order, in the process working directory where atmos docs generate starts (or the --chdir target), not base-dir.before.docs.generate hook with on_failure: fail, or a policy denial, aborts before any file
is written. With the default on_failure: warn, or with ignore, generation continues, so set
on_failure: fail on any hook that must block generation. after.docs.generate hooks run on
success and on failure, filtered by when: (default is success only; use failure or always
to react to failures). A failing after-hook fails the command only with on_failure: fail.ATMOS_DOCS_TYPE, ATMOS_DOCS_OUTPUT_PATH, ATMOS_DOCS_BASE_DIR, and
template values {{ .docs.type }}, {{ .docs.output_path }}, {{ .docs.base_dir }}. There is
no infrastructure component or stack: the stack is empty, and ATMOS_COMPONENT holds the
generator name (for example readme).atmos docs generate --skip-hooks skips all hooks, --skip-hooks=name1,name2 skips named
hooks, and ATMOS_SKIP_HOOKS is honored.on: operation and action: hooks also apply; see
atmos-policy.--skip-hooks to bypass all hooks for a diagnostic run, or --skip-hooks=name1,name2 to skip
specific hooks by name. This flag is registered on the terraform and docs generate commands
today; there is no helmfile or packer equivalent yet. ATMOS_SKIP_HOOKS sets it from the environment.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
58 skills in this plugin
/atmos-aiAtmos AI and MCP integrations: connect external AI assistants to Atmos through agent skills, atmos mcp start, multi-CLI MCP export, Atmos Pro MCP, and AWS MCP servers; run AI from Atmos through atmos ai ask/chat/exec, --ai command analysis, API providers, CLI providers, external MCP routing/pass-through, toolchain-aware export, auth-wrapped tools, and MCP+skills pairing/atmos-ansibleAnsible orchestration: playbook execution, variable passing, inventory management, stack-based configuration for configuration management/atmos-asciicastCreate and review portable Atmos CLI asciicast demos for community-facing documentation, examples, and training materials.npx claudepluginhub cloudposse/atmos --plugin atmosOther plugins' skills for the same job