CtrlK
BlogDocsLog inGet started
Tessl Logo

dsa-pattern-practice

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

Quality

92%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

The risk profile of this skill

SKILL.md
Quality
Evals
Security

DSA Pattern Practice

When to Use

  • Interview / learning: classify a pattern · capture a STIC card · generate a starter Java template.
  • Day-to-day code: audit complexity · choose a collection · refactor a nested loop · PR-review for Big-O.

Language-agnostic; Java is the shipped default. Path resolution: references/path-config.md.

Meta-rules (one line each — full text: references/meta-rules.md)

  1. STIC mandatory — Signal / Technique / Invariant / Complexity on every response. Complexity in explicit Big-O notation, never prose.
  2. Reevaluate before output — name a runner-up + 1-line rejection reason.
  3. Cite sources — user notes first, then Tier-2/3/4 priority. URLs by symbolic name from references/url-registry.md — never hardcode.
  4. Scoped outputclassify recommends, doesn't solve; review recognizes, doesn't refactor. User escalates explicitly.
  5. Practice-platform order — follow the 8-platform canonical order in references/meta-rules.md § Practice-platform rule.

Mandatory response structure (every DSA response)

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):

#SectionContent (1 line)
1STICSignal · Technique · Invariant · Complexity in O(...) notation (time + space; amortization called out; best/avg/worst when they differ).
2Code Snippet10–15 line Java skeleton — MANDATORY. Full file at <SKILL_ROOT>/templates/<lang>/<slug>.<ext>.
3CP usageConstraint trigger + contest sites + typical problem shape.
4Day-to-day useConcrete production examples (LRU cache, autocomplete, time-series rolling extrema, …).
5Related CP questionOne LC / CF / CSES / AtCoder / USACO problem at matching difficulty — direct URL required.
6Citation (REQUIRED)One-line Sources: block summarizing Tier-1/2/3/4/4b refs; all URLs by symbolic name.
7Closing 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.

Compact inline example (response shape — Code Snippet section)

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.

Data layout

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>.

Flows (full variant specs: references/flow-details.md)

FlowTriggerWhat 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 validation

After writing, re-read the Invariant. If it could apply to two or more different paradigms unchanged, it's too vague.

  • ❌ "We keep track of the best answer so far." (Kadane, monotonic-stack, greedy, DP all fit.)
  • ✅ "Stack is monotonically decreasing; each index pushed once + popped at most once → amortized O(1)."

If it fails → don't persist; ask the user to articulate the truth claim that justifies correctness.

Reference Index

FileContents
references/path-config.mdPlaceholder resolution + citation-only fallback
references/url-registry.mdSingle source of truth for all external URLs
references/meta-rules.mdFull meta-rules (STIC, citation priority, reevaluation, per-section URL spec, practice-platform order, Citation + closing-question rules)
references/stic-card-schema.mdFull 7-element template + 3 worked examples + field definitions
references/worked-examples.mdComplete end-to-end review-flow example (naive O(N²) → monotonic-stack O(N))
references/flow-details.mdPer-flow variant specs (brief, compare, annotated, refactor-plan, …)
references/paradigm-taxonomy.mdParadigm list with tier / signal / source
references/signal-triggers.md60+ trigger→paradigm rows
references/source-library.mdPer-paradigm book + LC + cp-algorithms + YouTube map + Tier-4 <URL:*> coverage
references/<lang>-idioms.md · references/<lang>-collections-taxonomy.mdPer-language defaults (Java first)
references/study-plans.md · references/library-audit.md · references/pitfalls.mdStudy curricula · audit protocol · STOP-and-ask checklist
templates/<lang>/<slug>.<ext> · attachments/books/refs/INDEX.mdSeed templates · per-book ref extracts

Output style follows <CLAUDE_CONFIG> (default code language: Java; concise, actionable).

Repository
sayed-moin-ahmed/DSA-CLAUDE-CODEX-GEMINI-SKILL
Last updated
Created

Is this your skill?

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.