agentleFS
tuana-vntuana-vn/system-reverse-engineer/.github/skills/persistence-schema-reverse-engineering/SKILL.md

persistence-schema-reverse-engineering

Skill0 starsChanged 2 months agoMITView on GitHub

Reconstruct persistence architecture and database/data schema from current source, ORM mappings, SQL, migrations, DDL, schema bootstrap, upgrade scripts, and runtime repository wiring; distinguish code-known schema from external-only details.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If no persistence is materially present, record NOT_APPLICABLE with evidence and stop.

    line 26
  2. Distinctive:

    Verify runtime binding of repository implementations when abstractions exist.

    line 40
  3. Distinctive:

    Use evidence in priority order:

    line 44
  4. Distinctive:

    Do not invent missing columns or relationships.

    line 65
  5. Distinctive:

    If the repository contains queries/mappings but not authoritative DDL:

    line 86
  6. Distinctive:

    do not call all database schema details UNKNOWN

    line 90
  7. Distinctive:

    Update evidence ledger/open questions as appropriate.

    line 100

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Persistence and Schema Reverse Engineering

Mission

Determine whether persistence exists, how code reaches it, and what schema/data model is actually supported by repository evidence.

Applicability Check

First search for:

  • JDBC/data sources/connections
  • ORM entities/mappings
  • repository/DAO classes
  • SQL/query builders
  • migration frameworks/scripts
  • DDL/schema files
  • embedded/test DB setup
  • upgrade/install scripts
  • table/column constants

If no persistence is materially present, record NOT_APPLICABLE with evidence and stop.

Runtime Trace

Trace representative reads and writes:

business/service
→ repository/DAO
→ ORM/query/SQL
→ connection/data source
→ table/entity/schema

Verify runtime binding of repository implementations when abstractions exist.

Schema Reconstruction

Use evidence in priority order:

  1. active migrations/DDL/schema bootstrap
  2. active ORM/entity mappings
  3. production SQL/query definitions
  4. install/upgrade scripts
  5. tests/test schema as supporting evidence only
  6. docs/comments as secondary evidence

Reconstruct where supported:

  • table/entity names
  • important columns/fields
  • data types
  • PK/unique keys
  • FKs/relationships
  • indexes when behaviorally relevant
  • read/write ownership
  • transaction boundaries
  • migration/version history

Do not invent missing columns or relationships.

Required Tables

Persistence Path

OperationService/CallerRepository/DAOConcrete BindingQuery/ORMData SourceEvidence

Schema Inventory

Table/EntityKeyImportant FieldsRelationshipsRead ByWritten ByDefinition EvidenceConfidence

Schema Gaps

QuestionSearch PerformedCode-Known FactsMissing External FactClosure State

External Schema

If the repository contains queries/mappings but not authoritative DDL:

  • promote only the schema facts directly required/proven by active code
  • mark unavailable authoritative DDL/version as external if repository search is exhausted
  • do not call all database schema details UNKNOWN

Output

Create/update:

docs/reverse-engineering/persistence/<scope>.md

Update evidence ledger/open questions as appropriate.

Consumer Architecture Model

Update:

docs/reverse-engineering/models/persistence_state_model.md
docs/reverse-engineering/diagrams/05_state_persistence_lifecycle.md

The model must explain ownership and behavior, not merely dump entity fields.

Capture, where applicable:

owner
→ read/write path
→ transaction/connection boundary
→ persisted entity/table/state
→ lifecycle/state transition
→ concurrency/async interaction
→ failure/recovery behavior

05_state_persistence_lifecycle.md must contain at least one evidence-linked Mermaid diagram. If persistence is not applicable, model the most material runtime state/resource/job lifecycle instead and document why persistence is NOT_APPLICABLE.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.