/agentic-docs:component-docsfrom agentic-docs
Creates lean component-specific documentation for OpenShift repositories, following a two-tier architecture that separates platform-wide conventions from component-specific knowledge.
Ships in agentic-docs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Creates lean component agentic documentation for OpenShift component repositories.
Philosophy: Component docs contain ONLY component-specific knowledge. Generic platform patterns live in the openshift/enhancements repo (dev-guide/, guidelines/, CONVENTIONS.md). Code is the source of truth — read it, verify claims against it, but link to existing repo docs that explain the "why".
Contains: Development conventions (dev-guide/), coding standards (CONVENTIONS.md), enhancement guidelines (guidelines/), cross-repo architectural context
Contains: Component-specific architecture, behavioral contracts, development guides, test patterns
Decision Rule: "Would another repo need to duplicate this?"
component-repo/
├── AGENTS.md # Executive briefing (40-60 lines)
├── CLAUDE.md → AGENTS.md # Symlink (Claude Code auto-loads)
├── REVIEW.md # Review instructions (Claude Code Review + CodeRabbit)
├── .coderabbit.yaml # CodeRabbit config (points at REVIEW.md)
└── ai-docs/
├── ARCHITECTURE.md # Internals, integrations, behavioral contracts, design refs
├── DEVELOPMENT.md # Build, common tasks, mistakes
├── TESTING.md # Test suites and patterns
└── ENHANCEMENTS.md # Optional — enhancement/KEP/design doc catalog
❌ Generic framework patterns (controller-runtime, status conditions, common libraries) ❌ Testing practices (test pyramid, E2E framework) ❌ Security practices (STRIDE, RBAC guidelines) ❌ Reliability practices (SLO framework) ❌ Kubernetes fundamentals (Pod, Node, Service) ❌ Cross-repo ADRs (etcd, CVO orchestration, immutable nodes)
If running inside the Chai Bot environment, use the documentation and other resources configured there, including Slack, Jira, and CodeRAG knowledge. Verify cross-repository facts against authoritative sources, such as upstream GitHub sources or Chai Bot's configured CodeRAG. See Phase 1 for specific query steps.
CLAUDE.md / AGENTS.md content under ai-docs/_sources/. Use them as temporary source material for review and recovery during generation.docs/, docs/enhancements/, design/, CONTRIBUTING.md, and any files with "design", "proposal", "enhancement" in the name. These will be linked from ENHANCEMENTS.md and ARCHITECTURE.md as appropriate. Also scan documentation files at the repository root and look elsewhere throughout the repository for relevant documentation, regardless of filename or location.ai-docs/_sources/repository-docs-used.txt, one path per line.SKILL.md. Resolve all scripts/, templates/, and guides/ paths relative to it. Do not search a plugin cache or assume the repository is the current directory.scripts/create-structure.sh, scripts/validate.sh, scripts/cleanup-sources.sh, all referenced templates, and any guide required by the selected execution path. Stop before writing if a required resource is unavailable.REPO_PATH="${provided_path:-$PWD}"scripts/create-structure.sh with "$REPO_PATH"."<repo-name> convention OR pitfall OR mistake OR gotcha""<repo-name> review process OR reviewer expectations""<repo-name> common rejection OR frequently rejected""<repo-name> design decision OR historical context"ai-docs/_sources/tribal-knowledge-notes.md for use in later phasestemplates/AGENTS-template.mdAGENTS.md as the executive summary only. If the old CLAUDE.md contains longer repo-specific operational detail (release/bundle commands, CI/Konflux notes, metrics/debugging guidance), move that detail into DEVELOPMENT.md or ARCHITECTURE.md instead of dropping it.AGENTS.md. A detailed "need → start here" map may move to ARCHITECTURE.md or ENHANCEMENTS.md, but AGENTS.md must link directly to that map. Do not replace useful deep links with only a bare directory name.ln -sf AGENTS.md "$REPO_PATH/CLAUDE.md"wc -l AGENTS.md (target: 40-60)https://github.com/openshift/enhancements/tree/master/enhancements/{component-area}/controller-runtime, library-go, operator-sdk, OLM bundle in bundle/, CRDs in config/crd/). If operator detected, follow the Operator-Specific Discovery checklist below in addition to the generic checklist.ai-docs/ARCHITECTURE.md with the following required sections:ARCHITECTURE.md Required Sections (target: 200-400 lines):
dev-guide/ for development conventions, guidelines/ for enhancement process, CONVENTIONS.md for coding standards. Do NOT link to specific files under ai-docs/ — that structure is subject to changedocs/, design docs) where they provide deeper detail — ARCHITECTURE.md is a map, not a replacement for existing documentationai-docs/_sources/tribal-knowledge-notes.md exists from Phase 1, incorporate relevant findings:
# Go version
grep "^go " "$REPO_PATH/go.mod"
# Branch name (no clone needed) — uses first remote found
_remote=$(git remote | head -1)
git ls-remote --symref "$(git remote get-url "$_remote")" HEAD | grep 'ref:' | awk '{print $2}' | cut -d/ -f3
# Makefile targets
grep "^[a-zA-Z-]*:" Makefile | cut -d: -f1
# Directory structure
ls -d cmd pkg test manifests 2>/dev/null
ai-docs/DEVELOPMENT.md using templates/DEVELOPMENT-template.md:
CLAUDE.md (for example: bundle/catalog/release commands, CI/Konflux notes, metrics/debugging commands, non-default environment variables)ai-docs/TESTING.md using templates/TESTING-template.md:
guides/REVIEW-GENERATION.md — all 8 steps are requiredscripts/validate.sh with "$REPO_PATH" (includes link validation and removal of broken external-link lines)ai-docs/_sources/ contains backups of any prior CLAUDE.md / AGENTS.md that existedgrep -r "client.Apply\|r.Update\|resourceapply" pkg/controller/<name>/). Verify feature gate claims trace to actual runtime code. Verify image env var names match Makefile/CSV.wc -l REVIEW.md), skip paths reference real directories (test -d), platform citations present (grep for "dev-guide" or "CONVENTIONS"), no content overlap with AGENTS.mdpython3 -c "import yaml; yaml.safe_load(open('.coderabbit.yaml'))"), filePatterns contains "REVIEW.md" but NOT "CLAUDE.md", path_filters match "Do not report" globs, path_instructions match "Path-specific rules"CLAUDE.md / AGENTS.md against the generated docs and ensure repo-specific commands, CI notes, metrics/debug tips, hard warnings, retrieval instructions, documentation maps, and useful direct links were preserved. For every relocated item, verify the new location and leave a discoverable route from AGENTS.md. Record any intentional drop and its rationale in the completion report._sources/repository-docs-used.txt, verify the document is linked from
AGENTS.md or ai-docs/. Record any intentional exception and its rationale
in the completion report.scripts/cleanup-sources.sh with "$REPO_PATH". Do not leave temporary source backups in the final repo tree.Link Validation:
VERBOSE=true with the resolved validator to see successful links. Use CHECK_EXTERNAL_LINKS=false when the host intentionally has no network access; report external links as unverified in that mode./review-docs to verify claims?"
/review-docs --path "$REPO_PATH"Skipping verification. Documentation may contain:
- Incorrect API field claims
- Wrong branch/version references
- Unverified pattern claims (SSA vs strategic merge, etc.)
Recommend running `/review-docs` before creating PRs to catch hallucinations.
Note: /review-docs verifies claims locally against the repository source
and vendored dependencies first, then checks cross-repository claims against
available authoritative resources.
Use this checklist during Phase 4 when exploring the codebase. These patterns produce the most valuable documentation — the kind that prevents an agent from writing subtly incorrect code.
| Pattern | How to Discover | What to Document |
|---|---|---|
| Multiple paradigms | Do different packages use different frameworks or approaches for similar tasks? | Comparison table with "use X for Y, never Z for Y" guidance |
| Shared utilities | Is there a common/, shared/, utils/, or internal/ package used across components? | Exact exported symbols with one-line usage contract |
| Wiring/registration | How do new components get registered and started? How does work get dispatched to them? | Startup sequence, event/trigger flow, where to hook in new components |
| Resource management | How does code create/update external resources? (SSA, strategic merge, REST calls, etc.) | Actual method with code reference — verify in code, don't assume |
| Naming conventions | Grep for patterns in env vars, labels, file names, package names | Exact format with examples |
| Feature toggles | Are there feature gates, flags, or config-driven enablement? | Definition → runtime check → wiring chain |
| Anti-patterns | Search for "DO NOT", "NEVER", "MUST", "HACK" in code comments. Study 2-3 existing implementations to identify shared patterns and things they avoid | Numbered "DO NOT" list with brief explanation |
| CI enforcement | grep -E "^(lint|fmt|vet|check|verify):" Makefile | CI-enforced checks → "Do not report" in REVIEW.md |
| High-risk areas | git log --since="1 year" --name-only --pretty=format: | sort | uniq -c | sort -rn | head -20 | High-churn files → severity tuning in REVIEW.md |
| Vendored API boundaries | ls vendor/github.com/openshift/api 2>/dev/null | Vendored API types → "Always check" in REVIEW.md |
When the repo is a Kubernetes/OpenShift operator (detected via controller-runtime, library-go, OLM bundle, CRDs), also investigate these patterns. Skipping them produces docs that look correct but cause agents to write subtly wrong code.
| Pattern | How to Discover | What to Document |
|---|---|---|
| Controller framework split | Check imports in EACH controller package for library-go vs controller-runtime. Don't assume uniformity. | Per-controller table: framework, apply method (client.Apply vs resourceapply vs Create+Update), code ref. |
| Reconciliation apply method | For EACH controller: grep -r "client.Apply|r.Update|r.Create|resourceapply" pkg/controller/<name>/ | Actual method per controller. This is the #1 source of hallucinations. |
| Feature gate runtime behavior | Read features.go end-to-end. Trace from definition → runtime check → startup wiring. | Full chain. For TechPreview: cluster-side gating (FeatureSet discovery, fail-closed). Don't just list gate names. |
| Image resolution & OLM bundle | grep -r RELATED_IMAGE Makefile bundle/. Check Makefile for *_VERSION vars. Check bundle/manifests/ for CSV. | Env var naming convention, version variables, how OLM injects images. CSV update checklist (env vars, RBAC, relatedImages). |
| Error classification | Check common/ for error wrapper types (IrrecoverableError, RetryRequiredError). | Which types exist, effect on requeue behavior. |
| Generated code & bindata pipeline | find . -name "zz_generated*" -o -name "bindata.go" -o -path "*/clientset/*". Check Makefile for generation targets. | Generated files/dirs with "NEVER hand-edit" + make target. For bindata: version var → hack script → output dir → Go loading. |
| FIPS compliance | Check for OpenShift fork references in go.mod (replace directives), FIPS build tags, or crypto constraints in Dockerfiles. | Whether FIPS is build-time (fork/toolchain) or runtime. Only document if present. |
| OLM lifecycle | Check bundle/manifests/ CSV for spec.replaces, skips, skipRange, installModes, spec.relatedImages, channel annotations. | Which upgrade strategy is used, relatedImages list, install mode constraints. |
| Status conditions & OpenShift integrations | Check for library-go OperatorStatus vs custom conditions. Grep for proxy, trusted-CA, TLS profile, CCO references. | Which condition system, which integrations exist — only document what's present. |
| Form factor behavior | Grep for topology detection: ControlPlaneTopology, InfrastructureTopology, SingleReplica, HighlyAvailable, External, single-node-cluster label, hypershift, HostedControlPlane, HostedCluster. Check for replica count adjustments, anti-affinity skips, or HCP-specific namespaces/RBAC. | Form factor table: how the component behaves on Standalone, SNO (single replica? resource constraints?), HCP (which cluster does it run in? cross-cluster communication?), MicroShift (does it run at all? config file alternative?). Only document form factors the code actually handles — don't invent behavior. |
pkg/controller/foo/deployments.go:40). If you can't point to source, you're inferring — flag it as unverified instead of stating it as factLength: 40-60 lines (strict limit)
Required Sections:
Format: Compressed, table-based, links not prose. Use templates/AGENTS-template.md.
Symlink: CLAUDE.md → AGENTS.md must exist at repo root.
✅ AGENTS.md: At repo root, 40-60 lines, critical warnings, no generic duplication
✅ CLAUDE.md: Symlink to AGENTS.md
✅ Temporary sources cleaned up: Any working backups created under ai-docs/_sources/ were removed before finishing
✅ No duplication: No generic framework explanations, no testing pyramid, no security frameworks
✅ ARCHITECTURE.md: 200-400 lines, contains repo layout, API Behavioral Contracts, Design References, OpenShift Integration Points, Platform Documentation sections
✅ Link validation: All external links return 200 OK, all internal links resolve
✅ Implementation patterns: ARCHITECTURE.md has discovery checklist results, shared utilities listed with exact symbols, anti-patterns documented
✅ Operator accuracy (if operator repo): Apply method documented per-controller (not assumed uniform), feature gate runtime behavior traced, generated code inventory listed, image resolution mechanism documented
✅ REVIEW.md: At repo root, 60-80 lines (cap 100), skip paths valid, platform citations present, no AGENTS.md overlap, .coderabbit.yaml in sync
Wrong: 187-line TESTING.md where 60% is generic test pyramid explanation Right: 90-line TESTING.md that's 100% component-specific, links to Platform
Wrong: Explaining framework internals in component docs Right: Link to Platform, document component-specific usage only
Wrong: Type fields from memory, outdated conventions, pattern claims without code evidence Right: Verify in source code, check actual branch names, confirm patterns exist, link to sources
Wrong: "Add new controller: 1. Create controller.go 2. Implement Reconcile() 3. Register" Right: Repo-specific steps with exact file paths, shared utilities to use, registration wiring, and naming conventions
Wrong: Scattering content across many small files — agents must read 8+ files Right: ARCHITECTURE.md as single authoritative source for internals, integrations, contracts, and key decisions
Wrong: Generating docs that don't link to existing design docs in docs/ Right: Discover and link to all existing repo docs — they are authoritative sources
/component-docs [--path <repository-path>]
--path <repository-path>: Path to component repository (default: current directory)✅ Component Documentation Created
Component: [component-name]
Repository: [path]
Structure:
✅ AGENTS.md (root): XX lines (target: 40-60)
✅ CLAUDE.md → AGENTS.md symlink
✅ REVIEW.md: XX lines (target: 60-80)
✅ .coderabbit.yaml: valid, synced with REVIEW.md
✅ ARCHITECTURE.md: XXX lines (target: 200-400)
✅ DEVELOPMENT.md
✅ TESTING.md
✅ ENHANCEMENTS.md (optional — only if content found)
Next Steps:
1. Run `/review-docs` to verify local and cross-repository claims (recommended)
2. Review generated documentation for accuracy
3. Create PR with documentation changes
/review-docs - Verify documentation claims locally and against available authoritative resources/update-platform-docs - Update Platform documentationguides/REVIEW-GENERATION.md (opens in a new tab)scripts/cleanup-sources.sh (opens in a new tab)scripts/create-structure.sh (opens in a new tab)scripts/validate.sh (opens in a new tab)templates/AGENTS-template.md (opens in a new tab)templates/DEVELOPMENT-template.md (opens in a new tab)templates/REVIEW-template.md (opens in a new tab)templates/TESTING-template.md (opens in a new tab)templates/coderabbit-template.yaml (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub openshift-eng/ai-helpers --plugin agentic-docs4 skills in this plugin
/generate-docsGenerate and iteratively verify OpenShift component documentation, or review existing documentation, without relying on host-specific hooks or commands./review-docsReview agentic documentation by verifying local claims against source code and cross-repository claims against available authoritative resources. Use when checking generated or existing agent docs for factual accuracy, stale claims, broken references, or pre-PR readiness./update-platform-docsUpdate existing platform documentation with automatic gap detection in openshift/enhancementsOther plugins' skills for the same job