@polymorphism-tech/morph-spec 4.5.0 → 4.6.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 (71) hide show
  1. package/.morph/.morphversion +3 -3
  2. package/.morph/analytics/threads-log.jsonl +6 -44
  3. package/.morph/config/config.json +1 -1
  4. package/.morph/framework/standards/frontend/nextjs/nextjs-patterns.md +17 -0
  5. package/.morph/framework/templates/docs/user-stories.md +34 -0
  6. package/.morph/logs/tool-failures.log +7 -51
  7. package/.morph/memory/{pre-compact-2026-02-22T17-01-01-658Z.json → pre-compact-2026-02-23T15-43-03-521Z.json} +1 -1
  8. package/CLAUDE.md +77 -56
  9. package/framework/{skills/level-2-domains → agents}/ai-agents/ai-system-architect.md +1 -4
  10. package/framework/{skills/level-2-domains → agents}/architecture/po-pm-advisor.md +1 -2
  11. package/framework/{skills/level-2-domains → agents}/architecture/prompt-engineer.md +1 -2
  12. package/framework/{skills/level-2-domains → agents}/architecture/seo-growth-hacker.md +1 -2
  13. package/framework/{skills/level-2-domains → agents}/architecture/standards-architect.md +1 -4
  14. package/framework/agents/backend/api-designer.md +103 -0
  15. package/framework/{skills/level-2-domains → agents}/backend/dotnet-senior.md +1 -2
  16. package/framework/agents/backend/ef-modeler.md +119 -0
  17. package/framework/{skills/level-2-domains → agents}/backend/hangfire-orchestrator.md +1 -4
  18. package/framework/{skills/level-2-domains → agents}/backend/ms-agent-expert.md +1 -4
  19. package/framework/{skills/level-2-domains → agents}/frontend/blazor-builder.md +1 -4
  20. package/framework/{skills/level-2-domains → agents}/frontend/nextjs-expert.md +1 -4
  21. package/framework/{skills/level-2-domains → agents}/frontend/ui-ux-designer.md +1 -2
  22. package/framework/{skills/level-2-domains → agents}/infrastructure/azure-architect.md +1 -2
  23. package/framework/{skills/level-2-domains → agents}/infrastructure/azure-deploy-specialist.md +1 -2
  24. package/framework/{skills/level-2-domains → agents}/infrastructure/bicep-architect.md +1 -4
  25. package/framework/{skills/level-2-domains → agents}/infrastructure/container-specialist.md +1 -4
  26. package/framework/{skills/level-2-domains → agents}/infrastructure/devops-engineer.md +1 -4
  27. package/framework/{skills/level-2-domains → agents}/integrations/asaas-financial.md +1 -4
  28. package/framework/{skills/level-2-domains → agents}/integrations/azure-identity.md +1 -4
  29. package/framework/{skills/level-2-domains → agents}/integrations/clerk-auth.md +1 -4
  30. package/framework/{skills/level-2-domains → agents}/integrations/hangfire-integration.md +1 -2
  31. package/framework/{skills/level-2-domains → agents}/integrations/resend-email.md +1 -4
  32. package/framework/{skills/level-2-domains → agents}/quality/code-analyzer.md +1 -4
  33. package/framework/{skills/level-2-domains → agents}/quality/testing-specialist.md +1 -4
  34. package/framework/hooks/claude-code/statusline.py +384 -85
  35. package/framework/hooks/shared/phase-utils.js +129 -129
  36. package/framework/skills/README.md +66 -0
  37. package/framework/skills/level-0-meta/{brainstorming.md → brainstorming/SKILL.md} +3 -1
  38. package/framework/skills/level-0-meta/brainstorming/references/proposal-example.md +138 -0
  39. package/framework/skills/level-0-meta/{code-review.md → code-review/SKILL.md} +3 -2
  40. package/framework/skills/level-0-meta/code-review/references/review-example.md +164 -0
  41. package/framework/skills/level-0-meta/code-review/scripts/scan-csharp.mjs +121 -0
  42. package/framework/skills/level-0-meta/{morph-checklist.md → morph-checklist/SKILL.md} +2 -5
  43. package/framework/skills/{level-1-workflows/morph-replicate.md → level-0-meta/morph-replicate/SKILL.md} +6 -7
  44. package/framework/skills/level-0-meta/{simulation-checklist.md → simulation-checklist/SKILL.md} +3 -6
  45. package/framework/skills/level-0-meta/{tool-usage-guide.md → tool-usage-guide/SKILL.md} +1 -2
  46. package/framework/skills/level-0-meta/{verification-before-completion.md → verification-before-completion/SKILL.md} +3 -1
  47. package/framework/skills/level-0-meta/verification-before-completion/scripts/check-phase-outputs.mjs +110 -0
  48. package/framework/skills/level-1-workflows/{phase-clarify.md → phase-clarify/SKILL.md} +3 -3
  49. package/framework/skills/level-1-workflows/phase-clarify/references/clarifications-example.md +117 -0
  50. package/framework/skills/level-1-workflows/{phase-codebase-analysis.md → phase-codebase-analysis/SKILL.md} +2 -3
  51. package/framework/skills/level-1-workflows/{phase-design.md → phase-design/SKILL.md} +13 -185
  52. package/framework/skills/level-1-workflows/phase-design/references/spec-example.md +253 -0
  53. package/framework/skills/level-1-workflows/{phase-implement.md → phase-implement/SKILL.md} +3 -3
  54. package/framework/skills/level-1-workflows/phase-implement/references/recap-example.md +132 -0
  55. package/framework/skills/level-1-workflows/{phase-setup.md → phase-setup/SKILL.md} +2 -3
  56. package/framework/skills/level-1-workflows/{phase-tasks.md → phase-tasks/SKILL.md} +4 -3
  57. package/framework/skills/level-1-workflows/phase-tasks/references/tasks-example.md +231 -0
  58. package/framework/skills/level-1-workflows/phase-tasks/scripts/validate-tasks.mjs +112 -0
  59. package/framework/skills/level-1-workflows/{phase-uiux.md → phase-uiux/SKILL.md} +2 -3
  60. package/package.json +1 -1
  61. package/src/commands/project/init.js +4 -64
  62. package/src/commands/project/update.js +1 -62
  63. package/src/lib/detectors/claude-config-detector.js +1 -3
  64. package/src/utils/agents-installer.js +2 -2
  65. package/src/utils/skills-installer.js +59 -15
  66. package/.morph/context/README.md +0 -17
  67. package/framework/skills/level-2-domains/backend/api-designer.md +0 -66
  68. package/framework/skills/level-2-domains/backend/ef-modeler.md +0 -65
  69. package/framework/skills/level-3-technologies/README.md +0 -7
  70. package/framework/skills/level-4-patterns/README.md +0 -7
  71. /package/framework/{skills/level-2-domains → agents}/README.md +0 -0
@@ -2,11 +2,18 @@
2
2
  * Skills Installer
3
3
  *
4
4
  * Copies framework skills to .claude/skills/ during morph-spec init.
5
- * Installs level-0-meta, level-1-workflows, and level-2-domains skills using
6
- * the native Claude Code subdirectory format: .claude/skills/{skill-name}/SKILL.md
7
- * so Claude Code can discover them via /<skill-name> syntax.
8
- * Level-3 and level-4 only contain README.md placeholder files and
9
- * are intentionally skipped.
5
+ * Installs level-0-meta and level-1-workflows skills using the native Claude Code
6
+ * subdirectory format: .claude/skills/{skill-name}/SKILL.md (plus optional
7
+ * scripts/, references/, and assets/ subdirectories).
8
+ * Level-2 domain specialists are installed as native subagents via installDomainAgents().
9
+ * Level-3 and level-4 only contain README.md placeholder files and are skipped.
10
+ *
11
+ * Source skills can be either:
12
+ * - Directory-based: framework/skills/{level}/{skill-name}/SKILL.md (preferred)
13
+ * - Flat file: framework/skills/{level}/{skill-name}.md (legacy, still supported)
14
+ *
15
+ * Directory-based skills have their entire directory copied (scripts/, references/,
16
+ * assets/) so Claude Code can execute scripts and load references on demand.
10
17
  */
11
18
 
12
19
  import { mkdirSync, copyFileSync, existsSync, readdirSync, statSync } from 'fs';
@@ -26,15 +33,42 @@ const FRAMEWORK_SKILLS_DIR = join(__dirname, '..', '..', 'framework', 'skills');
26
33
  const SKILL_LEVELS_TO_INSTALL = ['level-0-meta', 'level-1-workflows'];
27
34
 
28
35
  /**
29
- * Recursively walk srcDir and install each .md skill file (excluding README.md)
30
- * into destDir using the native Claude Code subdirectory format:
31
- * destDir/{skill-name}/SKILL.md
36
+ * Recursively copy a directory tree from src to dest.
37
+ * Creates dest if it doesn't exist. Skips README.md files.
38
+ *
39
+ * @param {string} src - Source directory path
40
+ * @param {string} dest - Destination directory path
41
+ */
42
+ function copyDirectory(src, dest) {
43
+ mkdirSync(dest, { recursive: true });
44
+ for (const entry of readdirSync(src)) {
45
+ if (entry === 'README.md') continue;
46
+ const srcPath = join(src, entry);
47
+ const destPath = join(dest, entry);
48
+ if (statSync(srcPath).isDirectory()) {
49
+ copyDirectory(srcPath, destPath);
50
+ } else {
51
+ copyFileSync(srcPath, destPath);
52
+ }
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Walk srcDir and install skills into destDir.
58
+ *
59
+ * Handles two source formats:
60
+ * 1. Directory-based skill: srcDir/{skill-name}/SKILL.md
61
+ * → copies entire directory (SKILL.md + scripts/ + references/ + assets/)
62
+ * → destDir/{skill-name}/
63
+ *
64
+ * 2. Flat .md skill (legacy): srcDir/{skill-name}.md
65
+ * → destDir/{skill-name}/SKILL.md
32
66
  *
33
- * Each skill file must have a unique name across all subdirectories;
34
- * duplicate filenames would cause silent overwrites of the SKILL.md inside
35
- * the subdirectory.
67
+ * Level directories (level-0-meta, level-1-workflows, sub-categories) are
68
+ * traversed recursively. A directory is recognized as a skill directory when
69
+ * it contains a SKILL.md file.
36
70
  *
37
- * @param {string} srcDir - Source directory to walk recursively
71
+ * @param {string} srcDir - Source directory to walk
38
72
  * @param {string} destDir - Destination base directory (.claude/skills/)
39
73
  */
40
74
  function installSkillsFromDir(srcDir, destDir) {
@@ -44,9 +78,18 @@ function installSkillsFromDir(srcDir, destDir) {
44
78
  const stat = statSync(srcPath);
45
79
 
46
80
  if (stat.isDirectory()) {
47
- installSkillsFromDir(srcPath, destDir);
81
+ const skillMdPath = join(srcPath, 'SKILL.md');
82
+ if (existsSync(skillMdPath)) {
83
+ // Directory-based skill — copy entire directory including scripts/, references/, assets/
84
+ const skillDestDir = join(destDir, entry);
85
+ copyDirectory(srcPath, skillDestDir);
86
+ } else {
87
+ // Level/category directory — recurse
88
+ installSkillsFromDir(srcPath, destDir);
89
+ }
48
90
  } else if (entry.endsWith('.md') && entry !== 'README.md') {
49
- const skillName = entry.slice(0, -3); // strip .md
91
+ // Legacy flat .md skill wrap in subdirectory as SKILL.md
92
+ const skillName = entry.slice(0, -3);
50
93
  const skillDir = join(destDir, skillName);
51
94
  mkdirSync(skillDir, { recursive: true });
52
95
  copyFileSync(srcPath, join(skillDir, 'SKILL.md'));
@@ -58,7 +101,8 @@ function installSkillsFromDir(srcDir, destDir) {
58
101
  * Install morph framework skills to .claude/skills/ in the target project.
59
102
  * Skills are copied into subdirectories as SKILL.md files so Claude Code can
60
103
  * discover them natively via /<skill-name> syntax (e.g., /phase-design,
61
- * /blazor-builder).
104
+ * /blazor-builder). Directory-based skills also get their scripts/,
105
+ * references/, and assets/ subdirectories copied for on-demand loading.
62
106
  *
63
107
  * @param {string} projectDir - Target project root directory
64
108
  */
@@ -1,17 +0,0 @@
1
- # morph-spec-framework - Project Context
2
-
3
- ## Overview
4
-
5
- This file will be auto-updated by MORPH-SPEC detection system.
6
-
7
- ## Stack
8
-
9
- Run `morph-spec detect` to analyze your project.
10
-
11
- ## Technologies
12
-
13
- (To be detected)
14
-
15
- ## Architecture
16
-
17
- (To be detected)
@@ -1,66 +0,0 @@
1
- ---
2
- name: api-designer
3
- description: >
4
- API Designer specialist for REST API design, OpenAPI specs, and endpoint architecture. Activates for keywords: api, endpoint, rest, openapi, swagger, http.
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
- ---
7
-
8
- # API Designer
9
-
10
- **Tier:** 3 (Specialist)
11
- **Always Active:** No
12
- **Keywords:** api, endpoint, controller, rest, http, route, dto, request, response
13
- **Reports to:** dotnet-senior
14
-
15
- ---
16
-
17
- ## Role
18
-
19
- REST API design specialist for .NET Minimal API and controllers, focusing on clean endpoint design and DTO contracts.
20
-
21
- ---
22
-
23
- ## Standards Applied
24
-
25
- ```
26
- framework/standards/core/coding.md
27
- framework/standards/backend/dotnet/core.md
28
- framework/standards/backend/dotnet/async.md
29
- framework/standards/backend/api/rest.md
30
- framework/standards/backend/api/validation.md
31
- ```
32
-
33
- ---
34
-
35
- ## Responsibilities
36
-
37
- - Design REST API endpoints following conventions
38
- - Create request/response DTOs
39
- - Implement API controllers or Minimal API endpoints
40
- - Apply proper HTTP status codes (200, 201, 400, 404, etc.)
41
- - Implement input validation with FluentValidation
42
- - Design API versioning strategy
43
- - Create error response formats
44
-
45
- ---
46
-
47
- ## When to Use
48
-
49
- - Creating new API endpoints
50
- - Designing DTO contracts
51
- - API refactoring
52
- - Implementing validation logic
53
- - Designing error responses
54
-
55
- ---
56
-
57
- ## Collaborates With
58
-
59
- - **dotnet-senior** - Service layer consumed by endpoints
60
- - **ef-modeler** - Entity → DTO mapping
61
- - **blazor-builder** - Frontend consuming API
62
- - **testing-specialist** - API integration tests
63
-
64
- ---
65
-
66
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,65 +0,0 @@
1
- ---
2
- name: ef-modeler
3
- description: >
4
- Entity Framework Modeler specialist for database schema, migrations, DbContext design, and ORM patterns. Activates for keywords: entity framework, migrations, dbcontext, ef core.
5
- allowed-tools: Read, Write, Edit, Bash, Glob, Grep
6
- ---
7
-
8
- # EF Modeler
9
-
10
- **Tier:** 3 (Specialist)
11
- **Always Active:** No
12
- **Keywords:** entity, database, migration, ef core, dbcontext, table, column, relationship, query
13
- **Reports to:** dotnet-senior
14
-
15
- ---
16
-
17
- ## Role
18
-
19
- Entity Framework Core specialist for database modeling, entities, configurations, and migrations.
20
-
21
- ---
22
-
23
- ## Standards Applied
24
-
25
- ```
26
- framework/standards/core/coding.md
27
- framework/standards/backend/dotnet/core.md
28
- framework/standards/backend/database/ef-core.md
29
- framework/standards/backend/database/migrations.md
30
- framework/standards/backend/database/repository-patterns.md
31
- framework/standards/backend/database/performance.md
32
- ```
33
-
34
- ---
35
-
36
- ## Responsibilities
37
-
38
- - Design entity models with private setters and factory methods
39
- - Create IEntityTypeConfiguration for each entity
40
- - Configure relationships, indexes, and constraints
41
- - Generate and review EF Core migrations
42
- - Optimize database queries (avoid N+1, use proper includes)
43
- - Implement repository patterns with IDbContextFactory
44
-
45
- ---
46
-
47
- ## When to Use
48
-
49
- - Creating/modifying entity classes
50
- - Database schema changes
51
- - Migration creation/review
52
- - Query optimization
53
- - DbContext configuration
54
-
55
- ---
56
-
57
- ## Collaborates With
58
-
59
- - **dotnet-senior** - Service layer consuming repositories
60
- - **api-designer** - DTO mapping from entities
61
- - **azure-architect** - Database provisioning (Azure SQL, Cosmos DB)
62
-
63
- ---
64
-
65
- *MORPH-SPEC by Polymorphism Tech*
@@ -1,7 +0,0 @@
1
- # Level 3: Technologies
2
-
3
- Technology-specific implementation patterns.
4
-
5
- **Purpose:** Skills for specific technologies (EF Core, Blazor, Hangfire, SignalR, etc.).
6
-
7
- **To be populated in Phase 8/9.**
@@ -1,7 +0,0 @@
1
- # Level 4: Patterns
2
-
3
- Architectural and design patterns.
4
-
5
- **Purpose:** Skills for specific patterns (CQRS, Event Sourcing, DDD, Repository, etc.).
6
-
7
- **To be populated later.**