go-md2pdf
AGENTS.md87 starsChanged 8 months agoBSD-3-ClauseView on GitHub
Picoloom is a Go library and CLI for Markdown-to-PDF conversion. Keep boundaries stable: Useful commands: Run the safest relevant checks for the change. Prefer non-mutating checks first. Common checks:
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
22 rules. About 0 are common, 17 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
Prefer small, explicit Go code over clever abstractions.
- Distinctive: line 23
Read only task-relevant stack files.
- Distinctive: line 43
Avoid importing CLI code from library/internal packages.
- Distinctive: line 47
Use standard library first when reasonable.
- Very specific: line 48
Keep context.Context as the first parameter when a function accepts context.
- Very specific: line 52
Use panic only for programmer errors or unrecoverable initialization paths already established in the project.
- Distinctive: line 53
Prefer consumer-side interfaces at boundaries used by tests or alternate implementations.
- Distinctive: line 54
Do not introduce new dependencies without a clear need and validation.
- Distinctive: line 58
Prefer cohesive files. If a file grows beyond about 500 LOC, consider splitting by responsibility.
- Very specific: line 59
Avoid generic names such as utils, helpers, or common for new files/packages.
- Distinctive: line 61
Keep comments short and contract-focused: inputs, outputs, side effects, edge cases.
- Distinctive: line 65
Prefer behavior-focused tests over implementation-detail tests.
- Distinctive: line 66
Use table-driven tests for validation, parsing, config mapping, and boundary cases.
- Distinctive: line 70
Keep tests deterministic and avoid real external services unless explicitly required.
- Distinctive: line 84
Run the safest relevant checks for the change.
- Distinctive: line 108
If a command is skipped, state why.
- Distinctive: line 113
Prefer upgrading vulnerable direct dependencies over replacing stable stack components.
- Very specific: line 114
Do not silence govulncheck, gosec, or linter findings without documented rationale.
- Distinctive: line 118
Keep refactors behavior-preserving unless task says otherwise.
- Distinctive: line 120
Prefer small PR-sized changes.
- Very specific: line 121
When renaming exported or widely-used symbols, prefer semantic tools such as gopls rename if available.
- Distinctive: line 122
Do not rewrite architecture unless evidence shows a concrete risk.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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.
Files
AGENTS.md
Principles
- KISS: keep solutions simple.
- DRY on behavior, not at the cost of unclear data structures.
- Prefer small, explicit Go code over clever abstractions.
- Preserve public API behavior unless the task explicitly requires a change.
Source of truth
- Codebase root: this repository.
- Project documentation:
README.md,docs/ARCHITECTURE.md,docs/LAYOUT.md,CONTRIBUTING.md. - Validation commands:
Makefile,.github/workflows/ci.yml,.golangci.yml,go.mod. - Stack references:
~/workspace/repos/contains local source-of-truth clones namedowner.repo. - For Go questions, prefer relevant local stack sources before web search:
~/workspace/repos/golang.gofor language, stdlib, tests, toolchain behavior.~/workspace/repos/golang.websitefor go.dev docs and release notes.~/workspace/repos/yuin.goldmarkfor Markdown parser behavior.~/workspace/repos/go-rod.rodfor browser lifecycle, context, timeout, Rod APIs.~/workspace/repos/goccy.go-yamlfor YAML behavior.~/workspace/repos/golangci.golangci-lintfor lint behavior.
- Read only task-relevant stack files. Do not bulk-audit stack.
Project architecture
Picoloom is a Go library and CLI for Markdown-to-PDF conversion.
Main areas:
- Root package
github.com/alnah/picoloom/v2: public library API, converter facade, PDF rendering, pool, public types. cmd/picoloom: CLI commands, flags, config wiring, batch conversion.internal/pipeline: Markdown preprocessing, Goldmark conversion, HTML injection, path rewriting.internal/assets: embedded/custom styles and templates.internal/config: YAML config and validation.internal/process: OS process cleanup for browser lifecycle.
Keep boundaries stable:
- Public API stays in the root package.
- Implementation details stay under
internal/. - CLI orchestration stays in
cmd/picoloom. - Avoid importing CLI code from library/internal packages.
Go practices
- Use standard library first when reasonable.
- Keep
context.Contextas the first parameter when a function accepts context. - Propagate context to I/O, browser, and long-running operations when supported.
- Make resource ownership explicit. Close browsers, pages, files, pools, timers, and temp resources.
- Wrap errors with useful context and
%wwhen callers may neederrors.Isorerrors.As. - Use
paniconly for programmer errors or unrecoverable initialization paths already established in the project. - Prefer consumer-side interfaces at boundaries used by tests or alternate implementations.
- Do not introduce new dependencies without a clear need and validation.
Files and names
- Prefer cohesive files. If a file grows beyond about 500 LOC, consider splitting by responsibility.
- Avoid generic names such as
utils,helpers, orcommonfor new files/packages. - Names should describe responsibility and behavior.
- Keep comments short and contract-focused: inputs, outputs, side effects, edge cases.
Testing
- Prefer behavior-focused tests over implementation-detail tests.
- Use table-driven tests for validation, parsing, config mapping, and boundary cases.
- Include happy paths, failure paths, edge cases, cleanup paths, and concurrency/race paths when relevant.
- For pipeline robustness, consider fuzz tests with small meaningful seeds.
- For browser/PDF behavior, use integration tests with the existing
integrationbuild tag. - Keep tests deterministic and avoid real external services unless explicitly required.
Useful commands:
go test ./...
go test -race ./...
ROD_NO_SANDBOX=1 go test -race -tags=integration ./...
go test -coverprofile=coverage.out ./...
go tool cover -func=coverage.outValidation before handoff
Run the safest relevant checks for the change. Prefer non-mutating checks first.
Common checks:
gofmt -w .
go mod verify
go vet ./...
golangci-lint run
go tool gosec ./...
govulncheck ./...
go test ./...
go test -race ./...
go build ./...Integration checks when browser/PDF/CLI conversion is touched:
ROD_NO_SANDBOX=1 go test -race -tags=integration ./...
go build -o /tmp/picoloom ./cmd/picoloom
ROD_NO_SANDBOX=1 /tmp/picoloom convert examples/simple-report.md -o /tmp/picoloom-simple-test.pdfIf a command is skipped, state why.
Dependency and security changes
- For dependency updates, run
go mod tidy,go mod verify, tests, andgovulncheck ./.... - Prefer upgrading vulnerable direct dependencies over replacing stable stack components.
- Do not silence
govulncheck,gosec, or linter findings without documented rationale.
Refactoring
- Keep refactors behavior-preserving unless task says otherwise.
- Split large files by responsibility, not by arbitrary layers.
- Prefer small PR-sized changes.
- When renaming exported or widely-used symbols, prefer semantic tools such as
gopls renameif available. - Do not rewrite architecture unless evidence shows a concrete risk.
Picoloom-specific cautions
- Goldmark raw HTML remains unsafe by design. Do not enable
html.WithUnsafe()without explicit security review. - Rod/Chrome lifecycle must avoid leaked browser processes. Preserve explicit close/kill behavior.
SourceDirpath rewriting must preserve path traversal protection.- Config validation and public type validation are separate trust boundaries. Keep them aligned with tests.
- CLI flags, config, and environment precedence must match README behavior.
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
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.

