Rule 9 Strategy: How to Cap Lists at 5 Items in the i-have-adhd Skill

Rule 9 requires splitting any list exceeding five items into two prioritized sections—such as "do now" versus "later" or "must" versus "nice to have"—and ranking items within each section to ensure clarity and reduce cognitive overload.

The i-have-adhd skill uses a structured rule set to keep interactions ADHD-friendly. According to the source code in skills/i-have-adhd/SKILL.md, Rule 9 explicitly caps lists at five items to prevent decision paralysis, stating: "If a list grows past five, split into 'do now' vs 'later', or 'must' vs 'nice to have'. Five items ranked beats ten unranked."

The Three-Step Implementation Strategy

Enforcing the Rule 9 cap involves a concrete three-step workflow that developers can integrate into the skill's response generation logic.

Step 1: Count the Items

Before presenting any list of actions, recommendations, or checks, the system must first count the total entries. This validation acts as the trigger for the capping mechanism.

Step 2: Enforce the Hard Cap

If the count exceeds five, the list must be divided into two distinct sections. As documented in SKILL.md lines 105-108, the preferred bifurcation strategies are:

  • Do now versus Later: Immediate action items versus deferrable tasks.
  • Must versus Nice-to-have: Essential requirements versus optional enhancements.

Step 3: Rank Within Sections

After splitting, items within each section must be ordered by importance. A short, ranked list of five or fewer items provides a clear hierarchy, allowing users to focus on the highest-priority tasks first rather than scanning an unordered, lengthy collection.

TypeScript Implementation Examples

The extensions/i-have-adhd.ts file serves as the primary integration point for these utilities. Below are production-ready functions that enforce Rule 9 programmatically.

Basic List Capping

This helper splits arrays once they exceed the maximum threshold:

/**
 * Split a list of strings into two prioritized groups if it exceeds
 * the maximum allowed items (default = 5).
 *
 * @param items   The original list of items.
 * @param max     Maximum items before splitting (default 5).
 * @param labels  Labels for the two groups.
 * @returns       An object with `primary` and `secondary` arrays.
 */
export function capList(
  items: string[],
  max = 5,
  labels = { primary: "Do now", secondary: "Later" }
): { primary: string[]; secondary: string[] } {
  if (items.length <= max) {
    return { primary: items, secondary: [] };
  }
  // Simple priority: keep the first `max` items as primary,
  // the rest go to secondary.
  const primary = items.slice(0, max);
  const secondary = items.slice(max);
  return { primary, secondary };
}

/* Usage */
const actions = [
  "Run tests",
  "Check lint",
  "Update docs",
  "Refactor utils",
  "Add missing types",
  "Optimize query",
];
const { primary, secondary } = capList(actions);
// → primary: ["Run tests","Check lint","Update docs","Refactor utils","Add missing types"]
// → secondary: ["Optimize query"]

Ranking Before Capping

For dynamic content, sort items by priority before applying the cap:

type RankedItem = { text: string; priority: number };

/**
 * Rank items by a numeric priority (higher = more important),
 * then apply Rule 9 capping.
 */
export function rankAndCap(items: RankedItem[], max = 5) {
  // Sort descending by priority
  const sorted = items.sort((a, b) => b.priority - a.priority);
  const texts = sorted.map((i) => i.text);
  return capList(texts, max);
}

/* Usage */
const recommendations: RankedItem[] = [
  { text: "Add unit tests", priority: 9 },
  { text: "Fix lint errors", priority: 8 },
  { text: "Update README", priority: 5 },
  { text: "Improve error handling", priority: 7 },
  { text: "Document API", priority: 6 },
  { text: "Refactor middleware", priority: 4 },
];
const result = rankAndCap(recommendations);
// → primary: ["Add unit tests","Fix lint errors","Improve error handling","Document API","Update README"]
// → secondary: ["Refactor middleware"]

Key Source Files

Understanding the file structure helps developers locate the rule definitions and integration points:

  • skills/i-have-adhd/SKILL.md — Contains the canonical text of Rule 9 at lines 105-108, including the specific splitting logic and rationale.
  • README.md — Lists all 10 skill rules (including Rule 9) at lines 70-74, providing a quick reference overview.
  • extensions/i-have-adhd.ts — Houses the runtime logic where the capList and rankAndCap helpers should be imported and invoked.

Summary

  • Rule 9 mandates a strict limit of five items per list to minimize cognitive load in the i-have-adhd skill.
  • Splitting strategy involves dividing overflow into "do now/later" or "must/nice-to-have" categories.
  • Ranking ensures the most critical items appear first within each capped section.
  • Implementation relies on TypeScript utilities like capList() and rankAndCap() to enforce these constraints programmatically.

Frequently Asked Questions

What happens if a list has exactly five items?

If a list contains exactly five items, Rule 9 does not require splitting. The threshold triggers only when the count grows past five (six or more), at which point the content must be divided into the prioritized primary and secondary groups.

Can I use different labels than "do now" and "later"?

Yes. While SKILL.md suggests "do now" versus "later" or "must" versus "nice to have" as standard pairings, the rule is flexible on terminology as long as the semantic split remains clear. The capList function accepts custom labels via its labels parameter to accommodate different contexts.

Where is the best place to implement the capping logic in the codebase?

The recommended integration point is extensions/i-have-adhd.ts, which contains the skill’s runtime logic. Import the capList helper there and invoke it on any array of recommendations or actions before sending the response to the user interface.

Does Rule 9 apply to nested lists or only top-level items?

According to the implementation in the source code, the rule applies to any discrete list presented to the user. When dealing with nested structures, apply the cap recursively to each sub-list to maintain the ADHD-friendly constraint of never overwhelming the user with more than five visible items at any given hierarchical level.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →