What ADHD Does
Coding agents often anchor on the first plausible answer, missing better alternatives. ADHD is a drop-in skill that forces broad ideation before convergence. It uses a two-phase process:
- Diverge: Multiple independent branches generate ideas in parallel, each using a different cognitive frame (e.g., hardware engineer, regulator, speedrunner). Branches do not share context, preventing anchoring.
- Focus: A separate pass scores all ideas on novelty, viability, and fit, identifies traps, clusters ideas, and deepens the top-K survivors.
The output is a structured analysis: a shortlist, a non-obvious-but-viable pick, a trap list, deepened sketches with risks and next steps, and a provocation. ADHD is designed for open-ended design tasks like architecture, naming, refactoring, and debugging hypotheses.
Installation
Install ADHD with one command: npx skills add UditAkhourii/adhd.
This auto-detects your agent (Claude Code, Cursor, etc.) and adds the skill.
For manual installation, download SKILL.md from the repository and place it in your agent's skills directory.
For Claude Code, use ~/.claude/skills/adhd/SKILL.md; for Cursor, append to .cursorrules.
To use ADHD as a CLI: npm install -g adhd-agent then run adhd "your problem".
As a library: npm install adhd-agent and import run.
Programmatic setup with the Claude Agent SDK appends the skill to the system prompt.
See the repository for details.
Usage
CLI examples:
adhd "design a rate limiter that survives a leader election"adhd "name this function" --frames 3 --ideas 8 --top 2adhd "..." --json > result.json
Library usage: Import run from adhd-agent and call with options like problem, framesPerRun, topK.
The returned object contains shortlist, nonObviousPick, traps, and deepened sketches.
Embedding: Call run() at decision points in an agent loop to widen the hypothesis space when stuck or facing high uncertainty.
Evals: Run npm run evals to compare ADHD against a baseline on open-ended problems.
import { run, renderText } from "adhd-agent"; const result = await run({ problem: "How should we shard this queue under bursty load?", context: readFileSync("./queue.ts", "utf8"), framesPerRun: 6, ideasPerFrame: 8, topK: 3, onEvent: (e) => console.error(e), }); console.log(renderText(result)); // result.shortlist, result.nonObviousPick, result.traps, result.deepened
Configuration and Options
| Flag | Default | Description |
|---|---|---|
--frames N | 5 | Parallel divergence branches |
--ideas N | 6 | Ideas per branch |
--top N | 3 | Ideas to deepen after scoring |
--concurrency N | 4 | Max parallel LLM calls |
--context PATH | — | Inject file as context |
--model NAME | SDK default | Override model |
--no-code-mode | — | Disable engineering bias |
--json | — | Output machine-readable JSON |
--quiet | — | Suppress progress events |
The library API mirrors these options in RunOptions.
Custom cognitive frames can be added by editing src/frames.ts — each frame is a short vantage prompt with tags.
Built-in frames include hardware engineer, regulator, speedrunner, ant colony, and more.
Constraints and Best Practices
Cost & latency: A default run involves ~10 LLM calls and takes 30–90 seconds. Use at decision points, not real-time loops.
Not suitable for: Lookup questions, known bug fixes, or problems with a single correct answer.
Best practices:
- Invoke ADHD when a senior engineer would pause to think differently.
- Keep
codeMode: true(default) for engineering tasks. - Inject relevant context via
--contextor thecontextoption. - Treat output as raw material; feed deepened sketches into downstream agents.
- Modify frames to fit your domain for recurring use.
- Frame the cost: a few cents and a minute vs. a wrong architecture decision.
Notable Procedures
Adding an eval problem: Add a 4-line entry to bench/problems.json and run npm run evals.
Manual skill installation: Download SKILL.md and place it in your agent's skills directory.
For Claude Code: ~/.claude/skills/adhd/SKILL.md.
For Cursor: append to .cursorrules.
For other agents, paste the body into the system prompt.
Global install: Use npx skills add UditAkhourii/adhd -g to make the skill available in every project.
Programmatic agent setup: Use the Claude Agent SDK to append the skill to the system prompt. See the code snippet below.
import { query } from "@anthropic-ai/claude-agent-sdk"; import { readFileSync } from "node:fs"; const skill = readFileSync("./skills/adhd/SKILL.md", "utf8"); for await (const m of query({ prompt: "design a retry strategy for a CLI whose LLM hangs for 90s", options: { systemPrompt: { type: "preset", preset: "claude_code", append: skill }, allowedTools: ["Task"], }, })) { // … }



