Use for **any DSA question — interview prep OR day-to-day code work** — algorithm paradigms (BFS, Dijkstra, sliding window, monotonic stack, Union-Find, binary search, backtracking, topological sort, trie, DP), data structures (heap, segment tree, fenwick, trie), Java collection choice (HashMap/TreeMap, ArrayList/LinkedList, ArrayDeque/PriorityQueue, Comparator) while writing production code, graph primitives, complexity analysis, or refactoring existing code for better Big-O. Answers in Signal/Technique/Invariant/Complexity (STIC) card format; persists cards to a user-writable skill-state directory (see references/path-config.md). **Not for software design patterns** — use `design-pattern-practice`. Triggers on "classify this problem", "Java template for X", "shortest path", "HashMap vs TreeMap", "next greater element", "top K elements", "why is this loop slow", "is this O(N²)", "which collection should I use", "optimize this nested loop", "review this for algorithmic complexity".
75
92%
Does it follow best practices?
Impact
—
No eval scenarios have been run
—
The risk profile of this skill
Language-agnostic; Java is the shipped default. Path resolution: references/path-config.md.
references/meta-rules.md)references/url-registry.md — never hardcode.classify recommends, doesn't solve; review recognizes, doesn't refactor. User escalates explicitly.references/meta-rules.md § Practice-platform rule.Every flow (classify, add, template, review) and every casual DSA question emits 5 sections + Citation + closing question, in this order. Each section attaches relevant URLs by symbolic name (full per-section URL spec: references/meta-rules.md § Rule 1; per-paradigm <URL:*> map: references/source-library.md § Tier-4):
| # | Section | Content (1 line) |
|---|---|---|
| 1 | STIC | Signal · Technique · Invariant · Complexity in O(...) notation (time + space; amortization called out; best/avg/worst when they differ). |
| 2 | Code Snippet | 10–15 line Java skeleton — MANDATORY. Full file at <SKILL_ROOT>/templates/<lang>/<slug>.<ext>. |
| 3 | CP usage | Constraint trigger + contest sites + typical problem shape. |
| 4 | Day-to-day use | Concrete production examples (LRU cache, autocomplete, time-series rolling extrema, …). |
| 5 | Related CP question | One LC / CF / CSES / AtCoder / USACO problem at matching difficulty — direct URL required. |
| 6 | Citation (REQUIRED) | One-line Sources: block summarizing Tier-1/2/3/4/4b refs; all URLs by symbolic name. |
| 7 | Closing question (REQUIRED) | Want in-depth details? menu offering (a) book walkthrough · (b) full template + variants · (c) more practice · (d) production case study · (e) sibling techniques. |
Plus: Tier label (must-have | cp-extra | advanced), Tips & Tricks (2–4 mnemonic bullets — MANDATORY), Pitfalls, Related slugs.
The Code Snippet (#2) for next-greater-element — note the 10–15 line bound, ArrayDeque over Stack, and the invariant comment:
int[] nextGreater(int[] a) { // O(N) time, O(N) space
int n = a.length, ans[] = new int[n];
java.util.Arrays.fill(ans, -1);
ArrayDeque<Integer> stk = new ArrayDeque<>(); // indices, values decreasing (invariant)
for (int i = 0; i < n; i++) {
while (!stk.isEmpty() && a[stk.peek()] < a[i]) ans[stk.pop()] = a[i];
stk.push(i);
}
return ans;
}Full worked end-to-end example (input → 7-element response with Citation + closing question): references/worked-examples.md.
Schema + 3 more worked examples (Monotonic Stack · Binary Search on Answer · Sliding Window Variable): references/stic-card-schema.md.
Placeholders resolved per references/path-config.md: <SKILL_ROOT> (read-only) · <SKILL_STATE> (cards/index) · <BOOKS_ROOT> (local PDFs; degrades to citation-only) · <CLAUDE_CONFIG>.
references/flow-details.md)| Flow | Trigger | What it does |
|---|---|---|
classify | "what pattern is this?" | Emit 7-element response for the top paradigm + runner-up + 1-line rejection. Does not solve the user's specific problem. |
add | "make a STIC card for X" | Build response → validate Invariant is paradigm-specific (rule below) → persist to <SKILL_STATE>/problems/<slug>.md, update index.md. |
template | "Java template for X" | Emit full template from <SKILL_ROOT>/templates/<lang>/<slug>.<ext> + the 7-element response. User-refined <SKILL_STATE>/templates/... takes precedence. |
review | "is this O(N²)?" / "why is this slow?" | Derive current Big-O from first principles → identify unrealized paradigm → emit 7-element response for the recommended swap + before/after Big-O. Does not refactor unless asked. |
add flow — strict Invariant validationAfter writing, re-read the Invariant. If it could apply to two or more different paradigms unchanged, it's too vague.
O(1)."If it fails → don't persist; ask the user to articulate the truth claim that justifies correctness.
| File | Contents |
|---|---|
references/path-config.md | Placeholder resolution + citation-only fallback |
references/url-registry.md | Single source of truth for all external URLs |
references/meta-rules.md | Full meta-rules (STIC, citation priority, reevaluation, per-section URL spec, practice-platform order, Citation + closing-question rules) |
references/stic-card-schema.md | Full 7-element template + 3 worked examples + field definitions |
references/worked-examples.md | Complete end-to-end review-flow example (naive O(N²) → monotonic-stack O(N)) |
references/flow-details.md | Per-flow variant specs (brief, compare, annotated, refactor-plan, …) |
references/paradigm-taxonomy.md | Paradigm list with tier / signal / source |
references/signal-triggers.md | 60+ trigger→paradigm rows |
references/source-library.md | Per-paradigm book + LC + cp-algorithms + YouTube map + Tier-4 <URL:*> coverage |
references/<lang>-idioms.md · references/<lang>-collections-taxonomy.md | Per-language defaults (Java first) |
references/study-plans.md · references/library-audit.md · references/pitfalls.md | Study curricula · audit protocol · STOP-and-ask checklist |
templates/<lang>/<slug>.<ext> · attachments/books/refs/INDEX.md | Seed templates · per-book ref extracts |
Output style follows <CLAUDE_CONFIG> (default code language: Java; concise, actionable).
cb69b4c
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.