搜索

PythonReactSEOPDF
GitHub Skill

retrofit-spec

Create a feature specification from existing code

asermax☆ 1 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Retrofit Spec

Create a feature specification from existing code implementation.

Input

Path to file or module: $ARGUMENTS

Context

You must load the following skills and read the following files before proceeding.

Skills
  • katachi:retrofit-existing - Retrofit workflow
Feature documentation structure
  • docs/feature-specs/ - Existing feature documentation to understand organization
  • docs/feature-specs/README.md - Top-level feature index (if exists)
  • Domain README files in feature-specs/ folders
Vision (if present)
  • docs/planning/VISION.md - Project context for inference

Pre-Check

Verify:

  • The specified path exists
  • Framework is initialized (or offer to initialize)
  • User understands this creates documentation for existing code

Process

1. Read and Analyze Code

Read the target file(s):

  • If single file: Read the file
  • If directory: Read key files in the module
2. Dispatch Codebase Analyzer
Task(
    subagent_type="katachi:codebase-analyzer",
    prompt=f"""
Analyze this code to create a feature specification.

## Analysis Type
spec

## Target Files
{file_contents}

## Project Context
{vision_content if exists else "No VISION.md - infer project context from code"}
"""
)
3. Present Draft Spec

Show the agent's draft spec:

## Draft Specification

Based on analyzing [path], here's a draft spec:

[Draft spec content]

---

### Notes from Analysis
- [Assumptions made]
- [Uncertainties]
- [Areas needing clarification]

What needs adjustment in this spec?
4. Iterate on Spec

User provides corrections:

  • Clarify user story
  • Adjust acceptance criteria
  • Add missing scenarios
  • Correct misunderstandings

Continue iteration until user approves.

5. Determine Feature Organization

Analyze existing feature-specs/ structure:

"Looking at existing feature documentation, where should this belong?

Existing capability domains:
- auth/ - [description]
- api/ - [description]
- [etc.]

Should this be:
A) New sub-capability in existing domain (e.g., auth/new-feature.md)
B) New capability domain (create new folder)
C) Standalone feature (top-level .md file)

Which organization makes sense?"
6. Save Feature Spec

Write spec to appropriate location in docs/feature-specs/:

  • If domain/sub-capability: docs/feature-specs/[domain]/[feature].md
  • If new domain: Create folder with README.md + feature.md
  • If standalone: docs/feature-specs/[feature].md

Include retrofit note:

# [Feature Name]

## Retrofit Note

This spec was created from existing code at `[path]`.
Original implementation date: [Unknown / from git history if available]

---

[Rest of spec content]

## Related Deltas
(To be added when deltas implement changes to this feature)
7. Update Domain README

If adding to existing domain:

  • Update docs/feature-specs/[domain]/README.md
  • Add entry to sub-capabilities table

If creating new domain:

  • Create docs/feature-specs/[domain]/README.md
  • Add domain to top-level docs/feature-specs/README.md
8. Summary and Next Steps
"Feature spec created for existing code:

File: docs/feature-specs/[path]
Type: [Domain/Sub-capability/Standalone]

The feature documentation has been created. You can now:
- Retrofit design rationale: /katachi:retrofit-design [path]
- Retrofit another module: /katachi:retrofit-spec <path>
- Document a specific decision: /katachi:retrofit-decision <topic>

**Recommended next step:** Run `/katachi:retrofit-design [path]` to:
- Capture the design rationale behind the implementation
- Automatically discover and document undocumented ADR/DES patterns
- Create a complete design document from the existing code"

Workflow

This is a collaborative process:

  • Read and analyze code
  • Present draft spec from agent
  • Iterate with user corrections
  • Determine feature organization (domain/sub-capability)
  • Save spec in appropriate location
  • Update domain READMEs
  • Offer next steps

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!