$npx -y skills add pavel-molyanov/molyanov-ai-dev --skill infrastructure-setupSets up dev infrastructure for new projects: framework init, folder structure, Docker, pre-commit hooks (gitleaks), testing infrastructure, .gitignore. Use when: "настрой инфраструктуру", "подготовь проект", "настрой тесты", "настрой проверки при коммите", "настрой проверки при п
| 1 | <!-- Generated by sync-to-codex v1. Do not edit directly. --> |
| 2 | |
| 3 | # Infrastructure Setup |
| 4 | |
| 5 | ## Project Documentation Autosync |
| 6 | |
| 7 | Project documentation source of truth is Claude-side: `CLAUDE.md` and `.claude/**`. |
| 8 | Codex-side `AGENTS.md` and `.codex/**` are generated runtime files. |
| 9 | |
| 10 | After changing any project-local `.claude/**` file, immediately run: |
| 11 | |
| 12 | ```bash |
| 13 | ~/.claude/scripts/sync-to-codex.sh --project "$PWD" --apply |
| 14 | ``` |
| 15 | |
| 16 | If sync reports a conflict, stop and report it. Include generated `.codex/**` changes in the same commit as the `.claude/**` source change. |
| 17 | |
| 18 | ## Gathering Project Context |
| 19 | |
| 20 | Read project-knowledge references: |
| 21 | - `.claude/skills/project-knowledge/references/architecture.md` — tech stack, framework |
| 22 | - `.claude/skills/project-knowledge/references/patterns.md` — code conventions, branching strategy, testing |
| 23 | - `.claude/skills/project-knowledge/references/deployment.md` — deployment strategy |
| 24 | |
| 25 | If files lack needed info, search other project-knowledge references — info may exist under different names. If missing entirely, ask the user and immediately update the relevant doc. |
| 26 | |
| 27 | **Autonomous decisions** (based on project-knowledge): |
| 28 | - Framework init commands, folder structure, test framework, .gitignore patterns |
| 29 | |
| 30 | **Ask user:** |
| 31 | - Docker: needed? Local dev, production, or both? |
| 32 | - Pre-commit strictness: gitleaks only, or add lint/format? |
| 33 | |
| 34 | ## Phase 1: Framework Initialization |
| 35 | |
| 36 | Init framework from `architecture.md`. Use Context7 for up-to-date init commands and flags. Verify it starts. |
| 37 | |
| 38 | **Checkpoint:** dev server starts successfully. |
| 39 | |
| 40 | ## Phase 2: Folder Structure |
| 41 | |
| 42 | Convention — separate concerns by purpose: |
| 43 | |
| 44 | - **Web Apps:** `src/{components, services, lib, config}` + `tests/{unit, integration, e2e}` |
| 45 | - **APIs:** `src/{routes, services, models, middleware, config}` + `tests/{unit, integration}` |
| 46 | - **CLI tools:** `src/{commands, services, config}` + `tests/{unit, integration}` |
| 47 | |
| 48 | Add `src/prompts/` if project uses LLM prompts. Add `src/messages/` if project uses i18n. |
| 49 | |
| 50 | **Checkpoint:** structure created, matches project type. |
| 51 | |
| 52 | ## Phase 3: Docker (conditional) |
| 53 | |
| 54 | Set up only if specified in project-knowledge or user confirms. |
| 55 | |
| 56 | **Checkpoint:** `docker build` succeeds, container starts. |
| 57 | |
| 58 | ## Phase 4: .gitignore |
| 59 | |
| 60 | Security patterns (always add): |
| 61 | ``` |
| 62 | .env |
| 63 | .env.* |
| 64 | !.env.example |
| 65 | *.key |
| 66 | *.pem |
| 67 | credentials.json |
| 68 | secrets/ |
| 69 | ``` |
| 70 | |
| 71 | Add framework-specific patterns from `architecture.md`. |
| 72 | Create `.env.example` with required variable names (no values). |
| 73 | |
| 74 | **Checkpoint:** `git check-ignore .env` returns `.env`. |
| 75 | |
| 76 | ## Phase 5: Pre-commit Hooks |
| 77 | |
| 78 | Convention: gitleaks for secret scanning. Target: total pre-commit time under 10 seconds. |
| 79 | |
| 80 | Pre-commit scope (fast, staged files only): |
| 81 | - gitleaks (~2-5 seconds) |
| 82 | - Lint staged files |
| 83 | - Format check |
| 84 | |
| 85 | Full test suites, integration tests, builds belong in CI. |
| 86 | |
| 87 | **Checkpoint:** commit a file containing `AKIA1234567890EXAMPLE` — gitleaks blocks it. |
| 88 | |
| 89 | ## Phase 6: Testing Infrastructure |
| 90 | |
| 91 | Set up test framework, create smoke test: 1-2 tests verifying setup works (import main module, check environment). |
| 92 | |
| 93 | **Checkpoint:** test command passes. |
| 94 | |
| 95 | ## Phase 7: Documentation & Commit |
| 96 | |
| 97 | Update project-knowledge references (append, don't overwrite): |
| 98 | - `deployment.md` — required environment variables |
| 99 | - `patterns.md` (Git Workflow section) — pre-commit hooks and what they check |
| 100 | |
| 101 | Commit: |
| 102 | ``` |
| 103 | chore: setup project infrastructure |
| 104 | |
| 105 | - Initialize [framework] project |
| 106 | - Setup pre-commit hooks (gitleaks) |
| 107 | - Create folder structure |
| 108 | - Add testing infrastructure |
| 109 | - Configure .gitignore and .env.example |
| 110 | [- Setup Docker (if applicable)] |
| 111 | ``` |
| 112 | |
| 113 | Verify before commit: `git status` shows no `.env` files (only `.env.example`). |
| 114 | |
| 115 | ## Final Validation |
| 116 | |
| 117 | - [ ] Framework runs locally |
| 118 | - [ ] Folder structure matches convention |
| 119 | - [ ] gitleaks blocks test secret |
| 120 | - [ ] `.gitignore` covers `.env`, `*.key`, secrets |
| 121 | - [ ] `.env.example` exists (if project uses env vars) |
| 122 | - [ ] Smoke test passes |
| 123 | - [ ] Documentation updated |
| 124 | - [ ] All infrastructure committed |
| 125 | - [ ] Docker works (if applicable) |