Easy Stat Edu Developer
by itou-daiki
Expert guidance, MCP workflow, and patterns for the Easy Stat Edu project.
Skill Details
Repository Files
1 file in this skill directory
name: Easy Stat Edu Developer description: Expert guidance, MCP workflow, and patterns for the Easy Stat Edu project.
Easy Stat Edu Developer Skill
This skill outlines the architecture, development patterns, testing strategies, and MCP workflow for the Easy Stat Edu project. Follow these guidelines to ensure consistency and efficiency.
1. MCP Workflow & Agentic Behavior
Leverage your specialized MCP tools to act as an autonomous, intelligent partner.
Sequential Thinking (Complex Logic)
When facing multi-step analytical problems (e.g., implementing a new ANOVA logic with multiple error terms):
- Call
sequential-thinking: Break the problem down.- Step 1: Understand the statistical formula (SS, df, MS, F).
- Step 2: Map formula terms to code variables (
cleanData,factors). - Step 3: Plan the data transformation (e.g., "Pivot long to wide?").
- Step 4: Verification strategy.
- Iterate: If a test fails, trigger a new thought sequence to hypothesize the root cause (e.g., "Is it a floating-point error or a wrong degree of freedom?").
Serena (Codebase Navigation)
Before editing any file, understand the context:
- Exploration: Use
get_symbols_overvieworfind_symbolto see available functions injs/utils.jsorjs/analyses/*.js. - References: If modifying a core utility (e.g.,
createVariableSelector), usefind_referencing_symbolsto check impact on other analyses. - Search: Use
search_for_patternto find usage of specific HTML IDs or CSS classes across the project.
Context7 (Documentation)
If you are unsure about a library's specific syntax:
- Call
context7: "How to calculate non-central F distribution in jStat?" or "Plotly.js grouped bar chart with error bars syntax". - Don't Guess: Verify the API before implementing, especially for
jStatandPlotly.
2. Project Architecture
- Type: Client-side SPA (Vanilla JS + HTML). No build step (no Webpack/Vite).
- Entry:
index.htmlloads all libraries andjs/main.js(module entry). - Libraries (Global Scope):
jStat(Statistics)Plotly(Visualization)XLSX(Excel import/export)math(Math.js)vis(Network graphs)
Directory Structure
js/analyses/: Individual analysis modules (must exportrender()).js/utils.js: Core UI/Logic helpers. Check this file first for reusable functions.css/style.css: Main styling.tests/: Playwright end-to-end tests.
3. Development Patterns
Common UI Helpers (js/utils.js)
showLoadingMessage(msg)/hideLoadingMessage(): Manage global spinner.toggleCollapsible(header): Handle accordion UI.toHtmlTable(headers, rows, data): Quick HTML table generation.createVariableSelector(...): Standardize variable input UI.
Coding Standards
- Japanese UI: All user-facing text must be Japanese.
- English Internals: Variable names and comments should be English.
- Error Handling: Use
showLoadingMessagefor progress andalert(or custom UI) for errors. - Async Rendering: Use
setTimeout(() => { ... }, 0)when rendering heavy Plotly charts to allow the DOM to update first.
4. Testing Strategy (Playwright)
Test Template
const { test, expect } = require('@playwright/test');
const path = require('path');
test('Feature Verification', async ({ page }) => {
// 0. Console Debugging
page.on('console', msg => console.log(`[Browser]: ${msg.text()}`));
// 1. Initial Load & Wait
await page.goto('http://127.0.0.1:8080/');
await expect(page.locator('#loading-screen')).toBeHidden({ timeout: 10000 });
// 2. Data Upload
const filePath = path.join(__dirname, '../datasets/demo.xlsx');
await page.locator('#main-data-file').setInputFiles(filePath);
await expect(page.locator('#dataframe-container')).toBeVisible({ timeout: 10000 });
// 3. Navigation
await page.click('.feature-card[data-analysis="your_analysis"]');
await expect(page.locator('#analysis-area')).toBeVisible();
// 4. Interaction (Handle async UI updates)
await page.selectOption('#var-selector', 'ColumnName');
// 5. Execution
await page.click('#run-btn');
// 6. Assertions
// Check Table
const table = page.locator('#results-table');
await expect(table).toContainText('Expected Value');
// Check Plotly
await expect(page.locator('.js-plotly-plot')).toBeVisible();
});
Debugging Tips
- Console Logs: Always add
page.on('console', ...)to see browser errors in the terminal. - Screenshots: If a test fails ("element not visible"), use
await page.screenshot({ path: 'debug.png' })to see the state. - Timeouts: Initial load and heavy calcs might take time. Increase timeouts if needed (
{ timeout: 30000 }).
Related Skills
Dask
Parallel/distributed computing. Scale pandas/NumPy beyond memory, parallel DataFrames/Arrays, multi-file processing, task graphs, for larger-than-RAM datasets and parallel workflows.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Polars
Fast DataFrame library (Apache Arrow). Select, filter, group_by, joins, lazy evaluation, CSV/Parquet I/O, expression API, for high-performance data analysis workflows.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Dask
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
Anndata
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Matplotlib
Low-level plotting library for full customization. Use when you need fine-grained control over every plot element, creating novel plot types, or integrating with specific scientific workflows. Export to PNG/PDF/SVG for publication. For quick statistical plots use seaborn; for interactive plots use plotly; for publication-ready multi-panel figures with journal styling, use scientific-visualization.
Dashboard Design
USE THIS SKILL FIRST when user wants to create and design a dashboard, ESPECIALLY Vizro dashboards. This skill enforces a 3-step workflow (requirements, layout, visualization) that must be followed before implementation. For implementation and testing, use the dashboard-build skill after completing Steps 1-3.
Writing Effective Prompts
Structure Claude prompts for clarity and better results using roles, explicit instructions, context, positive framing, and strategic organization. Use when crafting prompts for complex tasks, long documents, tool workflows, or code generation.
Flowchart Creator
Create HTML flowcharts and process diagrams with decision trees, color-coded stages, arrows, and swimlanes. Use when users request flowcharts, process diagrams, workflow visualizations, or decision trees.
