modelgen-nosql — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited modelgen-nosql (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Extract document-oriented NoSQL models from Agile user stories following a systematic DDD methodology. This skill is database-agnostic and produces generic document models applicable to MongoDB, Couchbase, DynamoDB, Firestore, CosmosDB, or any document-oriented NoSQL store.
Trigger this skill when the user asks to:
Do NOT use for RDBMS/relational schema extraction — use the modelgen-relational skill for that.
Before starting any work, resolve the application folder first (see Input Resolution below), then check CHANGELOG.md in the application folder (<app_folder>/CHANGELOG.md):
<app_folder>/CHANGELOG.md does not exist, skip this check (first-ever execution for this application).<app_folder>/CHANGELOG.md exists, scan all ## vX.Y.Z headings and determine the highest version using semantic versioning comparison."Version {requested} is lower than the current application version {highest} recorded in <app_folder>/CHANGELOG.md. Execution rejected." Do NOT proceed with any work.The skill requires mandatory <application> and <version> arguments, with an optional module: argument.
| Argument | Required | Description |
|---|---|---|
<application> | Yes | Application name — matched against root-level application folders |
<version> | Yes | Version label (e.g., v1.0.3). Used for version-filtered generation. |
module:<name> | No | Limit generation to a single module |
| Format | Example | Meaning |
|---|---|---|
| App + version | /modelgen-nosql hub_middleware v1.0.3 | All modules, version-filtered |
| App + version + module | /modelgen-nosql hub_middleware v1.0.3 module:Location Information | Single module, version-filtered |
| Module quoted | module:"Location Information" | Quoted form (equivalent) |
| Module snake_case | module:location_information | Converted to title-case for matching |
1_hub_middleware, 2_hc_adapter)<number>_ prefix from each folder name (e.g., 1_hub_middleware -> hub_middleware)snake_case, kebab-case, or title-case input (e.g., hub_middleware, hub-middleware, Hub Middleware all match 1_hub_middleware)| File | Resolved Path |
|---|---|
| PRD.md | <app_folder>/context/PRD.md |
| Output directory | <app_folder>/context/model/ |
snake_case input to title-case for matching (e.g., location_information → Location Information)When a module: argument is provided, the skill operates in module-filtered mode:
| Aspect | Full Generation | Module-Filtered |
|---|---|---|
| Per-module files (model.md, document-model.mermaid, schemas.json) for target module | Generate | Generate / overwrite |
| Per-module files for other modules | Generate | SKIP — leave untouched |
Root MODEL.md | Generate full file | Partial update — only the target module's row in the Modules table, its Table of Contents section, and its Assumptions Summary row are updated. All other module sections remain untouched. |
| Cross-Module Dependencies in MODEL.md | Generate | Update only rows where source or target is the filtered module |
| Update History in MODEL.md | Generate | Append new entry scoped to the target module |
Module filter is additive, not destructive: When module: is specified, only the named module's content files are written/overwritten. All other module files remain untouched. If the target module does not exist in PRD.md, stop and report available module names before doing any file writes.
First-time module generation: If the output directory does not yet contain files for the target module (e.g., generating a new module into an existing model), create the module subdirectory and files normally, then update MODEL.md to include the new module.
When a version argument is provided (with or without module:):
When combined with module:, both filters apply: only stories in the target module at or below the target version are processed.
This section defines the incremental update workflow for evolving an existing NoSQL document model when user stories change across versions. Use this mode instead of full regeneration when working with a previously generated model.
Activate update mode when the user says:
The user must provide a new version identifier for the update (e.g., "1.1.0", "v2", "Sprint-4").
| Element | Description |
|---|---|
| Existing Model Directory | Path to previously generated output (must contain MODEL.md + module subdirectories with model.md, document-model.mermaid, and schemas.json) |
| Updated PRD.md | The updated user story file with changes (additions, modifications, removals) |
| New Version | Version label for this update (e.g., "1.1.0", "v2") |
#### Phase U1: Baseline Loading
#### Phase U2: Change Detection (Diff Analysis)
#### Phase U3: Staleness & Validity Check
For each existing model element (collection, embedded document, field, reference, enum value), check:
Produce a Staleness Report table:
| Element Type | Element Name | Module | Status | Reason | Affected Stories | Action |
|---|---|---|---|---|---|---|
| Collection | orders | Order Mgmt | ORPHANED | All source stories removed | [US-010] | REMOVE |
| Field | priority | orders | STALE | Source story US-005 modified | [US-005] | UPDATE |
| Embed Decision | address in orders | Order Mgmt | STALE | Access pattern changed | [US-012] | REVIEW |
Status values: ORPHANED, STALE, CONTRADICTED, VALID Action values: REMOVE, UPDATE, REVIEW, KEEP
#### Phase U4: Incremental Extraction
#### Phase U5: Model Merge
#### Phase U6: Output Regeneration
Before processing any input, read both reference documents:
Read references/model-extraction-methodology.md
Read references/nosql-design-guide.mdidentification, attribute extraction, relationship detection) and appendices (verb heuristics, NFR impact map). Reused from the RDBMS skill.
decision framework, DDD-to-document classification, access pattern analysis matrix, field conventions, NFR adaptations, and all output format conventions with examples.
The user MUST provide the following structured input. If any required element is missing, ask the user to supply it before proceeding. Do NOT infer modules from story content.
| Element | Description |
|---|---|
| Module List | Explicit list of module names (bounded context candidates) |
| User Stories | Agile-format stories, each tagged with a module and a version. Format: "As [role], I want to [action] [object] so that [purpose]" |
| NFRs per Module | Non-functional requirements (security, performance, compliance, etc.) |
| Element | Description |
|---|---|
| Module Prefix Overrides | A 3-character prefix per module to override auto-generation. Format: Module Name: XXX. |
| External Reference Files | Supporting documents (Markdown, CSV, Excel, PDF, JSON, text, YAML, XML) for additional context. |
| Access Patterns | Descriptions of how the application reads and writes data. Critical for embed-vs-reference decisions. If not provided, inferred from user stories and flagged as assumptions. |
| Constraints | Technical or business constraints affecting the model |
| Glossary | Domain-specific term definitions (ubiquitous language) |
| Existing Data Model | Current-state model for migration or extension scenarios |
## Module: User Management
### Version: 1.0
- US-001: As an HR Admin, I want to create employee records so that new hires are registered.
- US-002: As an HR Admin, I want to assign departments to employees so that org structure is maintained.
### Version: 1.1
- US-005: As an HR Admin, I want to update employee contact info so that records stay current.
- US-006: As an HR Admin, I want to assign roles to employees so that permissions are controlled.
#### NFRs
- NFR-EM-001: All entities must support soft delete for compliance.
- NFR-EM-002: Audit trail required for all write operations.
#### Access Patterns (optional)
- AP-001: Employee profile is always read with department name and assigned roles.
- AP-002: List employees by department with pagination (up to 500 per department).The version tag is freeform (e.g., 1.0, v2, Sprint-3). Preserved exactly as provided.
Each module gets a 3-character uppercase prefix for collection names in shared-database deployment.
Auto-generation: Multi-word → first letter of each word ("User Management" → USM). Single-word → first 3 characters ("Billing" → BIL). Collisions resolved by alternate letters or numeric suffix.
Scope: Prefix appears in collection names in diagrams and JSON schemas only (e.g., usm_employees). The model.md uses clean PascalCase names.
Override: User can supply 3-character uppercase overrides per module.
[USHM00003], [NFRHM0003], [CONSHM003], [REFHM0003]). If ANY item is missing a tag, stop immediately and invoke the util-ustagger skill on the file to tag all untagged items. Only resume model extraction after all items are tagged. These tag codes will be used as the Source Story reference throughout the model output.<app_folder>/context/model/. Auto-create if the path doesn't exist.When no module: argument is provided, process ALL modules in a single pass. When a module: argument is provided, process ONLY the target module — skip all other modules entirely. Each module is independent — do not model cross-module references. Flag potential cross-module dependencies in assumptions.
Process stories in version order. Annotate every model element with the version that introduced it. New fields added in later versions carry the later version; the collection retains its original version.
If provided, read external files before Phase 1. They supplement — not replace — user stories. Every collection must trace to a user story. Reference-only entities go in assumptions. Set Source to REFERENCE with filename in Source Story when a field comes from a reference file. On conflicts, prefer user stories and flag the discrepancy.
Parse each user story per the methodology reference (Section 3). Extract subjects, verbs, direct/indirect objects, purpose clauses, qualifiers. Decompose compound stories.
Classify extracted nouns using the methodology reference (Section 4.2), then apply the DDD-to-document classification from the NoSQL design guide. Key principle: aggregate roots become collections; entities within aggregates become embedded documents; value objects are always embedded; M:N join entities become arrays of references unless data-rich.
For each collection candidate, run through the Access Pattern Analysis Matrix from the NoSQL design guide. If the user provided access patterns, use them directly. If not, infer from user stories (especially purpose clauses) and flag each inference as an assumption.
Apply the Embed vs Reference Decision Flowchart from the NoSQL design guide to every relationship. Record each decision with rationale in the Document Design Decisions table. Default to embedding; only promote to a separate collection when criteria are met.
Derive fields from four sources in priority order: explicit mention, operation inference, NFR requirements, domain convention. Use document-specific field conventions from the NoSQL design guide (_id, _audit, _version, ISODate, etc.).
Source types: EXPLICIT, OPERATION_INFERENCE, NFR, CONVENTION, REFERENCE, ASSUMPTION.
Map NFRs to document model impact using the NFR Adaptation table in the NoSQL design guide.
#### Phase 6a: Architecture Principle Integration
If PRD.md contains an # Architecture Principle section, read it and apply to model decisions:
If the # Architecture Principle section is absent, skip this sub-phase and proceed with existing behavior.
#### Phase 6b: Process Flow Integration
If PRD.md contains a # High Level Process Flow section, read it and apply to model decisions:
If the # High Level Process Flow section is absent, skip this sub-phase.
Produce three deliverables per domain (see Output Specification below).
Run quality gates as self-review. Fix issues before presenting output.
After all model files are successfully generated, append an entry to CHANGELOG.md in the application folder (<app_folder>/CHANGELOG.md):
<app_folder>/CHANGELOG.md. If it does not exist, create it with: # Changelog
- This file tracks all skill executions by version for this application.
- The highest version recorded here is the current application version.
- Skills MUST NOT execute for a version lower than the highest version in this file.
---## {version} heading matching the current version.--- below the context header and before any existing ## vX.Y.Z section (newest-first ordering), with a new table header and the first row.| {YYYY-MM-DD} | {application_name} | modelgen-nosql | {module or "All"} | Generated NoSQL document models |For each module, produce exactly three files in a kebab-case subdirectory, plus one root-level summary file:
/output-dir/
├── MODEL.md # Root summary and table of contents
└── {module-name}/
├── document-model.mermaid # Mermaid class diagram
├── schemas.json # JSON schema examples with sample documents
└── model.md # Full model documentationdocument-model.mermaidA Mermaid class diagram showing collections, embedded documents, and references. Follow all conventions from the Output Format Conventions section of the NoSQL design guide: stereotypes (<<collection>>, <<embedded>>, <<enum>>), composition vs association arrows, prefixed collection names, and camelCase fields. Include version and prefix comments at top.
schemas.jsonA JSON file with an example document per collection, following the format in the NoSQL design guide. Each collection entry includes: description, exampleDocument (realistic sample data showing all fields, embedded documents, arrays), and indexes (recommended indexes from access patterns). Include _meta block with domain, prefix, and versions.
model.md# NoSQL Document Model: {Module Name}
## 1. Module Prefix Map
| Module | Prefix | Auto-Generated | Override |
## 2. Collection Catalog
| Collection | DDD Type | Bounded Context | Document Type | Key Fields | Source Stories | Version |
(Document Type: Root Collection, Supporting Collection, Event Collection, Audit Collection)
## 3. Base Document Specification
(Audit, soft delete, versioning fields common to all documents)
## 4. Document Design Decisions
| Parent | Child | Decision | Rationale | Access Pattern | Source Story | Version |
(Decision: EMBED, EMBED_ARRAY, REFERENCE, DENORMALIZE_AND_REFERENCE)
This is the most critical table — records every embed-vs-reference decision with reasoning.
## 5. Field Detail (one subsection per collection)
### 5.x {Collection Name}
| Field | Type | Nullable | Constraints | Source | Source Story | Version |
Source values: EXPLICIT, OPERATION_INFERENCE, NFR, CONVENTION, REFERENCE, ASSUMPTION.
Type values: String, Number, Boolean, ObjectId, ISODate, Object, Array<Type>, enum name.
## 6. Embedded Document Definitions (one subsection per embedded type)
### 6.x {Embedded Document Name}
| Field | Type | Nullable | Description | Source Story | Version |
## 7. Enum Definitions (one subsection per enum)
### 7.x {Enum Name}
| Value | Description | Source Story | Version |
## 8. Reference Catalog
| Source Collection | Target Collection | Reference Field | Denormalized Fields | Cardinality | Business Rule | Source Story | Version |
## 9. Index Recommendations
| Collection | Field(s) | Index Type | Rationale | Source Story | Version |
(Index Type: unique, single, compound, text, ttl)
## 10. Domain Events
| Event Name | Trigger Story | Aggregate | Payload Fields | Version |
## 11. Bounded Context Summary
| Context | Collections | Description |
## 12. Assumptions and Ambiguities
| Story ID | Collection / Field | Assumption Made | Clarification Needed | Version |
## 13. Changelog
### Version {new-version} (from {previous-version})
#### Added
| Element Type | Name | Description | Source Stories |
|---|---|---|---|
#### Modified
| Element Type | Name | Change Description | Previous | New | Source Stories |
|---|---|---|---|---|---|
#### Removed
| Element Type | Name | Reason | Former Source Stories |
|---|---|---|---|
#### Flagged for Review
| Element Type | Name | Issue | Recommendation |
|---|---|---|---|MODEL.mdAfter generating all per-module files, produce a single MODEL.md in the root output directory. This file serves as the entry point and table of contents for the entire model extraction output.
#### Document Structure
# NoSQL Document Model Summary
> Generated from {total story count} user stories across {module count} modules.
## Modules
| # | Module | Prefix | Collections | Embedded Docs | References | Versions | Stories |
|---|--------|--------|-------------|---------------|------------|----------|---------|
(One row per module. Collections = count of root collections. Embedded Docs = count of
embedded document types. References = count of cross-collection references. Versions =
comma-separated list of versions included. Stories = count of source stories for that module.)
## Table of Contents
### {Module Name} (`{prefix}`)
> {One-line summary: e.g., "Manages employee records, departments, and role assignments."}
- **Model Documentation:** [{module-kebab}/model.md](./{module-kebab}/model.md)
- **Document Structure Diagram:** [{module-kebab}/document-model.mermaid](./{module-kebab}/document-model.mermaid)
- **JSON Schemas:** [{module-kebab}/schemas.json](./{module-kebab}/schemas.json)
- **Collections:** {comma-separated collection names in lower_snake_case with prefix}
- **Key Design Decisions:** {2–3 most significant embed-vs-reference decisions in natural language}
(Repeat for each module, in the same order as the Modules table.)
## Cross-Module Dependencies
| Source Module | Target Module | Dependency | Noted In |
|---------------|---------------|------------|----------|
(List any cross-module dependencies flagged in assumptions tables. If none, state "No
cross-module dependencies were identified.")
## Assumptions Summary
| Module | Count | Critical |
|--------|-------|----------|
(Count = total assumptions for that module. Critical = count of assumptions marked as
needing clarification. Links to the respective module's Assumptions and Ambiguities section.)
## Update History
| Version | Date | Modules Affected | Added | Modified | Removed | Flagged |
|---|---|---|---|---|---|---|and embed-vs-reference decisions.
when a clear "reference when" criterion is met, justified in Document Design Decisions.
Before presenting output, verify:
_id and audit fieldsMODEL.md is generated with correct links to all module subdirectoriesMODEL.md module statistics (collection count, embedded doc count, story count) match actual outputWhen running in update mode, additionally verify:
When running with a module: argument, additionally verify:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.