Nov 16, 2026
Cut Terraform Hallucinations with the TerraShark Skill
A 1k-star Terraform and OpenTofu skill that forces a failure-mode diagnosis before code generation, loads focused references on demand, and returns an output contract with rollback notes.
LLMs write plausible Terraform that breaks on the details: unstable resource addresses, secrets that leak into state, a blast radius nobody bounded. TerraShark, a 1k-star MIT-licensed skill by LukasNiessen, makes the agent diagnose the likely failure mode before it writes any HCL.
Why This Skill Matters
The README frames the problem through five failure modes it says AI agents fail at infrastructure code with: unstable identity, leaked secrets, wide blast radius, CI drift, and weak compliance gates. TerraShark is designed around those failure modes. Its guidance is primarily based on HashiCorp's official recommended practices, and when guidance conflicts, it prioritizes HashiCorp's recommendations.
The README also describes the core SKILL.md as an 86-line operational workflow costing about 600 tokens on activation, backed by 19 focused reference files that load only when the diagnosed failure mode calls for them. The comparison numbers against rival Terraform skills in the same README are the repo's own claims — treat them as the vendor's framing, not independent measurements.
Installation
On macOS or Linux, clone straight into your Claude Code skills directory — no restart needed:
git clone https://github.com/LukasNiessen/terrashark.git ~/.claude/skills/terrashark
If you use the Claude Code plugin system, add the repo's marketplace instead:
/plugin marketplace add LukasNiessen/terrashark
/plugin install terrashark
Codex has no global skill system, so setup is per-project. Clone into your repo and point your AGENTS.md at the workflow:
git clone https://github.com/LukasNiessen/terrashark.git .terrashark
## Terraform
When working with Terraform or OpenTofu, follow the workflow in `.terrashark/SKILL.md`.
Load references from `.terrashark/references/` as needed.
Antigravity and Gemini CLI each get their own clone targets: ~/.gemini/antigravity/skills/terrashark for Antigravity, and ~/.gemini/skills/terrashark (global) or .gemini/skills/terrashark (per-workspace) for Gemini CLI. Windows variants are documented for two of these paths — PowerShell and Command Prompt for the Claude Code clone, PowerShell for the Antigravity clone.
Real Workflow: Review a main.tf for Security Issues
Ask naturally — TerraShark activates automatically for any Terraform or OpenTofu task:
Review my main.tf for security issues
The skill then runs a seven-step workflow: capture execution context (runtime and version, providers, backend, execution path, risk level), diagnose the likely failure modes, load only the references relevant to those failure modes, propose a fix path with risk controls, generate the implementation artifacts, validate before finalize, and deliver a structured output. That output contract carries assumptions, remediation choices, tradeoffs, a validation plan, and recovery notes — so you can audit the agent's reasoning instead of reverse-engineering a diff.
You can also invoke the skill explicitly:
/terrashark Create a multi-region S3 module with replication
Real Workflow: Refactor a Stack with Migrations and CI
A prompt like the README's EKS example spans state migration, CI, and compliance scanning in one ask:
/terrashark Refactor our EKS stack into separate state files per environment, add moved blocks to avoid recreation, set up a GitHub Actions pipeline with plan on PR and gated apply on merge, and wire in Checkov for compliance scanning
The reference library the README documents covers migration playbooks for moved/import/refactor/upgrade work, CI stages and pipeline templates, and compliance framework mappings for ISO 27001, SOC 2, FedRAMP, GDPR, PCI DSS, and HIPAA.
Tips
- Invoke explicitly with
/terrashark <task>when you want the workflow for sure; a natural Terraform question triggers it too. - OpenTofu is supported: the workflow captures runtime and version first and adapts its guidance accordingly.
- For hand-rolled resources, the skill defaults to mature vendor and community modules — the AWS, Azure, GCP, Oracle Cloud, and IBM Cloud registries — and enforces exact version pinning for production. That guidance loads conditionally, so an AWS-only project never pays the token cost for Azure or GCP material.
- The references are plain Markdown; the FAQ notes they work from any workflow or AI assistant, with the trigger behavior optimized for skill-enabled environments.
- On Gemini CLI, run
/skills listto verify the skill was discovered.
When Not to Use This
The README scopes the skill to Terraform and OpenTofu work: module design, review, and refactoring; safe migration workflows; CI/CD and policy integration; and blast-radius reduction. The repo concedes one competitor advantage in plain terms — terraform-skill "wins on HCL example depth and testing docs" — so if you need the deepest HCL examples first, read both before choosing.
See the leaderboard for more skills.