name: software-engineer
description: Implement features and bugfixes for the Gleam-based LTI 1.3 example tool lti-example-tool. Use when asked to debug, investigate, implement, or ship product changes; for larger features, drive execution from docs/features//prd.md, fdd.md, and plan.md.
Software Engineer
Overview
Execute pragmatic, production-quality feature and bugfix work for this repository's Gleam + Erlang/OTP + Wisp/Mist LTI 1.3 tool stack.
Core Workflow
- Gather context.
- Read the prompt, related code paths, tests, and recent diffs.
- Start with the relevant modules:
- app startup/context:
src/lti_example_tool.gleam,src/lti_example_tool/application.gleam - web routing/middleware:
src/lti_example_tool_web/router.gleam,src/lti_example_tool_web/web.gleam - LTI endpoints:
src/lti_example_tool_web/controllers/lti_controller.gleam - registration flows:
src/lti_example_tool_web/controllers/registration_controller.gleam - persistence/repositories:
src/lti_example_tool/{database,registrations,deployments,jwks,nonces}.gleam
- app startup/context:
- Identify affected domains: LTI launch/auth, AGS/NRPS services, registration/deployment management, and DB-backed security state.
- Classify the work size.
- Use
investigationfor root-cause analysis or uncertain requirements. - Use
small-changefor isolated bugfixes or narrowly scoped feature updates. - Use
feature-deliveryfor larger functionality that should follow a feature spec.
- Select execution path.
investigation: Reproduce, isolate, form hypothesis, validate with evidence, propose minimal fix.small-change: Implement smallest safe patch, preserve behavior outside scope, add/update tests.feature-delivery: Read spec files in order:docs/features/<feature>/prd.mddocs/features/<feature>/fdd.mddocs/features/<feature>/plan.mdTreatprd.mdas product source of truth,fdd.mdas design constraints,plan.mdas execution sequence.
- Implement with stack discipline.
- Keep Gleam types and module interfaces explicit; prefer small composable functions and
Result-driven error flow. - Keep routing and method checks explicit in router/controllers (no hidden routing DSL behavior).
- Reuse existing repository modules instead of ad-hoc SQL in controllers.
- Preserve backward compatibility for web contracts unless the spec explicitly changes them.
- For LTI/LMS behavior, enforce launch/auth correctness (OIDC state/nonce, claims, issuer/client/deployment matching), and AGS/NRPS semantics.
- Keep user-facing errors safe; log implementation details with
logger.error_meta. - If data model changes are required:
- Add migration SQL in
priv/repo/migrations/. - Update decoders/repository modules.
- Update seeds handling if needed (
src/lti_example_tool/seeds.gleam,seeds.ymlschema assumptions).
- Add migration SQL in
- Verify before handoff.
- Run the narrowest relevant tests first, then broader suites as needed.
- Validate error paths, edge cases, and integration assumptions.
- Confirm docs/config/migrations are updated when behavior changes.
- Project validation commands (prefer this order when relevant):
gleam buildgleam run -m lti_example_tool/database/migrate test.setupgleam testgleam format --check src test
- Report clearly.
- State what changed, why, and what was validated.
- List assumptions, risks, and follow-up tasks if scope was constrained.
Delivery Rules
- Prefer small, reviewable commits and minimal blast radius.
- Avoid speculative refactors unless required to complete the task safely.
- Preserve repository conventions:
- explicit route matching in
router.gleam - middleware behavior in
web.gleam - server-rendered HTML via Nakai modules under
src/lti_example_tool_web/html*
- explicit route matching in
- Escalate contradictions between spec files; do not silently guess.
References
- Use references/execution-checklists.md for repeatable checklists.
- Keep
AGENTS.mdas the project-specific source of truth for architecture and operational commands.