Skip to content

Instantly share code, notes, and snippets.

View benmvp's full-sized avatar

Ben Ilegbodu benmvp

View GitHub Profile
@benmvp
benmvp / deliberate-spec-template.md
Created February 25, 2026 18:25
The spec template to go along with the `/deliberate` skill example

Spec Document Template

Use this structure when writing spec documents. Adapt section depth to the complexity of the feature — not every spec needs every section.

Before writing: Read 1-2 existing specs in the target folder to match local conventions (tone, heading depth, use of tables vs prose, code example density).

Structure

# [Feature Name]
@benmvp
benmvp / deliberate-skill.md
Last active February 28, 2026 07:25
An example SKILL.md for a `/deliberate` skill for Claude Code, Cursor, VS Code or any other skill-enabled Agents
name description
deliberate
Structured iterative brainstorming and planning protocol for features, refactors, and technical designs. Use when the user says "brainstorm", "think through", "deliberate", begins describing a task with background context like "I want to... because... so that...", or references an existing spec file for implementation planning. Produces either an implementation plan (Plan Mode), a spec document, or a decision summary.

Deliberate

A structured protocol for iterative planning through brainstorming, critical feedback, and convergence.

Trigger

@benmvp
benmvp / App.js
Created March 30, 2020 18:09
React FUNdamentals, Step 2 - Query Field Exercise
import React, { useState } from 'react'
const App = () => {
const [inputValue, setInputValue] = useState('')
const [isUpper, setIsUpper] = useState(false)
return (
<main>
<h1>Giphy Search!</h1>
@benmvp
benmvp / text.module.scss
Created January 18, 2020 00:02
Trying to figure out how to programmatically generate CSS class names using SASS + CSS Modules + babel-react-css-modules
$colors: ("white": $white, "yellow": $yellow, "green": $green, "blue": $blue);
@each $name, $color in $colors {
// this programmatically generates 4 class namaes in the resultant css.
// but when Babel parses the module to pull out the class names, it just
// gets "bg-color-#${name}" since postcss-scss doesn't compile the SCSS
// (https://github.com/postcss/postcss-scss) when used with babel-react-css-modules
// (https://github.com/gajus/babel-plugin-react-css-modules#configurate-syntax-loaders)
.bg-color-#{$name} {
background-color: #{$color};
@benmvp
benmvp / Text.jsx
Last active January 17, 2020 18:33
Trying to extend my Text component props from the props that come from the specified HTML element using TypeScript generics
import React from 'react'
// React.ElementType from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/8a31a2fe9e8417d47550db09e5f9f50fd09a8e60/types/react/index.d.ts#L67
interface Props<C extends React.ElementType> {
children: React.ReactNode
component?: C;
gutterBottom?: boolean;
className?: string;
style?: CSSProperties;
import {mapValues} from 'lodash';
import {Sdk, SdkConfig} from './types';
import request from './request';
import * as users from './users';
export * from './constants';
const DEFAULT_API_URL = 'https://www.eventbriteapi.com/v3';
@benmvp
benmvp / DummyAddressForm.jsx
Created November 16, 2017 05:32
How can I use enzyme shallow rendering to assert props being passed to TextInput/Label and not helper TopSection/BottomSection?
import React from 'react';
import TextInput from './TextInput';
import Label from './Label';
const TopSection = ({fields: {firstName, lastName}}) => (
<fieldset>
<div>
<Label>First Name</Label>
<TextInput name="firstName" value={firstName} />
// pass the children back to the component to be used
// in the final render
const Enhancer = ({render, children, foo}) => (
<div>{render(foo * 2, children)}</div>
)
// ViewComp uses both `render` & `children` 🙃
const ViewComp = () => (
<Enhancer foo={11} render={(value, children) => (<div>{value} - <span>{children}</span></div>)}>
Here's some children content
@benmvp
benmvp / dual-export-component.jsx
Last active September 25, 2017 21:23
Searching for a similar pattern for render props approach!
// This is what gets tested because it doesn't rely on any of
// the *magic* that may be in `withFoo` like reading context.
// The test just needs to pass in a valid `foo` prop which would've
// come from `withFoo`.
export const MyComponent = ({foo}) => (
<div>{foo}</div>
)
// This what actually gets used in the app!
export default withFoo(MyComponent)
@benmvp
benmvp / hoc.js
Last active August 29, 2017 06:20
Need Dynamic HOC Flow help
const myHOC = <Props: {}>(
Component: React.ComponentType<{}>
): React.ComponentType<Props> (
(props: Props) = {
let handlers = genDynamicAdditionalProps(props.eventName)
// The keys in `additionalProps` are dependent upon `props.eventName` value
// The values in `additionalProps` are all functions
let propsToPassThru = {...props}