一键导入
repo-to-architecture-summary
// Analyze a component repository and generate comprehensive architecture summary with structured markdown tables. Use when analyzing ODH/RHOAI components, documenting architecture, or creating security diagrams.
// Analyze a component repository and generate comprehensive architecture summary with structured markdown tables. Use when analyzing ODH/RHOAI components, documenting architecture, or creating security diagrams.
Discover platform components by exploring breadcrumbs (installers, operators, dependencies) in checkouts directory. Outputs component-map.json for platforms without manifest scripts.
Generate architecture diagrams (Mermaid, C4, security network diagrams) from GENERATED_ARCHITECTURE.md. Creates visual representations for different audiences - developers, architects, security teams.
Generate diagrams for all component architecture files in an organized architecture directory. Processes each component sequentially ONE AT A TIME by reading the .md file and extracting data from tables. Creates Mermaid, C4, and security diagrams. Skips components that already have diagrams by default.
Generate platform-level diagrams (dependency graphs, network topology, cross-component workflows) from aggregated PLATFORM.md file. Creates visualizations for architects, security teams, and platform engineers.
Combine multiple component architecture summaries into a platform-level architecture document. Use after generating component summaries to create a wholistic platform view.
Analyze all components for a platform (ODH or RHOAI) sequentially by parsing get_all_manifests.sh and executing repo-to-architecture-summary for each. Skips components that already have GENERATED_ARCHITECTURE.md. Fully autonomous and resumable.
| name | repo-to-architecture-summary |
| description | Analyze a component repository and generate comprehensive architecture summary with structured markdown tables. Use when analyzing ODH/RHOAI components, documenting architecture, or creating security diagrams. |
| user-invocable | true |
| allowed-tools | Read, Glob, Grep, Bash(git *), Bash(ls *), Bash(find *), Bash(python *), Write, Task |
Analyze a component repository (for Open Data Hub or Red Hat OpenShift AI) and generate a GENERATED_ARCHITECTURE.md file with detailed architecture information.
Positional argument:
[directory] - Path to repository directory (default: current directory)Optional flags:
--distribution=odh|rhoai|both (default: both)--version=X.Y (default: auto-detect)--output=FILENAME (default: GENERATED_ARCHITECTURE.md)--generated-by=STRING (default: auto-detect from model name + current date)Examples:
/repo-to-architecture-summary # analyze current directory
/repo-to-architecture-summary checkouts/opendatahub-io/kserve # analyze specific directory
/repo-to-architecture-summary ./kserve --distribution=rhoai --output=GENERATED_ARCHITECTURE.md
/repo-to-architecture-summary . --distribution=rhoai --generated-by="Claude Opus 4.6"
Generate a comprehensive architecture summary following these steps:
IMPORTANT - TOOL USAGE:
ToolSearch. You already have access to: Bash, Read, Write, Glob, Grep, Task.--include patterns over Bash grep commands.NEVER read *_test.go files. They consume context without informing architecture. Exclude them from all find commands and never open them.
CRITICAL - SOURCE REFERENCE TRACKING: You MUST maintain a running log of EVERY file you read or grep during analysis. For each file, record:
Track this from the very first file you open. This data is written into the final ## Source References section of the output. Every claim in the architecture document must be traceable to a specific file and line range. This is non-negotiable — the source references are as important as the architecture content itself.
IMPORTANT FOR OPERATORS: Don't just read manifests - read the controller code!
internal/controller/, controllers/, pkg/controller/ directoriesinternal/controller/services/gateway/ managing Gateway API is ingress architectureParse the arguments string:
cd [directory-path]
--output flag sets the output filename (default: GENERATED_ARCHITECTURE.md). Use this exact filename when writing the final file — do not invent a different name.For opendatahub-operator repository specifically:
make get-manifests
./opt/ directoryFor rhods-operator repository (RHOAI 3.x+):
This operator deploys the platform's entire ingress infrastructure. You MUST thoroughly analyze it:
find internal/controller -type d and find controllers -type d 2>/dev/nullls -la to see all files, then read every .go file and every template file (*.tmpl.yaml, *.yaml, *.tmpl) in that directory and its resources/ subdirectoryinternal/controller/services/gateway/ — Gateway API, Envoy, EnvoyFilter, kube-rbac-proxyinternal/controller/services/gateway/resources/ — YAML/template files for Gateway, EnvoyFilter, Deployments*dashboard*, *route*, *redirect*, *ingress*, *auth*The ingress stack this operator deploys includes ALL of:
gateway.networking.k8s.io): Gateway CR defining the platform ingress entry pointnetworking.istio.io/v1alpha3): Traffic shaping, header manipulation, auth integrationMissing ANY of these produces an incomplete ingress architecture. Document every resource the controllers create.
For other repositories: Skip to discovery below.
Identify:
main.go, controllers/, api/setup.py, requirements.txt, pyproject.tomlpackage.json, src/Cargo.toml, src/main.rsDockerfile.konflux or Containerfile.konflux if they exist
Dockerfile/Containerfile may be outdated/unused - verify they're actually used in buildsChart.yamlkustomization.yaml*.yaml in manifests/, config/, deploy/./opt/ directory for component manifests (populated by make get-manifests)Identify every shippable container image by parsing Konflux Dockerfiles. Each Dockerfile*konflux* maps to one deployable component.
find . -maxdepth 3 \( -name "*Dockerfile*konflux*" -o -name "*Containerfile*konflux*" \) -print | sort
Read each Konflux Dockerfile and extract: component name (from filename suffix), base image, build stages, COPY source paths, exposed ports, and entry command. This creates a component inventory that drives all subsequent analysis.
For each Dockerfile, also determine the component's intent — its architectural role:
The intent drives the Sub-Component Details section in the output.
See Konflux Component Discovery for the full procedure.
Based on what you found in Steps 3 and 3a, select which reference doc(s) to use for deep code analysis in Step 4a:
| Repo indicators | Reference doc | Sub-agent threshold |
|---|---|---|
go.mod + controllers/ or internal/controller/ or PROJECT file | Controller Analysis | 20+ Go files |
package.json + frontend/ + packages/*/bff/ | Frontend + BFF Analysis | 200+ TS/Go files |
pyproject.toml or setup.py + Python source dirs | Python Service Analysis | 100+ Python files |
go.mod + cmd/*/main.go (no controller dirs) | Go Service Analysis | 50+ Go files |
Cargo.toml + src/main.rs | Rust Service Analysis | 80+ Rust files |
| Only Dockerfiles, no significant source code | Container Image Analysis | Never (read directly) |
manifests/ or config/ with kustomization.yaml | Kustomize Manifest Analysis | Never (read directly) |
Multi-language repos (e.g., kserve with Go operators + Python SDK, model-registry with Go + Python + UI) should use multiple reference docs — one per language layer.
Kustomize manifests are a supplementary analysis — use the kustomize reference doc alongside the primary language-specific doc. Almost all component repos have manifests/ or config/ directories that define deployment resources, parameterization, and distribution variants.
First: Detect Controller Type and Capabilities
For Go operators, run recursive greps to understand operator capabilities before detailed analysis:
# Controller-runtime based operator detection
grep -r "sigs.k8s.io/controller-runtime" --include="*.go" . | head -20
# OpenShift API usage
grep -r "github.com/openshift/api" --include="*.go" . | head -20
# Gateway API usage (RHOAI 3.x ingress pattern)
grep -r "gateway.networking.k8s.io" --include="*.go" . | head -20
# Envoy / EnvoyFilter (RHOAI ingress data plane)
grep -r "EnvoyFilter\|envoy" --include="*.go" . | head -20
grep -r "EnvoyFilter\|envoy" --include="*.yaml" --include="*.tmpl.yaml" --include="*.tmpl" . | head -20
# kube-rbac-proxy (RHOAI auth sidecar)
grep -r "kube-rbac-proxy" --include="*.go" --include="*.yaml" --include="*.tmpl.yaml" . | head -20
# OLM/Operator SDK patterns
grep -r "github.com/operator-framework" --include="*.go" . | head -20
# Service Mesh / Istio usage
grep -r "istio.io/api\|networking.istio.io" --include="*.go" . | head -20
# FIPS compliance (build flags, crypto, OLM annotations)
grep -r "GOEXPERIMENT\|strictfipsruntime\|CGO_ENABLED" --include="Dockerfile*" --include="Containerfile*" --include="Makefile*" --include="*.sh" . | head -20
grep -r "fips-compliant\|fips\.enabled\|FIPS" --include="*.yaml" --include="*.json" . | head -20
grep -r "boring\|boringcrypto\|openssl\|crypto/tls" --include="*.go" . | head -20
Interpret results:
controller-runtime/pkg/client: Kubernetes operator using controller-runtimecontroller-runtime/pkg/reconcile: Has reconcile loops managing resourcesopenshift/api/route/v1: Manages OpenShift Routes (RHOAI 2.x pattern)openshift/api/config/v1: Accesses OpenShift cluster configurationgateway.networking.k8s.io: Manages Gateway API resources (RHOAI 3.x pattern)EnvoyFilter / networking.istio.io: Creates Envoy filters for traffic shaping (RHOAI ingress)kube-rbac-proxy: Injects auth sidecar containers (RHOAI 3.x auth pattern)operator-framework/api: OLM-based operator with CRDsistio.io/api: Integrates with Istio service meshGOEXPERIMENT=strictfipsruntime: Go binary compiled with FIPS-compliant cryptoCGO_ENABLED=1 (with strictfipsruntime): Required for Go FIPS — dynamically links against OpenSSL-tags strictfipsruntime: Build tag enabling FIPS crypto at compile timefips-compliant: "true" in CSV: OLM feature annotation declaring FIPS complianceboringcrypto / boring in imports: Using BoringCrypto backend for FIPScrypto/tls: Go TLS configuration — check for custom cipher suite restrictions or non-FIPS defaultsFIPS analysis has two layers — document both:
Layer 1: Build-time (check-payload gate):
Konflux validates images via check-payload which enforces: Go binaries must be dynamically linked (CGO_ENABLED=1), OpenSSL must be installed in the image, no statically linked Go crypto. The Dockerfile.konflux* files are where these build flags live. If Konflux discovery (Step 3a) found FIPS flags, carry them into Security → FIPS Compliance. If NOT found, also check:
bundle/manifests/*.clusterserviceversion.yaml) for features.operators.openshift.io/fips-compliant annotation-tags strictfipsruntime or GOEXPERIMENT env varsLayer 2: Application-level crypto correctness: check-payload is the bare minimum — it validates build artifacts but not runtime crypto behavior. A binary can pass check-payload while still using non-FIPS cipher suites. Search the source code for:
# Go: TLS config, cipher suites, custom crypto
grep -r "tls\.Config\|CipherSuites\|MinVersion\|InsecureSkipVerify" --include="*.go" . | head -20
grep -r "crypto/md5\|crypto/rc4\|crypto/des" --include="*.go" . | head -10
# Python: non-FIPS crypto libraries
grep -r "pycryptodome\|pycrypto\|hashlib\.md5\|Crypto\." --include="*.py" . | head -10
grep -r "cryptography\|pyOpenSSL" --include="*.txt" --include="*.toml" --include="*.cfg" . | head -10
# Rust: crypto crate choices
grep -r "ring\|rustls\|openssl" --include="*.toml" . | head -10
# Java: BouncyCastle, custom crypto providers
grep -r "BouncyCastle\|Security\.addProvider\|Cipher\.getInstance" --include="*.java" . | head -10
Document findings in both the Build-Time and Application-Level tables under Security → FIPS Compliance. A component that passes check-payload but uses crypto/md5 or InsecureSkipVerify has a FIPS gap worth noting.
Build hermeticity — check lock files at every layer: Hermetic builds require all dependencies to be pre-resolved and locked. Check for lock files at three layers:
# RPM-level locks (from rpm-lockfile-prototype — often only on downstream release branches)
find . -maxdepth 3 -name "rpms.lock.yaml" | head -10
# Language-level locks
find . -maxdepth 3 \( -name "go.sum" -o -name "uv.lock" -o -name "poetry.lock" -o -name "Pipfile.lock" -o -name "package-lock.json" -o -name "yarn.lock" -o -name "Cargo.lock" -o -name "pixi.lock" \) | head -20
# Artifact locks (Hermeto — locks non-package artifacts like ML models)
find . -maxdepth 3 -name "artifacts.lock.yaml" | head -10
# Hermeto (formerly cachi2) prefetch integration in Dockerfiles
grep -r "cachi2\|hermeto\|REMOTE_SOURCES" --include="Dockerfile*" --include="Containerfile*" . | head -10
Important: Lock files often exist only on downstream release branches (rhoai-3.4, rhoai-3.3) and not on upstream/main branches. This is expected — Konflux adds lock files during release hardening. Document what is present on the branch being analyzed and note if the branch is upstream vs downstream.
Document findings in the Security → Build Hermeticity table. Gaps at any layer (e.g., go.sum present but no rpms.lock.yaml) are supply chain risks worth noting.
Document findings in Architecture Components table:
This reconnaissance helps identify what the operator manages before reading controller code.
Search for and analyze:
CRDs: **/*_crd.yaml, config/crd/, api/*/groupversion_info.go
Controllers and Webhooks: controllers/, pkg/controller/, internal/controller/, internal/webhook/
Use the sub-agent dispatch procedure in Step 4a below for all controller and webhook analysis. Do NOT attempt to read all controller/webhook files yourself — large operators have 100+ files that exceed a single context window. Step 4a spawns sub-agents via the Task tool to read files in parallel and return structured findings.
RHOAI 3.x Migration Patterns (CRITICAL TO UNDERSTAND): Controllers in RHOAI 3.x create different resources than 2.x. Read controller code to identify current behavior:
Primary ingress pattern (RHOAI 3.x):
HTTPRoute CRs (Gateway API) for main service traffickube-rbac-proxy sidecars for authenticationgateway.networking.k8s.io/v1beta1 or v1, HTTPRoute, kube-rbac-proxy containerLegacy pattern (RHOAI 2.x, being phased out):
Route CRs for main service trafficoauth-proxy sidecars for authenticationroutev1.Route, oauth-proxy containerIMPORTANT — Routes still appear in 3.x code: RHOAI 3.x controllers may ALSO create OpenShift Route CRs intentionally for:
dashboard_redirects.go creates Route CRs for legacy dashboard and gateway hostnames that 301-redirect to the new hostname)How to identify in controller code:
// Search for ALL of these patterns across ALL .go files in controller directories:
HTTPRoute // Creating Gateway API HTTPRoutes
gateway.networking.k8s.io // Gateway API imports
Gateway // Gateway CR (the ingress entry point itself)
EnvoyFilter // Istio EnvoyFilter CRs (traffic shaping, header manipulation)
networking.istio.io // Istio API imports (for EnvoyFilter, VirtualService)
envoy // Envoy proxy configuration or deployment
kube-rbac-proxy // Auth sidecar (3.x primary)
routev1.Route // OpenShift Routes (may be redirects, OAuth callbacks, or OcpRoute mode)
oauth-proxy // OAuth proxy (2.x pattern)
Route // Any Route creation (check purpose: redirect vs primary ingress)
nginx // Redirect services (301 redirects from legacy URLs)
Examples:
kubeflow/components/odh-notebook-controller/controllers/: Creates HTTPRoutes + kube-rbac-proxy sidecars per notebookrhods-operator/internal/controller/services/gateway/: Deploys platform Gateway for HTTPRoutes to referencerhods-operator/internal/controller/services/gateway/dashboard_redirects.go: Creates nginx Deployment + Service + OpenShift Route CRs that redirect legacy dashboard/gateway URLs to the new Gateway API hostnameGateway API / Ingress Controllers:
gateway.networking.k8s.io, Gateway, HTTPRoute, GRPCRoute, TLSRouteEnvoyFilter, networking.istio.io, envoy (Envoy data plane)kube-rbac-proxy, oauth-proxy (auth sidecars)gateway.networking.k8s.io): Defines the platform ingress entry point (e.g., "data-science-gateway")networking.istio.io/v1alpha3): Traffic shaping, header manipulation, CORS, auth enforcementAPIs: Route definitions, OpenAPI specs, .proto files
Network Services: Service manifests
Sidecar Containers (injected by controllers):
Container{} structs being added to Pod specs in reconcile loopskube-rbac-proxy sidecars for authentication
RBAC: ClusterRole, Role, RoleBinding, ClusterRoleBinding
Secrets/ConfigMaps: Secret references (NOT values)
Network Policies: NetworkPolicy manifests
Service Mesh: Istio PeerAuthentication, AuthorizationPolicy
Kustomize structure analysis: When manifests/ or config/ directories contain kustomization.yaml files, analyze the full kustomize composition — not just individual YAML files. See Kustomize Manifest Analysis. Document the base/overlay structure, parameterization (configMapGenerator, vars, replacements, params.env), and distribution variants (ODH vs RHOAI) in the Deployment Manifests section. These manifests are consumed by the platform operator (rhods-operator/opendatahub-operator) via get_all_manifests.sh and define how the component is actually deployed on clusters.
When the repository has more source files than you can read in one context window, use the sub-agent dispatch pattern: enumerate files, group them by functional area, spawn sub-agents via the Task tool to read all files in parallel, then aggregate their structured findings.
Use the reference doc selected in Step 3b. Each reference doc contains the complete procedure — enumeration commands, grouping heuristics, sub-agent prompt template, and aggregation instructions:
| Repo type | Reference doc | Sub-agent prompt extracts |
|---|---|---|
| Go operator | Controller Analysis | Resources Created/Watched, Webhooks, Integration Points, Network Exposure, RBAC |
| Frontend + BFF monorepo | Frontend + BFF Analysis | API Surface, Module Federation, Routes, BFF Handlers, Upstream Calls, Config |
| Python ML service | Python Service Analysis | API Endpoints, Proto/gRPC, Config, Health, Dependencies, Model Architecture |
| Go service | Go Service Analysis | Entry Points, HTTP Handlers, gRPC, Upstream Calls, Auth, Health |
| Rust service | Rust Service Analysis | HTTP Routes, gRPC, Downstream Calls, Config, TLS/mTLS, Health |
| Container image | Container Image Analysis | Base images, installed packages, ports, entry points (no sub-agents needed) |
General sub-agent rules (apply to all reference docs):
subagent_type=Explore (read-only analysis)/tmp/arch-analysis-{component}-group-{N}.md) using the Write tool, then responds with only a short confirmation message. This keeps sub-agent responses small and avoids context bloat.Multi-language repos: Run sub-agents from multiple reference docs. For example, kserve needs both controller-analysis.md (Go operator) and python-service-analysis.md (Python SDK).
Git metadata (version, branch, remote URL, recent commits) is pre-gathered by the orchestrator and included at the top of this prompt under "Pre-gathered Git Metadata". Use that data directly — do NOT run git commands to re-collect it.
If the pre-gathered metadata section is missing (e.g., when running this skill manually), fall back to:
git describe --tags --always 2>/dev/null; git branch --show-current; git remote get-url origin 2>/dev/null; git log --oneline --no-merges -20
Follow the template exactly as defined in architecture template. Read that file before writing.
Structural rules:
Sub-Component Details (multi-component repos only):
When the component inventory from Step 3a contains multiple Konflux Dockerfiles, add a Sub-Component Details section after Architecture Components. Each Dockerfile-derived component gets its own ### subsection with: intent (1-2 sentences on why it exists and when it's deployed), API routes, upstream dependencies, and configuration tables. For single-Dockerfile repos, skip this section — the Purpose section covers intent. Every sub-component MUST be analyzed — do not sample or skip any.
When writing the intent for init containers and utility images: the Dockerfile CMD is the image default for standalone use. In Kubernetes, the consuming deployment typically overrides it via command:/args:. Describe the deployed behavior (what the pod actually runs), not just the image default. If the runtime command is specified in a deployment manifest within the repo (or a sibling checkout), use that. If it cannot be determined, note the Dockerfile CMD as the default and that the runtime command is set by the consuming deployment.
Architectural Analysis (all repos): After completing all structured sections, write an Architectural Analysis section with free-form observations about the component's architecture. This is where you synthesize patterns, design decisions, risks, or noteworthy findings that don't fit the tables. Examples: "The BFF modules share a common Go framework but each implements auth differently", "The cache server webhook has no TLS — it relies on the namespace network policy for isolation", "The driver/launcher split mirrors a sidecar pattern but runs as sequential Argo steps". Write 2-5 paragraphs. Be specific and cite files or patterns you observed.
IMPORTANT — Operators that manage infrastructure require expanded output:
If the component is an operator that creates Kubernetes resources dynamically (Deployments, Services, Routes, HTTPRoutes, EnvoyFilters, NetworkPolicies, etc.), the output MUST go beyond the flat tables in the template. Specifically:
Network Architecture section: Every resource the controller creates at runtime must appear in the Services, Ingress, or Egress tables. Include resources from Go code AND from .tmpl.yaml template files in resources/ directories. If the operator manages a multi-layer ingress stack (Gateway → Envoy → auth proxy → application), document the full chain with traffic flow.
Integration Points section: Must list every component this operator interacts with. For platform operators (rhods-operator, opendatahub-operator), this means every component CR it creates, every external CRD it watches, every webhook it calls, every shared Secret/ConfigMap it reads or writes.
Key Controllers section (under Architecture Components or as subsections): Each controller that manages significant infrastructure deserves a dedicated subsection describing:
For RHOAI ingress specifically: The Gateway controller deploys a full stack — Gateway CR, Envoy proxy, EnvoyFilter CRs, kube-auth-proxy (OAuth and OIDC deployments), HTTPRoutes, DestinationRules, NetworkPolicies, OpenShift Routes (redirects), nginx redirect Deployments. Every one of these must appear in the output with its purpose, ports, TLS configuration, and how it connects to the next layer. A bullet-point summary is NOT sufficient — use the Ingress table AND a traffic flow description.
RHOAI ingress patterns:
Precision requirements for table values:
8443/TCP, 9090/TCP (not "HTTPS port")HTTP, HTTPS, gRPC, gRPC/HTTP2 (not "network")TLS 1.3, TLS 1.2+, mTLS, plaintext (not "encrypted")Bearer Token (JWT), mTLS client certs, AWS IAM credentials (not "authenticated")"" for core, apps, serving.kserve.io (not "Kubernetes API")Write the output file using the filename from the --output flag (default: GENERATED_ARCHITECTURE.md). The file goes in the repository root.
Important: Populate the "Generated By" field in the Metadata section:
--generated-by was provided, use that exact stringdate +%Y-%m-%d command if needed)**Generated By**: Claude Opus 4.6 on 2026-03-13CRITICAL: The ## Source References section MUST be populated from your tracking log before writing.
12-45), not vague (e.g., "various")After writing, run the validation script to catch template conformance errors:
python ${CLAUDE_SKILL_DIR}/scripts/validate_architecture.py GENERATED_ARCHITECTURE.md
If validation fails, read the errors, fix the markdown, re-write the file, and re-validate. Do not proceed to Step 8 until validation passes. Warnings (e.g., extra sections) are informational — fix if straightforward, otherwise note in the report.
After creating the file, output:
✅ Architecture summary generated!
File created: GENERATED_ARCHITECTURE.md
Component: [Name]
Distribution: [ODH/RHOAI/Both]
Version: [X.Y]
Summary:
- [N] CRDs found
- [N] Services analyzed
- [N] RBAC rules documented
- [N] Data flows mapped
Source References:
- [N] files analyzed
- [N] total lines referenced
- [N] grep/search patterns used
- [List any sections marked as "inferred" with no direct file backing]
Next steps:
1. Review GENERATED_ARCHITECTURE.md for accuracy (especially network/security tables)
2. Audit Source References section — verify file:line mappings are correct
3. Edit markdown if corrections needed (it's human-editable!)
4. Commit: git add GENERATED_ARCHITECTURE.md && git commit -m "Add architecture summary"
5. Use /aggregate-platform-architecture to combine with other components
The Integration Points section is one of the most valuable parts of the output — it tells architects and agents how components connect. For every component, ask:
A platform operator should have 15-30+ integration point rows. A simple service might have 3-5. An empty Integration Points table is almost always wrong.