nuxt-terraform
Nuxt + Terraform Scaffold Skill
Generate files for Nuxt + AWS infrastructure projects. This skill replaces the CLI — generate all files directly.
Style Guide
All generated Terraform code follows HashiCorp's official style conventions. Read references/terraform-style-guide.md for formatting rules, naming conventions, file organization, security best practices, and the code review checklist. Apply these conventions to all .tf files produced by any command below.
Pre-Requisites
Read terraform-scaffold.config.ts for functionPrefix (PascalCase), environments, and custom paths. If no config exists, ask the user for these values.
Naming Conventions
| Concept | Convention | Example |
|---|---|---|
| Function prefix | PascalCase | MyApp |
| Full Lambda name | <prefix><PascalSuffix> |
MyAppRedeemNow |
| Resolver name | camelCase | productById |
| GraphQL constant | SCREAMING_SNAKE_CASE | PRODUCT_BY_ID |
| TF module name | appsync_function_<camelName> |
appsync_function_productById |
| TF lambda module | lambda_function_<camelName> |
lambda_function_productById |
| Composable file | use<Model>.ts |
useProduct.ts |
| GraphQL file | <model>.ts (lcfirst) |
product.ts |
| TF file per model | <model>.tf (lcfirst) |
product.tf |
| DynamoDB datasource | appsync_datasource_<modelLower> |
appsync_datasource_product |
| DynamoDB table | dynamodb_<modelLower>s |
dynamodb_products |
| Query index | by<Field> |
byUserId |
String conversions: toScreamingSnake splits on uppercase, joins with _, uppercases. toPascal capitalizes first letter. lcfirst lowercases first letter.
Command 1: Init
Ask user for: project name, function prefix (PascalCase), AWS profile, AWS region (default: ap-southeast-2), S3 state bucket, DynamoDB lock table.
AWS Profile Selection: Parse ~/.aws/credentials and ~/.aws/config for profile names. Present numbered list. Allow "add new" via aws configure --profile <name>.
Read references/init-workflow.md for directory structure, template placeholders, static files, scripts, and package.json entries. Consult references/terraform-modules.md for all 18 reusable module signatures.
Command 2: GraphQL Resolver
Ask user for:
- Model name —
@modeltype fromschema.graphql(PascalCase) - Resolver type —
queryormutation - Resolver name — camelCase (e.g.
productById) - Runtime —
APPSYNC_JSorLAMBDA - DynamoDB operation (APPSYNC_JS only) —
GetItem,Query,PutItem,UpdateItem,Scan,BatchDeleteItem - Fields — model fields as arguments + optional extras (
payload: AWSJSON,filter: AWSJSON,limit: Int,nextToken: String)
For advanced APPSYNC_JS resolver patterns (filters, conditions, batch operations, non-DynamoDB data sources), use the aws-appsync-resolver skill.
Read references/resolver-workflow.md for all generation templates: schema injection, GraphQL constant, Terraform modules (APPSYNC_JS and LAMBDA), dependency modules, AppSync JS functions, Lambda source, and composable generation.
Command 3: Lambda Function
Ask user for:
- Name — PascalCase suffix (e.g.
RedeemNow) - Type —
standardorcron - Schedule (cron only) — EventBridge expression (e.g.
rate(5 minutes))
Read references/lambda-workflow.md for Lambda source files, TF module block, cron resources, and dependency checks.
Command 4: Terraform Test
Generate .tftest.hcl test files for Terraform modules. Ask user for:
- Module path — which module to test (e.g.
./modules/dynamodb_table) - Test type —
unit(plan mode, fast),integration(apply mode, creates resources), ormock(plan mode with mock providers, no credentials needed) - Scenarios — what behaviors to validate (defaults, edge cases, validation rules)
Read references/terraform-test.md for test file structure, run block syntax, assert patterns, mock provider setup, expect_failures, parallel execution, and CI/CD integration examples.
Generated artifacts:
- Test file in
terraform/modules/<module>/tests/<name>_<type>_test.tftest.hcl - Mock provider blocks when test type is
mock
Naming convention: <description>_unit_test.tftest.hcl, <description>_integration_test.tftest.hcl, <description>_mock_test.tftest.hcl
Rules
Idempotency — never overwrite existing files during init. Skip if TF module, schema field, GraphQL constant, composable function, or Lambda source already exists. When appending, trim trailing whitespace and add newline before new content.
Pre-generation checklist:
- Read
terraform-scaffold.config.tsforfunctionPrefix - Read
schema.graphqlfor existing models and fields - Check TF files, graphql/ files, and composables for duplicates
- Follow exact naming conventions from the table above
- Verify module dependencies exist; generate if missing (see resolver-workflow.md dependency modules section)
Style compliance: All generated .tf files follow the conventions in references/terraform-style-guide.md — two-space indent, aligned equals signs, meta-arguments first, variables with type+description, descriptive resource names, security hardening defaults.
Post-generation validation: Run terraform fmt on modified .tf files, then terraform validate. If providers not initialized, skip and inform user to run terraform init first. For test files, run terraform test to verify tests pass.
More from ralphcrisostomo/nuxt-development-skills
ralph
Convert PRDs to prd.json format for the Ralph autonomous agent system. Use when you have an existing PRD and need to convert it to Ralph's JSON format. Triggers on: convert this prd, turn this into ralph format, create prd.json from this, ralph json.
52prd
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out.
39optimise-claude
Use when auditing, trimming, or restructuring AI instruction files (CLAUDE.md, SKILL.md, AGENTS.md) to reduce context-window consumption. Trigger whenever CLAUDE.md is bloated or Claude ignores instructions, a SKILL.md exceeds 120 lines, skills share duplicated content, AGENTS.md has large inline blocks, or the user asks to optimize, slim down, or reduce token usage.
37nuxt-init
Use when scaffolding a new Nuxt 4 project with standard config files (prettier, eslint, gitignore, husky, vitest, tsconfig, sops) and bun scripts.
33todo
Use when scanning a codebase for incomplete work and maintaining a living TODO.md grouped by feature. Triggers on: scan for todos, find incomplete work, update todo, what needs doing, create todo list.
30nuxt-env
Use when setting up SOPS + age encryption for environment variables. Checks dependencies, creates config, copies scripts, and adds package.json commands. Triggers on: setup sops, setup env encryption, add age encryption, env:pull, env:push.
29