@c0x12c/ai-toolkit 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +12 -0
- package/README.md +439 -0
- package/VERSION +1 -0
- package/agents/design-critic.md +127 -0
- package/agents/idea-killer.md +72 -0
- package/agents/infrastructure-expert.md +49 -0
- package/agents/micronaut-backend-expert.md +45 -0
- package/agents/phase-reviewer.md +150 -0
- package/agents/research-planner.md +70 -0
- package/agents/solution-architect-cto.md +49 -0
- package/agents/sre-architect.md +49 -0
- package/agents/team-coordinator.md +111 -0
- package/bin/cli.js +780 -0
- package/claude-md/00-header.md +39 -0
- package/claude-md/01-core.md +105 -0
- package/claude-md/05-database.md +20 -0
- package/claude-md/11-backend-micronaut.md +19 -0
- package/claude-md/20-frontend-react.md +44 -0
- package/claude-md/25-ux-design.md +56 -0
- package/claude-md/30-infrastructure.md +24 -0
- package/claude-md/30-project-mgmt.md +119 -0
- package/claude-md/40-product.md +39 -0
- package/claude-md/50-ops.md +34 -0
- package/claude-md/60-research.md +27 -0
- package/claude-md/90-footer.md +21 -0
- package/commands/spartan/brainstorm.md +134 -0
- package/commands/spartan/brownfield.md +157 -0
- package/commands/spartan/build.md +435 -0
- package/commands/spartan/careful.md +94 -0
- package/commands/spartan/commit-message.md +112 -0
- package/commands/spartan/content.md +17 -0
- package/commands/spartan/context-save.md +161 -0
- package/commands/spartan/contribute.md +140 -0
- package/commands/spartan/daily.md +42 -0
- package/commands/spartan/debug.md +308 -0
- package/commands/spartan/deep-dive.md +55 -0
- package/commands/spartan/deploy.md +207 -0
- package/commands/spartan/e2e.md +264 -0
- package/commands/spartan/env-setup.md +166 -0
- package/commands/spartan/epic.md +199 -0
- package/commands/spartan/fe-review.md +181 -0
- package/commands/spartan/figma-to-code.md +260 -0
- package/commands/spartan/forensics.md +46 -0
- package/commands/spartan/freeze.md +84 -0
- package/commands/spartan/fundraise.md +53 -0
- package/commands/spartan/gate-review.md +229 -0
- package/commands/spartan/gsd-upgrade.md +376 -0
- package/commands/spartan/guard.md +42 -0
- package/commands/spartan/init-project.md +178 -0
- package/commands/spartan/init-rules.md +298 -0
- package/commands/spartan/interview.md +154 -0
- package/commands/spartan/kickoff.md +73 -0
- package/commands/spartan/kotlin-service.md +109 -0
- package/commands/spartan/lean-canvas.md +222 -0
- package/commands/spartan/lint-rules.md +122 -0
- package/commands/spartan/map-codebase.md +124 -0
- package/commands/spartan/migration.md +82 -0
- package/commands/spartan/next-app.md +317 -0
- package/commands/spartan/next-feature.md +212 -0
- package/commands/spartan/onboard.md +326 -0
- package/commands/spartan/outreach.md +16 -0
- package/commands/spartan/phase.md +142 -0
- package/commands/spartan/pitch.md +18 -0
- package/commands/spartan/plan.md +210 -0
- package/commands/spartan/pr-ready.md +202 -0
- package/commands/spartan/project.md +106 -0
- package/commands/spartan/qa.md +222 -0
- package/commands/spartan/research.md +254 -0
- package/commands/spartan/review.md +132 -0
- package/commands/spartan/scan-rules.md +173 -0
- package/commands/spartan/sessions.md +143 -0
- package/commands/spartan/spec.md +131 -0
- package/commands/spartan/startup.md +257 -0
- package/commands/spartan/team.md +570 -0
- package/commands/spartan/teardown.md +161 -0
- package/commands/spartan/testcontainer.md +97 -0
- package/commands/spartan/tf-cost.md +123 -0
- package/commands/spartan/tf-deploy.md +116 -0
- package/commands/spartan/tf-drift.md +100 -0
- package/commands/spartan/tf-import.md +107 -0
- package/commands/spartan/tf-module.md +121 -0
- package/commands/spartan/tf-plan.md +100 -0
- package/commands/spartan/tf-review.md +106 -0
- package/commands/spartan/tf-scaffold.md +109 -0
- package/commands/spartan/tf-security.md +147 -0
- package/commands/spartan/think.md +221 -0
- package/commands/spartan/unfreeze.md +13 -0
- package/commands/spartan/update.md +134 -0
- package/commands/spartan/ux.md +1233 -0
- package/commands/spartan/validate.md +193 -0
- package/commands/spartan/web-to-prd.md +706 -0
- package/commands/spartan/workstreams.md +109 -0
- package/commands/spartan/write.md +16 -0
- package/commands/spartan.md +386 -0
- package/frameworks/00-framework-comparison-guide.md +317 -0
- package/frameworks/01-lean-canvas.md +196 -0
- package/frameworks/02-design-sprint.md +304 -0
- package/frameworks/03-foundation-sprint.md +337 -0
- package/frameworks/04-business-model-canvas.md +391 -0
- package/frameworks/05-customer-development.md +426 -0
- package/frameworks/06-jobs-to-be-done.md +358 -0
- package/frameworks/07-mom-test.md +392 -0
- package/frameworks/08-value-proposition-canvas.md +488 -0
- package/frameworks/09-javelin-board.md +428 -0
- package/frameworks/10-build-measure-learn.md +467 -0
- package/frameworks/11-mvp-approaches.md +533 -0
- package/frameworks/think-before-build.md +593 -0
- package/lib/assembler.js +197 -0
- package/lib/assembler.test.js +159 -0
- package/lib/detector.js +166 -0
- package/lib/detector.test.js +221 -0
- package/lib/packs.js +16 -0
- package/lib/resolver.js +272 -0
- package/lib/resolver.test.js +298 -0
- package/lib/worktree.sh +104 -0
- package/package.json +50 -0
- package/packs/backend-micronaut.yaml +35 -0
- package/packs/backend-nodejs.yaml +15 -0
- package/packs/backend-python.yaml +15 -0
- package/packs/core.yaml +37 -0
- package/packs/database.yaml +21 -0
- package/packs/frontend-react.yaml +24 -0
- package/packs/infrastructure.yaml +40 -0
- package/packs/ops.yaml +16 -0
- package/packs/packs.compiled.json +371 -0
- package/packs/product.yaml +22 -0
- package/packs/project-mgmt.yaml +24 -0
- package/packs/research.yaml +39 -0
- package/packs/shared-backend.yaml +14 -0
- package/packs/ux-design.yaml +21 -0
- package/rules/backend-micronaut/API_DESIGN.md +313 -0
- package/rules/backend-micronaut/BATCH_PROCESSING.md +92 -0
- package/rules/backend-micronaut/CONTROLLERS.md +388 -0
- package/rules/backend-micronaut/KOTLIN.md +414 -0
- package/rules/backend-micronaut/RETROFIT_PLACEMENT.md +290 -0
- package/rules/backend-micronaut/SERVICES_AND_BEANS.md +325 -0
- package/rules/core/NAMING_CONVENTIONS.md +208 -0
- package/rules/core/SKILL_AUTHORING.md +174 -0
- package/rules/core/TIMEZONE.md +316 -0
- package/rules/database/ORM_AND_REPO.md +289 -0
- package/rules/database/SCHEMA.md +146 -0
- package/rules/database/TRANSACTIONS.md +311 -0
- package/rules/frontend-react/FRONTEND.md +344 -0
- package/rules/infrastructure/MODULES.md +260 -0
- package/rules/infrastructure/NAMING.md +196 -0
- package/rules/infrastructure/PROVIDERS.md +309 -0
- package/rules/infrastructure/SECURITY.md +310 -0
- package/rules/infrastructure/STATE_AND_BACKEND.md +237 -0
- package/rules/infrastructure/STRUCTURE.md +234 -0
- package/rules/infrastructure/VARIABLES.md +285 -0
- package/rules/shared-backend/ARCHITECTURE.md +46 -0
- package/rules/ux-design/DESIGN_PROCESS.md +176 -0
- package/skills/api-endpoint-creator/SKILL.md +455 -0
- package/skills/api-endpoint-creator/error-handling-guide.md +244 -0
- package/skills/api-endpoint-creator/examples.md +522 -0
- package/skills/api-endpoint-creator/testing-patterns.md +302 -0
- package/skills/article-writing/SKILL.md +109 -0
- package/skills/article-writing/examples.md +59 -0
- package/skills/backend-api-design/SKILL.md +84 -0
- package/skills/backend-api-design/code-patterns.md +138 -0
- package/skills/brainstorm/SKILL.md +95 -0
- package/skills/browser-qa/SKILL.md +87 -0
- package/skills/browser-qa/playwright-snippets.md +110 -0
- package/skills/ci-cd-patterns/SKILL.md +108 -0
- package/skills/ci-cd-patterns/workflows.md +149 -0
- package/skills/competitive-teardown/SKILL.md +93 -0
- package/skills/competitive-teardown/example-analysis.md +50 -0
- package/skills/content-engine/SKILL.md +131 -0
- package/skills/content-engine/examples.md +72 -0
- package/skills/database-patterns/SKILL.md +72 -0
- package/skills/database-patterns/code-templates.md +114 -0
- package/skills/database-table-creator/SKILL.md +141 -0
- package/skills/database-table-creator/examples.md +552 -0
- package/skills/database-table-creator/kotlin-templates.md +400 -0
- package/skills/database-table-creator/migration-template.sql +68 -0
- package/skills/database-table-creator/validation-checklist.md +337 -0
- package/skills/deep-research/SKILL.md +80 -0
- package/skills/design-intelligence/SKILL.md +268 -0
- package/skills/design-workflow/SKILL.md +127 -0
- package/skills/design-workflow/checklists.md +45 -0
- package/skills/idea-validation/SKILL.md +129 -0
- package/skills/idea-validation/example-report.md +50 -0
- package/skills/investor-materials/SKILL.md +122 -0
- package/skills/investor-materials/example-outline.md +70 -0
- package/skills/investor-outreach/SKILL.md +112 -0
- package/skills/investor-outreach/examples.md +76 -0
- package/skills/kotlin-best-practices/SKILL.md +58 -0
- package/skills/kotlin-best-practices/code-patterns.md +132 -0
- package/skills/market-research/SKILL.md +99 -0
- package/skills/security-checklist/SKILL.md +65 -0
- package/skills/security-checklist/audit-reference.md +95 -0
- package/skills/service-debugging/SKILL.md +116 -0
- package/skills/service-debugging/common-issues.md +65 -0
- package/skills/startup-pipeline/SKILL.md +152 -0
- package/skills/terraform-best-practices/SKILL.md +244 -0
- package/skills/terraform-module-creator/SKILL.md +284 -0
- package/skills/terraform-review/SKILL.md +222 -0
- package/skills/terraform-security-audit/SKILL.md +280 -0
- package/skills/terraform-service-scaffold/SKILL.md +574 -0
- package/skills/testing-strategies/SKILL.md +116 -0
- package/skills/testing-strategies/examples.md +103 -0
- package/skills/testing-strategies/integration-test-setup.md +71 -0
- package/skills/ui-ux-pro-max/SKILL.md +238 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/python-setup.md +146 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/skills/web-to-prd/SKILL.md +478 -0
- package/templates/build-config.yaml +44 -0
- package/templates/commands-config.yaml +55 -0
- package/templates/competitor-analysis.md +60 -0
- package/templates/content/AGENT_TEMPLATE.md +47 -0
- package/templates/content/COMMAND_TEMPLATE.md +27 -0
- package/templates/content/RULE_TEMPLATE.md +40 -0
- package/templates/content/SKILL_TEMPLATE.md +41 -0
- package/templates/design-config.md +105 -0
- package/templates/design-doc.md +207 -0
- package/templates/epic.md +100 -0
- package/templates/feature-spec.md +181 -0
- package/templates/idea-canvas.md +47 -0
- package/templates/implementation-plan.md +159 -0
- package/templates/prd-template.md +86 -0
- package/templates/preamble.md +89 -0
- package/templates/project-readme.md +35 -0
- package/templates/quality-gates.md +230 -0
- package/templates/spartan-config.yaml +164 -0
- package/templates/user-interview.md +69 -0
- package/templates/validation-checklist.md +108 -0
- package/templates/workflow-backend-micronaut.md +409 -0
- package/templates/workflow-frontend-react.md +233 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:tf-module
|
|
3
|
+
description: Create or extend a Terraform module with proper interface, docs, and examples
|
|
4
|
+
argument-hint: "[module-name]"
|
|
5
|
+
preamble-tier: 3
|
|
6
|
+
---
|
|
7
|
+
@rules/infrastructure/MODULES.md
|
|
8
|
+
@rules/infrastructure/NAMING.md
|
|
9
|
+
@rules/infrastructure/VARIABLES.md
|
|
10
|
+
|
|
11
|
+
# Terraform Module: {{ args[0] | default: "new module" }}
|
|
12
|
+
|
|
13
|
+
Create a reusable Terraform module following best practices.
|
|
14
|
+
|
|
15
|
+
**Before creating, reference:** `terraform-module-creator` skill
|
|
16
|
+
|
|
17
|
+
## Step 1: Determine Purpose
|
|
18
|
+
|
|
19
|
+
Ask the user:
|
|
20
|
+
|
|
21
|
+
> **What does this module manage?** Describe the AWS resources and their purpose.
|
|
22
|
+
>
|
|
23
|
+
> Examples: "RDS PostgreSQL instance with parameter group and subnet group",
|
|
24
|
+
> "ECS service with task definition, ALB target group, and auto-scaling"
|
|
25
|
+
|
|
26
|
+
## Step 2: Create Module Structure
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
modules/{module-name}/
|
|
30
|
+
├── main.tf # Resource definitions
|
|
31
|
+
├── variables.tf # Input variables
|
|
32
|
+
├── outputs.tf # Exported attributes
|
|
33
|
+
├── versions.tf # Required providers and terraform version
|
|
34
|
+
├── locals.tf # Computed values (if needed)
|
|
35
|
+
└── README.md # Auto-generated docs
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Step 3: Define the Interface
|
|
39
|
+
|
|
40
|
+
### variables.tf
|
|
41
|
+
|
|
42
|
+
Group variables logically with comments:
|
|
43
|
+
|
|
44
|
+
```hcl
|
|
45
|
+
# --- Required ---
|
|
46
|
+
variable "name" {
|
|
47
|
+
description = "Name prefix for all resources"
|
|
48
|
+
type = string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
variable "environment" {
|
|
52
|
+
description = "Environment name (dev, staging, prod)"
|
|
53
|
+
type = string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# --- Optional ---
|
|
57
|
+
variable "tags" {
|
|
58
|
+
description = "Additional tags to apply to all resources"
|
|
59
|
+
type = map(string)
|
|
60
|
+
default = {}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### outputs.tf
|
|
65
|
+
|
|
66
|
+
Export everything downstream modules might need:
|
|
67
|
+
|
|
68
|
+
```hcl
|
|
69
|
+
output "id" {
|
|
70
|
+
description = "The ID of the primary resource"
|
|
71
|
+
value = aws_resource.this.id
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
output "arn" {
|
|
75
|
+
description = "The ARN of the primary resource"
|
|
76
|
+
value = aws_resource.this.arn
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Step 4: Add Resources
|
|
81
|
+
|
|
82
|
+
Write `main.tf` with:
|
|
83
|
+
- Merge tags using `locals` — combine module defaults with user-provided tags
|
|
84
|
+
- Use `for_each` over `count` when creating multiple similar resources
|
|
85
|
+
- Reference variables — never hardcode values
|
|
86
|
+
|
|
87
|
+
## Step 5: Set Provider Constraints
|
|
88
|
+
|
|
89
|
+
```hcl
|
|
90
|
+
# versions.tf
|
|
91
|
+
terraform {
|
|
92
|
+
required_version = ">= 1.5"
|
|
93
|
+
|
|
94
|
+
required_providers {
|
|
95
|
+
aws = {
|
|
96
|
+
source = "hashicorp/aws"
|
|
97
|
+
version = ">= 5.0"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Step 6: Validate
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cd modules/{module-name}
|
|
107
|
+
terraform init
|
|
108
|
+
terraform validate
|
|
109
|
+
terraform fmt -check
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Rules
|
|
113
|
+
|
|
114
|
+
- One module = one logical concern (don't mix unrelated resources)
|
|
115
|
+
- Every variable needs `description` and explicit `type`
|
|
116
|
+
- Every output needs `description`
|
|
117
|
+
- Use `locals` for tag merging and computed values
|
|
118
|
+
- No provider blocks inside modules — let the caller configure providers
|
|
119
|
+
- No backend blocks inside modules
|
|
120
|
+
- Use `for_each` over `count` — it handles additions/removals without index shifting
|
|
121
|
+
- Sensitive outputs must be marked `sensitive = true`
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:tf-plan
|
|
3
|
+
description: Guided terraform plan workflow — init, plan, review output, flag destructive changes
|
|
4
|
+
argument-hint: "[environment]"
|
|
5
|
+
preamble-tier: 2
|
|
6
|
+
---
|
|
7
|
+
@rules/infrastructure/STATE_AND_BACKEND.md
|
|
8
|
+
|
|
9
|
+
# Terraform Plan: {{ args[0] | default: "target environment" }}
|
|
10
|
+
|
|
11
|
+
Run a guided `terraform plan` with safety checks.
|
|
12
|
+
|
|
13
|
+
## Step 1: Verify Working Directory
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ls *.tf 2>/dev/null || echo "NO_TF_FILES"
|
|
17
|
+
ls backend.tf 2>/dev/null || echo "NO_BACKEND"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If no `.tf` files found, ask the user to navigate to the correct environment directory (e.g., `live/dev/`).
|
|
21
|
+
|
|
22
|
+
## Step 2: Check Backend Config
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cat backend.tf
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Verify:
|
|
29
|
+
- Backend type is `s3` with DynamoDB lock table
|
|
30
|
+
- Key path includes the environment name
|
|
31
|
+
- Region is set
|
|
32
|
+
|
|
33
|
+
## Step 3: Initialize
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
terraform init -backend-config=../../envs/{{ args[0] | default: "dev" }}.tfbackend
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If init fails, check:
|
|
40
|
+
- AWS credentials are configured (`aws sts get-caller-identity`)
|
|
41
|
+
- Backend bucket and DynamoDB table exist
|
|
42
|
+
- Network connectivity to AWS
|
|
43
|
+
|
|
44
|
+
## Step 4: Run Plan
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
terraform plan \
|
|
48
|
+
-var-file=../../envs/{{ args[0] | default: "dev" }}.tfvars \
|
|
49
|
+
-out=tfplan \
|
|
50
|
+
-detailed-exitcode
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Exit codes: `0` = no changes, `1` = error, `2` = changes present.
|
|
54
|
+
|
|
55
|
+
## Step 5: Review Plan Output
|
|
56
|
+
|
|
57
|
+
Analyze the plan and categorize changes:
|
|
58
|
+
|
|
59
|
+
| Symbol | Meaning | Risk |
|
|
60
|
+
|--------|---------|------|
|
|
61
|
+
| `+` | Create | Low |
|
|
62
|
+
| `~` | Update in-place | Medium |
|
|
63
|
+
| `-/+` | Destroy and recreate | HIGH |
|
|
64
|
+
| `-` | Destroy | CRITICAL |
|
|
65
|
+
|
|
66
|
+
### Flag Destructive Changes
|
|
67
|
+
|
|
68
|
+
If the plan shows `-/+` (replace) or `-` (destroy):
|
|
69
|
+
|
|
70
|
+
> **WARNING: Destructive changes detected.**
|
|
71
|
+
>
|
|
72
|
+
> The following resources will be destroyed or replaced:
|
|
73
|
+
> - `[resource address]` — [reason]
|
|
74
|
+
>
|
|
75
|
+
> Is this intentional? Common causes:
|
|
76
|
+
> - Name change without `moved` block
|
|
77
|
+
> - Force-new attribute changed (e.g., `name` on RDS)
|
|
78
|
+
> - Provider upgrade changed resource schema
|
|
79
|
+
|
|
80
|
+
## Step 6: Summary
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
## Plan Summary: {{ args[0] | default: "dev" }}
|
|
84
|
+
|
|
85
|
+
- **Add:** [N] resources
|
|
86
|
+
- **Change:** [N] resources
|
|
87
|
+
- **Destroy:** [N] resources
|
|
88
|
+
|
|
89
|
+
### Destructive changes: [none / list them]
|
|
90
|
+
### Estimated impact: [low / medium / high]
|
|
91
|
+
### Safe to apply: [yes / review destructive changes first]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Rules
|
|
95
|
+
|
|
96
|
+
- Never run `terraform apply` from this command — use `/spartan:tf-deploy` for that
|
|
97
|
+
- Always use `-out=tfplan` to save the plan for exact apply
|
|
98
|
+
- Always use `-var-file` — never rely on auto-loaded `.tfvars`
|
|
99
|
+
- Flag every destroy or replace action explicitly
|
|
100
|
+
- If credentials are missing, help the user configure them — don't proceed without auth
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:tf-review
|
|
3
|
+
description: PR review for Terraform changes — 8-stage checklist covering structure, security, naming, and state safety
|
|
4
|
+
argument-hint: "[optional: branch or PR]"
|
|
5
|
+
preamble-tier: 3
|
|
6
|
+
---
|
|
7
|
+
@rules/infrastructure/STRUCTURE.md
|
|
8
|
+
@rules/infrastructure/MODULES.md
|
|
9
|
+
@rules/infrastructure/PROVIDERS.md
|
|
10
|
+
@rules/infrastructure/NAMING.md
|
|
11
|
+
|
|
12
|
+
# Terraform Review: {{ args[0] | default: "current changes" }}
|
|
13
|
+
|
|
14
|
+
Perform a comprehensive review of Terraform changes.
|
|
15
|
+
|
|
16
|
+
**Before reviewing, reference these infrastructure rules:**
|
|
17
|
+
- `rules/infrastructure/STRUCTURE.md` — Directory layout and file organization
|
|
18
|
+
- `rules/infrastructure/MODULES.md` — Module design and composition
|
|
19
|
+
- `rules/infrastructure/NAMING.md` — Resource and variable naming
|
|
20
|
+
- `rules/infrastructure/SECURITY.md` — IAM, encryption, network security
|
|
21
|
+
- `rules/infrastructure/VARIABLES.md` — Variable definitions and validation
|
|
22
|
+
- `rules/infrastructure/PROVIDERS.md` — Provider configuration and versioning
|
|
23
|
+
- `rules/infrastructure/STATE_AND_BACKEND.md` — State management and locking
|
|
24
|
+
|
|
25
|
+
## Review Checklist
|
|
26
|
+
|
|
27
|
+
### Stage 1: Structure
|
|
28
|
+
- [ ] Files follow standard layout (`main.tf`, `variables.tf`, `outputs.tf`, `versions.tf`)
|
|
29
|
+
- [ ] Modules are in `modules/` directory, environments in `live/` or `envs/`
|
|
30
|
+
- [ ] No monolithic files — resources grouped by logical concern
|
|
31
|
+
- [ ] Backend config is separate per environment
|
|
32
|
+
|
|
33
|
+
### Stage 2: State Safety
|
|
34
|
+
- [ ] No resources moved or renamed without `moved` blocks or import
|
|
35
|
+
- [ ] State backend uses S3 + DynamoDB lock table
|
|
36
|
+
- [ ] No `terraform state` commands in scripts without safeguards
|
|
37
|
+
- [ ] Destructive changes (replace, destroy) are intentional and documented
|
|
38
|
+
- [ ] `prevent_destroy` lifecycle on critical resources (databases, S3 buckets)
|
|
39
|
+
|
|
40
|
+
### Stage 3: Security
|
|
41
|
+
- [ ] No secrets in `.tf` files or `.tfvars` committed to repo
|
|
42
|
+
- [ ] IAM policies follow least privilege — no `*` actions or resources
|
|
43
|
+
- [ ] Security groups restrict ingress to required ports only
|
|
44
|
+
- [ ] Encryption enabled: RDS `storage_encrypted`, S3 `server_side_encryption`, EBS volumes
|
|
45
|
+
- [ ] No public access unless explicitly required (S3 ACLs, RDS `publicly_accessible`)
|
|
46
|
+
- [ ] KMS keys used for sensitive resources
|
|
47
|
+
|
|
48
|
+
### Stage 4: Naming
|
|
49
|
+
- [ ] Resources use consistent naming: `{project}-{env}-{service}-{resource}`
|
|
50
|
+
- [ ] Variables are descriptive with `_` separators (not camelCase)
|
|
51
|
+
- [ ] All resources tagged: `project`, `environment`, `service`, `managed_by`
|
|
52
|
+
|
|
53
|
+
### Stage 5: Modules
|
|
54
|
+
- [ ] Modules have a single responsibility
|
|
55
|
+
- [ ] No provider blocks inside modules
|
|
56
|
+
- [ ] No backend blocks inside modules
|
|
57
|
+
- [ ] Variables have `description` and explicit `type`
|
|
58
|
+
- [ ] Outputs have `description`
|
|
59
|
+
- [ ] `for_each` preferred over `count`
|
|
60
|
+
|
|
61
|
+
### Stage 6: Variables
|
|
62
|
+
- [ ] All variables have `description` and `type`
|
|
63
|
+
- [ ] Sensitive variables marked `sensitive = true`
|
|
64
|
+
- [ ] Validation blocks for constrained inputs (environment names, CIDR blocks)
|
|
65
|
+
- [ ] Defaults are sensible — no default for required values
|
|
66
|
+
|
|
67
|
+
### Stage 7: Providers
|
|
68
|
+
- [ ] Provider versions pinned with `>=` lower bound
|
|
69
|
+
- [ ] `required_version` set for Terraform itself
|
|
70
|
+
- [ ] No deprecated provider features used
|
|
71
|
+
|
|
72
|
+
### Stage 8: CI/CD
|
|
73
|
+
- [ ] Pipeline runs `fmt -check`, `validate`, `plan` on PR
|
|
74
|
+
- [ ] Apply requires approval for production
|
|
75
|
+
- [ ] Plan output is posted to PR for review
|
|
76
|
+
|
|
77
|
+
## Output Format
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
## Terraform Review Summary
|
|
81
|
+
|
|
82
|
+
### Approved / Needs Changes / Blocked
|
|
83
|
+
|
|
84
|
+
### Critical Issues (must fix)
|
|
85
|
+
- [issue with file:line reference]
|
|
86
|
+
|
|
87
|
+
### State Safety Warnings
|
|
88
|
+
- [any resource replacements or deletions flagged]
|
|
89
|
+
|
|
90
|
+
### Security Findings
|
|
91
|
+
- [IAM, network, encryption issues]
|
|
92
|
+
|
|
93
|
+
### Suggestions (nice to have)
|
|
94
|
+
- [improvements]
|
|
95
|
+
|
|
96
|
+
### Verdict
|
|
97
|
+
[Final recommendation]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Rules
|
|
101
|
+
|
|
102
|
+
- Always use `git diff` to inspect actual changes — don't guess from filenames
|
|
103
|
+
- Every finding must include file:line reference
|
|
104
|
+
- Flag ALL destructive plan actions (destroy, replace) as critical unless justified
|
|
105
|
+
- Separate "must fix" from "nice to have" — don't block PRs on formatting
|
|
106
|
+
- Check `.tfvars` files for accidentally committed secrets
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:tf-scaffold
|
|
3
|
+
description: Scaffold service-level Terraform with live/, modules/, envs/ structure and CI/CD
|
|
4
|
+
argument-hint: "[service-name]"
|
|
5
|
+
preamble-tier: 3
|
|
6
|
+
---
|
|
7
|
+
@rules/infrastructure/STRUCTURE.md
|
|
8
|
+
@rules/infrastructure/NAMING.md
|
|
9
|
+
@rules/infrastructure/VARIABLES.md
|
|
10
|
+
|
|
11
|
+
# Terraform Scaffold: {{ args[0] | default: "new service" }}
|
|
12
|
+
|
|
13
|
+
Scaffold production-ready Terraform infrastructure for a service.
|
|
14
|
+
|
|
15
|
+
**Before scaffolding, reference:** `terraform-service-scaffold` skill
|
|
16
|
+
|
|
17
|
+
## Step 1: Gather Requirements
|
|
18
|
+
|
|
19
|
+
Ask the user:
|
|
20
|
+
|
|
21
|
+
> **Container host:** Which platform runs this service?
|
|
22
|
+
>
|
|
23
|
+
> I'd go with **A** — ECS is simpler for single-service deployments.
|
|
24
|
+
>
|
|
25
|
+
> - **A) ECS Fargate** — serverless containers, simpler ops
|
|
26
|
+
> - **B) EKS** — Kubernetes, more control, higher complexity
|
|
27
|
+
> - **C) Other** — specify (Lambda, EC2, etc.)
|
|
28
|
+
|
|
29
|
+
> **Resources needed:** What does this service depend on?
|
|
30
|
+
> - Database (RDS PostgreSQL / Aurora)
|
|
31
|
+
> - Cache (ElastiCache Redis)
|
|
32
|
+
> - Queue (SQS)
|
|
33
|
+
> - Object storage (S3)
|
|
34
|
+
> - CDN (CloudFront)
|
|
35
|
+
> - Other
|
|
36
|
+
|
|
37
|
+
## Step 2: Detect Infrastructure Remote State
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Check for existing infra state
|
|
41
|
+
find . -name "backend.tf" -o -name "*.tfbackend" 2>/dev/null | head -20
|
|
42
|
+
find . -name "remote-state*" -o -name "terraform.tfstate" 2>/dev/null | head -20
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Identify the remote state backend pattern (S3 + DynamoDB lock table) and region convention.
|
|
46
|
+
|
|
47
|
+
## Step 3: Scaffold Directory Structure
|
|
48
|
+
|
|
49
|
+
Create the standard layout:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
{service}/
|
|
53
|
+
├── live/
|
|
54
|
+
│ ├── dev/
|
|
55
|
+
│ │ ├── main.tf
|
|
56
|
+
│ │ ├── variables.tf
|
|
57
|
+
│ │ ├── outputs.tf
|
|
58
|
+
│ │ ├── backend.tf
|
|
59
|
+
│ │ └── dev.tfvars
|
|
60
|
+
│ ├── staging/
|
|
61
|
+
│ │ └── ... (same structure)
|
|
62
|
+
│ └── prod/
|
|
63
|
+
│ └── ... (same structure)
|
|
64
|
+
├── modules/
|
|
65
|
+
│ ├── service/ # ECS/EKS task + service
|
|
66
|
+
│ ├── networking/ # Security groups, ALB target groups
|
|
67
|
+
│ └── {resource}/ # One module per resource type
|
|
68
|
+
└── envs/
|
|
69
|
+
├── dev.tfvars
|
|
70
|
+
├── staging.tfvars
|
|
71
|
+
└── prod.tfvars
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Step 4: Generate Module Stubs
|
|
75
|
+
|
|
76
|
+
For each resource the user selected, create a module with:
|
|
77
|
+
- `main.tf` — resource definitions
|
|
78
|
+
- `variables.tf` — input variables with descriptions and types
|
|
79
|
+
- `outputs.tf` — exported values other modules consume
|
|
80
|
+
|
|
81
|
+
## Step 5: Wire Up Live Environments
|
|
82
|
+
|
|
83
|
+
Each environment's `main.tf` calls modules with environment-specific values. Use `data` sources to reference shared infrastructure (VPC, subnets, DNS).
|
|
84
|
+
|
|
85
|
+
## Step 6: Generate CI/CD Pipeline
|
|
86
|
+
|
|
87
|
+
Create pipeline config that runs:
|
|
88
|
+
1. `terraform fmt -check`
|
|
89
|
+
2. `terraform validate`
|
|
90
|
+
3. `terraform plan` (on PR)
|
|
91
|
+
4. `terraform apply` (on merge to main, with approval gate for prod)
|
|
92
|
+
|
|
93
|
+
## Step 7: Verify
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cd {service}/live/dev
|
|
97
|
+
terraform init
|
|
98
|
+
terraform validate
|
|
99
|
+
terraform plan -var-file=../../envs/dev.tfvars
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Rules
|
|
103
|
+
|
|
104
|
+
- Every variable must have a `description` and explicit `type`
|
|
105
|
+
- Use `locals` for computed values — never repeat expressions
|
|
106
|
+
- Remote state backend must use S3 + DynamoDB lock table
|
|
107
|
+
- Environment differences live in `.tfvars` files, not conditionals
|
|
108
|
+
- Tag all resources with `project`, `environment`, `service`, `managed_by = "terraform"`
|
|
109
|
+
- Never hardcode AWS account IDs, regions, or resource ARNs
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:tf-security
|
|
3
|
+
description: Security audit across IAM, networking, encryption, secrets, access control, and compliance
|
|
4
|
+
argument-hint: "[optional: focus-area]"
|
|
5
|
+
preamble-tier: 3
|
|
6
|
+
---
|
|
7
|
+
@rules/infrastructure/SECURITY.md
|
|
8
|
+
|
|
9
|
+
# Terraform Security Audit: {{ args[0] | default: "full audit" }}
|
|
10
|
+
|
|
11
|
+
Run a comprehensive security audit on Terraform infrastructure code.
|
|
12
|
+
|
|
13
|
+
**Before auditing, reference:** `terraform-security-audit` skill
|
|
14
|
+
|
|
15
|
+
## Audit Scope
|
|
16
|
+
|
|
17
|
+
If a focus area is provided, audit only that area. Otherwise, run all 6 stages.
|
|
18
|
+
|
|
19
|
+
Focus areas: `iam`, `network`, `encryption`, `secrets`, `access`, `compliance`
|
|
20
|
+
|
|
21
|
+
## Stage 1: IAM
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
grep -rn "aws_iam" *.tf modules/ 2>/dev/null
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Check for:
|
|
28
|
+
- [ ] No `"*"` in IAM policy actions — use specific actions
|
|
29
|
+
- [ ] No `"*"` in IAM policy resources — scope to specific ARNs
|
|
30
|
+
- [ ] Roles use `assume_role_policy` with specific principals (not `"*"`)
|
|
31
|
+
- [ ] Service roles follow least privilege
|
|
32
|
+
- [ ] No inline policies on users — use groups or roles
|
|
33
|
+
- [ ] MFA condition on sensitive operations
|
|
34
|
+
- [ ] IAM policies use conditions where applicable (`aws:SourceIp`, `aws:PrincipalOrgID`)
|
|
35
|
+
|
|
36
|
+
### Common Violations
|
|
37
|
+
|
|
38
|
+
```hcl
|
|
39
|
+
# WRONG — too permissive
|
|
40
|
+
statement {
|
|
41
|
+
actions = ["*"]
|
|
42
|
+
resources = ["*"]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# CORRECT — scoped
|
|
46
|
+
statement {
|
|
47
|
+
actions = ["s3:GetObject", "s3:PutObject"]
|
|
48
|
+
resources = ["arn:aws:s3:::{project}-{env}-*/*"]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Stage 2: Network
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
grep -rn "aws_security_group" *.tf modules/ 2>/dev/null
|
|
56
|
+
grep -rn "cidr_blocks" *.tf modules/ 2>/dev/null
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Check for:
|
|
60
|
+
- [ ] No `0.0.0.0/0` ingress on non-public ports (only 80/443 for ALB)
|
|
61
|
+
- [ ] No `0.0.0.0/0` egress unless justified
|
|
62
|
+
- [ ] Database security groups only allow app security group ingress
|
|
63
|
+
- [ ] SSH access (port 22) restricted to VPN/bastion CIDR
|
|
64
|
+
- [ ] Security group descriptions are meaningful
|
|
65
|
+
- [ ] VPC flow logs enabled
|
|
66
|
+
|
|
67
|
+
## Stage 3: Encryption
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
grep -rn "encrypted\|kms\|server_side_encryption" *.tf modules/ 2>/dev/null
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Check for:
|
|
74
|
+
- [ ] RDS: `storage_encrypted = true`
|
|
75
|
+
- [ ] S3: `server_side_encryption_configuration` block present
|
|
76
|
+
- [ ] EBS: `encrypted = true` on volumes
|
|
77
|
+
- [ ] ElastiCache: `transit_encryption_enabled = true`, `at_rest_encryption_enabled = true`
|
|
78
|
+
- [ ] Secrets Manager / SSM Parameter Store: KMS key specified
|
|
79
|
+
- [ ] ALB: HTTPS listeners with TLS 1.2+ policy
|
|
80
|
+
|
|
81
|
+
## Stage 4: Secrets
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
grep -rn "password\|secret\|api_key\|token\|credential" *.tf *.tfvars 2>/dev/null
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Check for:
|
|
88
|
+
- [ ] No plaintext secrets in `.tf` files
|
|
89
|
+
- [ ] No secrets in `.tfvars` committed to git
|
|
90
|
+
- [ ] Secrets referenced via `aws_secretsmanager_secret` or `aws_ssm_parameter`
|
|
91
|
+
- [ ] Sensitive variables marked `sensitive = true`
|
|
92
|
+
- [ ] Sensitive outputs marked `sensitive = true`
|
|
93
|
+
- [ ] `.gitignore` includes `*.tfvars` (or only example tfvars are committed)
|
|
94
|
+
|
|
95
|
+
## Stage 5: Access Control
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
grep -rn "publicly_accessible\|public_access\|acl" *.tf modules/ 2>/dev/null
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Check for:
|
|
102
|
+
- [ ] RDS: `publicly_accessible = false`
|
|
103
|
+
- [ ] S3: `block_public_acls = true`, `block_public_policy = true`
|
|
104
|
+
- [ ] ElastiCache: not in public subnet
|
|
105
|
+
- [ ] EKS: API server endpoint not public (or restricted by CIDR)
|
|
106
|
+
- [ ] Resources in private subnets where possible
|
|
107
|
+
|
|
108
|
+
## Stage 6: Compliance
|
|
109
|
+
|
|
110
|
+
Check for:
|
|
111
|
+
- [ ] All resources tagged: `project`, `environment`, `service`, `managed_by`
|
|
112
|
+
- [ ] Logging enabled: CloudTrail, ALB access logs, S3 access logs
|
|
113
|
+
- [ ] Backup configured: RDS automated backups, S3 versioning
|
|
114
|
+
- [ ] `prevent_destroy` on stateful resources (databases, S3 buckets with data)
|
|
115
|
+
- [ ] Terraform state bucket has versioning and encryption enabled
|
|
116
|
+
|
|
117
|
+
## Output Format
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
## Security Audit Results
|
|
121
|
+
|
|
122
|
+
### Critical (must fix before deploy)
|
|
123
|
+
- [finding with file:line reference]
|
|
124
|
+
|
|
125
|
+
### High (fix in next PR)
|
|
126
|
+
- [finding with file:line reference]
|
|
127
|
+
|
|
128
|
+
### Medium (plan to address)
|
|
129
|
+
- [finding]
|
|
130
|
+
|
|
131
|
+
### Low (nice to have)
|
|
132
|
+
- [finding]
|
|
133
|
+
|
|
134
|
+
### Passed Checks
|
|
135
|
+
- [what looks good]
|
|
136
|
+
|
|
137
|
+
### Score: [X/6 stages passed without critical findings]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Rules
|
|
141
|
+
|
|
142
|
+
- Every finding must include file:line reference
|
|
143
|
+
- Critical findings block deployment — no exceptions
|
|
144
|
+
- Check `.tfvars` files for secrets even if they're in `.gitignore`
|
|
145
|
+
- `0.0.0.0/0` ingress is only acceptable on ALB ports 80/443
|
|
146
|
+
- `"*"` in IAM actions/resources is always a critical finding
|
|
147
|
+
- Praise good security patterns — teams should know what they're doing right
|