{"slug":"goga-design-by-changes","title":"goga-design-by-changes","summary":"Generate a design document from CODEMANIFEST change analysis","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-08-24T17:38:11.525978Z","repo":{"url":"https://github.com/qarium/goga","stars":32,"forks":0,"license":"BSD-3-Clause","updatedAt":"2026-09-27T19:31:53Z"},"bodyHtml":"<hr>\n<h2>name: goga-design-by-changes\ndescription: Generate a design document from CODEMANIFEST change analysis</h2>\n<h1>Design by Changes</h1>\n<h2>Purpose</h2>\n<p>The agent produces a <strong>design document</strong> — a complete architectural specification derived from <code>CODEMANIFEST</code> changes.</p>\n<p>The design document specifies <strong>what</strong> to implement and <strong>how</strong> to implement it.</p>\n<p>The agent does <strong>not</strong> write implementation code. The agent does <strong>not</strong> produce an execution plan.\nThe agent produces an <strong>architectural specification</strong> where every detail is fully elaborated.</p>\n<hr>\n<h3>Phase 1: DSL Loading</h3>\n<h4>Step 1: Load the DSL specification</h4>\n<p>The agent invokes <code>goga-cell</code> via the <strong>Skill tool</strong>.</p>\n<p>Use <code>goga-cell</code> for:</p>\n<ul>\n<li>Understanding cell structure (CODEMANIFEST, <code>.usages/</code>)</li>\n<li>Interpreting directives (Imports, Usages, Annotations, types, mutations, embeddings)</li>\n<li>Validating syntactic correctness</li>\n</ul>\n<h4>Step 2: Load the DSL application principles</h4>\n<p>The agent invokes <code>goga-cookbook</code> via the <strong>Skill tool</strong>.</p>\n<p>Use <code>goga-cookbook</code> for:</p>\n<ul>\n<li>Selecting between Entity and Routine</li>\n<li>Determining cell granularity</li>\n<li>Choosing the Usages connection form (file / inline / URL)</li>\n<li>Applying principles for writing usage files in <code>.usages/</code></li>\n</ul>\n<hr>\n<h3>Phase 2: Change Collection</h3>\n<h4>Step 1: Git diff CODEMANIFEST</h4>\n<p>The agent diffs all CODEMANIFEST files between the current branch and the base branch.</p>\n<p>Identify:</p>\n<ul>\n<li>Added, removed, and modified contract entities</li>\n<li>Changes to Usages, Imports, Annotations, and re-exports</li>\n<li>New or deleted CODEMANIFEST files</li>\n</ul>\n<p><strong>Output</strong>: Change list grouped by CODEMANIFEST file with entity-level detail.</p>\n<h4>Step 2: Schema — dependency map</h4>\n<p>The agent executes <code>goga schema</code> to retrieve the cell hierarchy.</p>\n<p>Apply <code>--depends-on &lt;cell_path&gt;</code> for each path from Step 1 to locate affected cells.</p>\n<p><strong>Output</strong>: Dependency map scoped to affected cells.</p>\n<hr>\n<h3>Phase 3: Contract Validation</h3>\n<p>The phase objective: produce a <strong>clean CODEMANIFEST</strong> before deep tracing begins. Resolve all static contract defects at this stage.</p>\n<h4>Step 1: Resolve Usages references</h4>\n<p>Determine which Usages entries require reading:</p>\n<ol>\n<li><strong>Gather changed entities</strong> — from Phase 2</li>\n<li><strong>Always read root Usages</strong> — referenced by global <code>Annotations</code></li>\n<li><strong>Always read Usages of changed entities</strong> — referenced by entity/method/property annotations</li>\n<li><strong>Skip unreferenced Usages</strong> — where no changed entity and no global annotation references them</li>\n</ol>\n<p>For each Usages entry with a path value, read the file (paths resolve relative to project root; files reside in <code>.goga/usages/</code>).\nFor each imported usage from <code>Imports</code> → <code>Usages</code>, read <code>{from_path}/.usages/{usage_name}.md</code>.</p>\n<p><strong>Output</strong>: Complete set of resolved Usages specifications.</p>\n<h4>Step 2: Gap analysis</h4>\n<p>Compare CODEMANIFEST contracts against the current implementation.</p>\n<p>Validate with <code>goga-cell</code>:</p>\n<ul>\n<li>Signature syntax, <code>::</code> mutations, <code>-&gt;</code> embeddings, <code>Imports</code> directives</li>\n<li><code>location</code> correctness (file at the same directory level, with extension, no parent traversal)</li>\n<li>Key casing and YAML document structure (header → body → footer)</li>\n</ul>\n<p>Validate with <code>goga-cookbook</code>:</p>\n<ul>\n<li>Entity vs Routine selection (<code>methods</code>/<code>properties</code> present where required, absent where inappropriate)</li>\n<li>Usages connection form (file / inline / URL — conformance to selection criteria)</li>\n<li>Cell granularity (neither too fine-grained nor too coarse)</li>\n</ul>\n<p>Check for:</p>\n<ul>\n<li>Missing contract entities</li>\n<li>Invalid <code>location</code> values</li>\n<li>Missing re-exports</li>\n<li>Signature and behavior mismatches</li>\n<li>Existing code available for reuse</li>\n<li>Existing local <code>&lt;current_cell_path&gt;/.usages/</code> directories and their contents (when present, only for referenced usages)</li>\n<li>Imported usages from other cells via <code>Imports</code> → <code>Usages</code> — verify that referenced files exist at <code>{from_path}/.usages/{usage_name}.md</code></li>\n<li>Test coverage gaps</li>\n</ul>\n<p><strong>Output</strong>: Gap report with specific files and entities.</p>\n<h4>Step 3: Contract consistency audit</h4>\n<p>Verify four consistency dimensions.</p>\n<p>Validate DSL rules with <code>goga-cell</code> at each check:</p>\n<ul>\n<li><code>::</code> mutation rules (base type validation, multi-level chain resolution)</li>\n<li><code>-&gt;</code> embedding rules (type must appear in <code>Imports</code>)</li>\n<li>Annotation reference rules (backtick syntax, resolvability within document context)</li>\n<li><code>Imports</code> rules (no cross-dependencies; same level or below only)</li>\n</ul>\n<p>Validate architectural decisions with <code>goga-cookbook</code>:</p>\n<ul>\n<li>When mutation is justified versus a standard <code>Imports</code> dependency</li>\n<li>When embedding is justified versus a simple import</li>\n<li>Practice connection correctness (each connected practice is referenced in at least one annotation)</li>\n</ul>\n<p>Consistency dimensions:</p>\n<ol>\n<li><p><strong>Interface ↔ Type consistency</strong>: For each entity that accepts or returns a type from <code>Imports</code> or <code>Usages</code>, confirm the type is declared and its shape matches expected usage (fields, methods, and properties referenced by annotations exist in the source type).</p>\n</li>\n<li><p><strong>Type ↔ Mutation consistency</strong>: For each <code>Type::</code> mutation, confirm:</p>\n<ul>\n<li>The base type exists in <code>Imports</code> (correct name/alias) or <code>Usages</code> (qualified name)</li>\n<li>The mutation target exposes methods/properties compatible with the base type contract</li>\n<li>Multi-level mutations (<code>A::B::Cls</code>) form a valid chain where each segment resolves</li>\n</ul>\n</li>\n<li><p><strong>Interface ↔ Interface consistency</strong>: For interacting entities (one entity calls methods on another, one entity passes data to another):</p>\n<ul>\n<li>Output types of entity A match input types expected by entity B</li>\n<li>Method signatures are compatible at the contract level (not merely at the implementation level)</li>\n<li>Shared type references point to the same concrete type</li>\n</ul>\n</li>\n<li><p><strong>Annotations ↔ Entity consistency</strong>: Annotations reference types, usages, and parameters that exist in the current CODEMANIFEST context.</p>\n</li>\n</ol>\n<p>Record each detected inconsistency as a <strong>CODEMANIFEST defect</strong> specifying:</p>\n<ul>\n<li>Exact location in CODEMANIFEST (file, entity, method/property)</li>\n<li>Nature of the inconsistency</li>\n<li>Proposed remediation</li>\n</ul>\n<h4>Step 4: User approval of edits</h4>\n<p>Present all CODEMANIFEST defects to the user via AskUserQuestion (grouped by file). Offer:</p>\n<ol>\n<li><strong>Apply proposed fix</strong> — edit the CODEMANIFEST file</li>\n<li><strong>Propose alternative</strong> — the user describes a different fix</li>\n</ol>\n<p>Also raise questions about:</p>\n<ul>\n<li>Ambiguous CODEMANIFEST aspects</li>\n<li>Implementation details undefined by DSL</li>\n<li>Critical assumptions</li>\n</ul>\n<p>If no defects or questions exist — skip this step.</p>\n<h4>Step 5: Apply edits and validate</h4>\n<p>For each approved change:</p>\n<ol>\n<li>Apply the edit to CODEMANIFEST</li>\n<li>Validate syntactic correctness with <code>goga-cell</code> (<code>::</code> mutations, <code>-&gt;</code> embeddings, <code>Imports</code> structure, key casing)</li>\n<li>Validate Usages decisions with <code>goga-cookbook</code> (connection form, Entity vs Routine, granularity)</li>\n<li>Re-run the linter: <code>goga lint</code></li>\n<li>If the linter reports errors — fix the syntax and re-run</li>\n<li>Verify the change introduces no new inconsistencies</li>\n<li>Assess whether usages require updates</li>\n</ol>\n<p><strong>Output</strong>: Clean CODEMANIFEST ready for tracing.</p>\n<hr>\n<h3>Phase 4: Tracing and Algorithmization</h3>\n<p><strong>Design document core.</strong> Starting from the clean CODEMANIFEST produced in Phase 3, perform detailed elaboration.</p>\n<p>Validate design decisions at each step using <code>goga-cell</code> and <code>goga-cookbook</code>.</p>\n<p>This phase operates as a <strong>self-correcting loop</strong> — any step may surface a CODEMANIFEST defect that Phase 3 static analysis missed. Each step defines explicit transition conditions.</p>\n<h4>Step 1: Code Stack Trace</h4>\n<p>For each contract entry point (method, function, constructor), trace the complete logical chain through the code from start to finish:</p>\n<ol>\n<li><strong>Entry point</strong>: what initiates this code path (constructor invocation, method call, function call)</li>\n<li><strong>Input</strong>: what data arrives, in what form, from where</li>\n<li><strong>Each intermediate step</strong>: what transformation, validation, or lookup occurs; what returns; what passes to the next step</li>\n<li><strong>External calls</strong>: what imported types provide, what Usages libraries return, how they are invoked. If a Usages entry references a file — read that file to understand the actual API and usage patterns</li>\n<li><strong>Output</strong>: the final result, its form, and its destination</li>\n</ol>\n<p>Establish <strong>checkpoints</strong> at each step. Verify:</p>\n<ul>\n<li>Does the data type match what the next step expects?</li>\n<li>Is the transformation logically correct?</li>\n<li>Are there intermediate steps the contract implies but does not specify?</li>\n<li>Does external library usage conform to the actual API (verify against Usages specifications)?</li>\n</ul>\n<p><strong>Contract interaction checkpoints</strong> — additionally verify at each step where entities interact:</p>\n<ul>\n<li><strong>Type flow</strong>: If entity A passes data to entity B, the type declared in A's output must match the type declared in B's input. A mismatch is a CODEMANIFEST consistency error.</li>\n<li><strong>Mutation compatibility</strong>: If a <code>Type::</code> mutation is involved, the mutated type must satisfy the consumer's contractual expectations. If not — record as a CODEMANIFEST defect.</li>\n<li><strong>Interface contract alignment</strong>: When entity X's method calls entity Y's method, verify alignment on data shape (parameter types, return types, error types).</li>\n</ul>\n<p><strong>Important</strong>: Trace by reading actual source files of existing code and actual library documentation for Usages. If a Usages entry points to a specification file — read it. Do not assume — verify.</p>\n<ul>\n<li><strong>Checkpoint passed</strong> → Record the trace. Proceed to the next entry point.</li>\n<li><strong>Checkpoint failed</strong> → Record the defect. Propose a fix to the user via AskUserQuestion.\nUpon approval — apply the edit to CODEMANIFEST, validate (<code>goga-cell</code>, <code>goga-cookbook</code>, linter), check usages,\n<strong>re-trace</strong> the current entry point. Then continue.</li>\n</ul>\n<p>Do not work around contract errors — the defect is in CODEMANIFEST, not in the implementation.</p>\n<p>All entry points traced → proceed to Step 2.</p>\n<h4>Step 2: Analysis</h4>\n<p>Analyze the stack trace results:</p>\n<ul>\n<li>Identify new contract entities and their interactions</li>\n<li>Document implementation details unspecified by DSL (patterns, specific libraries from Usages, architectural decisions)</li>\n<li>Map cross-cutting concerns (error handling, logging, validation, caching, concurrency)</li>\n<li>Identify dependencies between entities</li>\n<li>Surface potential issues and edge cases discovered during tracing</li>\n<li>Map data flows between entities</li>\n</ul>\n<p><strong>Usages/Practices as interface bridges</strong>: A practice (Usages entry) is a <strong>bridging entity</strong> between cells. When an entity must interact with an external library, another cell, or a shared interface — it MUST route through a declared practice. The practice defines the interaction contract. Always route external system connections through the corresponding Usages entry — never bypass a declared practice with a direct dependency.</p>\n<p><strong>Import Usages analysis</strong>: When <code>Imports</code> contains <code>Usages:</code> groups, the agent:</p>\n<ul>\n<li><p>Reads each imported usages file at <code>{from_path}/.usages/{usage_name}.md</code></p>\n</li>\n<li><p>Analyzes how the imported practice applies to the current cell's entities</p>\n</li>\n<li><p>Traces which entities depend on which imported usages</p>\n</li>\n<li><p>Documents the traced dependency in the design (imported usages create traceable cross-cell links, not contractual obligations)</p>\n</li>\n<li><p><strong>Analysis completed without defects</strong> → proceed to Step 3</p>\n</li>\n<li><p><strong>Contract defect detected</strong> → Propose a fix via AskUserQuestion.\nUpon approval — apply the edit, validate (<code>goga-cell</code>, <code>goga-cookbook</code>, linter), check usages,\n<strong>return to Step 1</strong> to re-trace the affected entry points.</p>\n</li>\n</ul>\n<h4>Step 3: Usages analysis</h4>\n<p>For each Usages entry:</p>\n<ul>\n<li><strong>What it provides</strong>: Brief description</li>\n<li><strong>Where used</strong>: Contract entities that reference it</li>\n<li><strong>Why chosen</strong>: Justification</li>\n<li><strong>How exactly</strong>: Specific APIs and call patterns</li>\n</ul>\n<p>For each imported usage from <code>Imports</code> → <code>Usages</code>:</p>\n<ul>\n<li><p>Read the file at <code>{from_path}/.usages/{usage_name}.md</code></p>\n</li>\n<li><p>Document the traceable dependency</p>\n</li>\n<li><p><strong>All practices used correctly</strong> → proceed to Step 4</p>\n</li>\n<li><p><strong>Practice unreferenced in any annotation</strong> → Propose a fix (add annotation reference or remove the practice).\nUpon approval — apply the edit, validate (<code>goga-cell</code>, <code>goga-cookbook</code>, linter),\n<strong>return to Step 1</strong> to re-trace the affected entry points.</p>\n</li>\n</ul>\n<h4>Step 4: Cross-cutting concerns</h4>\n<p>Specify cross-cutting concerns:</p>\n<ul>\n<li><p><strong>Error handling</strong>: Global strategy</p>\n</li>\n<li><p><strong>Validation</strong>: Locations, rules, behavior on invalid data</p>\n</li>\n<li><p><strong>Logging</strong>: What is logged, at what level, what data</p>\n</li>\n<li><p><strong>Caching</strong>: What is cached, the strategy (if applicable)</p>\n</li>\n<li><p><strong>Concurrency</strong>: Thread safety requirements (if applicable)</p>\n</li>\n<li><p><strong>Cross-cutting concerns consistent with the contract</strong> → proceed to Step 5</p>\n</li>\n<li><p><strong>Contract defect detected</strong> (e.g., error strategy contradicts method signatures) → Propose a fix via AskUserQuestion.\nUpon approval — apply the edit, validate (<code>goga-cell</code>, <code>goga-cookbook</code>, linter), check usages,\n<strong>return to Step 1</strong> to re-trace the affected entry points.</p>\n</li>\n</ul>\n<h4>Step 5: Test scenarios</h4>\n<p>Generate and <strong>record</strong> test scenarios with full call stacks. Each test is written into the design document — tests are deliverables, not intermediate artifacts.</p>\n<p><strong>6 mandatory elements per test:</strong></p>\n<ol>\n<li><strong>Name</strong>: <code>&lt;test name&gt;</code> — self-documenting, following target language conventions</li>\n<li><strong>Setup</strong>: Exact configuration (fixtures, mocks, tmp_path contents) with concrete values</li>\n<li><strong>Input</strong>: Exact values passed to the function under test</li>\n<li><strong>Trace</strong>: Step-by-step code execution — what each function receives, returns, and produces as side effects</li>\n<li><strong>Assertions</strong>: Specific checks with exact expected values</li>\n<li><strong>Sufficiency</strong>: Why this test exists, what regression it prevents</li>\n</ol>\n<p><strong>Categories:</strong></p>\n<ul>\n<li><p><strong>Positive</strong> — happy path, defaults, explicit values</p>\n</li>\n<li><p><strong>Negative</strong> — invalid input, missing dependencies</p>\n</li>\n<li><p><strong>Edge cases</strong> — empty data, boundary values, idempotency</p>\n</li>\n<li><p><strong>Tests reveal no contract defects</strong> → proceed to Step 6</p>\n</li>\n<li><p><strong>Test exposes type or logic incompatibility in contract</strong> → Propose a fix via AskUserQuestion.\nUpon approval — apply the edit, validate (<code>goga-cell</code>, <code>goga-cookbook</code>, linter), check usages,\n<strong>return to Step 1</strong> to re-trace the affected entry points.</p>\n</li>\n</ul>\n<h4>Step 6: Usages and <code>.usages/</code> consistency</h4>\n<p><strong>Critical distinction — <code>Usages</code> directive vs practice directories</strong>: These are <strong>independent</strong> concepts:</p>\n<ul>\n<li><strong><code>Usages</code> directive</strong> (in CODEMANIFEST header) — internal practices consumed by cell entities (libraries, patterns, conventions). Path values resolve to <code>.goga/usages/</code></li>\n<li><strong><code>&lt;current_cell_path&gt;/.usages/</code> directory</strong> (in the cell folder) — external documentation for consumers importing this cell. Describes how to work with the cell API</li>\n</ul>\n<p>For each affected cell:</p>\n<ol>\n<li>If <code>.usages/</code> does not exist — skip</li>\n<li>If <code>.usages/</code> exists — read and verify:\n<ul>\n<li>Described APIs match the current CODEMANIFEST</li>\n<li>Which entities lack coverage</li>\n<li>Which descriptions are outdated</li>\n</ul>\n</li>\n</ol>\n<p>Use <code>goga-cookbook</code> for decision-making: <code>.usages/</code> file update rules, usage file authoring principles, criteria for supplementing an existing file versus creating a new one.</p>\n<p><strong>Functional categories</strong>: A cell implements logic divisible into semantic domains. If existing <code>.usages/</code> files follow a category-based organization — preserve that structure.</p>\n<p><strong>Decision rules:</strong></p>\n<ul>\n<li>Changes within an existing domain → <strong>supplement</strong> the existing file</li>\n<li>New functional domain → <strong>create</strong> a new file</li>\n<li>Outdated descriptions → <strong>update</strong> in place</li>\n<li><strong>Do NOT add CODEMANIFEST <code>Usages</code> references pointing to own <code>.usages/</code> files</strong> — <code>.usages/</code> is consumer documentation, not a source of contractual requirements</li>\n</ul>\n<p>Propose changes and obtain user confirmation.</p>\n<p>Phase complete → proceed to Phase 5.</p>\n<hr>\n<h3>Phase 5: Persist the design document</h3>\n<h4>Step 1: Write from template</h4>\n<p>Write results to a file using the template from <code>design-doc-template.md</code>.</p>\n<h4>Step 2: Save</h4>\n<p>Path: <code>docs/design/&lt;feature-name&gt;.md</code>.</p>\n<ul>\n<li>Prompt for the feature name if not obvious</li>\n<li>Create the <code>docs/design/</code> directory if it does not exist</li>\n<li>Overwrite if the file already exists</li>\n</ul>\n<hr>\n","files":[{"path":"design-doc-template.md","sizeBytes":4147,"isText":true},{"path":"SKILL.md","sizeBytes":15825,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-10T18:19:02.112639Z","sha256":"7B99A6C609FACCCEB5322C397AB8B4C2B9343545A33DDBD2E046AECB13BDC5A3","sizeBytes":7627},"review":null,"source":{"repositoryUrl":"https://github.com/qarium/goga","path":"goga/assets/skills/goga-design-by-changes","license":"BSD-3-Clause","commit":"9fdb39b191bec889e345e42ffa1549d2727ca247","subtreeSha":"6C0B7E3863C1E7563D6853DBDB4CEB2EA034F9FDCC33D9D7C2CC5D1F3940180F","lastSyncedAt":"2026-09-27T20:56:56.704728Z"},"reviewedAt":"2026-09-10T18:19:31.075752Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/qarium/goga/tree/1.2.x/goga/assets/skills/goga-design-by-changes"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install qarium-goga@llmmart"},{"target":"git","command":"git clone https://github.com/qarium/goga.git"}]}