Source Code Analyzer
Objective
Produce a high-confidence architecture and integration analysis of the repository with evidence from real files.
Scope
Analyze:
- Architecture boundaries and layering
- Framework/CMS/runtime and dependency stack
- Coding style and conventions
- Modules/themes/plugins and extension points
- API surfaces (REST/GraphQL/webhooks/events/CLI/jobs)
- Data layer and configuration model
- Security and operational posture
- Integration capability and constraints
Do not:
- Modify business logic
- Run destructive commands
- Install or upgrade dependencies unless requested
Required Output
Write a report to _analytics/structure.md (or user-provided path) with the exact section order defined in "Report Template".
Evidence Rules
For every important claim:
- Include concrete evidence (file path, symbol/class/function, and short snippet summary)
- Mark confidence as
High, Medium, or Low
- Label statement type:
Observed: Directly confirmed in source
Inferred: Derived from multiple observed facts
Assumed: Plausible but not yet confirmed
Avoid ungrounded conclusions.
Multi-Agent Orchestration
If subagents are available, split work in parallel:
Architecture lane
- Map directory topology, layers, modules/plugins/themes
- Identify entry points and dependency direction
Style and design lane
- Detect naming conventions, folder conventions, patterns, anti-patterns
- Detect coding standards and linting/testing quality gates
Dependency and runtime lane
- Detect language/runtime/framework versions
- Inventory key libraries and their roles
Integration and security lane
- Map APIs, events/hooks, queues, cron/jobs, webhooks, third-party SDKs
- Assess authN/authZ, input validation, secrets handling, and attack surface
Coordinator responsibilities:
- Normalize lane outputs
- Resolve contradictions
- Produce one final report with evidence and confidence
If subagents are unavailable, execute the same lanes sequentially.
Workflow
Step 0 — Knowledge Lookup (Pre-Analysis)
Before starting full analysis, check if pre-analyzed knowledge exists:
- Check if
heraspec/knowledge/index.json exists in the project
- Read all entries and match against the current project:
- For
file-contains signals: check if the file exists AND contains the specified string
- For
directory-exists signals: check if the directory exists
- Each matched signal = +1 to the match score
- If
score >= minMatchScore for any entry:
- Read the corresponding
structure.md from heraspec/knowledge/<knowledgePath>/
- Use it as the baseline analysis — skip redundant Steps 1-8 for sections already covered
- Focus only on project-specific differences (custom plugins, configs, .env, custom code)
- Output: merge baseline knowledge + project-specific delta into final report
- Also check
heraspec/knowledge/custom/index.json for project-specific knowledge entries
- If no match found in either index: proceed with full analysis from Step 1
Knowledge hierarchy: heraspec/knowledge/<category>/<runtime>/<framework>/<cms>/
Step 1 - Baseline Metadata
Read root metadata first:
composer.json, composer.lock
package.json, lockfiles
docker*, Makefile, CI configs
.env.example, config directories
Capture:
- Language/runtime versions
- Framework/CMS versions
- Build and deployment model
Step 2 - Repository Topology
Map major folders and responsibilities:
- Core/domain/infrastructure boundaries
- Plugin/module/theme architecture
- Shared libraries and cross-cutting concerns
- Bootstrapping and entry points
Step 3 - Architectural Patterns
Identify and evaluate:
- Layered/hexagonal/modular/monolith/microservice patterns
- Service container/DI usage
- Event-driven flows
- Boundaries and coupling hotspots
Step 4 - Coding Style and Design Conventions
Inspect representative files from each major layer:
- Naming conventions (class/function/file)
- Folder and namespace strategy
- Error handling patterns
- Test style and coverage signals
- Static analysis/lint/format rules
Step 5 - Extension Model
Map extensibility mechanisms:
- Hooks/filters/events/listeners
- Plugin/module registration and lifecycle
- Theme/template override model
- Custom providers, middleware, policies
Step 6 - API and Interaction Surfaces
Inventory internal and external interfaces:
- REST/GraphQL routes and controllers
- Command bus, queues, jobs, schedulers
- CLI commands, webhooks, callbacks
- Public SDK/service abstractions
Step 7 - Data and State
Analyze:
- ORM/data access strategy
- Migration and seeding patterns
- Cache/session/queue drivers
- Transaction boundaries and consistency risks
Step 8 - Security and Compliance Signals
Check:
- Authentication and authorization model
- CSRF/XSS/SQLi protections
- Secrets and credential handling
- Rate limiting and abuse protection
- Audit logging and sensitive operation traces
Step 9 - Integration Readiness
Evaluate integration capability across:
- Data integration
- API integration
- Event integration
- UI/theme integration
- Deployment/infra integration
For each integration type, summarize:
- Available entry points
- Required adapters
- Estimated complexity (
Low/Medium/High)
- Major risks and mitigations
Step 10 - Synthesis
Consolidate findings into one report, prioritize evidence-backed conclusions, and list unknowns that block confidence.
Report Template
Use this exact section order in _analytics/structure.md:
Executive Summary
Technology Profile
Repository Topology
Architecture and Dependency Flow
Coding Style and Conventions
Extension Points (Modules/Themes/Plugins/Hooks)
API and Interaction Surfaces
Data Model and State Management
Security Posture
Integration Capability Matrix
Strengths, Weaknesses, Risks
Top 10 Evidence Items
Unknowns and Verification Plan
Recommended Next Actions (30/60/90 day)
Integration Capability Matrix Format
Use one row per integration domain:
| Domain |
Entry Points |
Required Adapters |
Complexity |
Risks |
Confidence |
Domains to include:
- External APIs
- Authentication/SSO
- Payment
- Messaging/Queue
- Storage/CDN
- Observability
- Admin/UI customization
- Content/data migration
Completion Checklist
Complete the skill execution only when all conditions are met:
- Report file exists at target path
- Every critical claim has evidence
- Assumptions are explicitly marked
- Integration matrix is complete
- Top risks include mitigation guidance
1---2name: sourcecode-analyzer3description: Multi-agent deep source code analysis for architecture, coding style, design patterns, languages, frameworks, libraries, module structure, extension points, and integration readiness. Use when agents must understand a codebase before planning features, refactoring, integration, migration, auditing, or documentation.4---56# Source Code Analyzer78## Objective9Produce a high-confidence architecture and integration analysis of the repository with evidence from real files.1011## Scope12Analyze:13- Architecture boundaries and layering14- Framework/CMS/runtime and dependency stack15- Coding style and conventions16- Modules/themes/plugins and extension points17- API surfaces (REST/GraphQL/webhooks/events/CLI/jobs)18- Data layer and configuration model19- Security and operational posture20- Integration capability and constraints2122Do not:23- Modify business logic24- Run destructive commands25- Install or upgrade dependencies unless requested2627## Required Output28Write a report to `_analytics/structure.md` (or user-provided path) with the exact section order defined in "Report Template".2930## Evidence Rules31For every important claim:32- Include concrete evidence (file path, symbol/class/function, and short snippet summary)33- Mark confidence as `High`, `Medium`, or `Low`34- Label statement type:35 - `Observed`: Directly confirmed in source36 - `Inferred`: Derived from multiple observed facts37 - `Assumed`: Plausible but not yet confirmed3839Avoid ungrounded conclusions.4041## Multi-Agent Orchestration42If subagents are available, split work in parallel:43441. `Architecture lane`45- Map directory topology, layers, modules/plugins/themes46- Identify entry points and dependency direction47482. `Style and design lane`49- Detect naming conventions, folder conventions, patterns, anti-patterns50- Detect coding standards and linting/testing quality gates51523. `Dependency and runtime lane`53- Detect language/runtime/framework versions54- Inventory key libraries and their roles55564. `Integration and security lane`57- Map APIs, events/hooks, queues, cron/jobs, webhooks, third-party SDKs58- Assess authN/authZ, input validation, secrets handling, and attack surface5960Coordinator responsibilities:61- Normalize lane outputs62- Resolve contradictions63- Produce one final report with evidence and confidence6465If subagents are unavailable, execute the same lanes sequentially.6667## Workflow6869### Step 0 — Knowledge Lookup (Pre-Analysis)70Before starting full analysis, check if pre-analyzed knowledge exists:71721. Check if `heraspec/knowledge/index.json` exists in the project732. Read all entries and match against the current project:74 - For `file-contains` signals: check if the file exists AND contains the specified string75 - For `directory-exists` signals: check if the directory exists76 - Each matched signal = +1 to the match score773. If `score >= minMatchScore` for any entry:78 - Read the corresponding `structure.md` from `heraspec/knowledge/<knowledgePath>/`79 - Use it as the **baseline analysis** — skip redundant Steps 1-8 for sections already covered80 - Focus only on **project-specific differences** (custom plugins, configs, .env, custom code)81 - Output: merge baseline knowledge + project-specific delta into final report824. Also check `heraspec/knowledge/custom/index.json` for project-specific knowledge entries835. If no match found in either index: proceed with full analysis from Step 18485Knowledge hierarchy: `heraspec/knowledge/<category>/<runtime>/<framework>/<cms>/`8687### Step 1 - Baseline Metadata88Read root metadata first:89- `composer.json`, `composer.lock`90- `package.json`, lockfiles91- `docker*`, `Makefile`, CI configs92- `.env.example`, config directories9394Capture:95- Language/runtime versions96- Framework/CMS versions97- Build and deployment model9899### Step 2 - Repository Topology100Map major folders and responsibilities:101- Core/domain/infrastructure boundaries102- Plugin/module/theme architecture103- Shared libraries and cross-cutting concerns104- Bootstrapping and entry points105106### Step 3 - Architectural Patterns107Identify and evaluate:108- Layered/hexagonal/modular/monolith/microservice patterns109- Service container/DI usage110- Event-driven flows111- Boundaries and coupling hotspots112113### Step 4 - Coding Style and Design Conventions114Inspect representative files from each major layer:115- Naming conventions (class/function/file)116- Folder and namespace strategy117- Error handling patterns118- Test style and coverage signals119- Static analysis/lint/format rules120121### Step 5 - Extension Model122Map extensibility mechanisms:123- Hooks/filters/events/listeners124- Plugin/module registration and lifecycle125- Theme/template override model126- Custom providers, middleware, policies127128### Step 6 - API and Interaction Surfaces129Inventory internal and external interfaces:130- REST/GraphQL routes and controllers131- Command bus, queues, jobs, schedulers132- CLI commands, webhooks, callbacks133- Public SDK/service abstractions134135### Step 7 - Data and State136Analyze:137- ORM/data access strategy138- Migration and seeding patterns139- Cache/session/queue drivers140- Transaction boundaries and consistency risks141142### Step 8 - Security and Compliance Signals143Check:144- Authentication and authorization model145- CSRF/XSS/SQLi protections146- Secrets and credential handling147- Rate limiting and abuse protection148- Audit logging and sensitive operation traces149150### Step 9 - Integration Readiness151Evaluate integration capability across:152- Data integration153- API integration154- Event integration155- UI/theme integration156- Deployment/infra integration157158For each integration type, summarize:159- Available entry points160- Required adapters161- Estimated complexity (`Low`/`Medium`/`High`)162- Major risks and mitigations163164### Step 10 - Synthesis165Consolidate findings into one report, prioritize evidence-backed conclusions, and list unknowns that block confidence.166167## Report Template168169Use this exact section order in `_analytics/structure.md`:1701711. `Executive Summary`1722. `Technology Profile`1733. `Repository Topology`1744. `Architecture and Dependency Flow`1755. `Coding Style and Conventions`1766. `Extension Points (Modules/Themes/Plugins/Hooks)`1777. `API and Interaction Surfaces`1788. `Data Model and State Management`1799. `Security Posture`18010. `Integration Capability Matrix`18111. `Strengths, Weaknesses, Risks`18212. `Top 10 Evidence Items`18313. `Unknowns and Verification Plan`18414. `Recommended Next Actions (30/60/90 day)`185186## Integration Capability Matrix Format187188Use one row per integration domain:189190| Domain | Entry Points | Required Adapters | Complexity | Risks | Confidence |191|---|---|---|---|---|---|192193Domains to include:194- External APIs195- Authentication/SSO196- Payment197- Messaging/Queue198- Storage/CDN199- Observability200- Admin/UI customization201- Content/data migration202203## Completion Checklist204Complete the skill execution only when all conditions are met:205- Report file exists at target path206- Every critical claim has evidence207- Assumptions are explicitly marked208- Integration matrix is complete209- Top risks include mitigation guidance