codeforge-dev 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/.devcontainer/CHANGELOG.md +51 -0
  2. package/.devcontainer/CLAUDE.md +1 -1
  3. package/.devcontainer/config/defaults/rules/spec-workflow.md +67 -0
  4. package/.devcontainer/config/defaults/rules/workspace-scope.md +7 -0
  5. package/.devcontainer/config/defaults/settings.json +63 -66
  6. package/.devcontainer/config/file-manifest.json +30 -18
  7. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +104 -97
  8. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/.claude-plugin/plugin.json +7 -0
  9. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/README.md +158 -0
  10. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/hooks/hooks.json +39 -0
  11. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/collect-edited-files.py +47 -0
  12. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/format-on-stop.py +297 -0
  13. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/lint-file.py +536 -0
  14. package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/syntax-validator.py +146 -0
  15. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +77 -1
  16. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +18 -0
  17. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +18 -0
  18. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +86 -1
  19. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +18 -0
  20. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +142 -8
  21. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +18 -0
  22. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +108 -1
  23. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +24 -0
  24. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +97 -1
  25. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +33 -1
  26. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +24 -0
  27. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +29 -1
  28. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +96 -1
  29. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +100 -95
  30. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/spec-reminder.py +121 -0
  31. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-check/SKILL.md +86 -0
  32. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/SKILL.md +97 -0
  33. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/backlog-template.md +7 -0
  34. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-init/references/roadmap-template.md +13 -0
  35. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/SKILL.md +101 -0
  36. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-new/references/template.md +110 -0
  37. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/spec-update/SKILL.md +124 -0
  38. package/.devcontainer/scripts/setup-config.sh +86 -83
  39. package/package.json +42 -42
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Spec reminder — Stop hook that advises about spec updates after code changes.
4
+
5
+ On Stop, checks if source code was modified but no .specs/ files were updated.
6
+ Injects an advisory reminder as additionalContext pointing the user to
7
+ /spec-update.
8
+
9
+ Only fires when a .specs/ directory exists (project uses the spec system).
10
+
11
+ Reads hook input from stdin (JSON). Returns JSON on stdout.
12
+ Always exits 0 (advisory, never blocking).
13
+ """
14
+
15
+ import json
16
+ import os
17
+ import subprocess
18
+ import sys
19
+
20
+ GIT_CMD_TIMEOUT = 5
21
+
22
+ # Directories whose changes should trigger the spec reminder
23
+ CODE_DIRS = (
24
+ "src/",
25
+ "lib/",
26
+ "app/",
27
+ "pkg/",
28
+ "internal/",
29
+ "cmd/",
30
+ "tests/",
31
+ "api/",
32
+ "frontend/",
33
+ "backend/",
34
+ "packages/",
35
+ "services/",
36
+ "components/",
37
+ "pages/",
38
+ "routes/",
39
+ )
40
+
41
+
42
+ def _run_git(args: list[str]) -> str | None:
43
+ """Run a git command and return stdout, or None on any failure."""
44
+ try:
45
+ result = subprocess.run(
46
+ ["git"] + args,
47
+ capture_output=True,
48
+ text=True,
49
+ timeout=GIT_CMD_TIMEOUT,
50
+ )
51
+ if result.returncode == 0:
52
+ return result.stdout.strip()
53
+ except (FileNotFoundError, OSError, subprocess.TimeoutExpired):
54
+ pass
55
+ return None
56
+
57
+
58
+ def main():
59
+ try:
60
+ input_data = json.load(sys.stdin)
61
+ except (json.JSONDecodeError, ValueError):
62
+ sys.exit(0)
63
+
64
+ # Skip if another Stop hook is already blocking
65
+ if input_data.get("stop_hook_active"):
66
+ sys.exit(0)
67
+
68
+ cwd = os.getcwd()
69
+
70
+ # Only fire if this project uses the spec system
71
+ if not os.path.isdir(os.path.join(cwd, ".specs")):
72
+ sys.exit(0)
73
+
74
+ # Get all changed files (staged + unstaged)
75
+ diff_output = _run_git(["diff", "--name-only", "HEAD"])
76
+ staged_output = _run_git(["diff", "--name-only", "--cached"])
77
+
78
+ # Also include untracked files in source dirs
79
+ untracked = _run_git(["ls-files", "--others", "--exclude-standard"])
80
+
81
+ all_files: set[str] = set()
82
+ for output in (diff_output, staged_output, untracked):
83
+ if output:
84
+ all_files.update(output.splitlines())
85
+
86
+ if not all_files:
87
+ sys.exit(0)
88
+
89
+ # Check if any code directories have changes
90
+ has_code_changes = any(f.startswith(d) for f in all_files for d in CODE_DIRS)
91
+
92
+ if not has_code_changes:
93
+ sys.exit(0)
94
+
95
+ # Check if any spec files were also changed
96
+ has_spec_changes = any(f.startswith(".specs/") for f in all_files)
97
+
98
+ if has_spec_changes:
99
+ # Specs were updated alongside code — no reminder needed
100
+ sys.exit(0)
101
+
102
+ # Code changed but specs didn't — inject reminder
103
+ code_dirs_touched = sorted(
104
+ {f.split("/")[0] + "/" for f in all_files if "/" in f}
105
+ & {d.rstrip("/") + "/" for d in CODE_DIRS}
106
+ )
107
+ dirs_str = ", ".join(code_dirs_touched[:3])
108
+
109
+ message = (
110
+ f"[Spec Reminder] Code was modified in {dirs_str} "
111
+ "but no specs were updated. "
112
+ "Use /spec-update to update the relevant spec, "
113
+ "or /spec-new if no spec exists for this feature."
114
+ )
115
+
116
+ json.dump({"additionalContext": message}, sys.stdout)
117
+ sys.exit(0)
118
+
119
+
120
+ if __name__ == "__main__":
121
+ main()
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: spec-check
3
+ description: >-
4
+ This skill should be used when the user asks to "check spec status",
5
+ "audit specs", "which specs are stale", "spec health", "find missing
6
+ specs", "review spec quality", or needs a comprehensive audit of all
7
+ specifications in the project.
8
+ version: 0.1.0
9
+ context: fork
10
+ agent: explorer
11
+ ---
12
+
13
+ # Spec Health Audit
14
+
15
+ Audit all specifications in the current project and report their health status.
16
+
17
+ ## Workflow
18
+
19
+ ### Step 1: Discover Specs
20
+
21
+ ```
22
+ Glob: .specs/**/*.md
23
+ ```
24
+
25
+ If `.specs/` does not exist, report: "No specification directory found. Use `/spec-new` to create your first spec."
26
+
27
+ Exclude non-spec files:
28
+ - `ROADMAP.md`
29
+ - `BACKLOG.md`
30
+ - `LESSONS_LEARNED.md`
31
+ - Files in `archive/`
32
+ - `_overview.md` files (report them separately as parent specs)
33
+
34
+ ### Step 2: Read Each Spec
35
+
36
+ For each spec file, extract:
37
+ - **Feature name** from the `# Feature: [Name]` header
38
+ - **Version** from the `**Version:**` field
39
+ - **Status** from the `**Status:**` field
40
+ - **Last Updated** from the `**Last Updated:**` field
41
+ - **Line count** (wc -l)
42
+ - **Sections present** — check for each required section header
43
+ - **Acceptance criteria** — count total, count checked `[x]`
44
+ - **Discrepancies** — check if section has content
45
+
46
+ ### Step 3: Flag Issues
47
+
48
+ For each spec, check these conditions:
49
+
50
+ | Issue | Condition | Severity |
51
+ |-------|-----------|----------|
52
+ | **Stale** | Status is `planned` but Last Updated is >30 days ago | High |
53
+ | **Incomplete** | Missing required sections (Intent, Acceptance Criteria, Key Files, Requirements, Out of Scope) | High |
54
+ | **Oversized** | Exceeds 200 lines | Medium |
55
+ | **No criteria** | Acceptance Criteria section is empty or has no checkboxes | High |
56
+ | **Open discrepancies** | Discrepancies section has content | Medium |
57
+ | **Missing as-built** | Status is `implemented` but Implementation Notes is empty | Medium |
58
+ | **Stale paths** | Key Files references paths that don't exist | Low |
59
+
60
+ ### Step 4: Report
61
+
62
+ Output a summary table:
63
+
64
+ ```
65
+ ## Spec Health Report
66
+
67
+ | Feature | Version | Status | Updated | Lines | Issues |
68
+ |---------|---------|--------|---------|-------|--------|
69
+ | Session History | v0.2.0 | implemented | 2026-02-08 | 74 | None |
70
+ | Auth Flow | v0.3.0 | planned | 2026-01-15 | 45 | Stale (26 days) |
71
+ | Settings Page | v0.2.0 | partial | 2026-02-05 | 210 | Oversized |
72
+
73
+ ## Issues Found
74
+
75
+ ### High Priority
76
+ - **Auth Flow** (`.specs/v0.3.0/auth-flow.md`): Status is `planned` but last updated 26 days ago. Either implementation is stalled or the spec needs an as-built update.
77
+
78
+ ### Medium Priority
79
+ - **Settings Page** (`.specs/v0.2.0/settings-page.md`): 210 lines exceeds the 200-line limit. Split into sub-specs.
80
+
81
+ ### Suggested Actions
82
+ 1. Run `/spec-update auth-flow` to update the auth flow spec
83
+ 2. Split settings-page.md into sub-specs
84
+ ```
85
+
86
+ If no issues are found, report: "All specs healthy. N specs across M versions."
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: spec-init
3
+ description: >-
4
+ This skill should be used when the user asks to "initialize specs",
5
+ "set up specs", "bootstrap specs", "start using specs", "create spec
6
+ directory", "init specs for this project", or needs to set up the
7
+ .specs/ directory structure for a project that doesn't have one yet.
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # Initialize Specification Directory
12
+
13
+ ## Mental Model
14
+
15
+ Before any spec can be created, the project needs a `.specs/` directory with its supporting files: a ROADMAP (what each version delivers) and a BACKLOG (deferred items). This skill bootstraps that structure so `/spec-new` has a home.
16
+
17
+ ---
18
+
19
+ ## Workflow
20
+
21
+ ### Step 1: Check Existing State
22
+
23
+ ```
24
+ Glob: .specs/**/*.md
25
+ ```
26
+
27
+ **If `.specs/` already exists:**
28
+ - Report current state: how many specs, versions, whether ROADMAP.md and BACKLOG.md exist
29
+ - Suggest `/spec-check` to audit health instead
30
+ - Do NOT recreate or overwrite anything
31
+ - Stop here
32
+
33
+ **If `.specs/` does not exist:** proceed to Step 2.
34
+
35
+ ### Step 2: Create Directory Structure
36
+
37
+ Create the `.specs/` directory at the project root.
38
+
39
+ ### Step 3: Create ROADMAP.md
40
+
41
+ Write `.specs/ROADMAP.md` using the template from `references/roadmap-template.md`.
42
+
43
+ ### Step 4: Create BACKLOG.md
44
+
45
+ Write `.specs/BACKLOG.md` using the template from `references/backlog-template.md`.
46
+
47
+ ### Step 5: Retroactive Documentation
48
+
49
+ Ask the user:
50
+
51
+ > "Are there existing features in this project that should be documented retroactively? I can help create specs for them using `/spec-new`."
52
+
53
+ If yes, guide the user through creating a spec for each feature using `/spec-new`.
54
+
55
+ If no, proceed to Step 6.
56
+
57
+ ### Step 6: Report
58
+
59
+ Summarize what was created:
60
+
61
+ ```
62
+ ## Spec Directory Initialized
63
+
64
+ Created:
65
+ - `.specs/` directory
66
+ - `.specs/ROADMAP.md` — version tracking table
67
+ - `.specs/BACKLOG.md` — deferred items list
68
+
69
+ Next steps:
70
+ - Use `/spec-new <feature-name> <version>` to create your first feature spec
71
+ - Use `/spec-check` to audit spec health at any time
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Hard Constraints
77
+
78
+ - **Never overwrite** an existing `.specs/` directory or its contents.
79
+ - **ROADMAP.md** must stay under 30 lines (it's a summary, not a plan document).
80
+ - **BACKLOG.md** must stay under 15 lines (it grows as items are added).
81
+ - Templates are starting points — the user will extend them.
82
+
83
+ ---
84
+
85
+ ## Ambiguity Policy
86
+
87
+ - If the user runs this in a workspace root with multiple projects, ask which project to initialize.
88
+ - If `.specs/` exists but is missing ROADMAP.md or BACKLOG.md, offer to create only the missing files.
89
+
90
+ ---
91
+
92
+ ## Reference Files
93
+
94
+ | File | Contents |
95
+ |------|----------|
96
+ | `references/roadmap-template.md` | Starter ROADMAP with version table format |
97
+ | `references/backlog-template.md` | Starter BACKLOG with item format |
@@ -0,0 +1,7 @@
1
+ # Backlog
2
+
3
+ Deferred items not yet scheduled for a version.
4
+
5
+ ## Items
6
+
7
+ - [ ] [Item description] — [context/rationale]
@@ -0,0 +1,13 @@
1
+ # Roadmap
2
+
3
+ What each version delivers and why.
4
+
5
+ | Version | Status | Summary |
6
+ |---------|--------|---------|
7
+ | v0.1.0 | planned | [Initial release — describe core features] |
8
+
9
+ ## Versioning
10
+
11
+ - **Major**: Breaking changes to public APIs or data models
12
+ - **Minor**: New features, non-breaking changes
13
+ - **Patch**: Bug fixes, documentation, internal refactors
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: spec-new
3
+ description: >-
4
+ This skill should be used when the user asks to "create a spec",
5
+ "new feature spec", "write a spec for", "spec this feature",
6
+ "start a new spec", "plan a feature", or needs to create a new
7
+ specification file from the standard template.
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # Create New Feature Specification
12
+
13
+ ## Mental Model
14
+
15
+ A specification is a contract between the person requesting a feature and the person building it. Writing the spec BEFORE implementation forces you to think through edge cases, acceptance criteria, and scope boundaries while changes are cheap — before any code exists.
16
+
17
+ Every project uses `.specs/` as the specification directory. Specs are version-organized, independently loadable, and capped at 200 lines.
18
+
19
+ ---
20
+
21
+ ## Workflow
22
+
23
+ ### Step 1: Parse Arguments
24
+
25
+ Extract the feature name and version from `$ARGUMENTS`:
26
+ - **Feature name**: kebab-case identifier (e.g., `session-history`, `auth-flow`)
27
+ - **Version**: semver string (e.g., `v0.3.0`)
28
+
29
+ If arguments are missing, ask the user for:
30
+ 1. Feature name (what is being built)
31
+ 2. Target version (which release this belongs to)
32
+
33
+ ### Step 2: Determine File Path
34
+
35
+ - **Multi-feature version** (directory already exists or multiple features planned):
36
+ `.specs/{version}/{feature-name}.md`
37
+ - **Single-feature version** (one spec covers the whole version):
38
+ `.specs/{version}.md`
39
+
40
+ If `.specs/` does not exist at the project root, create it.
41
+
42
+ If `.specs/{version}/` does not exist and you're using the directory form, create it.
43
+
44
+ ### Step 3: Create the Spec File
45
+
46
+ Write the file using the standard template from `references/template.md`.
47
+
48
+ Pre-fill:
49
+ - **Version**: from arguments
50
+ - **Status**: `planned`
51
+ - **Last Updated**: today's date (YYYY-MM-DD)
52
+ - **Feature name**: from arguments
53
+
54
+ Leave all other sections as placeholders for the user to fill.
55
+
56
+ ### Step 4: Guide Content Creation
57
+
58
+ After creating the file, guide the user through filling it out:
59
+
60
+ 1. **Intent** — What problem does this solve? Who has this problem? (2-3 sentences)
61
+ 2. **Acceptance Criteria** — Use the `specification-writing` skill for EARS format and Given/When/Then patterns
62
+ 3. **Key Files** — Glob the codebase to identify existing files relevant to this feature
63
+ 4. **Schema / Data Model** — Reference file paths only, never inline schemas
64
+ 5. **API Endpoints** — Table format: Method | Path | Description
65
+ 6. **Requirements** — EARS format, numbered FR-1, FR-2, NFR-1, etc.
66
+ 7. **Dependencies** — What this feature depends on
67
+ 8. **Out of Scope** — Explicit non-goals to prevent scope creep
68
+
69
+ ### Step 5: Validate
70
+
71
+ Before finishing:
72
+ - [ ] File is ≤200 lines
73
+ - [ ] No source code, SQL, or type definitions reproduced inline
74
+ - [ ] Status is `planned`
75
+ - [ ] All required sections present (even if some are "N/A" or "TBD")
76
+ - [ ] Acceptance criteria are testable
77
+
78
+ ---
79
+
80
+ ## Hard Constraints
81
+
82
+ - **≤200 lines per spec.** If a feature needs more, split into sub-specs with a parent `_overview.md` (≤50 lines) linking them.
83
+ - **Reference, don't reproduce.** Write `see src/engine/db/migrations/002.sql lines 48-70` — never paste the SQL.
84
+ - **Independently loadable.** Each spec file must be useful without loading any other file.
85
+ - **EARS format for requirements.** Use the `specification-writing` skill for templates and examples.
86
+
87
+ ---
88
+
89
+ ## Ambiguity Policy
90
+
91
+ - If the user doesn't specify a version, ask — do not assume.
92
+ - If the feature scope is unclear, write a minimal spec with `## Open Questions` listing what needs clarification.
93
+ - If a spec already exists for this feature, inform the user and suggest `/spec-update` instead.
94
+
95
+ ---
96
+
97
+ ## Reference Files
98
+
99
+ | File | Contents |
100
+ |------|----------|
101
+ | `references/template.md` | Full standard template with field descriptions and examples |
@@ -0,0 +1,110 @@
1
+ # Specification Template
2
+
3
+ Standard template for all feature specifications. Copy this structure when creating a new spec.
4
+
5
+ ---
6
+
7
+ ## Template
8
+
9
+ ```markdown
10
+ # Feature: [Name]
11
+
12
+ **Version:** v0.X.0
13
+ **Status:** planned
14
+ **Last Updated:** YYYY-MM-DD
15
+
16
+ ## Intent
17
+
18
+ [What problem does this solve? Who has this problem? What's the cost of not solving it? 2-3 sentences.]
19
+
20
+ ## Acceptance Criteria
21
+
22
+ [Testable criteria. Use Given/When/Then for complex flows, checklists for simple features, or tables for business rules. Every criterion must be verifiable.]
23
+
24
+ - [ ] [Criterion 1]
25
+ - [ ] [Criterion 2]
26
+ - [ ] [Criterion 3]
27
+
28
+ ## Key Files
29
+
30
+ [File paths most relevant to implementation — paths an implementer should read first.]
31
+
32
+ **Backend:**
33
+ - `src/path/to/file.py` — [brief description]
34
+
35
+ **Frontend:**
36
+ - `src/web/path/to/component.svelte` — [brief description]
37
+
38
+ **Tests:**
39
+ - `tests/path/to/test_file.py` — [brief description]
40
+
41
+ ## Schema / Data Model
42
+
43
+ [Reference migration files and model files by path. Describe what changes — do NOT paste DDL, Pydantic models, or TypeScript interfaces.]
44
+
45
+ - New table: `table_name` — see `src/db/migrations/NNN.sql`
46
+ - Modified: `existing_table` — added `column_name` column
47
+
48
+ ## API Endpoints
49
+
50
+ | Method | Path | Description |
51
+ |--------|------|-------------|
52
+ | GET | `/api/resource` | List resources with pagination |
53
+ | POST | `/api/resource` | Create a new resource |
54
+
55
+ ## Requirements
56
+
57
+ ### Functional Requirements
58
+
59
+ - FR-1: [EARS format requirement — see specification-writing skill for templates]
60
+ - FR-2: When [event], the system shall [action].
61
+ - FR-3: If [unwanted condition], then the system shall [action].
62
+
63
+ ### Non-Functional Requirements
64
+
65
+ - NFR-1: The system shall respond to [endpoint] within [N]ms at the [percentile] percentile.
66
+ - NFR-2: [Security, accessibility, scalability requirement]
67
+
68
+ ## Dependencies
69
+
70
+ - [External system, library, or feature this depends on]
71
+ - [Blocked by: feature X must ship first]
72
+
73
+ ## Out of Scope
74
+
75
+ - [Explicit non-goal 1 — prevents scope creep]
76
+ - [Explicit non-goal 2]
77
+
78
+ ## Implementation Notes
79
+
80
+ [Post-implementation only. Leave empty in planned specs. After building, document what actually shipped vs. what was planned.]
81
+
82
+ ## Discrepancies
83
+
84
+ [Post-implementation only. Document gaps between spec intent and actual build. Prevents next session from re-planning decided work.]
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Field Descriptions
90
+
91
+ | Section | Required | When to Fill |
92
+ |---------|----------|-------------|
93
+ | Intent | Always | At creation |
94
+ | Acceptance Criteria | Always | At creation |
95
+ | Key Files | Always | At creation (update post-implementation) |
96
+ | Schema / Data Model | If applicable | At creation |
97
+ | API Endpoints | If applicable | At creation |
98
+ | Requirements | Always | At creation |
99
+ | Dependencies | If applicable | At creation |
100
+ | Out of Scope | Always | At creation |
101
+ | Implementation Notes | Post-implementation | After building |
102
+ | Discrepancies | Post-implementation | After building |
103
+
104
+ ## Status Values
105
+
106
+ | Status | Meaning |
107
+ |--------|---------|
108
+ | `planned` | Spec written, implementation not started |
109
+ | `partial` | Some acceptance criteria implemented, work ongoing |
110
+ | `implemented` | All acceptance criteria met, as-built notes complete |
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: spec-update
3
+ description: >-
4
+ This skill should be used when the user asks to "update the spec",
5
+ "mark spec as implemented", "as-built update", "spec maintenance",
6
+ "update spec status", "finish the spec", or after implementing a
7
+ feature when the spec needs to reflect what was actually built.
8
+ version: 0.1.0
9
+ ---
10
+
11
+ # As-Built Spec Update
12
+
13
+ ## Mental Model
14
+
15
+ Specs that say "planned" after code ships cause the next AI session to re-plan already-done work. The as-built update is the final step of every implementation — it closes the loop between what was planned and what was built.
16
+
17
+ This is not optional. Every implementation ends with a spec update.
18
+
19
+ ---
20
+
21
+ ## The 6-Step Workflow
22
+
23
+ ### Step 1: Find the Spec
24
+
25
+ ```
26
+ Glob: .specs/**/*.md
27
+ ```
28
+
29
+ Search for the feature name in spec file names and content. If the user provides a spec path or feature name as `$ARGUMENTS`, use that directly.
30
+
31
+ If no spec exists:
32
+ - For substantial changes: create one using `/spec-new`
33
+ - For trivial changes (bug fixes, config): note "spec not needed" and stop
34
+
35
+ ### Step 2: Set Status
36
+
37
+ Update the `**Status:**` field:
38
+ - `implemented` — all acceptance criteria are met
39
+ - `partial` — some criteria met, work ongoing or deferred
40
+
41
+ Never leave status as `planned` after implementation work has been done.
42
+
43
+ ### Step 3: Check Off Acceptance Criteria
44
+
45
+ Review each acceptance criterion in the spec:
46
+ - Mark as `[x]` if the criterion is met and verified (tests pass, behavior confirmed)
47
+ - Leave as `[ ]` if not yet implemented
48
+ - Add a note next to deferred criteria explaining why
49
+
50
+ If criteria were met through different means than originally planned, note the deviation.
51
+
52
+ ### Step 4: Add Implementation Notes
53
+
54
+ In the `## Implementation Notes` section, document:
55
+ - **Deviations from the original spec** — what changed and why
56
+ - **Key design decisions made during implementation** — choices that weren't in the spec
57
+ - **Surprising findings** — edge cases discovered, performance characteristics, limitations
58
+ - **Trade-offs accepted** — what was sacrificed and why
59
+
60
+ Keep notes concise. Reference file paths, not code.
61
+
62
+ ### Step 5: Update File Paths
63
+
64
+ In the `## Key Files` section:
65
+ - Add files that were created during implementation
66
+ - Remove files that no longer exist
67
+ - Update paths that moved
68
+
69
+ Verify paths exist before listing them. Use absolute project-relative paths.
70
+
71
+ ### Step 6: Update Metadata
72
+
73
+ - Set `**Last Updated:**` to today's date (YYYY-MM-DD)
74
+ - Verify `**Version:**` is correct
75
+
76
+ ---
77
+
78
+ ## Handling Edge Cases
79
+
80
+ ### Spec Already "Implemented"
81
+
82
+ If the spec is already marked `implemented` and new changes affect the feature:
83
+ 1. Check if acceptance criteria still hold
84
+ 2. Update Implementation Notes with the new changes
85
+ 3. Add any new Discrepancies between spec and current code
86
+ 4. Update Last Updated date
87
+
88
+ ### No Spec Exists
89
+
90
+ If there is no spec for the feature:
91
+ 1. Ask: is this a substantial feature or a minor fix?
92
+ 2. For substantial features: create one with `/spec-new`, then update it
93
+ 3. For minor fixes: no spec needed — report this and stop
94
+
95
+ ### Spec Has Unresolved Discrepancies
96
+
97
+ If the `## Discrepancies` section has open items:
98
+ 1. Check if the current implementation resolves any of them
99
+ 2. Remove resolved discrepancies
100
+ 3. Add any new discrepancies discovered
101
+
102
+ ---
103
+
104
+ ## Validation Checklist
105
+
106
+ Before finishing the update:
107
+ - [ ] Status reflects the actual implementation state
108
+ - [ ] All implemented acceptance criteria are checked off
109
+ - [ ] Implementation Notes document deviations from original spec
110
+ - [ ] File paths in Key Files are accurate and verified
111
+ - [ ] Last Updated date is today
112
+ - [ ] Spec is still ≤200 lines
113
+ - [ ] No source code was pasted inline (references only)
114
+
115
+ ---
116
+
117
+ ## Ambiguity Policy
118
+
119
+ - If unclear which spec to update, list all candidates and ask the user.
120
+ - If the implementation deviated significantly from the spec, document it
121
+ honestly in Implementation Notes — do not retroactively change the original
122
+ requirements to match what was built.
123
+ - If acceptance criteria are ambiguous about whether they're met, note the
124
+ ambiguity in Discrepancies rather than checking them off optimistically.