Codebase Architect
Generate exhaustive architecture documentation for any WordPress plugin/theme with built-in self-checking, progress tracking, and verification loops.
When to use
Use this skill when:
- Creating comprehensive architecture documentation for a plugin/theme
- Auditing what exists in a codebase (classes, functions, hooks, APIs)
- Verifying existing documentation completeness
- Onboarding to a new codebase and need a reference guide
Inputs required
- Path to the plugin or theme directory.
- Scope level:
architectural, hybrid, reference, or verify.
- Output directory for documentation files.
Scope Parameter
| Scope |
Coverage |
Best For |
Output Size |
architectural |
Conceptual 95%, Reference 15% |
Large codebases (500+ files) |
2,000-4,000 lines |
hybrid |
Conceptual 95%, Reference 50% |
Medium codebases (50-500 files) |
4,000-8,000 lines |
reference |
Conceptual 95%, Reference 90%+ |
Small codebases (<50 files) |
8,000+ lines |
verify |
Verification only |
Check existing docs |
Report only |
Procedure
0) Initialize manifest
Create manifest directory and tracking files:
mkdir -p <output-dir>/manifest
Create manifest files for each category:
- classes.txt, functions.txt, hooks.txt
- rest-endpoints.txt, ajax-handlers.txt
- js-files.txt, db-tables.txt, templates.txt
- blocks.txt, shortcodes.txt, widgets.txt
- cpt-taxonomies.txt, admin-pages.txt
- cron-jobs.txt, cli-commands.txt
- PROGRESS.md (master tracker)
Read:
references/manifest-format.md
1) Run enumeration (parallel agents)
Launch 16 enumeration agents in parallel to populate manifests:
- Classes:
grep -rn "^class \|^abstract class \|^trait \|^interface "
- Functions:
grep -rn "^function [a-z_]"
- Action hooks:
grep -rohn "do_action\s*(\s*['\"][^'\"]*['\"]"
- Filter hooks:
grep -rohn "apply_filters\s*(\s*['\"][^'\"]*['\"]"
- REST endpoints:
grep -rn "register_rest_route"
- AJAX handlers:
grep -rn "wp_ajax_"
- JavaScript files:
find -name "*.js"
- DB tables:
grep -rn "CREATE TABLE"
- Templates:
find -name "*.php" -path "*/templates/*"
- Blocks:
find -name "block.json"
- Shortcodes:
grep -rn "add_shortcode"
- Widgets:
grep -rn "extends WP_Widget"
- CPT/Taxonomies:
grep -rn "register_post_type\|register_taxonomy"
- Admin pages:
grep -rn "add_menu_page\|add_submenu_page"
- Cron jobs:
grep -rn "wp_schedule_event"
- CLI commands:
grep -rn "WP_CLI::add_command"
Read:
references/enumeration-commands.md
2) Document (with progress updates)
For each category, launch documentation agents that:
- Read from manifest
- Document each item
- Update manifest status:
pending → documented
- Update PROGRESS.md
Read:
references/documentation-agents.md
3) Self-verification loop
After documentation completes:
- Count items with
status:pending (gaps)
- Count items with
status:documented (done)
- If coverage < 100%, trigger gap filling
- Run cross-reference check
Read:
references/verification-loop.md
4) Gap filling (automatic)
For any gaps found:
- Read source code for item
- Generate documentation
- Update manifest
- Trigger verification again
5) Final validation
When verification passes:
- Structure check (TOC, links, code examples)
- Completeness check (all categories at 100%)
- Quality check (each item has required fields)
- Generate FINAL_REPORT.md
Verification
Documentation is COMPLETE when:
- All 15 manifest categories at 100% coverage
- Verification loop passes without finding new gaps
- Cross-reference check passes
- Final validation checklist complete
- FINAL_REPORT.md generated
Failure modes / debugging
- Enumeration returns 0 items:
- Path doesn't exist, wrong grep pattern, vendor folder included
- Documentation incomplete after multiple passes:
- Check for status:error items in manifests
- Review Gap Log in PROGRESS.md
- Cross-reference failures:
- Stale references from renamed/moved files
Read:
Escalation
- For very large codebases (1000+ files), use
architectural scope
- If enumeration takes too long, exclude vendor/node_modules
- For manual review items, document what's known and mark as partial
Output Files
<output-dir>/
├── PLUGIN_ARCHITECTURE.md # Final documentation
├── manifest/
│ ├── PROGRESS.md # Progress tracker
│ ├── classes.txt
│ ├── functions.txt
│ └── ... (other manifests)
└── FINAL_REPORT.md # Validation report
1---2name: codebase-architect-23description: Use when generating exhaustive architecture documentation for any WordPress plugin/theme with built-in self-checking, progress tracking, and verification loops. Produces comprehensive docs covering classes, functions, hooks, REST API, AJAX, JS, DB, templates, blocks, and more.4---5
6# Codebase Architect
7
8Generate exhaustive architecture documentation for any WordPress plugin/theme with **built-in self-checking, progress tracking, and verification loops**.
9
10## When to use
11
12Use this skill when:
13
14- Creating comprehensive architecture documentation for a plugin/theme
15- Auditing what exists in a codebase (classes, functions, hooks, APIs)
16- Verifying existing documentation completeness
17- Onboarding to a new codebase and need a reference guide
18
19## Inputs required
20
21- Path to the plugin or theme directory.
22- Scope level: `architectural`, `hybrid`, `reference`, or `verify`.
23- Output directory for documentation files.
24
25## Scope Parameter
26
27| Scope | Coverage | Best For | Output Size |
28|-------|----------|----------|-------------|
29| `architectural` | Conceptual 95%, Reference 15% | Large codebases (500+ files) | 2,000-4,000 lines |
30| `hybrid` | Conceptual 95%, Reference 50% | Medium codebases (50-500 files) | 4,000-8,000 lines |
31| `reference` | Conceptual 95%, Reference 90%+ | Small codebases (<50 files) | 8,000+ lines |
32| `verify` | Verification only | Check existing docs | Report only |
33
34## Procedure
35
36### 0) Initialize manifest
37
38Create manifest directory and tracking files:
39
40```bash
41mkdir -p <output-dir>/manifest
42```
43
44Create manifest files for each category:
45- classes.txt, functions.txt, hooks.txt
46- rest-endpoints.txt, ajax-handlers.txt
47- js-files.txt, db-tables.txt, templates.txt
48- blocks.txt, shortcodes.txt, widgets.txt
49- cpt-taxonomies.txt, admin-pages.txt
50- cron-jobs.txt, cli-commands.txt
51- PROGRESS.md (master tracker)
52
53Read:
54- `references/manifest-format.md`
55
56### 1) Run enumeration (parallel agents)
57
58Launch 16 enumeration agents in parallel to populate manifests:
59
601. Classes: `grep -rn "^class \|^abstract class \|^trait \|^interface "`
612. Functions: `grep -rn "^function [a-z_]"`
623. Action hooks: `grep -rohn "do_action\s*(\s*['\"][^'\"]*['\"]"`
634. Filter hooks: `grep -rohn "apply_filters\s*(\s*['\"][^'\"]*['\"]"`
645. REST endpoints: `grep -rn "register_rest_route"`
656. AJAX handlers: `grep -rn "wp_ajax_"`
667. JavaScript files: `find -name "*.js"`
678. DB tables: `grep -rn "CREATE TABLE"`
689. Templates: `find -name "*.php" -path "*/templates/*"`
6910. Blocks: `find -name "block.json"`
7011. Shortcodes: `grep -rn "add_shortcode"`
7112. Widgets: `grep -rn "extends WP_Widget"`
7213. CPT/Taxonomies: `grep -rn "register_post_type\|register_taxonomy"`
7314. Admin pages: `grep -rn "add_menu_page\|add_submenu_page"`
7415. Cron jobs: `grep -rn "wp_schedule_event"`
7516. CLI commands: `grep -rn "WP_CLI::add_command"`
76
77Read:
78- `references/enumeration-commands.md`
79
80### 2) Document (with progress updates)
81
82For each category, launch documentation agents that:
831. Read from manifest
842. Document each item
853. Update manifest status: `pending` → `documented`
864. Update PROGRESS.md
87
88Read:
89- `references/documentation-agents.md`
90
91### 3) Self-verification loop
92
93After documentation completes:
941. Count items with `status:pending` (gaps)
952. Count items with `status:documented` (done)
963. If coverage < 100%, trigger gap filling
974. Run cross-reference check
98
99Read:
100- `references/verification-loop.md`
101
102### 4) Gap filling (automatic)
103
104For any gaps found:
1051. Read source code for item
1062. Generate documentation
1073. Update manifest
1084. Trigger verification again
109
110### 5) Final validation
111
112When verification passes:
113- Structure check (TOC, links, code examples)
114- Completeness check (all categories at 100%)
115- Quality check (each item has required fields)
116- Generate FINAL_REPORT.md
117
118## Verification
119
120Documentation is COMPLETE when:
121- All 15 manifest categories at 100% coverage
122- Verification loop passes without finding new gaps
123- Cross-reference check passes
124- Final validation checklist complete
125- FINAL_REPORT.md generated
126
127## Failure modes / debugging
128
129- Enumeration returns 0 items:
130 - Path doesn't exist, wrong grep pattern, vendor folder included
131- Documentation incomplete after multiple passes:
132 - Check for status:error items in manifests
133 - Review Gap Log in PROGRESS.md
134- Cross-reference failures:
135 - Stale references from renamed/moved files
136
137Read:
138- `references/debugging.md`
139
140## Escalation
141
142- For very large codebases (1000+ files), use `architectural` scope
143- If enumeration takes too long, exclude vendor/node_modules
144- For manual review items, document what's known and mark as partial
145
146## Output Files
147
148```
149<output-dir>/
150├── PLUGIN_ARCHITECTURE.md # Final documentation
151├── manifest/
152│ ├── PROGRESS.md # Progress tracker
153│ ├── classes.txt
154│ ├── functions.txt
155│ └── ... (other manifests)
156└── FINAL_REPORT.md # Validation report
157```