Create Specification for Datagrok Scientific Application
This skill produces a complete, implementation-ready specification for an
interactive scientific application on the Datagrok platform.
Output: spec.md saved to the application directory.
Next step: Implementation via the implement-interactive-scientific-application-from-spec skill
(separate conversation).
Base path: .claude/skills/create-interactive-scientific-application-spec/ (relative to repo root).
All file paths below use {SKILL}/ as shorthand.
Step 1: Understand the request
Analyze the user's request and identify:
- The scientific domain and problem being solved.
- Core computational model (formulas, equations, algorithms).
- What the user wants to see and interact with.
- Complexity level: simple (single reactive task, no workers) vs. complex
(multiple tasks, workers, secondary pipelines).
Determine the target package:
- If the user specifies a package name — use it.
- If the current working directory is inside an existing package
(has
package.json with datagrok-api dependency) — add the
application to that package.
- Otherwise — ask the user whether to create a new package or add
to an existing one.
If the request is vague (e.g., "build a Lotka-Volterra app"), ask clarifying
questions before proceeding — but keep it to 2–3 focused questions, not an
interrogation.
Step 2: Read reference materials
Read these files once, in this order:
Spec template (mandatory):
{SKILL}/references/spec-template.md — read in full.
Architectural guide (mandatory):
{SKILL}/references/guide-for-spec.md — read in full.
This is a condensed version of the implementation guide, containing only
what is needed to write a correct specification: architecture concepts,
port/adapter/coordinator roles, naming conventions, section expectations.
Completed examples (if available):
{SKILL}/references/examples/ — list subdirectories, then read the
example spec(s) that are closest to the user's request.
Do NOT read the full implementation guide, worker guides, API references,
or coding conventions — those belong to the implementation skill.
Step 3: Fill in the specification
Fill in every section of the template. Follow these rules:
Critical sections — fill with maximum detail
- 1.0 General Information — application name, package, entry function,
description.
- 1.1 Core — task list, computation formulas (Level 1 is MANDATORY before
approval), input/output parameters, implementation approach.
- 3. Controls — every control must have: ID, label, type, data type,
default value, min, max, format, tooltip. No placeholders.
- 4. Display Elements — every viewer/element with ID, type, associated data.
- 7. Validation — concrete rules with conditions and error messages.
- 15. Testing — test categories, reference examples, expected coverage.
Sections that may be N/A for simple apps
For applications with a single reactive task, no workers, and no secondary
pipelines, the following sections can be marked N/A with a one-line explanation:
- 1.2 Ports (application-level: Progress, Cancellation)
- 8.2 Secondary Pipelines
- 8.4 Computation Blocking
- 12.2 Worker Termination
Never mark a section N/A without explanation. If unsure whether a section
applies — include it.
Computation formulas (Section 1.1) — special attention
This is the most important section. Level 1 must contain:
- All variables with meaning, units, and valid domains.
- All equations/relationships connecting inputs to outputs — unambiguously,
so that another developer could implement from this description alone.
- Output properties (invariants): bounds, monotonicity, conservation laws,
limiting cases.
- At least one reference example per computational path: concrete inputs →
expected output with source (manual calculation / literature).
Level 2 (full formalization) can be marked as "to be developed incrementally"
for the first iteration, but note what it will eventually contain.
Control IDs — naming convention
Use a consistent prefix: ctrl_ for inputs (e.g., ctrl_alpha, ctrl_x0),
btn_ for buttons (e.g., btn_optimize, btn_reset), view_ for viewers
(e.g., view_line_chart, view_phase_plot).
Step 4: Present for approval
Present the specification to the user in stages:
- First: Sections 1.0–1.5 (architecture, computation model, ports,
adapters, coordinator, independence principle).
Ask for feedback before continuing — this is the foundation.
- Then: Sections 2–5 (main view, controls, display, layout).
- Then: Sections 6–15 (feedback, validation, pipeline, reactivity,
data lifecycle, errors, resources, closure, UX, testing).
At each stage, ask: "Does this look correct? Anything to change?"
Step 5: Save and hand off
When the user approves the full specification:
Save the specification as spec.md in the application source directory
(e.g., src/<app-name>/spec.md).
Confirm explicitly:
Specification approved and saved to src/<app-name>/spec.md.
To implement, start a new conversation and use the
implement-interactive-scientific-application-from-spec skill, or run:
/implement-interactive-scientific-application-from-spec
Do NOT proceed to implementation in this conversation.
Iteration rules
- If the user requests changes — update the spec and re-present the changed
sections.
- If you discover ambiguities or inconsistencies while filling in later
sections — go back and fix earlier sections, noting the changes.
- The specification is the single source of truth for implementation.
Reference files summary
| File |
Purpose |
Required |
references/spec-template.md |
Section structure and expectations |
Yes |
references/guide-for-spec.md |
Architecture concepts for correct spec writing |
Yes |
references/examples/ |
Completed spec examples |
If available |
What guide-for-spec.md should contain
This file is a trimmed version of the full implementation guide. Keep:
- Hexagonal architecture overview (Core ↔ Ports ↔ Adapters ↔ Coordinator)
- Independence principle explanation
- Task taxonomy (reactive vs. on-demand, simple vs. complex)
- Port types and their roles (Input, Output, Progress, Cancellation)
- Adapter responsibilities (what UI adapters do, what worker adapters do)
- Coordinator responsibilities (high-level, not implementation details)
- Naming conventions (control IDs, CSS prefixes, file structure)
- Section-by-section expectations for the spec template
- Computation blocking concept (what it is, when to specify it)
- Resource lifecycle concept (subscriptions, workers — what to plan for)
Remove:
- Code examples and implementation patterns
- Webpack configuration details
- CSS implementation rules (selectors, specificity)
- Worker message protocol and lifecycle management code
- TypeScript interface definitions
- Subscription management code (
subs[] array patterns)
addValidators() implementation
onViewRemoved implementation patterns
- Testing framework setup and test runner details
- Any section that answers "how to code this" rather than "what to specify"
Target size: ~30–40% of the full guide.
1---2name: create-interactive-scientific-application-spec3description: Create a detailed specification for an interactive scientific application (simulation, mathematical model, ODE/PDE solver, computational tool) on the Datagrok platform. NOT for regular CRUD/data apps — use build-app for those. Analyzes the user's request, reads a spec template and architectural guide, fills in every section with full detail, and presents the result for staged approval. Triggers on: "write a spec for a scientific app", "create specification", "spec template", "plan the app before coding", or when the user describes a computation-heavy interactive application. The output is an approved spec.md file — implementation is handled by the implement-interactive-scientific-application-from-spec skill.4---5
6# Create Specification for Datagrok Scientific Application
7
8This skill produces a complete, implementation-ready specification for an
9interactive scientific application on the Datagrok platform.
10
11**Output:** `spec.md` saved to the application directory.
12**Next step:** Implementation via the `implement-interactive-scientific-application-from-spec` skill
13(separate conversation).
14
15**Base path:** `.claude/skills/create-interactive-scientific-application-spec/` (relative to repo root).
16All file paths below use `{SKILL}/` as shorthand.
17
18---
19
20## Step 1: Understand the request
21
22Analyze the user's request and identify:
23- The scientific domain and problem being solved.
24- Core computational model (formulas, equations, algorithms).
25- What the user wants to see and interact with.
26- Complexity level: simple (single reactive task, no workers) vs. complex
27 (multiple tasks, workers, secondary pipelines).
28
29Determine the target package:
30- If the user specifies a package name — use it.
31- If the current working directory is inside an existing package
32 (has `package.json` with `datagrok-api` dependency) — add the
33 application to that package.
34- Otherwise — ask the user whether to create a new package or add
35 to an existing one.
36
37If the request is vague (e.g., "build a Lotka-Volterra app"), ask clarifying
38questions before proceeding — but keep it to 2–3 focused questions, not an
39interrogation.
40
41---
42
43## Step 2: Read reference materials
44
45Read these files **once**, in this order:
46
471. **Spec template** (mandatory):
48 `{SKILL}/references/spec-template.md` — read in full.
49
502. **Architectural guide** (mandatory):
51 `{SKILL}/references/guide-for-spec.md` — read in full.
52 This is a condensed version of the implementation guide, containing only
53 what is needed to write a correct specification: architecture concepts,
54 port/adapter/coordinator roles, naming conventions, section expectations.
55
563. **Completed examples** (if available):
57 `{SKILL}/references/examples/` — list subdirectories, then read the
58 example spec(s) that are closest to the user's request.
59
60**Do NOT read** the full implementation guide, worker guides, API references,
61or coding conventions — those belong to the implementation skill.
62
63---
64
65## Step 3: Fill in the specification
66
67Fill in every section of the template. Follow these rules:
68
69### Critical sections — fill with maximum detail
70
71- **1.0 General Information** — application name, package, entry function,
72 description.
73- **1.1 Core** — task list, computation formulas (Level 1 is MANDATORY before
74 approval), input/output parameters, implementation approach.
75- **3. Controls** — every control must have: ID, label, type, data type,
76 default value, min, max, format, tooltip. No placeholders.
77- **4. Display Elements** — every viewer/element with ID, type, associated data.
78- **7. Validation** — concrete rules with conditions and error messages.
79- **15. Testing** — test categories, reference examples, expected coverage.
80
81### Sections that may be N/A for simple apps
82
83For applications with a single reactive task, no workers, and no secondary
84pipelines, the following sections can be marked N/A with a one-line explanation:
85- 1.2 Ports (application-level: Progress, Cancellation)
86- 8.2 Secondary Pipelines
87- 8.4 Computation Blocking
88- 12.2 Worker Termination
89
90Never mark a section N/A without explanation. If unsure whether a section
91applies — include it.
92
93### Computation formulas (Section 1.1) — special attention
94
95This is the most important section. Level 1 must contain:
96- All variables with meaning, units, and valid domains.
97- All equations/relationships connecting inputs to outputs — unambiguously,
98 so that another developer could implement from this description alone.
99- Output properties (invariants): bounds, monotonicity, conservation laws,
100 limiting cases.
101- At least one reference example per computational path: concrete inputs →
102 expected output with source (manual calculation / literature).
103
104Level 2 (full formalization) can be marked as "to be developed incrementally"
105for the first iteration, but note what it will eventually contain.
106
107### Control IDs — naming convention
108
109Use a consistent prefix: `ctrl_` for inputs (e.g., `ctrl_alpha`, `ctrl_x0`),
110`btn_` for buttons (e.g., `btn_optimize`, `btn_reset`), `view_` for viewers
111(e.g., `view_line_chart`, `view_phase_plot`).
112
113---
114
115## Step 4: Present for approval
116
117Present the specification to the user in stages:
118
1191. **First:** Sections 1.0–1.5 (architecture, computation model, ports,
120 adapters, coordinator, independence principle).
121 Ask for feedback before continuing — this is the foundation.
1222. **Then:** Sections 2–5 (main view, controls, display, layout).
1233. **Then:** Sections 6–15 (feedback, validation, pipeline, reactivity,
124 data lifecycle, errors, resources, closure, UX, testing).
125
126At each stage, ask: "Does this look correct? Anything to change?"
127
128---
129
130## Step 5: Save and hand off
131
132When the user approves the full specification:
133
1341. Save the specification as `spec.md` in the application source directory
135 (e.g., `src/<app-name>/spec.md`).
1362. Confirm explicitly:
137
138 > **Specification approved and saved to `src/<app-name>/spec.md`.**
139 >
140 > To implement, start a new conversation and use the
141 > `implement-interactive-scientific-application-from-spec` skill, or run:
142 >
143 > `/implement-interactive-scientific-application-from-spec`
144
145Do NOT proceed to implementation in this conversation.
146
147---
148
149## Iteration rules
150
151- If the user requests changes — update the spec and re-present the changed
152 sections.
153- If you discover ambiguities or inconsistencies while filling in later
154 sections — go back and fix earlier sections, noting the changes.
155- The specification is the single source of truth for implementation.
156
157---
158
159## Reference files summary
160
161| File | Purpose | Required |
162|------|---------|----------|
163| `references/spec-template.md` | Section structure and expectations | Yes |
164| `references/guide-for-spec.md` | Architecture concepts for correct spec writing | Yes |
165| `references/examples/` | Completed spec examples | If available |
166
167### What `guide-for-spec.md` should contain
168
169This file is a trimmed version of the full implementation guide. **Keep:**
170
171- Hexagonal architecture overview (Core ↔ Ports ↔ Adapters ↔ Coordinator)
172- Independence principle explanation
173- Task taxonomy (reactive vs. on-demand, simple vs. complex)
174- Port types and their roles (Input, Output, Progress, Cancellation)
175- Adapter responsibilities (what UI adapters do, what worker adapters do)
176- Coordinator responsibilities (high-level, not implementation details)
177- Naming conventions (control IDs, CSS prefixes, file structure)
178- Section-by-section expectations for the spec template
179- Computation blocking concept (what it is, when to specify it)
180- Resource lifecycle concept (subscriptions, workers — what to plan for)
181
182**Remove:**
183
184- Code examples and implementation patterns
185- Webpack configuration details
186- CSS implementation rules (selectors, specificity)
187- Worker message protocol and lifecycle management code
188- TypeScript interface definitions
189- Subscription management code (`subs[]` array patterns)
190- `addValidators()` implementation
191- `onViewRemoved` implementation patterns
192- Testing framework setup and test runner details
193- Any section that answers "how to code this" rather than "what to specify"
194
195Target size: ~30–40% of the full guide.