mcpField
G
GitLab Stack Creator

GitLab Stack Creator

github.com/rknall云与 DevOps86282 次安装53 周前更新
代码仓库

关于 GitLab Stack Creator

GitLab Stack Creator 是用于创建 Docker stack 项目的技能,涵盖目录结构、Git 设置、验证脚本和文档。它面向新建 stack 的用户,并要求在完成前检查配置与密钥。

主要功能

  1. 01引导收集 stack 需求
  2. 02创建标准项目目录
  3. 03配置 Git 与钩子
  4. 04验证 Docker 配置和密钥
  5. 05编写设置与服务文档

适用场景

  1. 01启动新的 Docker stack 项目
  2. 02初始化 Git 仓库和验证钩子
  3. 03完成前检查 stack 配置

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/rknall/claude-skills --skill gitlab-stack-creator

安装后在 Claude Code 中输入/gitlab-stack-creator确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

workflow-examples.md
git-hooks-guide.md
SKILL_COMPLETION.md
README.md
templates-reference.md

详细介绍

GitLab 堆栈创建器

为创建新的 GitLab 堆栈项目提供专业协助,确保项目结构、Git 配置、验证脚本和文档完善。

何时使用此技能

出现以下情况时,应触发此技能:

  • 创建新的 GitLab 堆栈项目
  • 使用适当的结构初始化 Docker 堆栈
  • 设置包含 ./config、./secrets、./_temporary 目录的项目
  • 为堆栈项目配置 Git 仓库
  • 设置验证钩子和脚本
  • 按照最佳实践引导创建堆栈项目

核心原则

此技能遵循 GitLab 堆栈管理模式:

  1. 所有内容都通过 docker-compose.yml 和 ./config 配置
  2. 机密信息存储在 ./secrets 和 Docker secrets 中
  3. 仅当容器不支持原生机密信息时,才使用 docker-entrypoint.sh 脚本
  4. 所有容器文件均由运行 Docker 的用户所有(不得有 root 所有的文件)
  5. 使用 ./_temporary 目录存放临时设置文件(使用后清理)
  6. 在认定堆栈创建完成前,必须完成全部验证

堆栈创建完成的条件

只有满足以下所有条件,才能认定堆栈创建已完成:

  1. ✅ stack-validator 技能报告无问题
  2. ✅ secrets-manager 技能确认无未解决问题
  3. ✅ docker-validation 技能确认无问题
  4. ✅ 所有验证脚本均成功执行
  5. ✅ Git 仓库已正确初始化和配置
  6. ✅ ./docs 中的文档已完整

重要:绝不要使用变通方法。如果直接方案不起作用,请停止并询问用户接下来该怎么做。

堆栈创建工作流

阶段 1:项目初始化
1.1 收集需求

询问用户:

  • 项目名称
  • 所需的主要服务(nginx、PostgreSQL、Redis 等)
  • 远程 Git 仓库 URL(如有)
  • 环境(开发、预发布、生产)
  • 特殊要求

绝不要假设——如有信息缺失,务必询问。

1.2 检查现有设置

创建任何内容之前:

  • 检查目录是否已存在
  • 检查 Git 仓库是否已存在
  • 如有冲突,询问用户如何处理
  • 未经明确许可,绝不要覆盖
阶段 2:创建目录结构

创建标准目录结构:

project-name/
├── .git/                       # Git repository
│   ├── hooks/                  # Git hooks (validation scripts)
│   └── config                  # Git configuration
├── config/                     # Service configurations
│   ├── nginx/                  # Nginx configs (if needed)
│   ├── postgres/               # PostgreSQL configs (if needed)
│   └── redis/                  # Redis configs (if needed)
├── secrets/                    # Docker secrets files
│   └── .gitkeep               # Keep directory in git
├── _temporary/                 # Temporary files (gitignored)
├── scripts/                    # Validation and utility scripts
│   ├── pre-commit              # Pre-commit validation hook
│   ├── validate-stack.sh       # Full stack validation
│   └── setup-hooks.sh          # Hook installation script
├── docs/                       # Project documentation
│   ├── decisions/              # Architecture decision records
│   ├── setup.md                # Setup instructions
│   └── services.md             # Service documentation
├── docker-compose.yml          # Main compose file
├── .env.example                # Environment template
├── .gitignore                  # Git exclusions
├── .dockerignore               # Docker exclusions
├── CLAUDE.md                   # Claude Code instructions
└── README.md                   # Project overview

操作:

  1. 创建目录:mkdir -p config secrets _temporary scripts docs/decisions
  2. 创建占位文件:touch secrets/.gitkeep
  3. 设置适当的权限:chmod 700 secrets
阶段 3:设置 Git 仓库
3.1 初始化或连接仓库

如果不存在 Git 仓库:

  • 强烈建议创建本地仓库
  • 询问是否应添加远程仓库
  • 使用 git init 初始化
  • 将 main 设为默认分支:git config init.defaultBranch main

如果提供了远程仓库 URL:

  • 克隆仓库:git clone <url> <project-name>
  • 或添加远程仓库:git remote add origin <url>
  • 验证远程连接:git remote -v

如果设置失败:停止并向用户寻求指导。绝不要尝试变通方法。

3.2 配置 Git

设置所需的 Git 配置:

# Set main as branch name
git config init.defaultBranch main

# Set ff-only merge strategy
git config pull.ff only
git config merge.ff only

# Ensure no rebase by default
git config pull.rebase false

# Set user info if not set globally
git config user.name "User Name"
git config user.email "[email protected]"

如果配置失败:请用户手动设置配置,或提供正确的值。

3.3 创建 .gitignore

生成完整的 .gitignore:

# Secrets - NEVER commit
secrets/*
!secrets/.gitkeep
*.key
*.pem
*.crt
*.p12
*.pfx

# Environment files
.env
.env.local
.env.*.local

# Temporary files
_temporary/
*.tmp
*.temp
.cache/

# Docker
.docker/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
*.log

# Backup files
*.bak
*.backup
3.4 创建 .dockerignore

生成 .dockerignore:

.git
.gitignore
README.md
docs/
_temporary/
*.md
.env
.env.example
secrets/
.vscode/
.idea/
阶段 4:设置验证脚本
4.1 创建 scripts/validate-stack.sh

生成完整的验证脚本,该脚本:

  • 调用 stack-validator 技能
  • 调用 secrets-manager 技能进行验证
  • 调用 docker-validation 技能
  • 报告所有问题
  • 仅当全部验证通过时返回退出代码 0

模板:

#!/usr/bin/env bash
set -euo pipefail

echo "=== GitLab Stack Validation ==="
echo

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

ERRORS=0

echo "1. Validating stack structure..."
if ! claude-code-cli run stack-validator; then
    echo -e "${RED}✗ Stack validation failed${NC}"
    ((ERRORS++))
else
    echo -e "${GREEN}✓ Stack validation passed${NC}"
fi
echo

echo "2. Validating secrets configuration..."
if ! claude-code-cli run secrets-manager --validate; then
    echo -e "${RED}✗ Secrets validation failed${NC}"
    ((ERRORS++))
else
    echo -e "${GREEN}✓ Secrets validation passed${NC}"
fi
echo

echo "3. Validating Docker configuration..."
if ! claude-code-cli run docker-validation; then
    echo -e "${RED}✗ Docker validation failed${NC}"
    ((ERRORS++))
else
    echo -e "${GREEN}✓ Docker validation passed${NC}"
fi
echo

if [ $ERRORS -gt 0 ]; then
    echo -e "${RED}Validation failed with $ERRORS error(s)${NC}"
    exit 1
fi

echo -e "${GREEN}All validations passed!${NC}"
exit 0

设置为可执行:chmod +x scripts/validate-stack.sh

4.2 创建 scripts/pre-commit

生成 pre-commit 钩子:

#!/usr/bin/env bash
set -euo pipefail

echo "Running pre-commit validation..."

# Check for secrets in staged files
if git diff --cached --name-only | grep -qE "secrets/.*[^.gitkeep]|\.env$"; then
    echo "ERROR: Attempting to commit secrets or .env file!"
    echo "Secrets should never be committed to git."
    exit 1
fi

# Check for root-owned files
if find . -user root -not -path "./.git/*" 2>/dev/null | grep -q .; then
    echo "ERROR: Root-owned files detected!"
    echo "All files should be owned by the user running Docker."
    exit 1
fi

# Run quick validation (if available)
if [ -x "./scripts/validate-stack.sh" ]; then
    echo "Running stack validation..."
    if ! ./scripts/validate-stack.sh; then
        echo "ERROR: Stack validation failed!"
        echo "Fix issues before committing, or use 'git commit --no-verify' to skip."
        exit 1
    fi
fi

echo "Pre-commit validation passed!"
exit 0

设置为可执行:chmod +x scripts/pre-commit

4.3 创建 scripts/setup-hooks.sh

生成钩子安装脚本:

#!/usr/bin/env bash
set -euo pipefail

echo "Installing git hooks..."

# Check if .git directory exists
if [ ! -d ".git" ]; then
    echo "ERROR: Not a git repository!"
    exit 1
fi

# Install pre-commit hook
if [ -f "scripts/pre-commit" ]; then
    cp scripts/pre-commit .git/hooks/pre-commit
    chmod +x .git/hooks/pre-commit
    echo "✓ Installed pre-commit hook"
else
    echo "✗ scripts/pre-commit not found"
    exit 1
fi

echo "Git hooks installed successfully!"

设置为可执行:chmod +x scripts/setup-hooks.sh

创建脚本后:运行 ./scripts/setup-hooks.sh 安装钩子。

Phase 5:Docker 配置
5.1 创建 docker-compose.yml 模板

根据用户需求生成初始 docker-compose.yml:

重要:使用 docker-validation 技能,确保 docker-compose.yml 符合所有最佳实践。

基本模板结构:

services:
  # Services will be added based on requirements

  # Example: nginx service
  nginx:
    image: nginx:alpine
    container_name: ${PROJECT_NAME:-project}_nginx
    restart: unless-stopped
    ports:
      - "${NGINX_PORT:-80}:80"
    volumes:
      - ./config/nginx:/etc/nginx/conf.d:ro
    networks:
      - app-network

networks:
  app-network:
    driver: bridge

# Secrets will be defined here when needed
secrets: {}

# Volumes for persistent data
volumes: {}

操作:

  1. 生成包含所选服务的 docker-compose.yml
  2. 使用 docker-validation 技能进行验证
  3. 修复报告中的任何问题
  4. 如果验证失败,绝不要继续——请用户提供指导
5.2 创建 .env.example

生成环境变量模板:

# Project Configuration
PROJECT_NAME=myproject

# Service Ports
NGINX_PORT=80
# Add more as needed

# Database Configuration (if applicable)
# POSTGRES_PORT=5432
# REDIS_PORT=6379

# IMPORTANT: Copy this file to .env and configure for your environment
# .env is gitignored and should contain actual secrets
Phase 6:配置文件

使用 config-generator 技能创建特定于服务的配置文件:

操作:

  1. 为每个服务(nginx、PostgreSQL、Redis)调用 config-generator
  2. 在 ./config// 中生成配置
  3. 使用 config-generator 验证生成的配置
  4. 配置无效时绝不要继续——请用户提供指导

调用示例:

  • “为此技术栈生成 nginx 生产环境配置”
  • “创建 PostgreSQL 开发环境配置”
  • “生成启用了持久化的 Redis 配置”
Phase 7:密钥管理

使用 secrets-manager 技能设置密钥:

操作:

  1. 确定需要密钥的服务
  2. 使用 secrets-manager 创建安全密钥
  3. 在 docker-compose.yml 中配置密钥引用
  4. 仅当容器不支持原生 Docker secrets 时,才生成 docker-entrypoint.sh 脚本
  5. 使用 secrets-manager 验证 .env 或 docker-compose.yml 环境配置中没有任何密钥
  6. 如果 secrets-manager 报告问题,绝不要继续——请用户提供指导

调用示例:

  • “为 PostgreSQL 设置数据库密码密钥”
  • “创建 Redis 密码密钥”
  • “为 JWT_SECRET 生成安全的随机密钥”
Phase 8:生成文档
8.1 创建 docs/setup.md

生成设置文档:

# Setup Instructions

## Prerequisites

- Docker Engine 20.10+
- Docker Compose V2
- Git

## Initial Setup

1. Clone the repository:
   ```bash
   git clone <repository-url>
   cd <project-name>
  1. 复制环境变量模板:

    cp .env.example .env
    
  2. 配置环境:

    • 根据你的设置编辑 .env
    • 绝不要将 .env 提交到 git
  3. 设置密钥:

    • 按照 secrets/README.md 创建密钥
    • 使用 docker secret create 创建每个密钥
  4. 安装 git 钩子:

    ./scripts/setup-hooks.sh
    
  5. 验证技术栈:

    ./scripts/validate-stack.sh
    
  6. 启动服务:

    docker compose up -d
    

验证

部署前始终运行验证:

./scripts/validate-stack.sh

此验证会检查:

  • 技术栈结构
  • 密钥配置
  • Docker 配置
  • 文件所有权
  • Git 排除规则

#### 8.2 Create docs/services.md

Document all services:
```markdown
# Services Documentation

## Service Overview

| Service | Port | Purpose | Configuration |
|---------|------|---------|---------------|
| nginx | 80 | Web server | ./config/nginx |
| ... | ... | ... | ... |

## Service Details

### Nginx

**Image**: nginx:alpine
**Purpose**: Web server and reverse proxy
**Configuration**: ./config/nginx/
**Secrets**: None
**Volumes**:
- ./config/nginx:/etc/nginx/conf.d:ro

### [Other Services]

Document each service similarly...
8.3 创建 docs/decisions/0001-stack-architecture.md

创建架构决策记录:

# 1. Stack Architecture

**Date**: YYYY-MM-DD

## Status

Accepted

## Context

This project uses GitLab Stack Management patterns to ensure:
- Consistent configuration management
- Secure secrets handling
- Proper file ownership
- Validated deployments

## Decision

We will follow these principles:
1. All configuration in docker-compose.yml and ./config
2. All secrets in ./secrets and Docker secrets
3. docker-entrypoint.sh only when necessary
4. No root-owned files
5. ./_temporary for transient files
6. Complete validation before deployment

## Consequences

**Positive**:
- Consistent structure across all stacks
- Automated validation prevents issues
- Secure by default
- Easy to maintain and update

**Negative**:
- Initial setup requires more steps
- Must follow strict patterns
- Validation gates can slow rapid iteration

## Compliance

- stack-validator: Ensures structure compliance
- secrets-manager: Ensures secure secrets
- docker-validation: Ensures Docker best practices
8.4 创建 CLAUDE.md

为项目生成 Claude Code 指令:

# CLAUDE.md

This file provides guidance to Claude Code when working with this stack project.

## Project Structure

This is a GitLab Stack project following strict patterns:
- Configuration: docker-compose.yml and ./config/
- Secrets: ./secrets/ and Docker secrets
- Temporary: ./_temporary/ (gitignored)
- Documentation: ./docs/
- Validation: ./scripts/

## Required Skills

This project uses these Claude Code skills:
- **stack-validator**: Validate entire stack structure
- **secrets-manager**: Manage Docker secrets securely
- **docker-validation**: Validate Docker configurations
- **config-generator**: Generate service configs

## Git Configuration

**Branch**: main
**Merge Strategy**: ff-only (fast-forward only)
**Hooks**: Pre-commit validation enabled

## Validation Requirements

BEFORE any git commit, ALL these must pass:
1. stack-validator reports NO issues
2. secrets-manager is satisfied
3. docker-validation is satisfied
4. No root-owned files exist
5. No secrets in .env or docker-compose.yml environment

## Making Changes

### Adding a Service

1. Update docker-compose.yml
2. Use config-generator to create configs
3. Use secrets-manager to handle secrets
4. Run ./scripts/validate-stack.sh
5. Fix ALL issues before committing
6. NEVER commit if validation fails

### Modifying Configuration

1. Edit configuration files
2. Validate with docker-validation
3. Run ./scripts/validate-stack.sh
4. Fix ALL issues before committing

### Working with Secrets

1. Use secrets-manager for ALL secret operations
2. NEVER put secrets in .env or docker-compose.yml
3. Use Docker secrets or ./secrets/ directory
4. Validate with secrets-manager before committing

## Commit Standards

**Pre-commit Hook**: Automatically validates before commit
**Skip Hook**: `git commit --no-verify` (emergency only)
**Commit Messages**: Use conventional commits format

Example:

feat: 添加 Redis 服务并启用持久化 fix: 修正 nginx 代理配置 docs: 更新设置说明


## Important Rules

1. NEVER commit secrets to git
2. NEVER create root-owned files
3. NEVER skip validation without asking
4. NEVER use workarounds - ask user instead
5. ALWAYS run validation before committing
6. ALWAYS document decisions in ./docs/decisions/
7. ALWAYS use ff-only merge strategy
8. ALWAYS use main as branch name

## Troubleshooting

### Validation Fails

1. Review validation output
2. Use respective skill to investigate (stack-validator, secrets-manager, docker-validation)
3. Fix reported issues
4. Re-run validation
5. Ask user if stuck - NEVER use workarounds

### Git Conflicts

1. NEVER use rebase without explicit permission
2. Use ff-only merges
3. Ask user how to resolve conflicts

### Permission Issues

1. Check file ownership: `find . -user root`
2. Fix with: `sudo chown -R $USER:$USER .`
3. Validate with stack-validator

## Resources

- Stack Validator Documentation
- Secrets Manager Documentation
- Docker Validation Documentation
- Config Generator Documentation
8.5 创建 README.md

生成项目 README:

# Project Name

Brief description of the project.

## Quick Start

```bash
# Clone repository
git clone <url>
cd <project-name>

# Copy environment template
cp .env.example .env

# Configure environment (edit .env)
nano .env

# Install git hooks
./scripts/setup-hooks.sh

# Validate stack
./scripts/validate-stack.sh

# Start services
docker compose up -d

文档

项目结构

.
├── config/          # Service configurations
├── secrets/         # Docker secrets (gitignored except .gitkeep)
├── _temporary/      # Temporary files (gitignored)
├── scripts/         # Validation and utility scripts
├── docs/            # Project documentation
└── docker-compose.yml

验证

此项目使用自动化验证:

# Full validation
./scripts/validate-stack.sh

# Pre-commit validation (automatic)
git commit -m "message"

验证检查项:

  • ✓ 技术栈结构(stack-validator)
  • ✓ 密钥配置(secrets-manager)
  • ✓ Docker 配置(docker-validation)
  • ✓ 文件所有权(无 root 文件)
  • ✓ Git 排除规则(.gitignore)

Git 工作流

分支:main 合并策略:ff-only(仅快进) 提交前钩子:已启用(提交前进行验证)

服务

服务端口用途
.........

详情请参阅服务文档。

开发

先决条件
  • Docker Engine 20.10+
  • Docker Compose V2
  • Git
  • Bash(用于脚本)
添加服务
  1. 更新 docker-compose.yml
  2. 生成配置:使用 config-generator skill
  3. 设置密钥:使用 secrets-manager skill
  4. 验证:./scripts/validate-stack.sh
  5. 提交更改
进行更改
  1. 进行更改
  2. 运行验证:./scripts/validate-stack.sh
  3. 修复报告的所有问题
  4. 提交(pre-commit hook 将再次验证)

故障排除

验证失败

运行各项验证器:

  • claude-code-cli run stack-validator
  • claude-code-cli run secrets-manager --validate
  • claude-code-cli run docker-validation
权限问题

检查是否有 root 所有的文件:

find . -user root -not -path "./.git/*"

修复所有权:

sudo chown -R $USER:$USER .

许可证

[你的许可证]

联系方式

[你的联系信息]


### Phase 9: Final Validation

#### 9.1 Run Complete Validation

Execute full validation workflow:

```bash
# Run validation script
./scripts/validate-stack.sh

必须检查以下内容:

  1. stack-validator:完整的结构验证
  2. secrets-manager:所有密钥均已正确配置
  3. docker-validation:Docker 配置有效
  4. 文件所有权:不存在 root 所有的文件
  5. Git 设置:.gitignore 配置正确,hooks 已安装
9.2 验证清单

手动验证:

  • 已创建所有目录
  • 已初始化 Git 仓库
  • 已配置 Git(main 分支、ff-only)
  • 已创建 .gitignore 和 .dockerignore
  • 已创建验证脚本且具有可执行权限
  • 已安装 Git hooks
  • 已创建 docker-compose.yml 且内容有效
  • 已创建 .env.example
  • 已生成服务配置(如适用)
  • 已正确配置密钥(如适用)
  • 已创建所有文档
  • 已创建 CLAUDE.md
  • 已创建 README.md
  • stack-validator:✓ 无问题
  • secrets-manager:✓ 无问题
  • docker-validation:✓ 无问题
9.3 完成堆栈创建

仅当满足以下条件时,才将堆栈创建标记为完成:

  • 所有验证均通过,且没有错误
  • 所有文档均已完成
  • Git 仓库已正确配置
  • 用户确认一切无误

如果任意验证失败:

  1. 清楚地报告问题
  2. 询问用户如何继续
  3. 绝不使用变通方案
  4. 正确修复问题
  5. 重新验证
阶段 10:首次提交

所有验证通过后:

# Stage all files
git add .

# Commit (pre-commit hook will validate)
git commit -m "feat: initial stack setup

- Created directory structure
- Configured git with main branch and ff-only
- Set up validation scripts and hooks
- Generated docker-compose.yml
- Created service configurations
- Set up secrets management
- Added comprehensive documentation"

# Push to remote (if configured)
git push -u origin main

如果提交因 pre-commit hook 失败:

  1. 检查验证输出
  2. 修复问题
  3. 重新运行验证
  4. 再次尝试提交
  5. 如果问题仍然存在,询问用户

沟通风格

创建堆栈时:

  • 对缺失的信息提出澄清问题
  • 执行前说明每个阶段
  • 清楚地报告验证结果
  • 如果验证失败,绝不继续
  • 遇到困难时向用户寻求指导
  • 执行前确认重要决定
  • 将所有决定记录在 ./docs/decisions/
  • 提供清晰的后续步骤

与其他技能集成

stack-validator
  • 在阶段 9(最终验证)结束时调用
  • 在验证脚本中调用
  • 在 pre-commit hooks 中调用
  • 如果验证失败,绝不继续
secrets-manager
  • 在阶段 7(密钥管理)期间调用
  • 所有密钥操作均使用此工具
  • 验证密钥配置
  • 如果 secrets-manager 报告问题,绝不继续
docker-validation
  • 在阶段 5(Docker 配置)期间调用
  • 验证 docker-compose.yml
  • 验证 Dockerfiles(如有)
  • 在验证脚本中调用
  • 如果 docker-validation 失败,绝不继续
config-generator
  • 在阶段 6(配置文件)期间调用
  • 生成特定于服务的配置
  • 用于 nginx、PostgreSQL、Redis 等
  • 验证生成的配置

错误处理

验证失败

不要:

  • 尝试变通方案
  • 跳过验证
  • 在存在错误时继续
  • 假定用户想要继续

应该:

  • 立即停止
  • 清楚地报告问题
  • 显示验证输出
  • 询问用户如何继续
  • 记录决定
Git 问题

不要:

  • 强制推送
  • 未经许可跳过 hooks
  • 未经许可使用 rebase
  • 未经许可修改 Git 历史

应该:

  • 向用户寻求指导
  • 说明问题
  • 提供选项
  • 记录解决方案
权限问题

不要:

  • 创建由 root 拥有的文件
  • 未经许可使用 sudo
  • 跳过权限检查

要:

  • 报告权限问题
  • 请用户修正所有权
  • 修正后进行验证
  • 记录正确的所有权设置

工作流示例

工作流 1:创建简单的 Web 技术栈
User: "Create a new stack for a web application with nginx"
Assistant: "I'll create a new web stack with nginx. Let me gather some information first."

**Questions**:
1. "What's the project name?"
   User: "mywebapp"

2. "Do you have a remote git repository URL?"
   User: "https://gitlab.com/user/mywebapp.git"

3. "What environment is this for?"
   User: "production"

**Actions**:
1. Create directory structure
2. Initialize git and connect to remote
3. Configure git (main branch, ff-only)
4. Create docker-compose.yml with nginx
5. Use docker-validation to validate
6. Use config-generator to create nginx config
7. Create validation scripts
8. Install git hooks
9. Generate all documentation
10. Run full validation
11. Report status

**Completion**:
"Stack creation complete! All validations passed:
✓ stack-validator: NO issues
✓ secrets-manager: NO issues (no secrets needed)
✓ docker-validation: NO issues

Next steps:
1. Review generated files
2. Customize .env from .env.example
3. Run: docker compose up -d"
工作流 2:创建完整的应用程序技术栈
User: "Create a stack with nginx, PostgreSQL, and Redis"
Assistant: "I'll create a full application stack. Let me gather information."

**Questions**:
1. "Project name?" → "myapp"
2. "Remote repository?" → "Yes, https://gitlab.com/user/myapp.git"
3. "Environment?" → "production"

**Actions**:
1. Create directory structure with config/{nginx,postgres,redis}
2. Initialize git, connect remote, configure (main, ff-only)
3. Create docker-compose.yml with all three services
4. Validate with docker-validation
5. Use config-generator for each service:
   - nginx production config
   - PostgreSQL production config
   - Redis production config
6. Use secrets-manager for:
   - PostgreSQL password
   - Redis password
   - Create Docker secrets
7. Create validation scripts and install hooks
8. Generate all documentation
9. Run full validation (stack-validator, secrets-manager, docker-validation)
10. Initial commit

**Completion**:
"Stack creation complete! All validations passed:
✓ stack-validator: NO issues
✓ secrets-manager: All secrets properly configured
✓ docker-validation: NO issues

Services configured:
- nginx (port 80)
- PostgreSQL (port 5432, password in Docker secret)
- Redis (port 6379, password in Docker secret)

Next steps:
1. Review secrets in ./secrets/
2. Customize .env from .env.example
3. Run: docker compose up -d"

总结

stack-creator 技能:

  1. 集成 stack-validator、secrets-manager、docker-validation、config-generator
  2. 强制要求 完成全部验证后才能认为创建完成
  3. 绝不 使用权宜之计——始终向用户寻求指导
  4. 正确配置 git(main 分支、仅快进合并)
  5. 安装 验证钩子和脚本
  6. 在 ./docs/ 中记录所有内容
  7. 按照 GitLab Stack Management 模式创建可用于生产环境的技术栈

只有当全部三个验证器均通过且没有任何问题,并且所有文档均已就绪时,技术栈创建才算完成。

评论

支持 Markdown