update-spec

19
0
Source

Update Spec - Capture Knowledge into Specifications

Install

mkdir -p .claude/skills/update-spec && curl -L -o skill.zip "https://mcp.directory/api/skills/download/1156" && unzip -o skill.zip -d .claude/skills/update-spec && rm skill.zip

Installs to .claude/skills/update-spec

About this skill

Update Code-Spec - Capture Executable Contracts

When you learn something valuable (from debugging, implementing, or discussion), use this skill to update the relevant code-spec documents.

Timing: After completing a task, fixing a bug, or discovering a new pattern


Code-Spec First Rule (CRITICAL)

In this project, "spec" for implementation work means code-spec:

  • Executable contracts (not principle-only text)
  • Concrete signatures, payload fields, env keys, and boundary behavior
  • Testable validation/error behavior

If the change touches infra or cross-layer contracts, code-spec depth is mandatory.

Required sections for infra/cross-layer specs:

  1. Scope / Trigger
  2. Signatures (command/API/DB)
  3. Contracts (request/response/env)
  4. Validation & Error Matrix
  5. Good/Base/Bad Cases
  6. Tests Required (with assertion points)
  7. Wrong vs Correct (at least one pair)

When to Update Code-Specs

TriggerExampleTarget Spec
Implemented a featureAdded template download with gigetRelevant backend/ or frontend/ file
Made a design decisionUsed type field + mapping table for extensibilityRelevant code-spec + "Design Decisions" section
Fixed a bugFound a subtle issue with error handlingbackend/error-handling.md
Discovered a patternFound a better way to structure codeRelevant backend/ or frontend/ file
Hit a gotchaLearned that X must be done before YRelevant code-spec + "Common Mistakes" section
Established a conventionTeam agreed on naming patternquality-guidelines.md
New thinking trigger"Don't forget to check X before doing Y"guides/*.md (as a checklist item, not detailed rules)

Key Insight: Code-spec updates are NOT just for problems. Every feature implementation contains design decisions and contracts that future AI/developers need to execute safely.


Spec Structure Overview

.trellis/spec/
├── backend/           # Backend coding standards
│   ├── index.md       # Overview and links
│   └── *.md           # Topic-specific guidelines
├── frontend/          # Frontend coding standards
│   ├── index.md       # Overview and links
│   └── *.md           # Topic-specific guidelines
└── guides/            # Thinking checklists (NOT coding specs!)
    ├── index.md       # Guide index
    └── *.md           # Topic-specific guides

CRITICAL: Code-Spec vs Guide - Know the Difference

TypeLocationPurposeContent Style
Code-Specbackend/*.md, frontend/*.mdTell AI "how to implement safely"Signatures, contracts, matrices, cases, test points
Guideguides/*.mdHelp AI "what to think about"Checklists, questions, pointers to specs

Decision Rule: Ask yourself:

  • "This is how to write the code" → Put in backend/ or frontend/
  • "This is what to consider before writing" → Put in guides/

Example:

LearningWrong LocationCorrect Location
"Use reconfigure() not TextIOWrapper for Windows stdout"guides/cross-platform-thinking-guide.mdbackend/script-conventions.md
"Remember to check encoding when writing cross-platform code"backend/script-conventions.mdguides/cross-platform-thinking-guide.md

Guides should be short checklists that point to specs, not duplicate the detailed rules.


Update Process

Step 1: Identify What You Learned

Answer these questions:

  1. What did you learn? (Be specific)
  2. Why is it important? (What problem does it prevent?)
  3. Where does it belong? (Which spec file?)

Step 2: Classify the Update Type

TypeDescriptionAction
Design DecisionWhy we chose approach X over YAdd to "Design Decisions" section
Project ConventionHow we do X in this projectAdd to relevant section with examples
New PatternA reusable approach discoveredAdd to "Patterns" section
Forbidden PatternSomething that causes problemsAdd to "Anti-patterns" or "Don't" section
Common MistakeEasy-to-make errorAdd to "Common Mistakes" section
ConventionAgreed-upon standardAdd to relevant section
GotchaNon-obvious behaviorAdd warning callout

Step 3: Read the Target Code-Spec

Before editing, read the current code-spec to:

  • Understand existing structure
  • Avoid duplicating content
  • Find the right section for your update
cat .trellis/spec/<category>/<file>.md

Step 4: Make the Update

Follow these principles:

  1. Be Specific: Include concrete examples, not just abstract rules
  2. Explain Why: State the problem this prevents
  3. Show Contracts: Add signatures, payload fields, and error behavior
  4. Show Code: Add code snippets for key patterns
  5. Keep it Short: One concept per section

Step 5: Update the Index (if needed)

If you added a new section or the code-spec status changed, update the category's index.md.


Update Templates

Mandatory Template for Infra/Cross-Layer Work

## Scenario: <name>

### 1. Scope / Trigger
- Trigger: <why this requires code-spec depth>

### 2. Signatures
### 3. Contracts
### 4. Validation & Error Matrix
### 5. Good/Base/Bad Cases
### 6. Tests Required
### 7. Wrong vs Correct
#### Wrong
...
#### Correct
...

Adding a Design Decision

### Design Decision: [Decision Name]

**Context**: What problem were we solving?

**Options Considered**:
1. Option A - brief description
2. Option B - brief description

**Decision**: We chose Option X because...

**Example**:
\`\`\`typescript
// How it's implemented
code example
\`\`\`

**Extensibility**: How to extend this in the future...

Adding a Project Convention

### Convention: [Convention Name]

**What**: Brief description of the convention.

**Why**: Why we do it this way in this project.

**Example**:
\`\`\`typescript
// How to follow this convention
code example
\`\`\`

**Related**: Links to related conventions or specs.

Adding a New Pattern

### Pattern Name

**Problem**: What problem does this solve?

**Solution**: Brief description of the approach.

**Example**:
\`\`\`
// Good
code example

// Bad
code example
\`\`\`

**Why**: Explanation of why this works better.

Adding a Forbidden Pattern

### Don't: Pattern Name

**Problem**:
\`\`\`
// Don't do this
bad code example
\`\`\`

**Why it's bad**: Explanation of the issue.

**Instead**:
\`\`\`
// Do this instead
good code example
\`\`\`

Adding a Common Mistake

### Common Mistake: Description

**Symptom**: What goes wrong

**Cause**: Why this happens

**Fix**: How to correct it

**Prevention**: How to avoid it in the future

Adding a Gotcha

> **Warning**: Brief description of the non-obvious behavior.
>
> Details about when this happens and how to handle it.

Interactive Mode

If you're unsure what to update, answer these prompts:

  1. What did you just finish?

    • Fixed a bug
    • Implemented a feature
    • Refactored code
    • Had a discussion about approach
  2. What did you learn or decide?

    • Design decision (why X over Y)
    • Project convention (how we do X)
    • Non-obvious behavior (gotcha)
    • Better approach (pattern)
  3. Would future AI/developers need to know this?

    • To understand how the code works → Yes, update spec
    • To maintain or extend the feature → Yes, update spec
    • To avoid repeating mistakes → Yes, update spec
    • Purely one-off implementation detail → Maybe skip
  4. Which area does it relate to?

    • Backend code
    • Frontend code
    • Cross-layer data flow
    • Code organization/reuse
    • Quality/testing

Quality Checklist

Before finishing your code-spec update:

  • Is the content specific and actionable?
  • Did you include a code example?
  • Did you explain WHY, not just WHAT?
  • Did you include executable signatures/contracts?
  • Did you include validation and error matrix?
  • Did you include Good/Base/Bad cases?
  • Did you include required tests with assertion points?
  • Is it in the right code-spec file?
  • Does it duplicate existing content?
  • Would a new team member understand it?

Relationship to Other Commands

Development Flow:
  Learn something → $update-spec → Knowledge captured
       ↑                                  ↓
  $break-loop ←──────────────────── Future sessions benefit
  (deep bug analysis)
  • $break-loop - Analyzes bugs deeply, often reveals spec updates needed
  • $update-spec - Actually makes the updates (this skill)
  • $finish-work - Reminds you to check if specs need updates

Core Philosophy

Code-specs are living documents. Every debugging session, every "aha moment" is an opportunity to make the implementation contract clearer.

The goal is institutional memory:

  • What one person learns, everyone benefits from
  • What AI learns in one session, persists to future sessions
  • Mistakes become documented guardrails

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

286790

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

212415

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

209292

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

218234

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

171200

rust-coding-skill

UtakataKyosui

Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.

165173

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.