Table Spec Generation

VerifiedCaution

Generate spec files for tables found in implementation artifacts.

Sby Skills Guide Bot
DocumentationIntermediate
7/22/2026
Claude Code
#spec-generation#data-modeling#schema-extraction#dbt#sdd

Recommended for

Automated summary

Generates a specs/<table-id>/spec.md file for every table discovered in the given implementation artifacts (model.yaml, SQL/dbt, Python), bootstrapping permanent table specs for an existing project.

Strengths

  • Handles several input formats: model.yaml read through the modscape CLI, SQL/dbt files, and Python (SQLAlchemy, PySpark, pandas)
  • Asks for confirmation before creating or updating model.yaml, keeping spec generation separate from model changes
  • Never overwrites an existing spec.md — already documented tables are skipped
  • Reports conflicts when the same physical table shows up in multiple files, keeping the first definition

Limitations

  • Bootstrap-only: existing spec files are never refreshed or extended
  • YAML extraction relies on the modscape CLI (table list / table get) with no fallback to direct file reads
  • Owner, SLA and update frequency are inferred heuristically and often left as placeholders
When to use it

Use it to quickly produce a first set of table specs from existing code or models before entering the regular SDD flow.

When not to use it

Avoid it when specs already exist and need updating, or when the provided files contain no usable table definitions.

Security analysis

Caution
Quality score85/100

The skill is not overtly malicious or destructive. It uses shell commands and filesystem writes for a legitimate spec-generation workflow, asks before modifying `model.yaml`, and does not send data externally. However, it requires powerful tools without declaring them and does not validate table IDs before building output paths, so it warrants caution rather than a clean safe rating.

Findings
  • •Skill instructs running `modscape` CLI commands and writing/creating files and directories, but declares no `allowed-tools`; the agent may need broad shell/filesystem permissions to execute it.
  • •Table IDs are derived from user-supplied files and interpolated into output paths like `.modscape/specs/<table-id>/spec.md`; unvalidated IDs containing `../` could write outside the intended directory.
  • •The skill may modify `model.yaml` based on parsed file contents; confirmation is required, but it still mutates repository files.
  • •It reads arbitrary user-provided paths/globs, so it could process sensitive files if pointed at them. No network calls, credential exfiltration, or destructive commands were found.
How this analysis is made

Examples

From a model.yaml
@modscape-spec-generate model.yaml
Mixed SQL and Python sources
@modscape-spec-generate models/staging/*.sql src/models.py
Interactive discovery
@modscape-spec-generate

name: modscape-spec-generate description: Generate specs/<table-id>/spec.md for all tables found in the given implementation artifacts. Use this to bootstrap permanent table specs for an existing project before starting the regular SDD flow.

Spec Generate

Generate specs/<table-id>/spec.md for all tables found in the given implementation artifacts. Use this to bootstrap permanent table specs for an existing project before starting the regular SDD flow.

Usage

@modscape-spec-generate [files...]

[files...] is optional. Accepts file paths, glob patterns, or a mix of both:

@modscape-spec-generate model.yaml
@modscape-spec-generate models/staging/*.sql src/models.py
@modscape-spec-generate model.yaml models/**/*.sql

If no arguments are provided, the skill will ask interactively.

Instructions

When reading model information from a YAML file, always use modscape CLI commands — do not use grep or direct file reads:

modscape table list <file>
modscape table get <file> --id <id>

Step 1: Collect input files

  • If arguments are provided: use them as the list of input files. Expand globs if needed.
  • If no arguments are provided: ask the user:

    Which files should I read to discover tables? (Enter file paths or glob patterns — e.g., model.yaml, models/**/*.sql, src/models.py) Continue collecting until the user signals they are done.

Step 2: Confirm model.yaml update

Immediately after collecting input files, before reading any file, ask:

Should I also update (or create) model.yaml with the tables I find?

  • Yes — generate spec.md AND add/update tables in model.yaml
  • No — generate spec.md only (recommended if model.yaml already exists and is up to date)

If the user confirms model.yaml update:

  • If model.yaml is among the input files, update it in place.
  • If no model.yaml exists yet, ask the user for the target path (default: model.yaml).
  • If a model.yaml exists but is not among the input files, ask whether to update it.

Step 3: Read and extract tables

Read each input file and extract table definitions. Apply the following per file type:

.yaml / .yml (model.yaml format)

modscape table list <file>
# For each table id:
modscape table get <file> --id <id>

From each table, extract:

  • id: physical.name if available, otherwise the table id field
  • owner: metadata.owner
  • update_frequency: inferred from physical.strategy + physical.partition.granularity
  • sla: metadata.sla
  • business_context: conceptual.description
  • business_rules: from column description and expression fields

.sql files Read the file and parse:

  • CREATE TABLE <name> — physical table name becomes the ID
  • dbt model files: filename (without .sql) becomes the ID; {{ config(materialized=...) }} informs update_frequency
  • Column names, types, and inline comments become business_rules candidates
  • CTE names are not tables — skip them

.py files Read the file and parse:

  • SQLAlchemy class <Model>(Base): table name from __tablename__; Column() definitions for columns
  • PySpark StructType / StructField: extract schema field names and types
  • pandas read_sql('SELECT ... FROM <table>'): extract table names
  • Use class/variable docstrings as business_context candidates

Conflict resolution: If the same physical table name appears in multiple files, use the first file that defined it and note the conflict in the final summary.

Step 4: Generate spec file for each table

Output path per table:

.modscape/specs/<table-id>/spec.md

If the file already exists: skip it. Do not overwrite.

If the file does not exist: create the directory and write the file.

Write using this format:

# <table-id>

## Overview
- **Owner**: <metadata.owner, or "—">
- **Update Frequency**: <inferred from physical.strategy + partition, or "—">
- **SLA**: <metadata.sla, or "—">

## Business Context
<conceptual.description, or "—">

## Business Rules
- <derived from column descriptions / expressions, or "—">

## Known Issues / Caveats
- —

## Changelog
- <YYYY-MM-DD>: Bootstrapped from existing implementation (`@modscape-spec-generate`)

Fill <YYYY-MM-DD> with today's date.

Step 5: Update model.yaml (if confirmed in Step 2)

If the user confirmed model.yaml updates:

  • For tables that exist in model.yaml: skip (do not overwrite existing definitions).
  • For tables not yet in model.yaml: add a minimal entry using modscape table add.
  • Run validate after all additions:
    modscape validate <model.yaml-path>
    

Step 6: Display summary

After processing all tables, output the following summary — always, without exception:


✅ spec:generate complete.

Input files scanned: <list of files>

spec.md results:

  • Generated: <n> tables — specs/fct_orders/spec.md, specs/dim_customers/spec.md, ...
  • Skipped (already exists): <m> tables — specs/stg_raw_orders/spec.md, ...
  • Conflicts (first-source used): <list, or "none">

model.yaml: <updated / not updated>

ℹ️ Generated specs contain only information available in the source files. Sections marked — can be enriched later using the regular SDD flow (@modscape-spec-requirements → @modscape-spec-design).


From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/table-spec-generation-mrwakcmh/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/table-spec-generation-mrwakcmh' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/table-spec-generation-mrwakcmh/download' --output '.skill-downloads/table-spec-generation-mrwakcmh/SKILL.md.part' && mv '.skill-downloads/table-spec-generation-mrwakcmh/SKILL.md.part' '.skill-downloads/table-spec-generation-mrwakcmh/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/table-spec-generation-mrwakcmh/SKILL.md' && test -s '.skill-downloads/table-spec-generation-mrwakcmh/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/modscape-spec-generate' && cp -R '.skill-downloads/table-spec-generation-mrwakcmh' '.claude/skills/modscape-spec-generate'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/table-spec-generation-mrwakcmh'

openskills read 'table-spec-generation-mrwakcmh'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/table-spec-generation-mrwakcmh/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills