Development guidelines for gogh, a GitHub repository management tool inspired by ghq. Covers project structure, testing patterns, mock generation, and architecture rules.
Development instructions for contributing to the gogh project, a tool for efficient GitHub repository management inspired by `ghq`.
- Code comments
- Error messages
- Test case titles
- Documentation strings
```
gogh/
├── app/ # Application layer (use cases)
│ ├── auth/ # Authentication-related use cases
│ ├── bundle/ # Bundle (repository batch management) use cases
│ ├── clone/ # Clone operation use cases
│ ├── fork/ # Fork operation use cases
│ ├── repos/ # Repository list display use cases
│ └── service/ # Common services (used across multiple use cases)
│
├── core/ # Core layer (domain models and interfaces)
│ ├── auth/ # Authentication-related interfaces
│ ├── git/ # Git operation interfaces
│ ├── hosting/ # Repository hosting service interfaces
│ ├── repository/ # Repository representation and path operation interfaces
│ ├── store/ # Data persistence interfaces
│ ├── workspace/ # Workspace management interfaces
│ └── *_mock/ # Packages containing mocks for each interface
│
├── infra/ # External system integration layer (implementations of core interfaces)
│ ├── auth/ # Authentication implementation
│ ├── git/ # Git operation implementation
│ ├── github/ # GitHub API integration
│ ├── store/ # Data persistence implementation
│ └── workspace/ # Workspace management implementation
│
└── ui/ # UI layer (user interfaces)
└── cli/ # Command-line interface
└── commands/ # Implementation of various commands
```
**Example**:
```go
package mypackage_test
import (
"testing"
testtarget "github.com/kyoh86/gogh/v4/mypackage"
)
func TestPublicFunction(t *testing.T) {
// Test implementation
}
```
**Example gen.go**:
```go
package repository_mock
//go:generate mockgen -destination=gen_default_name_service_mock.go -package=repository_mock github.com/kyoh86/gogh/v4/core/repository DefaultNameService
```
#### 1. Core Layer (`core/`)
- Repository references
- Hosting service interfaces
- Authentication interfaces
- Domain entities and pure logic
#### 2. Application Layer (`app/`)
- Use case flows
- Business logic coordination
- Examples: clone, fork, list repositories
#### 3. Infrastructure Layer (`infra/`)
- API clients (e.g., GitHub)
- Database connections
- File operations
- Store implementations
#### 4. UI Layer (`ui/`)
- CLI commands (Cobra-based)
- Output formatters
- User input handling
1. **Core layer**: No imports from other layers
2. **Application layer**: Import core layer only
3. **Infrastructure layer**: Import core layer only
4. **UI layer**: Import application layer
1. Core layer **defines** interfaces
2. Infrastructure layer **implements** interfaces
3. Application layer **uses** interfaces to call external systems
1. **Define interfaces** in the core layer
2. **Implement use cases** in the application layer using core interfaces
3. **Implement external integrations** in the infrastructure layer
4. **Expose functionality** through the UI layer
5. **Generate mocks** using `go generate` for testing
6. **Write tests** following the testing guidelines above
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/gogh-project-development-guide/raw