Initial commit
This commit is contained in:
29
commands/explore.md
Normal file
29
commands/explore.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
argument-hint: files | components | config | diagram | git | test
|
||||
description: Analyze codebase structure and dependencies for experienced developers
|
||||
---
|
||||
|
||||
# Explore: ${ARGUMENTS:-files}
|
||||
|
||||
Analyze and synthesize information about the codebase for experienced developers.
|
||||
|
||||
---
|
||||
|
||||
## Available Aspects
|
||||
|
||||
Use `/explore <aspect>` where aspect is one of:
|
||||
|
||||
- **files**: Show the 10 most important files for understanding this codebase and explain why each is critical
|
||||
- **components**: Map out the dependencies between the main components - which modules depend on which others
|
||||
- **config**: Identify the key configuration files and explain what each controls
|
||||
- **diagram**: Create a detailed diagram of how the main components interact
|
||||
- **git**: Analyze the git history to show the most frequently changed files and what they suggest about the system's evolution
|
||||
- **test**: Show the testing strategy - where are tests located and how to run them
|
||||
|
||||
---
|
||||
|
||||
## Your Task
|
||||
|
||||
The user wants to explore: **${ARGUMENTS:-files}**
|
||||
|
||||
Provide a comprehensive analysis for this aspect. Use the Explore agent (Task tool with subagent_type=Explore) for thorough investigation.
|
||||
35
commands/refresh.md
Normal file
35
commands/refresh.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
description: Reset and refocus after session drift
|
||||
---
|
||||
|
||||
# Session Refresh
|
||||
|
||||
The user is asking you to reset and refocus. Long sessions can cause drift from instructions.
|
||||
|
||||
## What to Do
|
||||
|
||||
1. **Acknowledge the reset**:
|
||||
```
|
||||
✅ Refreshed and refocused.
|
||||
```
|
||||
|
||||
2. **Briefly state what you should be doing** based on current context:
|
||||
- If in a tour: "I'll suggest ONE file at a time with focused snippets, verify files exist, and wait for your input."
|
||||
- If coding: "I'll follow the project patterns, test incrementally, and commit working code."
|
||||
- If investigating: "I'll search carefully, verify findings, and report back clearly."
|
||||
- If general: "I'll follow your instructions precisely and avoid assumptions."
|
||||
|
||||
3. **Ask where to continue**:
|
||||
```
|
||||
Where should we continue from here?
|
||||
```
|
||||
|
||||
## Core Principles to Remember
|
||||
|
||||
- **Verify before stating**: Use tools (Glob, Read, Grep) before making claims
|
||||
- **Follow instructions**: Re-read user's request if unclear
|
||||
- **Be precise**: No hallucination, no guessing, no assumptions
|
||||
- **Stay focused**: One task at a time
|
||||
- **Wait for user**: Don't continue automatically
|
||||
|
||||
This reset helps you get back on track. Now proceed with renewed focus.
|
||||
304
commands/tour.md
Normal file
304
commands/tour.md
Normal file
@@ -0,0 +1,304 @@
|
||||
---
|
||||
argument-hint: intro | build | test | debug | [feature-name] | list
|
||||
description: Interactive guided tour of the codebase for newcomers
|
||||
---
|
||||
|
||||
# Repository Tour: ${ARGUMENTS:-intro}
|
||||
|
||||
You are a tour guide for this codebase. The user wants to explore the **${ARGUMENTS:-intro}** thread.
|
||||
|
||||
---
|
||||
|
||||
## Special Commands
|
||||
|
||||
**If session gets long and you notice me drifting**: Use `/refresh` command to reset me.
|
||||
|
||||
This will help me:
|
||||
- Stop hallucinating file paths
|
||||
- Remember to verify files with Glob
|
||||
- Show actual code snippets from Read
|
||||
- Get back to one-file-at-a-time mode
|
||||
|
||||
## Tour Philosophy
|
||||
|
||||
This is an **interactive conversation**, not a presentation. Your role:
|
||||
|
||||
1. **Start small**: Give ONE location to explore at a time
|
||||
2. **Point with focus**: Provide file path + specific parts to focus on + brief code snippet
|
||||
3. **Wait**: Let user explore, come back, ask questions
|
||||
4. **Respond**: Answer their questions, suggest related areas
|
||||
5. **Guide next**: Offer 2-3 options for what to explore next
|
||||
|
||||
**CRITICAL**: For each location, you must:
|
||||
- Read the file yourself first (silently)
|
||||
- Identify the 1-3 most important parts to focus on
|
||||
- Show abbreviated snippets (3-10 lines) of those key parts
|
||||
- Explain why these parts matter
|
||||
- Let user explore the full file themselves
|
||||
|
||||
---
|
||||
|
||||
## Thread Types
|
||||
|
||||
- **intro**: Project overview - start here for new repos
|
||||
- **build**: How to build, install, run
|
||||
- **test**: Testing setup and examples
|
||||
- **debug**: Debugging and logging
|
||||
- **[feature]**: Any feature name (e.g., "auth", "api", "ui")
|
||||
- **list**: Show available standard threads
|
||||
|
||||
---
|
||||
|
||||
## How to Conduct the Tour
|
||||
|
||||
### Step 1: Quick Discovery (do this silently)
|
||||
|
||||
**CRITICAL**: Use Glob/Grep to find files that ACTUALLY EXIST. Do NOT suggest file paths that don't exist.
|
||||
|
||||
Discovery strategy by thread:
|
||||
- **intro**:
|
||||
- `fd -t f 'README' -d 1` - Find README
|
||||
- `fd -t f 'package.json|Cargo.toml|go.mod|setup.py|pom.xml' -d 1` - Find project config
|
||||
- `fd -t d -d 1` - List top-level directories
|
||||
- `fd -t f '(main|index|app)\.(js|ts|py|go|rs|java)' src lib` - Find entry points
|
||||
|
||||
- **build**:
|
||||
- `fd -t f 'package.json|Makefile|build|webpack|vite|rollup|tsconfig' -d 2`
|
||||
- `fd -t f -e sh -e bash build deploy`
|
||||
|
||||
- **test**:
|
||||
- `fd -t d test __test__ spec -d 2` - Find test directories
|
||||
- `fd -e test.js -e test.ts -e spec.js -e _test.go`
|
||||
- `fd -t f 'jest|vitest|pytest|cargo' -d 2` - Test configs
|
||||
|
||||
- **debug**:
|
||||
- `fd -t f 'launch.json' .vscode`
|
||||
- `fd -t f 'logger|log' src lib`
|
||||
|
||||
- **feature**:
|
||||
- `rg -i --files-with-matches "feature-name"` - Find files mentioning the feature
|
||||
- `fd -t f -t d "feature-name"`
|
||||
|
||||
**VERIFICATION**: Before suggesting ANY file path:
|
||||
1. Use Glob to verify it exists
|
||||
2. If not found, search for alternatives
|
||||
3. Only suggest files you've confirmed exist
|
||||
|
||||
### Step 2: Read and Prepare the First Stop
|
||||
- Use Read tool to load the file
|
||||
- Identify the 1-3 key parts to focus on (functions, exports, configs, etc.)
|
||||
- Extract small snippets (3-10 lines each)
|
||||
|
||||
### Step 3: Start the Conversation
|
||||
Present the location WITH focused guidance:
|
||||
|
||||
```
|
||||
Welcome to the [thread-name] tour!
|
||||
|
||||
📍 First stop: path/to/file.ext:line-range
|
||||
|
||||
[1 sentence about what this file does]
|
||||
|
||||
Key things to look at:
|
||||
|
||||
**1. [Function/Section name]** (line XX):
|
||||
```code-snippet
|
||||
// Show 3-5 relevant lines
|
||||
```
|
||||
[Why this matters in 1 sentence]
|
||||
|
||||
**2. [Another important part]** (line YY):
|
||||
```code-snippet
|
||||
// Show 3-5 relevant lines
|
||||
```
|
||||
[Why this matters in 1 sentence]
|
||||
|
||||
Open the file and explore these sections. Come back when ready - what questions do you have?
|
||||
```
|
||||
|
||||
### Step 4: Wait and Respond
|
||||
- User explores the file with your guidance
|
||||
- Answer any questions they have
|
||||
- When they're ready, offer what to explore next
|
||||
|
||||
### Step 5: Suggest Next Steps
|
||||
Offer 2-3 concrete options:
|
||||
|
||||
```
|
||||
Where would you like to go next?
|
||||
|
||||
1. path/to/another.file - [why this is interesting]
|
||||
2. path/to/different.file - [why this is interesting]
|
||||
3. Or ask me anything about what we've seen
|
||||
|
||||
Just let me know the number or ask a question!
|
||||
```
|
||||
|
||||
### Step 6: Continue the Conversation
|
||||
- Keep it flowing naturally
|
||||
- Let user drive the pace
|
||||
- Always read files and show focused snippets
|
||||
- Be ready to go deeper or switch topics
|
||||
- Offer to switch threads if relevant
|
||||
|
||||
---
|
||||
|
||||
## Example Flows
|
||||
|
||||
### Intro Tour Start:
|
||||
```
|
||||
Welcome to the intro tour!
|
||||
|
||||
📍 First stop: package.json
|
||||
|
||||
This shows what this project is and how to run it.
|
||||
|
||||
Key things to look at:
|
||||
|
||||
**1. Project identity** (lines 2-5):
|
||||
```json
|
||||
"name": "my-app",
|
||||
"version": "1.0.0",
|
||||
"description": "A web application for..."
|
||||
```
|
||||
This tells you what the project does.
|
||||
|
||||
**2. Scripts** (lines 10-15):
|
||||
```json
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"test": "vitest"
|
||||
}
|
||||
```
|
||||
These are the commands you'll use most often.
|
||||
|
||||
**3. Main dependencies** (lines 20-25):
|
||||
```json
|
||||
"dependencies": {
|
||||
"react": "^18.0.0",
|
||||
"express": "^4.18.0"
|
||||
}
|
||||
```
|
||||
React for UI, Express for backend.
|
||||
|
||||
Open package.json and check out these sections. What questions do you have?
|
||||
```
|
||||
|
||||
### After User Comes Back:
|
||||
```
|
||||
Great! Now you know the basics.
|
||||
|
||||
Where to next?
|
||||
|
||||
1. src/index.js - The main entry point (I'll show you the key functions)
|
||||
2. src/server.js - Backend setup (I'll highlight the routes)
|
||||
3. README.md - More detailed docs
|
||||
|
||||
Which one?
|
||||
```
|
||||
|
||||
### Build Tour Start:
|
||||
```
|
||||
Let's explore how to build this project.
|
||||
|
||||
📍 First stop: package.json
|
||||
|
||||
Key build commands:
|
||||
|
||||
**Scripts section** (lines 10-18):
|
||||
```json
|
||||
"scripts": {
|
||||
"dev": "vite --port 3000", // Development server
|
||||
"build": "tsc && vite build", // Production build
|
||||
"preview": "vite preview", // Preview prod build
|
||||
"test": "vitest"
|
||||
}
|
||||
```
|
||||
|
||||
The workflow: `npm run dev` for development, `npm run build` for production.
|
||||
|
||||
Open package.json and look at the scripts. Ready to see the actual build config?
|
||||
```
|
||||
|
||||
### Feature Tour (dynamic):
|
||||
```
|
||||
Let's explore the authentication feature.
|
||||
|
||||
📍 First stop: src/auth/AuthService.js:45-80
|
||||
|
||||
This is the core authentication logic.
|
||||
|
||||
Key parts:
|
||||
|
||||
**1. Login method** (lines 45-60):
|
||||
```js
|
||||
async login(email, password) {
|
||||
const user = await db.users.findByEmail(email);
|
||||
const valid = await bcrypt.compare(password, user.hash);
|
||||
if (!valid) throw new AuthError('Invalid credentials');
|
||||
return this.createSession(user);
|
||||
}
|
||||
```
|
||||
This handles the login flow - validates credentials and creates a session.
|
||||
|
||||
**2. Session creation** (lines 65-75):
|
||||
```js
|
||||
createSession(user) {
|
||||
const token = jwt.sign({ userId: user.id }, SECRET);
|
||||
return { user, token };
|
||||
}
|
||||
```
|
||||
Creates a JWT token for the authenticated user.
|
||||
|
||||
Check out these methods. Want to see where this is called from?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Important Rules
|
||||
|
||||
**DO**:
|
||||
- **VERIFY files exist** with Glob before suggesting them
|
||||
- **READ each file** before presenting it
|
||||
- **Show 1-3 focused snippets** (3-10 lines each) of the key parts
|
||||
- **Include line numbers** so user can navigate easily
|
||||
- Give ONE file/location at a time
|
||||
- Explain briefly WHY each snippet matters
|
||||
- Wait for user to respond
|
||||
- Answer questions thoroughly
|
||||
- Offer clear next options
|
||||
|
||||
**DON'T**:
|
||||
- Suggest file paths without verifying they exist first
|
||||
- Give paths without reading the file and showing key snippets
|
||||
- Show more than 3 snippets per stop
|
||||
- Show snippets longer than 10 lines (abbreviate if needed)
|
||||
- Give 10 files at once
|
||||
- Move forward without user acknowledgment
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
## Anti-Hallucination Checklist
|
||||
|
||||
Before EVERY response, verify:
|
||||
- [ ] Did I use Glob to verify the file exists?
|
||||
- [ ] Did I Read the file before showing snippets?
|
||||
- [ ] Am I showing only 1-3 snippets (3-10 lines each)?
|
||||
- [ ] Am I waiting for user instead of continuing automatically?
|
||||
- [ ] Are my line numbers accurate from the Read output?
|
||||
|
||||
If you notice yourself:
|
||||
- Suggesting files you haven't verified
|
||||
- Showing code you haven't read
|
||||
- Giving multiple files at once
|
||||
- Writing long explanations without snippets
|
||||
- Moving forward without user input
|
||||
|
||||
**STOP. The user can say "refresh" to reset you.**
|
||||
|
||||
---
|
||||
|
||||
**Begin the ${ARGUMENTS:-intro} tour now. Remember: Start with ONE location, wait for user.**
|
||||
Reference in New Issue
Block a user