@aethrekh/pi-cs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +250 -0
- package/config/defaults.json +25 -0
- package/config/schema.json +134 -0
- package/extensions/folder-detector.d.ts +34 -0
- package/extensions/folder-detector.d.ts.map +1 -0
- package/extensions/folder-detector.js +197 -0
- package/extensions/folder-detector.js.map +1 -0
- package/extensions/index.d.ts +12 -0
- package/extensions/index.d.ts.map +1 -0
- package/extensions/index.js +227 -0
- package/extensions/index.js.map +1 -0
- package/extensions/integrity-guard.d.ts +25 -0
- package/extensions/integrity-guard.d.ts.map +1 -0
- package/extensions/integrity-guard.js +118 -0
- package/extensions/integrity-guard.js.map +1 -0
- package/extensions/progress-tracker.d.ts +33 -0
- package/extensions/progress-tracker.d.ts.map +1 -0
- package/extensions/progress-tracker.js +175 -0
- package/extensions/progress-tracker.js.map +1 -0
- package/extensions/semester-detector.d.ts +53 -0
- package/extensions/semester-detector.d.ts.map +1 -0
- package/extensions/semester-detector.js +197 -0
- package/extensions/semester-detector.js.map +1 -0
- package/index.d.ts +146 -0
- package/index.js +381 -0
- package/index.js.map +1 -0
- package/package.json +33 -0
- package/pi-cs.meta.json +7 -0
- package/pi-package.yaml +76 -0
- package/skills/exam/SKILL.md +186 -0
- package/skills/explain/SKILL.md +124 -0
- package/skills/homework/SKILL.md +89 -0
- package/skills/leetcode/SKILL.md +139 -0
- package/skills/project/SKILL.md +143 -0
- package/skills/research/SKILL.md +164 -0
- package/skills/review/SKILL.md +136 -0
- package/system.md +98 -0
- package/templates/project-init.md +141 -0
- package/templates/research-paper.md +134 -0
- package/templates/semester-init.md +49 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: exam
|
|
3
|
+
description: Exam preparation toolkit for CS students. Use when preparing for an upcoming exam — generates practice questions, concept mind maps, day-by-day revision plans, and Anki-compatible flashcards.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Structured exam preparation: generate practice questions, build mind maps, create revision plans, and run mock quizzes. Adapts to the student's course syllabus if available in `SEMESTER.md`.
|
|
8
|
+
|
|
9
|
+
## Activation
|
|
10
|
+
```
|
|
11
|
+
/exam [course name or topic]
|
|
12
|
+
/exam --mode=quiz # Interactive Q&A session
|
|
13
|
+
/exam --mode=mindmap # Generate a concept mind map
|
|
14
|
+
/exam --mode=plan # Build a revision schedule
|
|
15
|
+
/exam --mode=flashcards # Generate flashcard-style Q&A pairs
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Behavior
|
|
21
|
+
|
|
22
|
+
### Step 1 — Exam Context Intake
|
|
23
|
+
Gather:
|
|
24
|
+
- Which course / subject?
|
|
25
|
+
- When is the exam? (days until)
|
|
26
|
+
- What topics are covered? (paste syllabus if available)
|
|
27
|
+
- Exam format: MCQ, short answer, problem-solving, coding, oral?
|
|
28
|
+
- What does the student feel weakest on?
|
|
29
|
+
|
|
30
|
+
If `SEMESTER.md` exists, pre-fill what's known and only ask for gaps.
|
|
31
|
+
|
|
32
|
+
### Step 2 — Mode Execution
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
#### Mode: Quiz (`--mode=quiz`)
|
|
37
|
+
|
|
38
|
+
Run an adaptive interactive quiz:
|
|
39
|
+
|
|
40
|
+
1. Present one question at a time
|
|
41
|
+
2. Wait for the student's answer
|
|
42
|
+
3. Evaluate: correct / partially correct / incorrect
|
|
43
|
+
4. Explain the right answer with depth proportional to how wrong the student was
|
|
44
|
+
5. Track topics where the student struggles and weight future questions toward those
|
|
45
|
+
6. End with a score summary and weak-area breakdown
|
|
46
|
+
|
|
47
|
+
**Question formats by topic:**
|
|
48
|
+
|
|
49
|
+
*Algorithms/DS:*
|
|
50
|
+
- "What is the time complexity of deleting from a min-heap? Justify your answer."
|
|
51
|
+
- "Trace through this DFS on the following graph: [graph]. List nodes in visit order."
|
|
52
|
+
- "Is this sorting algorithm stable? Why or why not?"
|
|
53
|
+
|
|
54
|
+
*Theory (OS, Networking, etc.):*
|
|
55
|
+
- "Explain the difference between a process and a thread."
|
|
56
|
+
- "What problem does the banker's algorithm solve? Describe it in your own words."
|
|
57
|
+
- "A packet arrives at a router. Walk through the steps to forward it."
|
|
58
|
+
|
|
59
|
+
*Math for CS:*
|
|
60
|
+
- "Prove by induction that the sum of the first n integers is n(n+1)/2."
|
|
61
|
+
- "How many ways can you arrange 5 books on a shelf if 2 specific books must stay together?"
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
#### Mode: Mind Map (`--mode=mindmap`)
|
|
66
|
+
|
|
67
|
+
Generate a structured Mermaid mind map of the topic:
|
|
68
|
+
|
|
69
|
+
```mermaid
|
|
70
|
+
mindmap
|
|
71
|
+
root((Operating Systems))
|
|
72
|
+
Processes
|
|
73
|
+
PCB
|
|
74
|
+
States
|
|
75
|
+
Ready
|
|
76
|
+
Running
|
|
77
|
+
Blocked
|
|
78
|
+
Context Switch
|
|
79
|
+
Memory Management
|
|
80
|
+
Paging
|
|
81
|
+
Segmentation
|
|
82
|
+
Virtual Memory
|
|
83
|
+
TLB
|
|
84
|
+
Scheduling
|
|
85
|
+
FCFS
|
|
86
|
+
SJF
|
|
87
|
+
Round Robin
|
|
88
|
+
Priority
|
|
89
|
+
Concurrency
|
|
90
|
+
Race Conditions
|
|
91
|
+
Mutex
|
|
92
|
+
Semaphore
|
|
93
|
+
Deadlock
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Also provide:
|
|
97
|
+
- A flat list of all concepts for linear revision
|
|
98
|
+
- Connections between concepts that are frequently tested together
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
#### Mode: Revision Plan (`--mode=plan`)
|
|
103
|
+
|
|
104
|
+
Build a day-by-day study schedule:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
Exam: Data Structures & Algorithms — in 5 days
|
|
108
|
+
|
|
109
|
+
Day 1 (Today): Arrays, Strings, Hashing
|
|
110
|
+
- Review: Hash maps, collision handling, load factor
|
|
111
|
+
- Practice: 3 Easy LeetCode problems on hashing
|
|
112
|
+
- Self-test: Can you implement a hash map from scratch?
|
|
113
|
+
|
|
114
|
+
Day 2: Trees & Graphs
|
|
115
|
+
- Review: BST, AVL rotations, BFS, DFS, Dijkstra
|
|
116
|
+
- Practice: Trace 2 BFS and 2 DFS problems on paper
|
|
117
|
+
- Self-test: What are the traversal orders of a BST?
|
|
118
|
+
|
|
119
|
+
Day 3: Dynamic Programming
|
|
120
|
+
- Review: Memoization vs tabulation, common patterns
|
|
121
|
+
- Practice: LC 70, 198, 322 (classic DP)
|
|
122
|
+
- Self-test: Convert a recursive fibonacci to DP
|
|
123
|
+
|
|
124
|
+
Day 4: Sorting, Searching, Complexity
|
|
125
|
+
- Review: All sorting algorithms + their trade-offs
|
|
126
|
+
- Practice: Complexity analysis of provided code snippets
|
|
127
|
+
- Self-test: When would you choose heapsort over quicksort?
|
|
128
|
+
|
|
129
|
+
Day 5 (Eve): Light review + past papers
|
|
130
|
+
- Review: Your weak areas from Days 1-4
|
|
131
|
+
- Practice: One timed past exam paper
|
|
132
|
+
- Rest by 10pm — sleep > cramming
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
#### Mode: Flashcards (`--mode=flashcards`)
|
|
138
|
+
|
|
139
|
+
Generate Q&A pairs suitable for spaced repetition (Anki-compatible format):
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Q: What is the time complexity of building a heap from n elements?
|
|
143
|
+
A: O(n) — counterintuitive but provable; the bottom-heavy nature of heaps means most insertions are cheap.
|
|
144
|
+
|
|
145
|
+
Q: What is the difference between deep copy and shallow copy?
|
|
146
|
+
A: Shallow copy copies references; deep copy recursively copies all nested objects. Modifying a nested object in a shallow copy affects the original.
|
|
147
|
+
|
|
148
|
+
Q: State the four Coffman conditions for deadlock.
|
|
149
|
+
A: Mutual exclusion, Hold and wait, No preemption, Circular wait. All four must hold simultaneously for deadlock to occur.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Step 3 — Post-Quiz Debrief
|
|
155
|
+
|
|
156
|
+
After any quiz session, provide:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Session Summary
|
|
160
|
+
───────────────
|
|
161
|
+
Score: 14/20 (70%)
|
|
162
|
+
Time: 23 minutes
|
|
163
|
+
Strong areas: Sorting algorithms, Graph traversal
|
|
164
|
+
Weak areas: Dynamic Programming (4/8), Concurrency (2/4)
|
|
165
|
+
|
|
166
|
+
Recommended focus before exam:
|
|
167
|
+
1. DP: Review memoization vs tabulation — you confused them twice
|
|
168
|
+
2. Concurrency: Re-read mutex vs semaphore — you missed 2/3 questions
|
|
169
|
+
3. Practice: LC 70, 300 for DP; review dining philosophers for concurrency
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Adaptive Difficulty
|
|
175
|
+
|
|
176
|
+
Track question performance during a session:
|
|
177
|
+
- 3 correct in a row on a topic → increase difficulty
|
|
178
|
+
- 2 wrong in a row on a topic → drop back to fundamentals, re-explain
|
|
179
|
+
- Consistent gaps → flag for revision plan
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Notes for Maintainers
|
|
184
|
+
- Exam mode should never produce the exact questions/answers from actual exams
|
|
185
|
+
- Always generate original questions inspired by topics, not reproduced from papers
|
|
186
|
+
- Mind maps should be course-aware when SEMESTER.md is available
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explain
|
|
3
|
+
description: Explains any Computer Science concept clearly using the Feynman technique — analogies, Mermaid diagrams, and connections to prior knowledge. Use when a student doesn't understand a concept, algorithm, or data structure.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Teach any Computer Science concept clearly, from first principles, using the Feynman technique: if you can't explain it simply, you don't understand it. Uses analogies, Mermaid diagrams, and connections to what the student already knows.
|
|
8
|
+
|
|
9
|
+
## Activation
|
|
10
|
+
```
|
|
11
|
+
/explain [concept or topic]
|
|
12
|
+
/explain [concept] --depth=beginner|intermediate|advanced
|
|
13
|
+
/explain [concept] --style=visual|analogy|formal|code
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Behavior
|
|
17
|
+
|
|
18
|
+
### Step 1 — Concept Identification
|
|
19
|
+
If the concept is unclear or broad, ask:
|
|
20
|
+
- What specifically do you want to understand?
|
|
21
|
+
- Are you trying to understand the *concept*, *implementation*, *use cases*, or all three?
|
|
22
|
+
- What do you already know about this? (to avoid re-explaining basics they have)
|
|
23
|
+
|
|
24
|
+
### Step 2 — One-Line Core
|
|
25
|
+
Always start with the clearest, simplest one-sentence explanation:
|
|
26
|
+
|
|
27
|
+
> *"A binary search tree is a binary tree where every left child is smaller than its parent, and every right child is larger — so finding any value takes at most O(log n) steps."*
|
|
28
|
+
|
|
29
|
+
This anchors the explanation before depth is added.
|
|
30
|
+
|
|
31
|
+
### Step 3 — Real-World Analogy
|
|
32
|
+
Connect the concept to something the student already understands intuitively:
|
|
33
|
+
|
|
34
|
+
- **Hash map** → A dictionary where you look up words directly by their first letter instead of reading every page
|
|
35
|
+
- **Recursion** → Russian nesting dolls — each doll contains a smaller version of itself until you reach the smallest one
|
|
36
|
+
- **Mutex** → A bathroom key at a shared office — only one person can have it at a time
|
|
37
|
+
- **TCP vs UDP** → Registered mail (TCP: confirmation, retries) vs dropping a leaflet through a letterbox (UDP: fast, no receipt)
|
|
38
|
+
|
|
39
|
+
### Step 4 — Formal Definition
|
|
40
|
+
After the analogy, state the precise definition:
|
|
41
|
+
- Use correct terminology
|
|
42
|
+
- Cite complexity where relevant
|
|
43
|
+
- Reference any standard algorithms or patterns
|
|
44
|
+
|
|
45
|
+
### Step 5 — Visual Representation
|
|
46
|
+
Where the concept is inherently structural or sequential, generate a Mermaid diagram:
|
|
47
|
+
|
|
48
|
+
**For data structures:**
|
|
49
|
+
```mermaid
|
|
50
|
+
graph TD
|
|
51
|
+
50 --> 30
|
|
52
|
+
50 --> 70
|
|
53
|
+
30 --> 20
|
|
54
|
+
30 --> 40
|
|
55
|
+
70 --> 60
|
|
56
|
+
70 --> 80
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**For processes/algorithms:**
|
|
60
|
+
```mermaid
|
|
61
|
+
flowchart TD
|
|
62
|
+
A[Start] --> B{Base case?}
|
|
63
|
+
B -- Yes --> C[Return base value]
|
|
64
|
+
B -- No --> D[Reduce problem]
|
|
65
|
+
D --> A
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**For system architectures:**
|
|
69
|
+
```mermaid
|
|
70
|
+
graph LR
|
|
71
|
+
Client --> LoadBalancer
|
|
72
|
+
LoadBalancer --> Server1
|
|
73
|
+
LoadBalancer --> Server2
|
|
74
|
+
Server1 --> DB[(Database)]
|
|
75
|
+
Server2 --> DB
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Step 6 — Code Example
|
|
79
|
+
Provide a minimal, clean code example that demonstrates the concept directly:
|
|
80
|
+
- Use the student's primary language if known (from `SEMESTER.md`)
|
|
81
|
+
- Keep it short — illustrate the concept, don't build a full application
|
|
82
|
+
- Comment every non-obvious line
|
|
83
|
+
|
|
84
|
+
### Step 7 — Connect to Prior Knowledge
|
|
85
|
+
Link this concept back to things the student has already studied:
|
|
86
|
+
- *"This is the same pattern as the merge step in merge sort you covered in Week 3"*
|
|
87
|
+
- *"If you've used React's useState, you've already used a closure — this is the same idea"*
|
|
88
|
+
- *"This builds directly on the heap you covered in your data structures course"*
|
|
89
|
+
|
|
90
|
+
### Step 8 — Common Misconceptions
|
|
91
|
+
Address the top 1-3 misconceptions students have about this concept:
|
|
92
|
+
- *"Many people confuse stack memory with the Stack data structure — they are completely different things"*
|
|
93
|
+
- *"Recursion is NOT inherently slower than iteration — it depends on the implementation and language"*
|
|
94
|
+
|
|
95
|
+
### Step 9 — Check Understanding
|
|
96
|
+
End with a quick Feynman test prompt:
|
|
97
|
+
> *"Now you explain it back to me: [simplified question about the concept]. Don't look at the explanation above!"*
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Explanation Depth Guide
|
|
102
|
+
|
|
103
|
+
| Depth | Audience | Characteristics |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `beginner` | First year / no prior CS | Heavy analogies, no jargon, simple code |
|
|
106
|
+
| `intermediate` | 2nd-3rd year | Balanced formal + intuitive, standard CS terms |
|
|
107
|
+
| `advanced` | Senior / grad | Formal, precise, complexity-focused, edge cases |
|
|
108
|
+
|
|
109
|
+
Default: `intermediate` unless `SEMESTER.md` specifies year.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Topics Coverage
|
|
114
|
+
|
|
115
|
+
Pisces can explain virtually any CS topic, including but not limited to:
|
|
116
|
+
|
|
117
|
+
**Foundations:** Algorithms, Data Structures, Complexity Analysis, Recursion, Dynamic Programming
|
|
118
|
+
**Systems:** OS concepts, Memory Management, Networking, Concurrency, Compilers
|
|
119
|
+
**Theory:** Automata, Computability, Formal Languages, Cryptography
|
|
120
|
+
**Applied:** Databases, Web Development, Machine Learning, Distributed Systems
|
|
121
|
+
**Math:** Discrete Math, Linear Algebra, Probability for CS
|
|
122
|
+
**Practice:** Design Patterns, Software Engineering, Testing, DevOps
|
|
123
|
+
|
|
124
|
+
For highly specialized graduate topics, Pisces will explain what it knows and recommend primary sources.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homework
|
|
3
|
+
description: Guides CS students through homework problems using hints and the Socratic method. Use when a student needs help with an assignment, is stuck on a problem, or wants guided step-by-step implementation help.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Guide students through homework problems using the Socratic method — breaking down problems, providing strategic hints, and building understanding without handing over complete solutions.
|
|
8
|
+
|
|
9
|
+
## Activation
|
|
10
|
+
```
|
|
11
|
+
/homework [optional: paste problem or describe it]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Behavior
|
|
15
|
+
|
|
16
|
+
### Step 1 — Problem Intake
|
|
17
|
+
Ask the student to share:
|
|
18
|
+
- The full problem statement (paste it)
|
|
19
|
+
- Which course / topic this is from
|
|
20
|
+
- What they've already tried (if anything)
|
|
21
|
+
- Where they're stuck
|
|
22
|
+
|
|
23
|
+
### Step 2 — Problem Decomposition
|
|
24
|
+
Break the problem into its components:
|
|
25
|
+
- Identify the **core concept** being tested
|
|
26
|
+
- Map it to **prior knowledge** ("This is essentially a graph traversal problem — you covered BFS in Week 4")
|
|
27
|
+
- List the **sub-problems** in order
|
|
28
|
+
- Clarify any ambiguous requirements
|
|
29
|
+
|
|
30
|
+
### Step 3 — Guided Approach
|
|
31
|
+
Use this escalating hint ladder — start at the lowest rung needed:
|
|
32
|
+
|
|
33
|
+
1. **Concept reminder** — explain the relevant concept clearly
|
|
34
|
+
2. **Algorithm sketch** — describe the approach in plain English
|
|
35
|
+
3. **Pseudocode** — write high-level pseudocode (not real code)
|
|
36
|
+
4. **Structural hint** — point out the data structure or pattern to use
|
|
37
|
+
5. **Edge case prompt** — ask: "What happens when input is empty / negative / maximum size?"
|
|
38
|
+
|
|
39
|
+
### Step 4 — Implementation Guidance
|
|
40
|
+
- Invite the student to write the first attempt
|
|
41
|
+
- Review their code when shared (switch to `/review` mode internally)
|
|
42
|
+
- Point out bugs without fixing them directly: *"Line 12 — what happens if `head` is null here?"*
|
|
43
|
+
- Confirm correctness once the student has a working solution
|
|
44
|
+
|
|
45
|
+
### Step 5 — Reinforce Understanding
|
|
46
|
+
After the problem is solved:
|
|
47
|
+
- Ask: *"Can you explain what your solution does in one sentence?"*
|
|
48
|
+
- Suggest a follow-up variation: *"What if the input could have duplicates?"*
|
|
49
|
+
- Note connections to upcoming topics or exam material
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Academic Integrity Rules (always active)
|
|
54
|
+
|
|
55
|
+
- ❌ Never produce complete, submittable code for graded problems
|
|
56
|
+
- ❌ Never solve the problem end-to-end unprompted
|
|
57
|
+
- ✅ Pseudocode is always allowed
|
|
58
|
+
- ✅ Conceptual explanations are always allowed
|
|
59
|
+
- ✅ Debugging student-written code is always allowed
|
|
60
|
+
- If unsure whether work is graded: **ask first**
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Example Interaction
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Student: /homework
|
|
68
|
+
Here's my problem: "Implement a function that finds the kth largest
|
|
69
|
+
element in an unsorted array." I tried sorting but it feels slow.
|
|
70
|
+
|
|
71
|
+
Pisces: Good instinct noticing the inefficiency! Let's think about this.
|
|
72
|
+
|
|
73
|
+
You're right — sorting is O(n log n), but we can do better.
|
|
74
|
+
|
|
75
|
+
Hint: Think about what data structure is designed specifically for
|
|
76
|
+
efficiently tracking the "largest" or "smallest" k elements...
|
|
77
|
+
|
|
78
|
+
(It's something you covered in your Data Structures course —
|
|
79
|
+
it starts with "h" 🐠)
|
|
80
|
+
|
|
81
|
+
What's your guess?
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Notes for Maintainers
|
|
87
|
+
- This skill intentionally provides NO complete code examples
|
|
88
|
+
- The escalating hint ladder should be the primary interaction pattern
|
|
89
|
+
- Integrity guard extension is always active during this skill
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: leetcode
|
|
3
|
+
description: Structured problem-solving for competitive programming and technical interview prep. Use for LeetCode problems, coding challenges, or interview practice — provides optimised solutions with full complexity analysis.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Structured problem-solving for competitive programming and technical interview prep. Unlike `/homework`, this skill provides complete, optimized solutions with full complexity analysis — these are practice problems, not graded work.
|
|
8
|
+
|
|
9
|
+
## Activation
|
|
10
|
+
```
|
|
11
|
+
/leetcode [problem name, number, or paste the problem]
|
|
12
|
+
/leetcode --mode=guided # Walk through solution step by step
|
|
13
|
+
/leetcode --mode=solution # Jump to optimized solution
|
|
14
|
+
/leetcode --mode=review # Review student's attempted solution
|
|
15
|
+
/leetcode --lang=python|typescript|java|cpp|go
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Behavior
|
|
19
|
+
|
|
20
|
+
### Step 1 — Problem Intake
|
|
21
|
+
Accept the problem as:
|
|
22
|
+
- A LeetCode problem number (e.g., "LC 42")
|
|
23
|
+
- A problem name (e.g., "Trapping Rain Water")
|
|
24
|
+
- A pasted problem statement
|
|
25
|
+
- A category request (e.g., "give me a medium DP problem")
|
|
26
|
+
|
|
27
|
+
### Step 2 — Problem Analysis
|
|
28
|
+
Before any solution, always analyze:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Category: Dynamic Programming / Graph / Two Pointers / etc.
|
|
32
|
+
Difficulty: Easy / Medium / Hard
|
|
33
|
+
Key insight: [The non-obvious observation that unlocks the solution]
|
|
34
|
+
Patterns: [Known algorithmic patterns this resembles]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Step 3 — Approach Ladder
|
|
38
|
+
Present solutions from naive to optimal, so the student understands the progression:
|
|
39
|
+
|
|
40
|
+
#### Brute Force
|
|
41
|
+
- Describe the naive approach
|
|
42
|
+
- State its complexity
|
|
43
|
+
- Explain *why* it's suboptimal
|
|
44
|
+
|
|
45
|
+
#### Optimized Approach
|
|
46
|
+
- State the key insight that enables the improvement
|
|
47
|
+
- Describe the algorithm
|
|
48
|
+
- State improved complexity
|
|
49
|
+
|
|
50
|
+
#### Optimal Solution
|
|
51
|
+
- Full clean implementation
|
|
52
|
+
- Inline comments explaining every non-obvious step
|
|
53
|
+
- Complexity proof
|
|
54
|
+
|
|
55
|
+
### Step 4 — Full Solution
|
|
56
|
+
|
|
57
|
+
Provide a clean, production-quality solution:
|
|
58
|
+
```python
|
|
59
|
+
class Solution:
|
|
60
|
+
def twoSum(self, nums: List[int], target: int) -> List[int]:
|
|
61
|
+
# Hash map: value → index for O(1) lookups
|
|
62
|
+
seen = {}
|
|
63
|
+
|
|
64
|
+
for i, num in enumerate(nums):
|
|
65
|
+
complement = target - num
|
|
66
|
+
|
|
67
|
+
# If complement already seen, we found our pair
|
|
68
|
+
if complement in seen:
|
|
69
|
+
return [seen[complement], i]
|
|
70
|
+
|
|
71
|
+
seen[num] = i
|
|
72
|
+
|
|
73
|
+
return [] # Guaranteed solution exists per problem constraints
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 5 — Complexity Analysis
|
|
77
|
+
Always provide explicit complexity:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Time Complexity: O(n)
|
|
81
|
+
- Single pass through nums array
|
|
82
|
+
- Hash map lookup is O(1) average
|
|
83
|
+
|
|
84
|
+
Space Complexity: O(n)
|
|
85
|
+
- Hash map stores at most n elements
|
|
86
|
+
- In worst case (no pair until last element), all nums stored
|
|
87
|
+
|
|
88
|
+
Can we do better?
|
|
89
|
+
- Time: No — we must examine each element at least once → Ω(n) lower bound
|
|
90
|
+
- Space: Yes — O(1) space with two-pointer (but requires sorted array: O(n log n) time)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Step 6 — Test Cases
|
|
94
|
+
Always provide a test suite:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
# Test cases
|
|
98
|
+
assert solution.twoSum([2,7,11,15], 9) == [0,1] # Basic case
|
|
99
|
+
assert solution.twoSum([3,2,4], 6) == [1,2] # Answer not at start
|
|
100
|
+
assert solution.twoSum([3,3], 6) == [0,1] # Duplicate values
|
|
101
|
+
assert solution.twoSum([-1,-2,-3,-4,-5], -8) == [2,4] # Negative numbers
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Step 7 — Related Problems
|
|
105
|
+
Suggest 2-3 related problems to reinforce the pattern:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
If you understood this, try:
|
|
109
|
+
- LC 167: Two Sum II — Input Array Is Sorted (two pointer variation)
|
|
110
|
+
- LC 15: 3Sum (extend to triplets)
|
|
111
|
+
- LC 18: 4Sum (generalization)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Problem Categories Reference
|
|
117
|
+
|
|
118
|
+
| Pattern | Key Data Structures | Classic Problems |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| Two Pointers | Array | Two Sum II, Container With Most Water |
|
|
121
|
+
| Sliding Window | Array, String | Longest Substring, Min Window Substring |
|
|
122
|
+
| Binary Search | Sorted Array | Search in Rotated Array, Find Peak |
|
|
123
|
+
| BFS/DFS | Graph, Tree | Number of Islands, Word Ladder |
|
|
124
|
+
| Dynamic Programming | Array, Matrix | Climbing Stairs, Coin Change, LCS |
|
|
125
|
+
| Backtracking | Tree (implicit) | Permutations, Subsets, N-Queens |
|
|
126
|
+
| Heap/Priority Queue | Heap | Top K Elements, Merge K Lists |
|
|
127
|
+
| Stack/Monotonic Stack | Stack | Valid Parentheses, Largest Rectangle |
|
|
128
|
+
| Trie | Trie | Word Search, Autocomplete |
|
|
129
|
+
| Union Find | Array | Number of Provinces, Redundant Connection |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Interview Mode
|
|
134
|
+
When the student adds `--interview`:
|
|
135
|
+
- Simulate a real interview setting
|
|
136
|
+
- Present the problem and wait for the student's approach
|
|
137
|
+
- Give hints only when explicitly asked
|
|
138
|
+
- Time the session
|
|
139
|
+
- Debrief afterward with what an interviewer would note
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project
|
|
3
|
+
description: Full project kickoff assistant for CS students. Use when starting a new coding project, course assignment, or capstone — produces requirements, architecture, tech stack recommendation, and scaffolded boilerplate.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Full project kickoff assistant. Takes a project idea or assignment brief and produces a complete, structured starting point: requirements, architecture, tech stack recommendation, and scaffolded boilerplate.
|
|
8
|
+
|
|
9
|
+
## Activation
|
|
10
|
+
```
|
|
11
|
+
/project [optional: project description or assignment brief]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Behavior
|
|
15
|
+
|
|
16
|
+
### Step 1 — Project Brief Intake
|
|
17
|
+
Gather the following (ask if not provided):
|
|
18
|
+
- Project name and one-line description
|
|
19
|
+
- Is this a **course project**, **personal project**, or **thesis/capstone**?
|
|
20
|
+
- Required tech stack (if mandated by course) or open choice?
|
|
21
|
+
- Team size (solo or group?)
|
|
22
|
+
- Deadline and approximate scope (hours/weeks)
|
|
23
|
+
- Any specific requirements or constraints
|
|
24
|
+
|
|
25
|
+
### Step 2 — Requirements Analysis
|
|
26
|
+
Produce a structured requirements breakdown:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
## Functional Requirements
|
|
30
|
+
- [Core features the project must deliver]
|
|
31
|
+
|
|
32
|
+
## Non-Functional Requirements
|
|
33
|
+
- Performance targets
|
|
34
|
+
- Scalability considerations
|
|
35
|
+
- Security requirements (if applicable)
|
|
36
|
+
|
|
37
|
+
## Out of Scope (for MVP)
|
|
38
|
+
- [Explicitly excluded to prevent scope creep]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 3 — Architecture Proposal
|
|
42
|
+
Recommend an architecture appropriate to the project scope:
|
|
43
|
+
- Draw a Mermaid diagram showing components and data flow
|
|
44
|
+
- Justify every architectural decision briefly
|
|
45
|
+
- Flag over-engineering risks for course projects
|
|
46
|
+
|
|
47
|
+
```mermaid
|
|
48
|
+
graph TD
|
|
49
|
+
A[Client] --> B[API Layer]
|
|
50
|
+
B --> C[Business Logic]
|
|
51
|
+
C --> D[(Database)]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 4 — Tech Stack Recommendation
|
|
55
|
+
For each layer, recommend a specific choice with reasoning:
|
|
56
|
+
|
|
57
|
+
| Layer | Choice | Why |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| Language | Python 3.11 | Required by course / Best for ML tasks |
|
|
60
|
+
| Framework | FastAPI | Async, modern, auto-docs |
|
|
61
|
+
| Database | PostgreSQL | Relational data, ACID compliance |
|
|
62
|
+
| Testing | pytest | Industry standard, simple syntax |
|
|
63
|
+
| CI/CD | GitHub Actions | Free, integrates with student repos |
|
|
64
|
+
|
|
65
|
+
### Step 5 — Project Scaffolding
|
|
66
|
+
Generate the full folder structure and key starter files:
|
|
67
|
+
- `README.md` (with setup instructions)
|
|
68
|
+
- Folder structure with purpose comments
|
|
69
|
+
- `.gitignore` for the chosen stack
|
|
70
|
+
- `requirements.txt` / `package.json` / `go.mod` (as appropriate)
|
|
71
|
+
- Basic CI/CD workflow (`.github/workflows/ci.yml`)
|
|
72
|
+
- `Makefile` or `justfile` for common commands
|
|
73
|
+
- Docker setup if appropriate
|
|
74
|
+
|
|
75
|
+
### Step 6 — Development Milestones
|
|
76
|
+
Break the project into weekly milestones aligned with the deadline:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Week 1: Setup + Core data models
|
|
80
|
+
Week 2: API endpoints + basic tests
|
|
81
|
+
Week 3: Frontend integration
|
|
82
|
+
Week 4: Polish, edge cases, documentation
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Scaffolding Templates
|
|
88
|
+
|
|
89
|
+
### Python Project
|
|
90
|
+
```
|
|
91
|
+
project-name/
|
|
92
|
+
├── src/
|
|
93
|
+
│ ├── __init__.py
|
|
94
|
+
│ ├── main.py
|
|
95
|
+
│ └── models/
|
|
96
|
+
├── tests/
|
|
97
|
+
│ ├── __init__.py
|
|
98
|
+
│ └── test_main.py
|
|
99
|
+
├── docs/
|
|
100
|
+
├── .github/workflows/
|
|
101
|
+
├── .gitignore
|
|
102
|
+
├── README.md
|
|
103
|
+
├── requirements.txt
|
|
104
|
+
└── Makefile
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### TypeScript/Node Project
|
|
108
|
+
```
|
|
109
|
+
project-name/
|
|
110
|
+
├── src/
|
|
111
|
+
│ ├── index.ts
|
|
112
|
+
│ └── types/
|
|
113
|
+
├── tests/
|
|
114
|
+
├── dist/
|
|
115
|
+
├── .github/workflows/
|
|
116
|
+
├── .gitignore
|
|
117
|
+
├── README.md
|
|
118
|
+
├── package.json
|
|
119
|
+
├── tsconfig.json
|
|
120
|
+
└── Makefile
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Systems/C++ Project
|
|
124
|
+
```
|
|
125
|
+
project-name/
|
|
126
|
+
├── src/
|
|
127
|
+
├── include/
|
|
128
|
+
├── tests/
|
|
129
|
+
├── build/
|
|
130
|
+
├── docs/
|
|
131
|
+
├── .github/workflows/
|
|
132
|
+
├── .gitignore
|
|
133
|
+
├── README.md
|
|
134
|
+
├── CMakeLists.txt
|
|
135
|
+
└── Makefile
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Notes for Maintainers
|
|
141
|
+
- Always ask about deadlines — scope recommendations depend on time available
|
|
142
|
+
- For course projects, check if the professor mandated a specific structure
|
|
143
|
+
- Scaffolded code should be minimal starters, not complete implementations
|