@aegis-scan/skills 0.2.0 → 0.4.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.
Files changed (45) hide show
  1. package/ATTRIBUTION.md +60 -4
  2. package/CHANGELOG.md +78 -0
  3. package/README.md +27 -0
  4. package/dist/bin.js +1 -1
  5. package/dist/commands/list.d.ts.map +1 -1
  6. package/dist/commands/list.js +9 -2
  7. package/dist/commands/list.js.map +1 -1
  8. package/dist/skills-loader.d.ts +43 -0
  9. package/dist/skills-loader.d.ts.map +1 -1
  10. package/dist/skills-loader.js +102 -0
  11. package/dist/skills-loader.js.map +1 -1
  12. package/package.json +1 -1
  13. package/sbom.cdx.json +1 -1
  14. package/skills/compliance/_INDEX.md +49 -0
  15. package/skills/compliance/aegis-native/brutaler-anwalt/SKILL.md +100 -3
  16. package/skills/defensive/aegis-native/rls-defense/SKILL.md +25 -0
  17. package/skills/defensive/aegis-native/tenant-isolation-defense/SKILL.md +26 -0
  18. package/skills/foundation/_INDEX.md +73 -0
  19. package/skills/foundation/aegis-native/aegis-audit/SKILL.md +194 -0
  20. package/skills/foundation/aegis-native/aegis-audit/references/layer-1-headers.md +138 -0
  21. package/skills/foundation/aegis-native/aegis-audit/references/layer-2-html.md +153 -0
  22. package/skills/foundation/aegis-native/aegis-audit/references/layer-3-impressum.md +159 -0
  23. package/skills/foundation/aegis-native/aegis-audit/references/layer-4-dse.md +178 -0
  24. package/skills/foundation/aegis-native/aegis-audit/references/layer-5-cookie.md +180 -0
  25. package/skills/foundation/aegis-native/aegis-audit/references/layer-6-branche.md +204 -0
  26. package/skills/foundation/aegis-native/aegis-audit/references/layer-7-code-cross-check.md +212 -0
  27. package/skills/foundation/aegis-native/aegis-audit/references/layer-8-schadens-diagnose.md +232 -0
  28. package/skills/foundation/aegis-native/aegis-customer-build/SKILL.md +232 -0
  29. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-1-recon.md +147 -0
  30. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-2-architecture.md +164 -0
  31. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-3-component-build.md +231 -0
  32. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-4-content.md +196 -0
  33. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-5-integration.md +273 -0
  34. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-6-mid-audit.md +200 -0
  35. package/skills/foundation/aegis-native/aegis-customer-build/references/phase-7-final-verify.md +258 -0
  36. package/skills/foundation/aegis-native/aegis-handover-writer/SKILL.md +128 -0
  37. package/skills/foundation/aegis-native/aegis-module-builder/SKILL.md +251 -0
  38. package/skills/foundation/aegis-native/aegis-orchestrator/SKILL.md +146 -0
  39. package/skills/foundation/aegis-native/aegis-quality-gates/SKILL.md +122 -0
  40. package/skills/foundation/aegis-native/aegis-skill-creator/SKILL.md +223 -0
  41. package/skills/foundation/aegis-native/aegis-skill-creator/references/hard-constraint-template.md +213 -0
  42. package/skills/foundation/aegis-native/aegis-skill-creator/references/skillforge-methodology.md +220 -0
  43. package/skills/foundation/aegis-native/dsgvo-compliance/SKILL.md +185 -0
  44. package/skills/foundation/aegis-native/dsgvo-compliance/references/art-13-15-templates.md +309 -0
  45. package/skills/foundation/aegis-native/dsgvo-compliance/references/datenpanne-runbook.md +291 -0
@@ -0,0 +1,232 @@
1
+ <!-- aegis-local: AEGIS-native skill, MIT-licensed; library-engine-driven autonomous customer-website builder. Ingests a configurator-output briefing.md, runs 7 phases (Recon/Architecture/Component-Build/Content/Integration/Mid-Audit/Final-Verify) plus Pre-Build-Validation and Post-Build status-report, dispatches subagents (Master/Research/Executor/Strategist), hits AAA+++ quality-gates (994/S/FORTRESS, Lighthouse 98+, briefing-coverage 100%) or returns INCOMPLETE-Status. Pattern ported from a private operational reference; this is the public OSS variant. References to private engines, libraries, and reference-implementations are placeholder/concept-level only. -->
2
+ ---
3
+ name: aegis-customer-build
4
+ description: Autonomous customer-website builder. Ingests configurator-briefing, runs 7 phases (Recon/Architecture/Build/Content/Integration/Mid-Audit/Final-Verify) + multi-agent dispatch, hits production-bar quality gates or returns INCOMPLETE-list. Trigger keywords - build customer, kundenseite, konfigurator-briefing, autonomous-build, 3h-build, agentur-build.
5
+ model: opus
6
+ license: MIT
7
+ metadata:
8
+ required_tools: "shell-ops,file-ops,task-tracking,subagent-dispatch,library-engine,aegis-scan,brutaler-anwalt,lighthouse"
9
+ required_audit_passes: "3"
10
+ enforced_quality_gates: "9"
11
+ pre_done_audit: "true"
12
+ ---
13
+
14
+ # aegis-customer-build — Autonomous AAA+++ Customer-Site Builder
15
+
16
+ The Foundation's flagship skill. One operator-prompt → 3-5h autonomous → deployment-ready customer-site at production-bar quality. Multi-agent orchestration with mandatory mid-build audits and a final 9-gate verification loop. Either DONE with proof or INCOMPLETE with explicit open-list — never "looks done".
17
+
18
+ > **Library-engine** = the project's component-library invocation toolchain. Could be a private engine kept out of the public AEGIS repo (referenced by capability, not by code), a public starter-template, or a project-specific harvested library. The skill never assumes a specific engine; it consumes whatever the project has bound under `<private-engine>` per the spec §13.14.F placeholder convention.
19
+
20
+ ---
21
+
22
+ ## HARD-CONSTRAINT — Anti-Halbherzig-Discipline
23
+
24
+ Before Phase 1 starts, this skill MUST:
25
+
26
+ 1. **Load all 7 phase-references** in `references/phase-1-recon.md` through `references/phase-7-final-verify.md`. Skipping a phase-reference = guaranteed quality-regression. References live next to this SKILL.md.
27
+ 2. **Load the project's component-library inventory.** Scan, catalog, and bind to component-tree. No improvising components when the library has a fitting one.
28
+ 3. **Load the configurator-briefing** at the path the operator passed. Validate it against the schema in `references/phase-1-recon.md` BEFORE any build-action.
29
+ 4. **Load `compliance/aegis-native/brutaler-anwalt/SKILL.md`** for the spot-check passes in Phase 6 + final pass in Phase 7. Audit-patterns are mandatory cross-reference.
30
+ 5. **Pages-Count-Commitment:** count the pages explicitly listed in the briefing. Print `Briefing pages: N expected, will build: N`. If briefing says 5 pages, build 5. Building 4 is a violation — explicit INCOMPLETE-Status with the 5th page listed.
31
+ 6. **7-phase-pipeline is non-skippable.** No "this build doesn't need Phase 6". Mid-Audit and Final-Verify run on every build, regardless of size.
32
+ 7. **Per-phase checkpoint:** after each phase, write `.aegis/state.json` with `{phase, status, timestamp, gates_run, gates_pass}`. The next agent (or resumed session) needs this to recover from a crash.
33
+ 8. **Final-Verify-Loop:** all 9 gates (per `aegis-quality-gates`) green OR repair-attempt (max 3 iterations) OR INCOMPLETE-Status with the failing-gate-list. Never silent-skip.
34
+
35
+ If any of (1)-(8) cannot be satisfied — STOP and report which precondition is missing. Don't improvise; the foundation depends on these guarantees.
36
+
37
+ ---
38
+
39
+ ## Mission
40
+
41
+ Eliminate the failure-mode where a coding-agent says "the site is done" while pages are stub-quality, gates were skipped, or the briefing's page-list isn't fully covered. Provide an industrial-grade pipeline that:
42
+
43
+ - Runs a fixed 9-step sequence (Pre-Build + 7 phases + Post-Build) — no agent-judgment-call to skip steps.
44
+ - Uses the project's existing component-library 1:1 — no parallel hand-cobbled assemblies that drift from the library's quality-bar.
45
+ - Audits at the half-way mark (Phase 6) before pouring more time into a build whose foundation is already broken.
46
+ - Verifies every page in the briefing exists in the artifact (briefing-coverage gate) — no silent omissions.
47
+ - Reports DONE-with-proof or INCOMPLETE-with-list — never optimistic "looks done".
48
+
49
+ Production-bar reference: a previous customer-build run (private operational reference) hit AEGIS 994/S/FORTRESS + Lighthouse 98/100/100/100 + brutaler-anwalt 0 KRITISCH/0 HOCH on a 13-page deliverable in 3h. This skill is the public-reusable version of that pipeline.
50
+
51
+ ---
52
+
53
+ ## Triggers
54
+
55
+ ### Slash-commands
56
+
57
+ - `/build` — start a customer-build run (operator passes briefing-path as argument)
58
+ - `/customer-build` — alias
59
+ - `/agentur-build` — alias
60
+
61
+ ### Auto-trigger keywords
62
+
63
+ - build customer, kundenseite, neue site, konfigurator-briefing, autonomous-build, 3h-build, AAA+++ site
64
+
65
+ ### Required-input gate
66
+
67
+ The skill refuses to start without a briefing-path. If the user just says "build a site", the skill asks for the briefing-file (path or content) and exits if not provided. No improvising a briefing from chat-context — the briefing is the contract.
68
+
69
+ ---
70
+
71
+ ## Process
72
+
73
+ The pipeline is fixed. Pre-Build + 7 numbered phases + Post-Build = 9 mandatory steps. Each step has a phase-reference under `references/`. Each step ends with a checkpoint-write to `.aegis/state.json`.
74
+
75
+ ### Phase Summary Table
76
+
77
+ | # | Phase | Time | Subagent | Reference | Checkpoint |
78
+ |---|---|---|---|---|---|
79
+ | 0 | Pre-Build-Validation | ~10 min | Master | phase-1-recon.md | briefing_validated |
80
+ | 1 | Recon | ~20-30 min | Research (opus) | phase-1-recon.md | briefing_parsed |
81
+ | 2 | Architecture | ~20-30 min | Strategist (opus) | phase-2-architecture.md | architecture_decisions |
82
+ | 3 | Component-Build | ~60-90 min | Executor (sonnet) × N | phase-3-component-build.md | pages_built |
83
+ | 4 | Content | ~30-45 min | Executor (sonnet) | phase-4-content.md | content_complete |
84
+ | 5 | Integration | ~30-45 min | Executor (sonnet) | phase-5-integration.md | integrations_mounted |
85
+ | 6 | Mid-Audit | ~20-30 min | Auditor (opus) | phase-6-mid-audit.md | mid_audit_score |
86
+ | 7 | Final-Verify | ~30-45 min | Auditor (opus) | phase-7-final-verify.md | gates_status |
87
+ | 8 | Post-Build Status | ~5-10 min | Master | _(inline below)_ | status: DONE\|INCOMPLETE |
88
+
89
+ Total: 3-5h wall-clock with parallel subagent dispatch in Phase 3.
90
+
91
+ ### Pre-Build-Validation (~10 min)
92
+
93
+ Before Phase 1: validate the briefing.md exists, parses, and is complete enough to commit to a 3-5h build. See `references/phase-1-recon.md` for the briefing-completeness checklist (project-slug, brand, pages-list with N≥3, tech-stack, content-plan, brand-identity, design-prefs).
94
+
95
+ If briefing is incomplete — STOP, print the missing fields, ask the operator to complete it. Don't guess.
96
+
97
+ Tech-stack auto-detection: if the briefing says Next.js, the build uses the foundation's Next.js template. Alternative stacks (Remix, SvelteKit) are extension-points; the canonical path is Next.js App Router.
98
+
99
+ ### Phase 1: Recon (~20-30 min)
100
+
101
+ Parse the briefing into structured data. Extract: pages-list, tech-stack, brand-identity, content-plan, design-prefs. Identify mandatory integrations (forms, chatbot, scanner, analytics).
102
+
103
+ See `references/phase-1-recon.md` for the parser-checklist + tech-stack-detection-patterns.
104
+
105
+ Checkpoint: `.aegis/state.json` `phase: 1, status: complete, briefing_parsed: true`.
106
+
107
+ ### Phase 2: Architecture (~20-30 min)
108
+
109
+ Decide routing-pattern (App Router vs Pages Router), component-tree (page-level vs shared), data-flow (props vs context vs server-state), and tech-stack-decision-matrix (Tailwind vs styled-components, etc.).
110
+
111
+ See `references/phase-2-architecture.md`.
112
+
113
+ Checkpoint: `.aegis/state.json` `phase: 2, architecture_decisions: {routing, component_tree, data_flow}`.
114
+
115
+ ### Phase 3: Component-Build (~60-90 min)
116
+
117
+ Iterate page-by-page. For each page: bind to library-components from the project's component-library. Custom-content for unique pages; standard-template for boilerplate.
118
+
119
+ This is the biggest time-block. Subagent-dispatch is recommended: each page can be built by an Executor-subagent in parallel (per spec §14.3 — multi-agent orchestration via Task tool / spawn_agent).
120
+
121
+ See `references/phase-3-component-build.md` for the per-page-iteration pattern.
122
+
123
+ Checkpoint per page: `.aegis/state.json` `pages_built: [...]` updated incrementally.
124
+
125
+ ### Phase 4: Content (~30-45 min)
126
+
127
+ Copy-writing per page (matching the briefing's tone-of-voice), image-placement (per the operator's image-pipeline — typically a mix of stock + custom), SEO-meta + Open-Graph + Schema.org structured data.
128
+
129
+ See `references/phase-4-content.md`.
130
+
131
+ Checkpoint: `.aegis/state.json` `phase: 4, content_complete: true, alt_texts_present: true`.
132
+
133
+ ### Phase 5: Integration (~30-45 min)
134
+
135
+ API-routes (with secureApiRoute + Zod-strict + requireRole patterns from the foundation's templates), forms (DSGVO-compliant + double-opt-in pattern), chatbot mounting (e.g., a public LLM via /api/chat — per the foundation's reference integration), scanner mounting (/scan + sub-routes if the project uses the AEGIS public scanner).
136
+
137
+ See `references/phase-5-integration.md` for the API-route-template + form-template + chatbot-mount-pattern.
138
+
139
+ Checkpoint: `.aegis/state.json` `phase: 5, integrations_mounted: [...]`.
140
+
141
+ ### Phase 6: Mid-Audit (~20-30 min, MANDATORY)
142
+
143
+ Run AEGIS-scan on the half-built artifact. Run brutaler-anwalt in HUNT-mode with topic-specific scope (focus: Impressum + Cookie + DSE — the bug-prone surface). Identify regressions early before pouring 60 more minutes of content into a foundation that's already red.
144
+
145
+ See `references/phase-6-mid-audit.md` for the spot-check-pattern + repair-attempt-loop (max 3 iterations before escalating to Phase 7 INCOMPLETE).
146
+
147
+ Checkpoint: `.aegis/state.json` `phase: 6, mid_audit_score: X, mid_audit_repairs: N`.
148
+
149
+ ### Phase 7: Final-Verify (~30-45 min)
150
+
151
+ Run all 9 quality-gates (per `aegis-quality-gates`). Run briefing-coverage check (every page in briefing exists in artifact + has minimum content + has SEO-meta). Run Lighthouse (Mobile + Desktop). Run final brutaler-anwalt full-pass.
152
+
153
+ See `references/phase-7-final-verify.md` for the 9-gate-runner-invocation + briefing-coverage-pattern + status-report-format.
154
+
155
+ Checkpoint: `.aegis/state.json` `phase: 7, gates_status: {build, tsc, ...}, briefing_coverage: X/X, status: DONE|INCOMPLETE`.
156
+
157
+ ### Post-Build: Status-Report (~5-10 min)
158
+
159
+ Print the structured status:
160
+
161
+ ```
162
+ Bin fertig, Chef.
163
+ - Site unter <output-path>/
164
+ - AEGIS Score: <score>/<grade>/<bracket>
165
+ - Lighthouse: <mobile>/<desktop>
166
+ - brutaler-anwalt: <kritisch> KRITISCH, <hoch> HOCH
167
+ - Briefing-Coverage: <built>/<expected> pages (<pct>%)
168
+ - Audit-Report: <output-path>/audits/final.md
169
+ - Bereit für deploy.
170
+ ```
171
+
172
+ OR if any gate is red:
173
+
174
+ ```
175
+ BUILD INCOMPLETE — folgende Items offen:
176
+ - [ ] <gate-name>: <actual> (threshold: <expected>)
177
+ - [ ] <missing-page>: <expected-path> (briefing line N)
178
+ ...
179
+ Repair-attempt-Count: <N>/3. Empfehlung: <repair / abandon>.
180
+ ```
181
+
182
+ Never report "DONE" with red gates. Never silent-skip a gate.
183
+
184
+ ---
185
+
186
+ ## Verification / Success Criteria
187
+
188
+ Before declaring the build complete:
189
+
190
+ - [ ] Pre-Build-Validation passed (briefing complete, schema-valid, pages ≥3)
191
+ - [ ] Phase 1 Recon checkpoint written + parsed-briefing under `<output>/briefing-parsed.json`
192
+ - [ ] Phase 2 Architecture decisions written under `<output>/architecture.md`
193
+ - [ ] Phase 3 Component-Build: every page in briefing has a corresponding file in the artifact
194
+ - [ ] Phase 4 Content: every page has copy + images + SEO-meta + alt-texts (no missing fields)
195
+ - [ ] Phase 5 Integration: all integrations from briefing mounted (forms, chatbot, scanner — whichever applies)
196
+ - [ ] Phase 6 Mid-Audit: AEGIS-score ≥ 900 mid-build (interim threshold) + brutaler-anwalt 0 KRITISCH
197
+ - [ ] Phase 7 Final-Verify: all 9 gates green per `aegis-quality-gates`
198
+ - [ ] Briefing-coverage: 100% of pages in briefing exist in artifact
199
+ - [ ] AEGIS-score: ≥ 950 (target ≥ 990)
200
+ - [ ] Lighthouse: Mobile ≥ 75, Desktop ≥ 90, A11y/SEO/BP = 100
201
+ - [ ] brutaler-anwalt: 0 KRITISCH, ≤ 2 HOCH (any HOCH explicitly listed in status)
202
+
203
+ If any checkbox unmet → INCOMPLETE-Status. Report which checkbox is open + repair-attempt count + recommendation.
204
+
205
+ ---
206
+
207
+ ## Anti-Patterns
208
+
209
+ - ❌ Skipping Pre-Build-Validation "because the briefing looks fine" — schema-validation catches missing fields the operator forgot.
210
+ - ❌ Building 4 pages when briefing says 5 — pages-count-commitment is non-negotiable.
211
+ - ❌ Skipping Phase 6 Mid-Audit "to save time" — Phase 6 catches foundation-bugs before Phase 7 has to find them in a fully-built artifact (more expensive to repair).
212
+ - ❌ Hand-cobbling components when the project's library has a fitting one — library-binding is the quality-bar; improvising drifts.
213
+ - ❌ Reporting "DONE" with red Lighthouse — Lighthouse is gate 7; red gate = INCOMPLETE.
214
+ - ❌ Skipping the final brutaler-anwalt pass "because the mid-audit was clean" — final pass is mandatory.
215
+ - ❌ Mocking gate-runs in Phase 7 — every gate hits real tools; mocking gates is grounds for full-rebuild.
216
+ - ❌ "Repair-attempt count: 5" — max 3 iterations before INCOMPLETE-Status. Don't loop forever; escalate.
217
+ - ❌ Silent-skipping Phase 6 because "this is just a small site" — every customer-build runs all 9 steps.
218
+ - ❌ Improvising a briefing from chat-context — the briefing is the contract; demand the file from the operator.
219
+ - ❌ Writing the post-build status-report without actually verifying the artifact (e.g., not running Lighthouse, just claiming a score).
220
+
221
+ ---
222
+
223
+ ## Extension Points
224
+
225
+ - **Alternative tech-stacks**: Next.js App Router is the canonical path. Remix / SvelteKit / Astro / Vite-React extensions add a `references/phase-2-architecture-<stack>.md` and a parallel `references/phase-3-component-build-<stack>.md`. Phase 1 + 4 + 5 + 6 + 7 stay stack-agnostic.
226
+ - **Custom briefing-schemas**: a project might use a different configurator that produces a different briefing-shape. Add a `references/phase-1-recon-<configurator>.md` and a schema-validator script. Pre-Build-Validation reads the configurator-name from the briefing and dispatches.
227
+ - **Multi-language sites**: extend Phase 4 with a `references/phase-4-content-i18n.md` covering locale-routing, message-bundles, hreflang-tags, locale-specific SEO-meta.
228
+ - **E-commerce extensions**: Phase 5 Integration extends with `references/phase-5-integration-ecommerce.md` covering payment-providers, cart-flows, fulfillment-webhooks. Phase 6 mid-audit extends to include PCI-DSS-spot-check.
229
+ - **Custom Lighthouse-thresholds**: a starter-template might cap at 80 instead of 95. Override in `presets/<use-case>.yaml` `lighthouse:{mobile,desktop,a11y,seo,bp}`. Phase 7 reads from preset, not hardcoded here.
230
+ - **Subagent-dispatch granularity**: by default Phase 3 dispatches one Executor per page. Larger sites (20+ pages) benefit from sub-batching (5-page batches per Executor). Add a `--batch-size` flag handled in Phase 3.
231
+ - **Resume after crash**: `.aegis/state.json` checkpoints make resume possible. Add a `--resume` flag that reads the latest checkpoint and skips already-complete phases. The skill's HARD-CONSTRAINT block stays — even on resume, the briefing is re-validated and the references are re-loaded.
232
+ - **Custom audit-gates**: a project with industry-specific compliance (HIPAA, PCI-DSS) adds gates to `presets/<use-case>.yaml` `custom_gates:[]`. Phase 7 picks them up automatically per `aegis-quality-gates` extension-points.
@@ -0,0 +1,147 @@
1
+ # Phase 1 Reference — Recon (Briefing Parser + Tech-Stack Detection)
2
+
3
+ Phase 1 of the customer-build pipeline. Inputs: a configurator-output briefing.md. Outputs: structured `briefing-parsed.json` + identified tech-stack + pages-list + brand-identity-distilled.
4
+
5
+ **Time budget:** 20-30 min. **Subagent dispatch:** Research-subagent (model: opus) recommended for complex briefings (>1000 lines).
6
+
7
+ ---
8
+
9
+ ## Briefing-Completeness Checklist
10
+
11
+ The skill refuses to start Phase 2 if any of these fields is missing or malformed. The checklist IS the contract.
12
+
13
+ | Field | Required | Validator |
14
+ |---|---|---|
15
+ | `project_slug` | yes | `[a-z][a-z0-9-]{2,40}`, unique within `customers/` |
16
+ | `brand.name` | yes | non-empty string |
17
+ | `brand.tagline` | yes | non-empty string, ≤ 80 chars |
18
+ | `brand.colors` | yes | object with `primary`, `secondary`, `accent` (hex) |
19
+ | `pages[]` | yes | array, length ≥ 3, each item has `slug`, `title`, `purpose`, `sections[]` |
20
+ | `tech_stack` | yes | one of `next-app-router`, `next-pages-router`, `remix`, `sveltekit`, `astro`, `vite-react` |
21
+ | `content_plan` | yes | object with `tone`, `voice`, `keywords[]` |
22
+ | `brand_identity` | yes | object with `target_audience`, `value_proposition`, `differentiators[]` |
23
+ | `design_prefs` | yes | object with `typography`, `mood`, `references[]` |
24
+ | `integrations` | optional | array of `forms`, `chatbot`, `scanner`, `analytics`, `commerce` (any subset) |
25
+ | `legal` | yes | object with `impressum_data`, `dse_provider`, `cookie_strategy` |
26
+ | `seo` | yes | object with `target_keywords[]`, `gmb_url` (if local biz) |
27
+
28
+ If a field is missing — STOP, print:
29
+ ```
30
+ Pre-Build-Validation FAILED — missing fields:
31
+ - brand.colors.accent
32
+ - pages[3].sections (page "Kontakt")
33
+ Operator: please complete the briefing and re-run.
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Parser-Workflow
39
+
40
+ ```
41
+ 1. Read briefing.md → gray-matter (YAML frontmatter) + markdown body
42
+ 2. Validate frontmatter against schema (above table)
43
+ 3. Parse markdown sections (## Pages, ## Brand, ## Content-Plan, ## Design)
44
+ 4. Cross-check: every page in frontmatter pages[] has a corresponding ## section in body
45
+ 5. Extract pages-list with full structured data per page
46
+ 6. Write briefing-parsed.json under customers/<slug>/.aegis/briefing-parsed.json
47
+ 7. Print "Briefing pages: N expected, will build: N" for the operator-confirm
48
+ ```
49
+
50
+ Parser reads a single file (`briefing.md`). Multi-file briefings (`briefing.md` + `pages.json` + `brand.json`) are an extension-point per Extension Points in SKILL.md.
51
+
52
+ ---
53
+
54
+ ## Tech-Stack Detection Patterns
55
+
56
+ The briefing's `tech_stack` field is authoritative. If present, use that. If absent, infer:
57
+
58
+ | Briefing signal | Inferred stack |
59
+ |---|---|
60
+ | Mentions "App Router" or "RSC" or "use server" | next-app-router |
61
+ | Mentions "getServerSideProps" or "getStaticProps" | next-pages-router |
62
+ | Mentions "loaders" or "actions" or "Remix" | remix |
63
+ | Mentions "+page.svelte" or "+layout.svelte" | sveltekit |
64
+ | Mentions "Astro" or "MDX islands" | astro |
65
+ | Mentions "Vite" without server-rendering | vite-react |
66
+ | Default fallback | next-app-router |
67
+
68
+ Once inferred, ask the operator to confirm before Phase 2 commits to the architecture.
69
+
70
+ ---
71
+
72
+ ## Brand-Identity Distillation
73
+
74
+ Extract a 1-paragraph "brand essence" from the briefing's `brand_identity` block. Used in Phase 4 (Content) for tone-matching:
75
+
76
+ ```
77
+ Essence: [target_audience] looking for [value_proposition]; differentiated by [differentiators], speaking in a [tone] voice with [voice] (e.g., "Sie", "Du", "lockerer Plural-Wir").
78
+ ```
79
+
80
+ The essence becomes the system-prompt header for any LLM-call in Phase 4 (copy-writing). It also drives the chatbot's persona if a chatbot is mounted in Phase 5.
81
+
82
+ ---
83
+
84
+ ## Pages-List Schema
85
+
86
+ Each page in the briefing's `pages[]` MUST conform to:
87
+
88
+ ```yaml
89
+ - slug: home # url-path-segment
90
+ title: "Startseite" # navigation-title (≤ 30 chars)
91
+ purpose: "..." # 1-sentence why-this-page-exists
92
+ sections: # ordered list of in-page sections
93
+ - hero
94
+ - intro
95
+ - features
96
+ - cta
97
+ - testimonials
98
+ - footer-cta
99
+ meta:
100
+ title: "..." # SEO-meta title
101
+ description: "..." # SEO-meta description (120-160 chars)
102
+ canonical: "/" # canonical URL-path
103
+ ```
104
+
105
+ If `sections` is empty — STOP. The operator must specify in-page sections; the build cannot guess them.
106
+
107
+ ---
108
+
109
+ ## Integrations Detection
110
+
111
+ The `integrations` array drives Phase 5 mounting. Common values:
112
+
113
+ - `forms.contact` — contact-form with double-opt-in
114
+ - `forms.newsletter` — newsletter-signup
115
+ - `chatbot.public-llm` — chat-widget routing to /api/chat
116
+ - `scanner.aegis` — embed AEGIS public scanner at /scan
117
+ - `analytics.plausible` — Plausible analytics (privacy-friendly, no consent-banner gate)
118
+ - `analytics.matomo` — Matomo (self-hosted, may need consent depending on config)
119
+ - `commerce.stripe` — Stripe checkout
120
+ - `commerce.paypal` — PayPal checkout
121
+
122
+ Phase 5 reads each enabled integration and mounts via `references/phase-5-integration.md` template per integration.
123
+
124
+ ---
125
+
126
+ ## Anti-Patterns specific to Phase 1
127
+
128
+ - ❌ Skipping schema validation "because the briefing came from the official configurator" — configurator-output drift happens; always validate.
129
+ - ❌ Inferring tech_stack from page-content (e.g., "they wrote 'use client', so it's RSC") — too brittle; require explicit briefing field.
130
+ - ❌ Writing a partial `briefing-parsed.json` and proceeding to Phase 2 with "we'll fix it later" — Phase 2 architecture decisions depend on a complete briefing.
131
+ - ❌ Treating an empty `integrations` array as "no integrations needed" — clarify with the operator; many briefings forget to enumerate.
132
+
133
+ ---
134
+
135
+ ## Recovery / Resume
136
+
137
+ If a previous run crashed in Phase 1, the resume-flow:
138
+
139
+ ```
140
+ 1. Read .aegis/state.json — confirm phase: 1 status: incomplete
141
+ 2. Re-validate briefing.md (changes possible)
142
+ 3. If briefing-parsed.json exists: load it, validate freshness against briefing.md mtime
143
+ 4. If stale: re-parse from scratch
144
+ 5. Resume Phase 2
145
+ ```
146
+
147
+ Always re-validate — never trust a stale checkpoint blindly.
@@ -0,0 +1,164 @@
1
+ # Phase 2 Reference — Architecture (Routing + Component-Tree + Data-Flow)
2
+
3
+ Phase 2 turns parsed-briefing into concrete architecture decisions. Outputs: `architecture.md` under `customers/<slug>/`. **Time budget:** 20-30 min. **Model:** opus (Strategist subagent).
4
+
5
+ ---
6
+
7
+ ## Decision 1: Routing-Pattern
8
+
9
+ For Next.js (canonical default):
10
+
11
+ | Briefing signal | Routing |
12
+ |---|---|
13
+ | ≥ 80% pages have server-side data + auth-aware | App Router (`app/`) |
14
+ | Largely static + client-heavy interactivity | Pages Router (`pages/`) |
15
+ | Pre-existing legacy site being incrementally rebuilt | Pages Router with App Router islands |
16
+ | Default for new projects | App Router |
17
+
18
+ **Decision criterion:** App Router unless the briefing explicitly forbids it. Document the decision in `architecture.md` under `## Routing`.
19
+
20
+ For Remix / SvelteKit / Astro: routing follows the framework's idiomatic file-based pattern. No alternatives to evaluate.
21
+
22
+ ---
23
+
24
+ ## Decision 2: Component-Tree
25
+
26
+ Distinguish between:
27
+
28
+ - **Page-level components** — unique to one page (e.g., `app/leistungen/components/PricingTable.tsx`).
29
+ - **Shared components** — used by ≥ 2 pages (e.g., `components/Hero.tsx`).
30
+ - **Library-bound components** — instances of project's component-library that get assembled per page (e.g., the project's component-library provides 80+ pre-built blocks; a page picks 8-12 of them).
31
+
32
+ Rule of thumb: every page in the briefing produces ≥ 1 page-level + ≥ 3 library-bound + ≥ 5 shared imports. If a page is pure library-binding with zero page-level components — flag in `architecture.md` for operator review (might indicate a too-generic page).
33
+
34
+ ---
35
+
36
+ ## Decision 3: Data-Flow
37
+
38
+ | Data shape | Pattern |
39
+ |---|---|
40
+ | Server-side data fetched at request time | RSC + fetch (App Router) or getServerSideProps (Pages Router) |
41
+ | Client-side state shared across components | React Context or Zustand (no Redux for new builds) |
42
+ | Form-state | React Hook Form + Zod resolver |
43
+ | Real-time data (chat-stream, scanner-stream) | Server-Sent Events (SSE) |
44
+ | Persistent client-state | localStorage with a typed wrapper |
45
+
46
+ Avoid `useEffect`-driven data-fetching in App Router; prefer RSC. Document the decision in `architecture.md` under `## Data-Flow`.
47
+
48
+ ---
49
+
50
+ ## Decision 4: Tech-Stack-Decision-Matrix
51
+
52
+ For ambiguous parts of the stack, decide and record:
53
+
54
+ | Choice | Default | Alternative | When alternative |
55
+ |---|---|---|---|
56
+ | Styling | Tailwind v4 | CSS Modules | If briefing mentions corporate design-system |
57
+ | UI primitives | shadcn/ui | Radix-only | If shadcn templates clash with briefing aesthetic |
58
+ | Forms | React Hook Form + Zod | TanStack Form | If briefing mentions multi-step wizards (≥ 5 steps) |
59
+ | Icons | lucide-react | Custom SVG | Always lucide unless briefing forbids |
60
+ | Fonts | Local-bundled .woff2 | Next/font | Always local-bundled (DSGVO + perf reasons) |
61
+ | Image optimization | next/image with `quality={95}` + WebP source | Plain `<img>` | Always next/image with quality prop |
62
+ | API-route security | secureApiRoute wrapper + Zod-strict + requireRole | None | Always wrap |
63
+
64
+ **Hard rules** (non-negotiable):
65
+
66
+ - DSGVO: no Google Fonts via Google CDN — always local-bundled.
67
+ - Performance: image quality = 95 (default 75 re-compresses uploaded images poorly).
68
+ - Security: every API-route wraps secureApiRoute (rate-limit + Origin-check + body-validation).
69
+
70
+ ---
71
+
72
+ ## Decision 5: Folder-Structure
73
+
74
+ Canonical Next.js App Router layout:
75
+
76
+ ```
77
+ customers/<slug>/
78
+ app/
79
+ layout.tsx # root + chatbot mount + viewport
80
+ page.tsx # home
81
+ [slug]/page.tsx # dynamic for catalog-style pages
82
+ api/
83
+ chat/route.ts # if chatbot integration enabled
84
+ scan/route.ts # if scanner integration enabled
85
+ contact/route.ts # contact form submission
86
+ leistungen/
87
+ page.tsx
88
+ [...]
89
+ impressum/page.tsx
90
+ datenschutz/page.tsx
91
+ cookies/page.tsx # if cookie-banner used
92
+ agb/page.tsx
93
+ components/
94
+ layout/
95
+ Navbar.tsx
96
+ Footer.tsx
97
+ CookieBanner.tsx
98
+ library/ # bound from project component-library (Phase 3)
99
+ page-level/ # page-unique components
100
+ lib/
101
+ seo.ts # SEO meta helpers
102
+ api/
103
+ secure-route.ts # secureApiRoute wrapper
104
+ rate-limit.ts
105
+ schemas/ # Zod schemas
106
+ public/
107
+ images/ # WebP-optimised
108
+ fonts/ # .woff2 local bundle
109
+ .aegis/
110
+ state.json # checkpoint
111
+ briefing-parsed.json
112
+ architecture.md
113
+ briefing.md # original input (left in place)
114
+ audits/ # populated in Phase 6 + 7
115
+ ```
116
+
117
+ For non-Next.js stacks: replace `app/` and `pages/` paths with the framework-idiomatic equivalents. The semantic structure (components, lib, public, .aegis) stays the same.
118
+
119
+ ---
120
+
121
+ ## architecture.md Output Template
122
+
123
+ Phase 2 writes a structured architecture doc under `customers/<slug>/architecture.md`:
124
+
125
+ ```markdown
126
+ # Architecture — <project_slug>
127
+
128
+ **Date:** YYYY-MM-DD
129
+ **Tech-Stack:** <chosen-stack>
130
+ **Routing:** <App Router | Pages Router | ...>
131
+ **Style:** Tailwind v4 + shadcn/ui
132
+
133
+ ## Component-Tree
134
+
135
+ (table of pages × components, with ratio of page-level vs shared vs library-bound)
136
+
137
+ ## Data-Flow
138
+
139
+ (per-page-section: where data comes from, how it's passed)
140
+
141
+ ## API-Routes
142
+
143
+ (list per integration: chat, scan, contact, ...)
144
+
145
+ ## Decisions Log
146
+
147
+ (any non-default-path choices, with rationale referencing the briefing)
148
+
149
+ ## Pre-Phase-3 Confirmations
150
+
151
+ - [ ] Operator-confirmed tech-stack
152
+ - [ ] Operator-confirmed page-list (re-counted from briefing)
153
+ - [ ] Operator-confirmed integrations
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Anti-Patterns specific to Phase 2
159
+
160
+ - ❌ Choosing Pages Router for a new build "because it's simpler" — App Router is the canonical path; Pages Router only for legacy continuity.
161
+ - ❌ Skipping the architecture.md write "because we know what we're doing" — Phase 4 + 5 + 6 + 7 read this doc; missing it breaks downstream phases.
162
+ - ❌ Mixing styling approaches (Tailwind + CSS Modules + styled-components) — choose one, document, stick to it.
163
+ - ❌ Using `useEffect` for server-side data in App Router — that's Pages Router thinking; use RSC.
164
+ - ❌ Skipping `secureApiRoute` wrapping for "internal-only" routes — every API-route gets the wrapper, no exceptions.