skills/ARCHIVE-code-wiki/SKILL.md
Generate structured wiki docs, module maps, and Mermaid diagrams for unfamiliar codebases.
npx skillsauth add ariffazil/openclaw-workspace Code Wiki — Codebase Documentation GeneratorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill produces a comprehensive reference wiki for any codebase. It creates a project overview, architecture narrative, per-module deep-dives, getting-started guide, and Mermaid class/sequence diagrams. The output is reference documentation (what the code does and how) — not strategic narrative (why it exists).
Before using this skill on any mutating, irreversible, or high-blast-radius task:
| Input | Required | Description |
|-------|----------|-------------|
| repo_path or GitHub URL | yes | Local path or cloneable repository URL |
| output_name | no | Directory name under ~/.codex/wikis/ (defaults to repo basename) |
| module_limit | no | Maximum modules to document (default: 8–10) |
| include_api_doc | no | Set true if the project is a library/API server |
For a local path, record the repo SHA and name:
cd <path>
REPO_SHA=$(git rev-parse HEAD 2>/dev/null || echo "uncommitted")
REPO_NAME=$(basename "$PWD")
For a GitHub URL, clone to a temp directory:
WIKI_TMP=$(mktemp -d)
git clone --depth 50 <url> "$WIKI_TMP/repo"
cd "$WIKI_TMP/repo"
REPO_SHA=$(git rev-parse HEAD)
REPO_NAME=$(basename <url> .git)
Create the output structure:
OUTPUT_DIR="$HOME/.codex/wikis/$REPO_NAME"
mkdir -p "$OUTPUT_DIR/modules" "$OUTPUT_DIR/diagrams"
Run a shallow, filtered scan:
find . -type d \
-not -path '*/\.*' \
-not -path '*/node_modules*' \
-not -path '*/venv*' \
-not -path '*/__pycache__*' \
-not -path '*/dist*' \
-not -path '*/build*' \
-not -path '*/target*' \
-maxdepth 3 | sort
Optionally collect language stats:
pygount --format=summary \
--folders-to-skip=".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,target" \
. 2>/dev/null || true
Read the relevant manifest files (package.json, pyproject.toml, Cargo.toml, go.mod, etc.) and README.md.
Use language-specific heuristics:
__init__.py)src/<subdir> or top-level workspace dirssrc/<module> dirsPrioritize by import count, LOC, and README mentions. Cap the list at 8–10 modules unless the user expands scope. State the selected modules before generating docs.
# <Project Name>
<One paragraph: what it is and what it's for.>
## Key Concepts
- **<Concept>** — <one line>
## Entry Points
- [`path/to/main.py`](link) — <what runs when started>
## High-Level Architecture
<2–3 sentences pointing to architecture.md.>
## Module Map
| Module | Purpose |
|---|---|
| [`<module>`](link) | <one-line purpose> |
Include:
flowchart TD Mermaid diagram using [] for components, [()] for storage, {{}} for external services, and (()) for entry points.--> = sync call and -.-> = async/event.For each selected module, read 3–5 key files, then produce:
# Module: `<module>`
<1–2 sentence purpose.>
## Responsibilities
- <bullet>
## Key Files
- [`<module>/<file>`](link) — <what it does>
## Public API
<Functions/classes used by other code, with signatures.>
## Dependencies
- **Used by:** <other modules>
- **Uses:** <other modules + external libs>
Pick 5–10 important classes/types and diagram them:
# Class Diagram
## Core Types
```mermaid
classDiagram
class Agent {
+string name
+list~Tool~ tools
+chat(message) string
}
class Tool {
<<interface>>
+name string
+execute(args) any
}
Agent --> Tool : uses
For Go/Rust without classes, diagram struct relationships or explain in prose.
### Step 8: Write diagrams/sequences.md
Pick 2–4 key workflows and trace call paths:
```markdown
# Sequence Diagrams
## Workflow: <Name>
```mermaid
sequenceDiagram
participant User
participant CLI
participant Agent
participant LLM
User->>CLI: types message
CLI->>Agent: chat(message)
Agent->>LLM: API call
LLM-->>Agent: response + tool_calls
Agent-->>CLI: final response
cli.py:HermesCLI.run_session
### Step 9: Write getting-started.md
Include prerequisites, installation commands, first-run command, common workflows, and configuration files.
### Step 10: Write api.md (Conditional)
Only if the project is a library or API server. Document the public API surface.
### Step 11: Write .codewiki-state.json
```bash
cat > "$OUTPUT_DIR/.codewiki-state.json" <<'EOF'
{
"repo_name": "$REPO_NAME",
"source_path": "$PWD",
"source_sha": "$REPO_SHA",
"generated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"generator": "code-wiki skill",
"modules_documented": []
}
EOF
Verify expected files and balanced Mermaid fences:
ls "$OUTPUT_DIR"/{README.md,architecture.md,getting-started.md,.codewiki-state.json}
for f in "$OUTPUT_DIR"/diagrams/*.md "$OUTPUT_DIR"/architecture.md; do
opens=$(grep -c '^```mermaid' "$f")
total=$(grep -c '^```' "$f")
echo "$f: $opens mermaid blocks, $total total fences"
done
Report the generated wiki path and contents to the user. If cloned to temp, remind them it can be removed after review.
| Tool / Capability | Purpose |
|---|---|
| read_file | Inspect manifests, README, and key source files |
| search_files | Locate modules, classes, and call paths without reading entire files |
| Bash / shell | Run filtered tree scans, pygount, and git commands |
| Write | Emit wiki files to ~/.codex/wikis/<repo-name>/ |
| mcporter (if available) | Pull federation context for cross-organ repos |
_pb2.py, .min.js, node_modules/).%%{init: ...}%% Mermaid theme blocks — GitHub Mermaid theme is fixed.## Skill Result: code-wiki
### Summary
Generated a structured wiki for <repo-name> at ~/.codex/wikis/<repo-name>/, including overview, architecture, module deep-dives, getting-started guide, and Mermaid diagrams.
### Evidence
- Source repo: <path-or-url>
- Source SHA: <commit-sha>
- Modules documented: <list>
- Files created: README.md, architecture.md, getting-started.md, modules/<N>, diagrams/class-diagram.md, diagrams/sequences.md, .codewiki-state.json
- Mermaid blocks verified: <count>
### Recommendations
- Review module selection for correctness.
- If cloned to temp, remove the temp directory after review.
- Re-run if the user expands scope beyond the default 8–10 modules.
### Escalations
- None / <list if secrets or constitutional impact found>
| Condition | Escalate To | Method | |-----------|-------------|--------| | Secrets or credentials found in source | security.agent + arifOS judge | A2A message / 888 HOLD | | Constitutional files affected | arifOS 888_JUDGE | A2A verdict_request | | User requests exhaustive scope beyond T1 | Arif (human) | confirm before proceeding |
Skill version 1.0.0 — AAA Skill Library
development
Federation-wide gold (XAUUSD) trading capability. Python stack, OANDA broker, backtesting, macro signals, RSI strategy. Every organ has a role.
development
Capital claim state management — tracks claim lifecycle across WEALTH organ.
development
Archived constitutional warga placeholder retained only for audit provenance. Do not use for active work; use the live arifOS governance and constitutional skills instead.
testing
Warga (citizen) agent skills for AAA federation members. See subdirectories for specialized warga skills.