.agents/skills/update-spec/SKILL.md
Captures executable contracts and coding knowledge into .trellis/spec/ documents after implementation, debugging, or design decisions. Enforces code-spec depth for infra and cross-layer changes with mandatory sections for signatures, contracts, validation matrices, and test points. Use when a feature is implemented, a bug is fixed, a design decision is made, a new pattern is discovered, or cross-layer contracts change.
npx skillsauth add basui01/agentflow update-specInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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
In this project, "spec" for implementation work means code-spec:
If the change touches infra or cross-layer contracts, code-spec depth is mandatory.
Required sections for infra/cross-layer specs:
| Trigger | Example | Target Spec |
|---------|---------|-------------|
| Implemented a feature | Added template download with giget | Relevant backend/ or frontend/ file |
| Made a design decision | Used type field + mapping table for extensibility | Relevant code-spec + "Design Decisions" section |
| Fixed a bug | Found a subtle issue with error handling | backend/error-handling.md |
| Discovered a pattern | Found a better way to structure code | Relevant backend/ or frontend/ file |
| Hit a gotcha | Learned that X must be done before Y | Relevant code-spec + "Common Mistakes" section |
| Established a convention | Team agreed on naming pattern | quality-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.
.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
| Type | Location | Purpose | Content Style |
|------|----------|---------|---------------|
| Code-Spec | backend/*.md, frontend/*.md | Tell AI "how to implement safely" | Signatures, contracts, matrices, cases, test points |
| Guide | guides/*.md | Help AI "what to think about" | Checklists, questions, pointers to specs |
Decision Rule: Ask yourself:
backend/ or frontend/guides/Example:
| Learning | Wrong Location | Correct Location |
|----------|----------------|------------------|
| "Use reconfigure() not TextIOWrapper for Windows stdout" | ❌ guides/cross-platform-thinking-guide.md | ✅ backend/script-conventions.md |
| "Remember to check encoding when writing cross-platform code" | ❌ backend/script-conventions.md | ✅ guides/cross-platform-thinking-guide.md |
Guides should be short checklists that point to specs, not duplicate the detailed rules.
Answer these questions:
| Type | Description | Action | |------|-------------|--------| | Design Decision | Why we chose approach X over Y | Add to "Design Decisions" section | | Project Convention | How we do X in this project | Add to relevant section with examples | | New Pattern | A reusable approach discovered | Add to "Patterns" section | | Forbidden Pattern | Something that causes problems | Add to "Anti-patterns" or "Don't" section | | Common Mistake | Easy-to-make error | Add to "Common Mistakes" section | | Convention | Agreed-upon standard | Add to relevant section | | Gotcha | Non-obvious behavior | Add warning callout |
Before editing, read the current code-spec to:
cat .trellis/spec/<category>/<file>.md
Follow these principles:
If you added a new section or the code-spec status changed, update the category's index.md.
## 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
...
### 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...
### 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.
### 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.
### 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
\`\`\`
### Common Mistake: Description
**Symptom**: What goes wrong
**Cause**: Why this happens
**Fix**: How to correct it
**Prevention**: How to avoid it in the future
> **Warning**: Brief description of the non-obvious behavior.
>
> Details about when this happens and how to handle it.
If you're unsure what to update, answer these prompts:
What did you just finish?
What did you learn or decide?
Would future AI/developers need to know this?
Which area does it relate to?
Before finishing your code-spec update:
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 updatesCode-specs are living documents. Every debugging session, every "aha moment" is an opportunity to make the implementation contract clearer.
The goal is institutional memory:
development
Multi-agent pipeline orchestrator that plans and dispatches parallel development tasks to worktree agents. Reads project context, configures task directories with PRDs and jsonl context files, and launches isolated coding agents. Use when multiple independent features need parallel development, orchestrating worktree agents, or managing multi-agent coding pipelines.
development
Initializes an AI development session by reading workflow guides, developer identity, git status, active tasks, and project guidelines from .trellis/. Classifies incoming tasks and routes to brainstorm, direct edit, or task workflow. Use when beginning a new coding session, resuming work, starting a new task, or re-establishing project context.
development
Records completed work progress to .trellis/workspace/ journal files after human testing and commit. Captures session summaries, commit hashes, and updates developer index files for future session context. Use when a coding session is complete, after the human has committed code, or to persist session knowledge for future AI sessions.
development
Interactive three-part onboarding for new team members to the Trellis AI-assisted workflow system. Covers core philosophy (AI memory, project-specific knowledge, context drift), system structure and command deep-dives, real-world workflow examples, and guideline customization. Use when a new developer joins the project, someone needs to understand the Trellis workflow, or project guidelines need initial setup.