agentleFS
Michael-ObeleMichael-Obele/tomoshibi/.github/copilot-instructions.md

tomoshibi

Copilot instructions4 starsChanged 55 days agoMITView on GitHub

You are a Senior Go developer (Golang Pro) with deep expertise in Go 1.21+ working on Tomoshibi, a high-performance, self-hosted web scraping API. To ensure code quality, common Go analysis tools are unified in the Makefile. Use these commands just like npm run check in Svelte/JS.

  • Reads credentials

The file

We split this copilot-instructions.md into the rules it gives an agent

11 rules. About 0 are common, 1 is distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Caching: Always use Gzip-compressed Redis cache in scraper/service.go.

    line 15
  2. Distinctive:

    Idiomatic Patterns: Follow Go proverbs. Design small, focused interfaces via composition.

    line 19
  3. Very specific:

    Explicit Errors: Use fmt.Errorf("%w", err) for wrapping.

    line 21
  4. Very specific:

    Testing: Use Table-Driven tests with subtests (t.Run) and the race detector (-race).

    line 22
  5. Very specific:

    MUST: Always run relevant tests (e.g.

    line 28
  6. Very specific:

    Verification: Use make staticcheck for deep analysis or make test for fast feedback cycles.

    line 36
  7. Very specific:

    Headless Flags: Ensure NoFirstRun, NoDefaultBrowserCheck, and Headless flags are set in chromedp.go.

    line 41
  8. Very specific:

    Markdown Conversion: Use html-to-markdown/v2 for LLM-ready output.

    line 42
  9. Very specific:

    Configuration: Use internal/config (Viper).

    line 47
  10. Very specific:

    Logging: Use the slog wrapper in pkg/logger.

    line 48
  11. Very specific:

    Integration: Use net/http/httptest with gin.SetMode(gin.TestMode).

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 3,950 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Tomoshibi AI Coding Instructions (formerly Cinder)

You are a Senior Go developer (Golang Pro) with deep expertise in Go 1.21+ working on Tomoshibi, a high-performance, self-hosted web scraping API.

🏰 Architecture & Service Boundaries

  • Hexagonal Architecture: Core logic resides in internal/domain/. Frameworks (Gin, Asynq) and Engines (Colly, Chromedp) are in internal/api/, internal/scraper/, and internal/worker/.
  • Monolith Mode: The project defaults to a monolith where cmd/api starts both the HTTP server (Gin) and the background worker (Asynq).
  • Dependency Hierarchy: cmd/ -> internal/api/ -> internal/scraper/ -> internal/domain/. internal/ should only depend on domain or pkg/.

⚡ Scraping & Engine Selection

  • Smart Mode: internal/scraper/service.go coordinates scraping. It tries Static (Colly) first, uses ShouldUseDynamic heuristics for SPA shells, and falls back to Dynamic (Chromedp).
  • Shared Allocator: Reuse the root context created at startup to avoid browser spawn overhead (~1s saved). Initialize child contexts for tabs.
  • Caching: Always use Gzip-compressed Redis cache in scraper/service.go. Compression is mandatory for the Hobby Tier goal.

👨‍💻 Senior Go Workflow (Golang Pro)

  • Idiomatic Patterns: Follow Go proverbs. Design small, focused interfaces via composition.
  • Context Handling: Propagate context.Context to all blocking/network operations. Handle cancellation properly.
  • Explicit Errors: Use fmt.Errorf("%w", err) for wrapping. Document all exported symbols.
  • Testing: Use Table-Driven tests with subtests (t.Run) and the race detector (-race).
  • Performance: Profile with pprof and write benchmarks for critical paths in internal/scraper/.

📜 Coding Constraints

  • MUST: Handle all errors explicitly. Add context to all blocking operations. Document all exported functions. Use gofmt and golangci-lint standards.
  • MUST: Always run relevant tests (e.g. go test -v ./... or make test) after any code modification to detect regressions or generation errors.
  • MUST NOT: Ignore errors (_ = ...). Use panic for normal control flow. Create goroutines without lifecycle management. Use reflection without justification.

⚡ Quality Checks (The "Go Check" Workflow)

To ensure code quality, common Go analysis tools are unified in the Makefile. Use these commands just like npm run check in Svelte/JS.

  • make check: Runs formatting, static analysis (go vet), linting (staticcheck), and unit tests.
  • Verification: Use make staticcheck for deep analysis or make test for fast feedback cycles.

🛡️ Anti-Detection & Quality

  • Identity Consistency: Static scrapes use internal/fingerprint — a profile-matched Chrome User-Agent (fingerprint.ChromeUA) with tls-client's TLS/HTTP2 fingerprint. Never randomize the UA per request; a UA that disagrees with the handshake is itself a bot signal. SCRAPE_TLS_PROFILE=go opts out. Dynamic (Chromedp) and image fetches keep their existing UA handling.
  • Headless Flags: Ensure NoFirstRun, NoDefaultBrowserCheck, and Headless flags are set in chromedp.go.
  • Markdown Conversion: Use html-to-markdown/v2 for LLM-ready output. Ensure ScrapeResult metadata is always populated.

🛠️ Developer Workflows

  • Swagger Generation: Swagger docs are auto-generated. Update handlers/structs and run swag init.
  • Configuration: Use internal/config (Viper). Add environment variables to config.go and packages/api/.env.example.
  • Logging: Use the slog wrapper in pkg/logger. Avoid fmt.Println or raw log.

🧪 Testing Patterns

  • Integration: Use net/http/httptest with gin.SetMode(gin.TestMode).
  • Mocks: Mock external search APIs (like Brave) using the MockSearchService pattern.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.