Skip to content
Back to skills

Collection

ASecurity

Create D3 questions with +/- button controls and emoji/visual displays. Common for ratio, mixture, and recipe problems where students adjust quantities.

  • 24 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 8, 2026
developmentjavascriptgojavabash

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-cc8a6633/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-cc8a6633)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: Implement Increment Controls Question
description: Create D3 questions with +/- button controls and emoji/visual displays. Common for ratio, mixture, and recipe problems where students adjust quantities.
---

# Implement Increment Controls Question

Use this skill when creating questions where students:
- Adjust quantities using increment/decrement buttons
- See visual feedback (emoji displays, diagrams)
- Explain their reasoning about ratios, mixtures, or recipes

## When to Use This Pattern

**Perfect for:**
- Drink mix ratio problems (🧂 salt, 🥛 water, 🍫 chocolate)
- Recipe scaling questions (🌾 flour, 🥚 eggs, 🧈 butter)
- Part-to-whole ratio explorations
- Comparing quantities/concentrations

**Not suitable for:**
- Questions requiring free-form numeric input → use [implement-table-question](../implement-table-question/SKILL.md)
- Questions with complex graphs → use [implement-graph-question](../implement-graph-question/SKILL.md)
- Drag-and-drop categorization → use [implement-drag-match-question](../implement-drag-match-question/SKILL.md)

## Components Required

**Copy these from** `.claude/skills/question-types/snippets/`:

### Cards (Required)
- `cards/standard-card.js` → `createStandardCard()`

### Cards (Optional)
- `cards/explanation-card.js` → `createExplanationCard()` - For student explanations
- `cards/video-accordion.js` → `createVideoAccordion()` - For help videos

### Form Inputs (Required)
- `form-inputs.js` → Increment/decrement button pattern

## Quick Start

1. **Study the working example**:
   ```bash
   cat courses/IM-8th-Grade/modules/Unit-3/assignments/117-Equivalent-Ratios/questions/01/attachments/chart.js
   ```

2. **Customize the scenario data** (emojis, names, colors, ranges)
3. **Adjust the visualization** (emoji grid or SVG)
4. **Test locally** with `chart.html`

## Working Example

**Reference this codebase file:**
```bash
courses/IM-8th-Grade/modules/Unit-3/assignments/117-Equivalent-Ratios/questions/01/attachments/chart.js
```

This example includes:
- ✅ Scenario constants setup (🥤 drink, 💧 water)
- ✅ State management with default values
- ✅ Increment/decrement controls for 2 items
- ✅ Emoji grid visualization
- ✅ Explanation card
- ✅ Full message protocol
- ✅ Interactivity locking

## Customization Points

### 1. Scenario Data
```javascript
const SCENARIO = {
  item1: { emoji: "🧂", name: "Salt", color: "#FFD700" },
  item2: { emoji: "🥛", name: "Water", color: "#87CEEB" },
  minValue: 0,
  maxValue: 20,
  initialValue1: 2,
  initialValue2: 5
};
```

### 2. State Shape
```javascript
function createDefaultState() {
  return {
    item1Count: SCENARIO.initialValue1,
    item2Count: SCENARIO.initialValue2,
    explanation: ""
  };
}
```

### 3. Visualization Style
- **Emoji grid** (simple, performant) - Most common
- **SVG diagram** (custom shapes) - For more complex visualizations

## Common Variations

### Two-Column Comparison
Display two mixtures side-by-side:
```javascript
const layout = container.append("div")
  .style("display", "grid")
  .style("grid-template-columns", "1fr 1fr")
  .style("gap", "20px");
```

### Fraction/Ratio Display
Show the relationship as a fraction:
```javascript
fractionDiv.append("div").text(numerator);
fractionDiv.append("hr").style("width", "50px");
fractionDiv.append("div").text(denominator);
```

### Range Validation
Disable buttons at limits:
```javascript
.property("disabled", interactivityLocked || count <= MIN)
.style("opacity", count <= MIN ? 0.3 : 1);
```

## Implementation Checklist

- [ ] Copied template to question directory
- [ ] Updated scenario constants (emojis, names, colors, ranges)
- [ ] Customized visualization (emoji grid or SVG)
- [ ] Added explanation card (if needed)
- [ ] Tested increment/decrement at min/max boundaries
- [ ] Verified state restoration with `setInitialState`
- [ ] Tested interactivity locking
- [ ] Checked message payload structure
- [ ] Tested locally with chart.html

## Tips

1. **Keep it simple** - Emoji displays are faster and more accessible than complex SVG
2. **Label clearly** - Tell students what each button controls
3. **Show the ratio** - Display fractions, ratios, or percentages prominently
4. **Add context** - Use intro cards to set up the scenario
5. **Validate ranges** - Always check min/max before updating state

## Related Skills

- [implement-table-question](../implement-table-question/SKILL.md) - For ratio tables
- [implement-slider-question](../implement-slider-question/SKILL.md) - Alternative control style
- [create-d3-question](../../create-d3-question/SKILL.md) - Parent workflow skill

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.