lcp-go-lcpd
Develop the go-lcpd daemon/tools (Go). Follow repo principles (robustness, TDD, lint) and validate with make test/lint/gen.
When & Why to Use This Skill
The lcp-go-lcpd skill is a specialized Go development assistant designed for building and maintaining the go-lcpd daemon and its associated tools. It streamlines the software engineering lifecycle by enforcing strict repository principles such as Test-Driven Development (TDD), the Single Responsibility Principle (SRP), and robust error handling. By integrating automated workflows for Protobuf generation, linting with golangci-lint, and comprehensive testing, this skill ensures the delivery of high-quality, production-ready Go code that aligns with specific protocol documentation.
Use Cases
- Feature Implementation: Developing new functionalities for the LCP daemon using TDD and ensuring strict adherence to the protocol specification and design docs.
- Automated Code Validation: Executing and fixing findings from 'make lint', 'make test', and 'make fmt' to maintain high code quality and repository standards.
- Protocol & API Management: Modifying .proto sources and regenerating Go code to ensure consistent communication across the LCP ecosystem.
- Robustness & Refactoring: Improving system architecture by aligning modules with SRP and enhancing diagnosability through configurable logging and ubiquitous language.
| name | lcp-go-lcpd |
|---|---|
| description | Develop the go-lcpd daemon/tools (Go). Follow repo principles (robustness, TDD, lint) and validate with make test/lint/gen. |
| short-description | Work on the go-lcpd implementation |
You are working in the go-lcpd/ module (the reference LCP daemon and tools).
Scope
- Module:
go-lcpd/ - Primary behavior sources:
- Protocol spec:
docs/protocol/protocol.md - WYSIWID design doc (when present):
go-lcpd/spec.md(see$lcp-wysiwid-spec)
- Protocol spec:
Development principles
These are the consolidated rules that previously lived in go-lcpd/AGENTS.md:
- If
go-lcpd/spec.mdexists, implementation MUST match the behavior defined there. - Design for robustness. Keep modules aligned with SRP.
- Use a ubiquitous language. Keep terminology consistent across code and docs.
- Test-first. Prefer TDD when changing behavior.
- Run golangci-lint v2. When changing code, run
make lintand fix findings. - Use
cmp.Diffin tests. Compare expected vs actual withgithub.com/google/go-cmp/cmp.Diff. - Make logging diagnosable. Logging level MUST be configurable (for example via env vars).
- Prefer lnd libraries. Use lnd-provided APIs/libraries before re-implementing.
Go documentation and commenting (house style)
- Every function should have a comment describing purpose and assumptions.
- Function comments start with the function name (Effective Go), use complete sentences.
- Comments in code should explain intent, not restate the obvious.
Workflow
- Locate the relevant codepath under
go-lcpd/internal/orgo-lcpd/tools/. - If changing protobufs, edit the
.protosources and regenerate instead of hand-editing generated code. - Prefer small, testable changes; add/update unit tests and integration tests as needed.
- If you are authoring/changing
go-lcpd/spec.md, use$lcp-wysiwid-spec.
Validation (run from go-lcpd/)
make gen(only if protobuf / generated code changes)make testmake lintmake fmt
Optional integration test (regtest):
LCP_ITEST_REGTEST=1 go test ./itest/e2e -run Regtest_LNDPayment -count=1 -v