scaffold-viewer
Skill0 starsChanged 5 months agoMITView on GitHub
Scaffold a new data viewer page for a database table
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- browseSkill
- discoverSkill
- onboardSkill
- rememberSkill
- scaffold-clientSkill
- scaffold-projectSkill
- scaffold-taskSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Read the Drizzle schema file for the table (in src/db/schema/).
- Very specific: line 43
Write the ColumnDef array to server/lib/column-defs.ts (append to existing file or add new export).
- Very specific: line 47
If the table has a date filter column, add an entry to DATE_FILTER_COLUMNS in server/lib/column-defs.ts.
- Very specific: line 51
Create server/routes/{table-name}.ts using ${CLAUDE_SKILL_DIR}/../../templates/viewer-route.ts as the starting template.
- Very specific: line 59
Add app.route("/api/{table-name}", route) in server/index.ts.
- Very specific: line 63
Create server/public/{table-name}.html from ${CLAUDE_SKILL_DIR}/../../templates/data-viewer-page.html:
- Very specific: line 70
Add the table to the sidebar navigation in server/public/shared.js (see ${CLAUDE_SKILL_DIR}/../../templates/shared.js for framework).
- Very specific: line 74
Add the table to the dashboard stats registry in server/routes/dashboard.ts.
- Very specific: line 85
Always read the existing column-defs.ts and route files first to match patterns
- Distinctive: line 86
Use the same Zod schema pattern as existing routes
- Distinctive: line 89
Test the page loads before reporting success
≈ “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
Scaffold Data Viewer
Interactive skill that scaffolds a new data viewer page for the data server.
Process
Step 1 -- Gather Table Info
Ask the user:
- What is the SQL table name? (e.g.,
entities,source_cache) - Is it tenant-scoped (has
tenant_id)? Or global? - What is the date filter column? (e.g.,
created_at,fetched_at, or none)
Step 2 -- Read the Schema
Read the Drizzle schema file for the table (in src/db/schema/). Extract all column names, types, and constraints.
Step 3 -- Generate ColumnDef Array
For each column in the schema, generate a ColumnDef entry following the conventions in ${CLAUDE_SKILL_DIR}/../../imp_doc/data-viewer/patterns.md and the example in ${CLAUDE_SKILL_DIR}/../../templates/column-defs.ts:
key: snake_case column namelabel: Title Case display nameselect: SQL expression (raw column name or transform likeLEFT(col::text, 8))dbColumn: raw column name for WHERE clausesfilterable: true for status/category columns with <20 distinct valuessortable: true for most columnssearchable: true for name/URL/text columnsmono: true for IDs, URLs, keysnumeric: true for counts, scoresdate: true for timestamp columnstruncate: set for long text fieldslink: true for URL columnsw: width in pixels (70 for IDs, 120 for status, 200 for names, 250 for URLs, 160 for dates)
Write the ColumnDef array to server/lib/column-defs.ts (append to existing file or add new export).
Step 4 -- Add DATE_FILTER_COLUMNS Entry
If the table has a date filter column, add an entry to DATE_FILTER_COLUMNS in server/lib/column-defs.ts.
Step 5 -- Create Route File
Create server/routes/{table-name}.ts using ${CLAUDE_SKILL_DIR}/../../templates/viewer-route.ts as the starting template. Also reference ${CLAUDE_SKILL_DIR}/../../imp_doc/data-viewer/patterns.md Section 10:
- Data endpoint:
GET /api/{table-name}usingqueryPaginated()from${CLAUDE_SKILL_DIR}/../../templates/query-builder.ts - Stats endpoint:
GET /api/{table-name}/statsusingqueryStats()with 5-min cache - Zod schema for query params (page, limit, sort, order, search, filter[], date_from, date_to)
- Global table handling if not tenant-scoped
Step 6 -- Mount Route
Add app.route("/api/{table-name}", route) in server/index.ts.
Step 7 -- Create HTML Page
Create server/public/{table-name}.html from ${CLAUDE_SKILL_DIR}/../../templates/data-viewer-page.html:
- Set
apiPath,title,columnsin VIEWER_CONFIG - Configure funnel chart if the table has a natural funnel flow (optional)
- Page loads
shared.js(${CLAUDE_SKILL_DIR}/../../templates/shared.js) andshared.css(${CLAUDE_SKILL_DIR}/../../templates/shared.css)
Step 8 -- Update Sidebar
Add the table to the sidebar navigation in server/public/shared.js (see ${CLAUDE_SKILL_DIR}/../../templates/shared.js for framework). Add entry to the appropriate nav group.
Step 9 -- Update Dashboard Stats
Add the table to the dashboard stats registry in server/routes/dashboard.ts.
Step 10 -- Report
Show the user:
- Files created/modified
- How to test:
npm run server:devthen openhttp://localhost:3100/{table-name}.html - Suggest running the schema drift test to verify column alignment
Rules
- Always read the existing column-defs.ts and route files first to match patterns
- Use the same Zod schema pattern as existing routes
- ColumnDef keys must match SQL column names (converted to snake_case)
- Global tables (no tenant_id) use a different Zod schema without
tenant_id - Test the page loads before reporting success
- Cross-ref:
${CLAUDE_SKILL_DIR}/../../imp_doc/data-viewer/patterns.md,${CLAUDE_SKILL_DIR}/../../templates/data-viewer-server.ts,${CLAUDE_SKILL_DIR}/../../templates/query-builder.ts,${CLAUDE_SKILL_DIR}/../../templates/column-defs.ts,${CLAUDE_SKILL_DIR}/../../templates/viewer-route.ts,${CLAUDE_SKILL_DIR}/../../templates/shared.js,${CLAUDE_SKILL_DIR}/../../templates/shared.css,${CLAUDE_SKILL_DIR}/../../templates/data-viewer-page.html
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.

