Provides comprehensive context for working on ArthArvest, a Go application that monitors X/Twitter lists and archives art content with metadata. Includes architecture patterns, project structure, development guidelines, and implementation status.
This skill provides comprehensive context for working on the ArthArvest project, a Go application that monitors X/Twitter lists for art content and automatically archives images with metadata.
When invoked, this skill loads the complete project context for ArthArvest into your working memory, enabling you to:
ArthArvest is a containerized Go application following 12-factor app principles, designed to:
The project implements:
```
artharvest-app/
├── cmd/artharvest/main.go # Application entry point
├── internal/
│ ├── app/app.go # Application bootstrap & lifecycle
│ ├── api/ # REST API layer
│ │ ├── routes.go # Route definitions
│ │ └── handlers.go # HTTP handlers
│ ├── config/config.go # Configuration management
│ ├── database/ # Data layer
│ │ ├── database.go # Connection pooling
│ │ └── schema.sql # Database schema
│ ├── logger/logger.go # Structured logging
│ ├── models/models.go # Data models
│ ├── scheduler/scheduler.go # Periodic job execution
│ └── services/ # Business logic
│ ├── services.go # Service container
│ ├── twitter.go # X/Twitter API client
│ ├── media.go # Media download & storage
│ ├── lists.go # List management
│ └── processing.go # Data processing
├── docker-compose.yml # Container orchestration
├── Dockerfile # Application container
├── .env.example # Environment variable template
└── config.example.yaml # YAML configuration template
```
Located in `internal/config/`, provides:
`internal/database/schema.sql` includes:
`internal/services/` contains:
`internal/scheduler/` provides:
1. Follow standard Go conventions and gofmt
2. Use structured logging with key-value pairs
3. Implement graceful shutdowns for all services
4. Handle contexts for cancellation and timeouts
1. Use parameterized queries to prevent SQL injection
2. Leverage JSONB for extensible metadata storage
3. Create indexes for frequently queried columns
4. Use transactions for multi-table operations
1. Wrap errors with context using `fmt.Errorf`
2. Log errors at appropriate levels
3. Return structured API errors
4. Implement retry logic for transient failures
1. Unit tests for service layer logic
2. Integration tests for database operations
3. API tests for HTTP endpoints
4. Mock external dependencies (Twitter API)
```bash
TWITTER_BEARER_TOKEN # X/Twitter API bearer token
POSTGRES_PASSWORD # Database password
```
```bash
ARTHARVEST_HOST=0.0.0.0
ARTHARVEST_PORT=8080
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=artharvest
POSTGRES_USER=artharvest
POSTGRES_SSLMODE=prefer
LOG_LEVEL=info
SCHEDULER_ENABLED=true
SCHEDULER_INTERVAL=24h
TWITTER_LOOKBACK_WINDOW=6h
TWITTER_RATE_LIMIT_REQUESTS=300
TWITTER_RATE_LIMIT_WINDOW=15m
STORAGE_BASE_PATH=./data
```
1. Define route in `internal/api/routes.go`
2. Implement handler in `internal/api/handlers.go`
3. Add service method if needed in `internal/services/`
4. Update database schema if required
1. Update `internal/database/schema.sql`
2. Add fields to models in `internal/models/models.go`
3. Update service methods for new fields
4. Consider backward compatibility
1. Create service file in `internal/services/`
2. Define interface and implementation
3. Add to service container in `internal/services/services.go`
4. Wire into application in `internal/app/app.go`
**Rate limiting**: Check Twitter API usage in structured logs. Free tier allows 300 requests per 15 minutes.
**Database connection**: Verify PostgreSQL is running and credentials match environment variables. Check `POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_USER`, and `POSTGRES_PASSWORD`.
**File permissions**: Ensure `STORAGE_BASE_PATH` directory exists and is writable by the application process.
**Memory usage**: Monitor for large file downloads. Consider implementing size limits or streaming.
```bash
LOG_LEVEL=debug
SCHEDULER_INTERVAL=5m # More frequent for testing
TWITTER_LOOKBACK_WINDOW=1h # Shorter window for testing
```
When working on ArthArvest:
1. **Review Context First**: Read this entire document before making changes to understand architecture patterns and design decisions.
2. **Follow Established Patterns**: Use the service layer pattern, repository pattern, and clean architecture principles already in place.
3. **Respect Rate Limits**: Twitter API has strict limits (300 req/15min). Always use the TwitterService which implements rate limiting.
4. **Database Changes**: When modifying schema, update both `schema.sql` and the corresponding models in `internal/models/models.go`. Use JSONB for extensible fields.
5. **Configuration**: New settings should be added to `internal/config/config.go` with environment variable support and sensible defaults.
6. **Error Handling**: Wrap errors with context, log at appropriate levels, and return structured errors from API endpoints.
7. **Testing**: Write tests for new service methods. Mock external dependencies like the Twitter API.
8. **Documentation**: Update this context document when making significant architectural changes or adding new patterns.
9. **Check Implementation Status**: Refer to the "Implementation Status" section to understand what's complete vs. placeholder code.
10. **Graceful Shutdown**: Ensure new services and goroutines properly handle context cancellation for graceful shutdown.
```bash
/skill artharvest-context
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/artharvest-project-context/raw