architecture-reconstruction-and-diagrams
Skill0 starsChanged 2 months agoMITView on GitHub
Reconstruct a consumer-usable current-system architecture model from verified source evidence, emphasizing responsibilities, dependencies, runtime relationships, system boundaries, and evidence-linked Mermaid diagrams rather than file inventories.
In this repository33 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- adversarial-baseline-auditSkill
- architecture-drift-detectionSkill
- artifact-detailed-designSkill
- baseline-source-of-truth-maintenanceSkill
- claim-verification-and-promotionSkill
- configuration-source-traceSkill
- contract-impact-test-designSkill
- current-state-tdd-synthesisSkill
- design-artifact-decompositionSkill
- design-artifact-decomposition-verificationSkill
- detailed-design-verificationSkill
- full-reverse-engineeringSkill
- implementation-readiness-certificationSkill
- incident-root-cause-analysisSkill
- integration-selection-analysisSkill
- observability-traceability-analysisSkill
- patch-impact-reviewSkill
- persistence-schema-reverse-engineeringSkill
- post-readiness-adversarial-auditSkill
- regression-test-designSkill
- requirement-compliance-reviewSkill
- resolve-high-impact-unknownsSkill
- resume-reverse-engineeringSkill
- reverse-engineering-bootstrapSkill
- reverse-engineering-coverage-auditSkill
- run-engineering-workflowSkill
- runtime-binding-verificationSkill
- runtime-flow-analysisSkill
- technical-design-proposalSkill
- technical-design-verificationSkill
- wbs-generationSkill
- wbs-verificationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 78
Do not produce a package-count diagram.
- Very specific: line 93
Use a Mermaid sequenceDiagram when the behavior is sequential/collaborative.
- Distinctive: line 116
Every material node and edge must be supportable from current source evidence.
- Distinctive: line 125
Do not invent components merely to make a diagram visually complete.
- Very specific: line 139
Use NOT_APPLICABLE with evidence where a model dimension truly does not apply.
- Distinctive: line 159
Every generated Mermaid diagram MUST use syntax that belongs to exactly one Mermaid diagram type.
- Distinctive: line 211
Do not use flowchart node declarations such as:
- Distinctive: line 222
Before persisting any Mermaid block:
- Distinctive: line 225
Check every connector/message against that diagram type.
- Very specific: line 228
Ensure every message with : in a sequence diagram has non-empty text after the colon.
- Very specific: line 229
Prefer quoted flowchart node labels when labels contain <br/>, punctuation, parentheses, brackets, or method names.
- Distinctive: line 230
Keep diagram syntax minimal.
- Distinctive: line 231
If uncertain whether a diagram will parse, simplify it rather than emitting speculative Mermaid syntax.
- Very specific: line 284
If the requested artifact is Component Architecture, it MUST remain a component/dependency graph.
- Distinctive: line 311
Before persisting a mandatory diagram, verify both:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Architecture Reconstruction and Diagrams — 4.0
Mission
Turn verified repository evidence into an understandable model of the current system.
The goal is not to inventory files. The goal is to answer:
what owns each major responsibility?
what calls what?
what crosses a boundary?
where is state owned?
what selects runtime variants?
what happens on failure?Relationship-First Rule
Prefer:
responsibility + relationship + behavior + evidenceover:
package name + file count + class listFile counts may appear as supporting topology context only. They are never sufficient architecture.
Major Subsystem Model
For every material subsystem, record all applicable fields:
| Subsystem | Entry | Responsibility | Inputs | Outputs | Dependencies | State Ownership | Failure Behavior | Runtime/Config Selection | Evidence |
A material subsystem is not considered MODELED while an applicable field is blank or asserted without evidence.
Mandatory Diagram Set for Full Baseline
A full repository baseline must create these Mermaid-backed artifacts under docs/reverse-engineering/diagrams/:
01_system_context.md
02_component_architecture.md
03_primary_runtime_sequence.md
04_integration_boundaries.md
05_state_persistence_lifecycle.mdEach file must contain at least one valid mermaid fenced block and an Evidence Anchors section.
01 — System Context
Show:
- external actors/systems
- application boundary
- major inbound surfaces
- major outbound dependencies
02 — Component Architecture
Show:
- major runtime components/subsystems
- dependency direction
- ownership/responsibility boundaries
- material runtime variant points
Do not produce a package-count diagram.
03 — Primary Runtime Sequence
Show at least one externally significant end-to-end runtime flow:
entry
→ validation/conversion
→ orchestration/domain
→ integration/persistence
→ result/error mapping
→ observable response/effectUse a Mermaid sequenceDiagram when the behavior is sequential/collaborative.
04 — Integration Boundaries
Show:
- abstractions/adapters
- selectors/factories/bindings
- concrete integrations
- external systems/processes
- fallback or alternate routes where material
05 — State / Persistence / Lifecycle
Show the most material state-bearing lifecycle. Prefer:
- persistence ownership and read/write flow;
- background-job lifecycle;
- resource/session/thread lifecycle;
- state transitions.
For systems without persistence, model another material state/lifecycle concern rather than omitting the diagram.
Diagram Evidence Rule
Every material node and edge must be supportable from current source evidence.
Each diagram artifact must include:
## Evidence Anchors
- <repo-relative path> — <symbol/method/class/config key> — <what it proves>Do not invent components merely to make a diagram visually complete.
Output Model Artifacts
Create/update:
docs/reverse-engineering/models/component_catalog.md
docs/reverse-engineering/models/runtime_flow_catalog.md
docs/reverse-engineering/models/integration_catalog.md
docs/reverse-engineering/models/configuration_model.md
docs/reverse-engineering/models/persistence_state_model.mdUse NOT_APPLICABLE with evidence where a model dimension truly does not apply.
Completion Gate
Architecture synthesis is incomplete if any of the following is true:
[ ] fewer than 5 mandatory diagram artifacts exist
[ ] any mandatory diagram lacks Mermaid
[ ] any mandatory diagram lacks evidence anchors
[ ] a material subsystem lacks responsibility
[ ] a material subsystem lacks dependencies
[ ] a material subsystem lacks state/failure/selection classification where applicable
[ ] primary runtime behavior exists only as prose/class lists with no sequence model
[ ] integration boundaries exist but no boundary model existsMermaid Syntax Safety Contract
Every generated Mermaid diagram MUST use syntax that belongs to exactly one Mermaid diagram type.
Flowchart / graph rules
For diagrams beginning with:
graph TD
graph LR
flowchart TD
flowchart LRuse flowchart edges only.
Valid:
REST --> VALIDATOR
REST -->|validate()| VALIDATOR
PARSER -.-> LOGICInvalid in a flowchart:
REST->>VALIDATOR: validate()
REST-->>MODEL: result->> and -->> are sequence-diagram message operators and MUST NOT appear in a graph/flowchart.
Sequence diagram rules
For diagrams beginning with:
sequenceDiagramdeclare participants and use sequence-message syntax.
Valid:
participant REST as REST Handler
participant VALIDATOR as Validator
REST->>VALIDATOR: validate()
VALIDATOR-->>REST: validDo not use flowchart node declarations such as:
REST[REST Handler]
VALIDATOR["Validator"]inside a sequence diagram.
Mandatory self-check before writing a Mermaid artifact
Before persisting any Mermaid block:
- Identify its declared diagram type from the first Mermaid statement.
- Check every connector/message against that diagram type.
- For
graph/flowchart, reject any line containing->>or-->>. - For
sequenceDiagram, reject flowchart-style node declarations (ID[...],ID(...),ID{...}). - Ensure every message with
:in a sequence diagram has non-empty text after the colon. - Prefer quoted flowchart node labels when labels contain
<br/>, punctuation, parentheses, brackets, or method names. - Keep diagram syntax minimal; do not mix diagram grammars for visual convenience.
- If uncertain whether a diagram will parse, simplify it rather than emitting speculative Mermaid syntax.
A diagram that does not pass this self-check MUST NOT be counted toward mandatory diagram coverage.
Canonical examples
Component/architecture diagram:
graph TD
REST["REST Handler<br/>SnapshotGroupHandler"]
VALIDATOR["Validator<br/>SnapshotGroupValidator"]
LOGIC["Logic<br/>GetSnapshotGroupLogic"]
REST -->|validate()| VALIDATOR
REST -->|getSnapshotGroups()| LOGICRuntime sequence:
sequenceDiagram
participant REST as SnapshotGroupHandler
participant VALIDATOR as SnapshotGroupValidator
participant LOGIC as GetSnapshotGroupLogic
REST->>VALIDATOR: validate()
VALIDATOR-->>REST: valid
REST->>LOGIC: getSnapshotGroups()
LOGIC-->>REST: resultSemantic Diagram Type Contract
The semantic purpose of a required diagram is fixed by the artifact contract.
A Mermaid syntax problem MUST be repaired within the required diagram type. Never change the diagram type merely because another Mermaid grammar is easier to generate.
Canonical mapping:
| Required artifact | Required semantic representation | Allowed Mermaid form |
| System Context | system/external-boundary relationships | graph or flowchart |
| Component Architecture | components, layers, ownership, dependencies | graph or flowchart |
| Primary Runtime Sequence | time-ordered calls and responses | sequenceDiagram |
| Integration Boundaries | system-to-external-system boundaries and dependencies | graph or flowchart |
| State / Persistence Lifecycle | state transitions, ownership, persistence lifecycle | stateDiagram-v2 or flowchart, chosen according to the evidence |
Preservation rule
If the requested artifact is Component Architecture, it MUST remain a component/dependency
graph. For example, this is incorrect repair behavior:
Component Architecture has invalid graph syntax
→ convert the artifact to sequenceDiagramThe correct behavior is:
Component Architecture has invalid graph syntax
→ retain graph/flowchart
→ repair only the invalid graph connectors/labelsLikewise:
Primary Runtime Sequencemust remain a sequence diagram and MUST NOT be converted into a component graph merely to avoid sequence syntax.
Semantic self-check
Before persisting a mandatory diagram, verify both:
- Grammar correctness — connectors and declarations belong to the selected Mermaid grammar.
- Semantic correctness — the selected Mermaid diagram type matches the purpose of the required artifact.
A syntactically valid diagram with the wrong semantic type MUST NOT satisfy the diagram quality gate.
For Component Architecture specifically, the diagram should primarily communicate:
- architectural layers or subsystems;
- component responsibility boundaries;
- dependency direction;
- important interfaces/adapters;
- relevant external dependencies.
Method names may label relationships when useful, but the artifact must remain an architectural relationship graph rather than becoming a chronological call sequence.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

