Skip to content

Commit 0b687a9

Browse files
author
Marvin Zhang
committed
feat(guides): add comprehensive development, testing, error checking, and git workflow guidelines
1 parent aa1514b commit 0b687a9

File tree

6 files changed

+254
-203
lines changed

6 files changed

+254
-203
lines changed

.github/copilot-instructions.md

Lines changed: 28 additions & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -22,216 +22,41 @@ mcp_devlog_discover_related_devlogs()
2222
4. **📝 TRACK PROGRESS**: Update entries with notes and status changes via MCP functions
2323
5. **🔗 LINK WORK**: Reference devlog IDs in commits and documentation
2424

25-
### 🎯 Standard Entry Format
26-
```json
27-
{
28-
"title": "Brief, descriptive title",
29-
"type": "feature|bug|task|refactor|docs",
30-
"description": "Detailed description with context",
31-
"priority": "low|medium|high|critical"
32-
}
33-
```
34-
35-
## Early Development Stage Guidelines
25+
## Development Philosophy (Brief)
3626

3727
**IMPORTANT**: This project is in early development. We prioritize clean, modern architecture over backwards compatibility.
3828

39-
### Development Philosophy
40-
- **Quality over continuity**: A well-architected solution is more valuable than preserving broken legacy code
41-
- **Rapid iteration**: Make bold changes to improve the codebase structure
42-
- **Technical debt elimination**: Actively remove code that doesn't serve the current vision
43-
- **Modern tooling**: Always use the latest stable versions and best practices
44-
- **Breaking changes are acceptable**: We're not bound by API compatibility during this phase
45-
46-
## Detailed Dogfooding Guidelines
47-
48-
### Core Principles
49-
- **MCP Integration**: Primary interface for AI assistants is through MCP server tools
50-
- **Duplicate Prevention**: Built-in safeguards against creating duplicate entries
51-
- **Self-Documentation**: Use devlog features to track their own development
52-
53-
### When Adding New Features
54-
1. **🔍 DISCOVER FIRST**: Use `discover_related_devlogs` to find existing relevant work
55-
2. Create devlog entry using MCP server only if no overlapping work exists
56-
3. Use the feature to track its own development
57-
4. Update the entry as you implement via MCP functions
58-
5. Document the feature in the entry notes using MCP tools
59-
60-
### Legacy Code Management
61-
- **Remove obsolete code**: Don't preserve legacy implementations when refactoring
62-
- **Modernize aggressively**: Prefer current best practices over maintaining old patterns
63-
- **Clean slate approach**: It's better to rewrite than to patch outdated code
64-
65-
## Testing Best Practices
66-
67-
### 1. Prefer Structured Tests Over Temporary Scripts
68-
- **Use Vitest framework**: Create proper test cases instead of ad-hoc scripts
69-
- **Use `tmp/` for debugging only**: When debugging is needed, use the `tmp/` directory (gitignored)
70-
- **Clean up legacy**: Remove temporary scripts once proper tests are in place
71-
72-
### 2. Test Organization
73-
- **Unit tests**: Test individual functions and classes in isolation
74-
- **Integration tests**: Test interactions between components and external services
75-
- **E2E tests**: Use Playwright MCP tools for web application testing
76-
- **Test data management**: Use proper fixtures and test data setup/teardown
77-
- **Descriptive test names**: Tests should clearly describe what they're validating
78-
79-
### 3. Testing Workflow
80-
1. **Primary approach**: Write proper test cases using Vitest framework
81-
2. **For debugging only**: Use `tmp/` directory for temporary debugging scripts (gitignored)
82-
3. **Test organization**: Ensure tests can be run with standard npm/pnpm scripts
83-
4. **Cleanup**: Remove any temporary debugging files from `tmp/` when no longer needed
84-
5. **Structured over ad-hoc**: Always prefer structured tests over temporary scripts
85-
86-
### 4. File Management for Testing
87-
- **Proper tests**: `packages/*/src/__tests__/` directories using Vitest
88-
- **Debugging files**: `tmp/` directory (temporary, gitignored)
89-
- **Never create**: Temporary scripts in `scripts/`, `src/`, or other tracked directories
90-
- **Clean codebase**: Keep the main codebase free of debugging artifacts
91-
92-
## Error Checking and Code Quality Guidelines
93-
94-
### 1. Always Check for Problems Before Building or Running
95-
- **Use get_errors tool**: Check for compilation errors, TypeScript issues, and linting problems before proceeding
96-
- **Problems panel workflow**: Leverage VS Code's built-in error detection and reporting
97-
- **Fix errors promptly**: Address compilation issues immediately rather than ignoring them
98-
- **Validate after edits**: Always check for new errors after making code changes
99-
100-
### 2. When to Check for Errors
101-
**ALWAYS check before:**
102-
-**Running build commands** (`pnpm build`, `npm run build`, etc.)
103-
-**Starting development servers** (`pnpm dev`, `npm start`, etc.)
104-
-**Running tests** (`pnpm test`, `npm test`, etc.)
105-
-**Committing changes** (as part of pre-commit workflow)
106-
-**After making significant code edits**
107-
108-
**Also check after:**
109-
- 📝 **Installing new dependencies**
110-
- 🔄 **Switching branches or pulling changes**
111-
- ⚙️ **Modifying configuration files** (tsconfig.json, package.json, etc.)
112-
113-
### 3. Error Handling Workflow
114-
1. **Check for problems**: Use `get_errors` tool to identify issues
115-
2. **Prioritize errors**: Address compilation errors before linting warnings
116-
3. **Fix systematically**: Resolve errors one file at a time
117-
4. **Verify fixes**: Re-check for errors after each fix
118-
5. **Document complex issues**: Add notes to devlog entries for non-trivial problems
119-
120-
### 4. Types of Problems to Address
121-
- **TypeScript errors**: Type mismatches, missing imports, syntax errors
122-
- **ESLint warnings**: Code style, unused variables, potential bugs
123-
- **Build configuration issues**: Missing dependencies, incorrect paths
124-
- **Import/export problems**: Circular dependencies, missing modules
125-
126-
### 5. Tools and Commands
127-
```bash
128-
# Check specific files for errors (preferred method)
129-
# Use get_errors tool with file paths
130-
131-
# Check overall project health
132-
pnpm build --dry-run # Check if build would succeed
133-
pnpm type-check # Run TypeScript compiler without emitting
134-
```
135-
136-
### 6. Integration with Development Workflow
137-
- **Before major refactoring**: Ensure clean starting state with no existing errors
138-
- **During development**: Check errors after each logical change
139-
- **Before committing**: Include error check as part of pre-commit verification
140-
- **In devlog entries**: Document any persistent or complex errors encountered
29+
- **Quality over continuity**: Well-architected solutions over preserving broken legacy code
30+
- **Rapid iteration**: Make bold changes to improve codebase structure
31+
- **Modern tooling**: Always use latest stable versions and best practices
32+
- **Breaking changes acceptable**: Not bound by API compatibility during this phase
14133

142-
## Git Workflow Guidelines
34+
## Quick Reference Links
14335

144-
### 1. Commit Early and Often
145-
- **After completing logical units**: Commit after implementing complete features, fixing bugs, or making significant refactors
146-
- **Before risky operations**: Always commit stable state before attempting complex changes
147-
- **At session milestones**: Commit when reaching significant progress points
148-
- **During interruptions**: If work might be interrupted, commit incomplete but stable progress
36+
📋 **Detailed Guidelines:**
37+
- [Devlog Workflow Guide](guides/devlog-workflow.md) - Detailed MCP operations and workflows
38+
- [Development Guidelines](guides/development-guidelines.md) - Development philosophy and practices
39+
- [Testing Guidelines](guides/testing-guidelines.md) - Testing best practices and file management
40+
- [Error Checking](guides/error-checking.md) - Error checking workflows and tools
41+
- [Git Workflow](guides/git-workflow.md) - Git operations using MCP tools
14942

150-
### 2. Commit Message Format
151-
Use the conventional commit format for consistency:
43+
## Essential SOPs
15244

153-
```
154-
<type>(<scope>): <description>
155-
156-
[optional body]
157-
158-
[optional footer(s)]
159-
```
160-
161-
**Types:**
162-
- `feat`: New features
163-
- `fix`: Bug fixes
164-
- `refactor`: Code restructuring without behavior changes
165-
- `docs`: Documentation changes
166-
- `test`: Adding or updating tests
167-
- `chore`: Maintenance tasks (dependencies, build, etc.)
168-
- `style`: Code formatting changes
169-
170-
**Examples:**
171-
```
172-
feat(devlog): add git commit guidelines to copilot instructions
173-
174-
docs: update README with installation steps
175-
176-
fix(mcp): resolve duplicate entry creation issue
177-
178-
refactor(core): modernize storage layer architecture
179-
```
45+
### Before Any Work
46+
1. **🔍 ALWAYS** run `mcp_devlog_discover_related_devlogs()` first
47+
2. **🔧 CHECK ERRORS** using `get_errors` tool before building/running
48+
3. **📊 CHECK STATUS** using `mcp_git_git_status()` to understand repo state
18049

181-
### 3. When to Commit
182-
**ALWAYS commit in these situations:**
183-
-**After completing a feature or bug fix**
184-
-**Before starting major refactoring**
185-
-**When tests are passing**
186-
-**At the end of a productive session**
187-
-**Before switching contexts or tasks**
188-
-**When code reaches a stable intermediate state**
50+
### Git Operations Priority
51+
**Use Git MCP tools as primary method:**
52+
- `mcp_git_git_status()`, `mcp_git_git_add()`, `mcp_git_git_commit()`, `mcp_git_git_push()`
53+
- **Fallback to terminal only when MCP tools unavailable**
18954

190-
**DON'T commit:**
191-
- ❌ Broken or non-compiling code (unless explicitly marked as WIP)
192-
- ❌ Temporary debugging code or console.log statements
193-
- ❌ Files in `tmp/` directory or other gitignored locations
194-
- ❌ Large binary files or build artifacts
195-
196-
### 4. Git Commands for AI Agents
197-
Use these commands through the `run_in_terminal` tool:
198-
199-
```bash
200-
# Check status before committing
201-
git status
202-
203-
# Stage specific files (preferred over git add .)
204-
git add path/to/specific/file.ts
205-
206-
# Commit with descriptive message
207-
git commit -m "feat(scope): descriptive message about changes"
208-
209-
# Push changes to remote (when appropriate)
210-
git push
211-
```
212-
213-
### 5. Recovery and Safety
214-
- **Check git status regularly**: Always verify what files are staged/unstaged
215-
- **Use git diff**: Review changes before committing
216-
- **Stash when switching contexts**: Use `git stash` for temporary work
217-
- **Create branches for experiments**: Use feature branches for risky changes
218-
219-
### 6. Integration with Devlog Workflow
220-
- **Link commits to devlog entries**: Reference devlog IDs in commit messages when relevant
221-
- **Update devlog after commits**: Add notes about committed changes to corresponding devlog entries
222-
- **Commit devlog updates**: Don't forget to commit changes to devlog files themselves
223-
224-
**Example workflow:**
225-
```bash
226-
# 1. Make code changes
227-
# 2. Test changes
228-
git add src/feature.ts
229-
git commit -m "feat(core): implement new feature as described in devlog #4"
230-
231-
# 3. Update devlog entry
232-
# 4. Commit devlog updates
233-
git add devlog/entries/
234-
git commit -m "docs(devlog): update entry #4 with implementation progress"
235-
```
55+
### Commit Early and Often
56+
- After completing features/fixes
57+
- Before risky operations
58+
- At session milestones
59+
- When tests pass
23660

237-
This ensures both code changes and development tracking are properly versioned and never lost.
61+
---
62+
*For detailed instructions on any topic, see the linked guides above.*
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Development Guidelines
2+
3+
## Development Philosophy
4+
5+
**IMPORTANT**: This project is in early development. We prioritize clean, modern architecture over backwards compatibility.
6+
7+
### Core Principles
8+
- **Quality over continuity**: A well-architected solution is more valuable than preserving broken legacy code
9+
- **Rapid iteration**: Make bold changes to improve the codebase structure
10+
- **Technical debt elimination**: Actively remove code that doesn't serve the current vision
11+
- **Modern tooling**: Always use the latest stable versions and best practices
12+
- **Breaking changes are acceptable**: We're not bound by API compatibility during this phase
13+
14+
## Detailed Dogfooding Guidelines
15+
16+
### Core Principles
17+
- **MCP Integration**: Primary interface for AI assistants is through MCP server tools
18+
- **Duplicate Prevention**: Built-in safeguards against creating duplicate entries
19+
- **Self-Documentation**: Use devlog features to track their own development
20+
21+
### When Adding New Features
22+
1. **🔍 DISCOVER FIRST**: Use `discover_related_devlogs` to find existing relevant work
23+
2. Create devlog entry using MCP server only if no overlapping work exists
24+
3. Use the feature to track its own development
25+
4. Update the entry as you implement via MCP functions
26+
5. Document the feature in the entry notes using MCP tools
27+
28+
### Legacy Code Management
29+
- **Remove obsolete code**: Don't preserve legacy implementations when refactoring
30+
- **Modernize aggressively**: Prefer current best practices over maintaining old patterns
31+
- **Clean slate approach**: It's better to rewrite than to patch outdated code

.github/guides/devlog-workflow.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Devlog Workflow Guide
2+
3+
## Detailed Dogfooding Guidelines
4+
5+
### Core Principles
6+
- **MCP Integration**: Primary interface for AI assistants is through MCP server tools
7+
- **Duplicate Prevention**: Built-in safeguards against creating duplicate entries
8+
- **Self-Documentation**: Use devlog features to track their own development
9+
10+
### When Adding New Features
11+
1. **🔍 DISCOVER FIRST**: Use `discover_related_devlogs` to find existing relevant work
12+
2. Create devlog entry using MCP server only if no overlapping work exists
13+
3. Use the feature to track its own development
14+
4. Update the entry as you implement via MCP functions
15+
5. Document the feature in the entry notes using MCP tools
16+
17+
## Standard Entry Format
18+
```json
19+
{
20+
"title": "Brief, descriptive title",
21+
"type": "feature|bug|task|refactor|docs",
22+
"description": "Detailed description with context",
23+
"priority": "low|medium|high|critical"
24+
}
25+
```
26+
27+
## MCP Tools Reference
28+
- `mcp_devlog_discover_related_devlogs()` - Find existing related work
29+
- `mcp_devlog_create_devlog()` - Create new entry
30+
- `mcp_devlog_update_devlog()` - Update entry progress
31+
- `mcp_devlog_add_devlog_note()` - Add timestamped notes
32+
- `mcp_devlog_get_context_for_ai()` - Get entry context
33+
- `mcp_devlog_list_devlogs()` - List all entries
34+
- `mcp_devlog_search_devlogs()` - Search entries

.github/guides/error-checking.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Error Checking and Code Quality Guidelines
2+
3+
## Always Check for Problems Before Building or Running
4+
- **Use get_errors tool**: Check for compilation errors, TypeScript issues, and linting problems before proceeding
5+
- **Problems panel workflow**: Leverage VS Code's built-in error detection and reporting
6+
- **Fix errors promptly**: Address compilation issues immediately rather than ignoring them
7+
- **Validate after edits**: Always check for new errors after making code changes
8+
9+
## When to Check for Errors
10+
**ALWAYS check before:**
11+
-**Running build commands** (`pnpm build`, `npm run build`, etc.)
12+
-**Starting development servers** (`pnpm dev`, `npm start`, etc.)
13+
-**Running tests** (`pnpm test`, `npm test`, etc.)
14+
-**Committing changes** (as part of pre-commit workflow)
15+
-**After making significant code edits**
16+
17+
**Also check after:**
18+
- 📝 **Installing new dependencies**
19+
- 🔄 **Switching branches or pulling changes**
20+
- ⚙️ **Modifying configuration files** (tsconfig.json, package.json, etc.)
21+
22+
## Error Handling Workflow
23+
1. **Check for problems**: Use `get_errors` tool to identify issues
24+
2. **Prioritize errors**: Address compilation errors before linting warnings
25+
3. **Fix systematically**: Resolve errors one file at a time
26+
4. **Verify fixes**: Re-check for errors after each fix
27+
5. **Document complex issues**: Add notes to devlog entries for non-trivial problems
28+
29+
## Types of Problems to Address
30+
- **TypeScript errors**: Type mismatches, missing imports, syntax errors
31+
- **ESLint warnings**: Code style, unused variables, potential bugs
32+
- **Build configuration issues**: Missing dependencies, incorrect paths
33+
- **Import/export problems**: Circular dependencies, missing modules
34+
35+
## Tools and Commands
36+
```bash
37+
# Check specific files for errors (preferred method)
38+
# Use get_errors tool with file paths
39+
40+
# Check overall project health
41+
pnpm build --dry-run # Check if build would succeed
42+
pnpm type-check # Run TypeScript compiler without emitting
43+
```
44+
45+
## Integration with Development Workflow
46+
- **Before major refactoring**: Ensure clean starting state with no existing errors
47+
- **During development**: Check errors after each logical change
48+
- **Before committing**: Include error check as part of pre-commit verification
49+
- **In devlog entries**: Document any persistent or complex errors encountered

0 commit comments

Comments
 (0)