techygarg/lattice-code-forge
Generate implementation code from an approved design blueprint or verbal requirements. Composes context anchoring, architecture, clean code, DDD, security, and test quality into an inside-out implementation workflow. Use when moving from design to code, implementing approved contracts, or when the user says 'implement', 'code this', 'build it', 'forge the code', or 'generate the code'.
This is a copy. The original lives at techygarg/code-forge.
npx skills add https://github.com/techygarg/lattice --skill code-forge
Read, apply:
framework:knowledge-priming -- Load proj context (stack, arch, conventions) so impl matches real proj (always)framework:context-anchoring -- Load/find context anchor doc; enrich as impl decisions made (always)framework:learning-harvest -- Load prior operational learnings inform impl; harvest new patterns at session end (always)framework:collaborative-judgment -- Surface real judgment calls w/ structured opts vs silent assume (always)framework:architecture -- Layer place, dep direction, struct valid (always)framework:clean-code -- Craft rails: SRP, naming, complexity, err handle (always)framework:domain-driven-design -- Aggregates, entities, VOs, domain svcs (conditional: only when touch domain folder)framework:secure-coding -- Trust bounds, injection prevent, secrets mgmt (conditional: only boundary-cross code)framework:test-quality -- AAA struct, isolation, assert quality, naming (always when write tests)Use framework:learning-harvest Load behavior. Focus hint: "implementation session — focus: implementation craft, quality signals, reliability".
Use framework:context-anchoring Doc Discovery check existing context anchor doc for feature impl.
Design completeness check — STOP gates before Step 2:
Check 1 — status: Read frontmatter status.
approved → pass.status: [value]). Run design-blueprint first. Proceed anyway?" Confirm → log in Decisions Log, continue as "Without approved design."Check 2 — levels present: Scan body for ## Design: Level 3 and ## Design: Level 4.
Both pass → proceed as "With approved design".
With approved design: Extract component list, layer assigns from context anchor doc. Use L2 (Components) decisions for layer place, L3 (Interactions) for dep flow.
Without approved design: Classify req components→arch layers using layer defs from framework:architecture. Each component, determine:
If framework:architecture no loaded layer defs (neither defaults nor custom doc resolved), warn: "No arch rules avail. Run /architecture-refiner define arch standards. Proceed w/o arch guidance." Continue w/ only remaining atom rails.
Present proposed layer assigns→user for approval before proceed.
Both cases, plan inside-out impl order following dep direction from loaded arch doc — start innermost layer (no outward deps), work outward. Each layer's deps should exist when built.
Classify each op per flow patterns in loaded arch doc (e.g., cmd vs query flows, or equiv distinction your arch style).
Present impl plan -- ordered component list, layer assigns, flow classifs -- confirm w/ user before write code.
After plan approved, ask user choose review mode:
> "How review impl?"
> 1. Layer-by-layer (rec) -- Impl each layer fully, pause for review before next. One review pt/layer.
> 2. Full autonomy -- Impl everything end-to-end, present complete result. One review pt at end. (If blueprint exists, still pause any deviation from approved design.)
> 3. Component-by-component -- Pause after each individual component for feedback. Max review pts.
Default layer-by-layer if user no preference.
Each component in planned order, gen code+tests together -- tests not afterthought.
Every component:
framework:architecture. Valid dep direction follows loaded arch rules.framework:clean-code self-valid during gen. Run inline checks: SRP comply, meaningful naming, low cyclomatic complexity, proper err handle, no magic vals, clean func sigs, no dead code, appropriate abstract level, clear control flow, minimal comments (code self-doc).framework:test-quality self-valid.Conditional checks per component:
framework:domain-driven-design self-valid.framework:secure-coding self-valid.Post-Gen Verification (applies every component, all review modes):
After gen each component, before present→user:
framework:collaborative-judgment protocol before show code. Don't silent resolve.Pacing -- follow user's chosen review mode:
Step checks arch coherence -- not code quality (verified per-component Step 3). After all components impl:
framework:architecture verif across all components — verify inter-component dep direction follows loaded arch rules. No layer import from layer not permitted depend.framework:secure-coding across component boundaries. Check data flowing between components crosses trust bounds safely.Throughout Steps 3-4, use framework:context-anchoring Enrich behavior keep living doc current:
Harvest learnings. Use framework:learning-harvest Harvest behavior. Session context: "implementation session — code generation from design contracts". Synthesize and propose cross-cutting patterns from this session — implementation gotchas, design-to-reality gaps, library/framework lessons. User confirms what enters the document. STOP: run this before closing the feature lifecycle below.
Close feature lifecycle: Write status: complete to context doc frontmatter. STOP: required.
STOP: do not write status to requirement_doc. The feature file's status is owned by whoever manages the requirement — a human, or an external system it may live in. This molecule manages its own context doc only.
After enrich context doc, recommend review:
> "Impl complete. Recommend run /review on gen code before consider feature done -- provides independent quality assess against same atom standards, catches issues generator may blind to, captures learnings future sessions."
Take techygarg/lattice-code-forge from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.