monorepo-package-workflow
Guides creation of new MCP tool packages in @j0kz/mcp-agents monorepo following modular architecture with constants/, helpers/, utils/ extraction, tools.json registration, and version.json synchron...
Best use case
monorepo-package-workflow is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Guides creation of new MCP tool packages in @j0kz/mcp-agents monorepo following modular architecture with constants/, helpers/, utils/ extraction, tools.json registration, and version.json synchron...
Teams using monorepo-package-workflow should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/monorepo-package-workflow/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How monorepo-package-workflow Compares
| Feature / Agent | monorepo-package-workflow | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Guides creation of new MCP tool packages in @j0kz/mcp-agents monorepo following modular architecture with constants/, helpers/, utils/ extraction, tools.json registration, and version.json synchron...
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Monorepo Package Creation for @j0kz/mcp-agents
Create new MCP tool packages following established patterns from the 9 existing tools.
## Prerequisites Checklist
- [ ] Tool purpose clearly defined and unique
- [ ] No duplicate functionality in existing tools (check tools.json)
- [ ] Tool fits one category: analysis, generation, refactoring, design, orchestration
- [ ] Name follows pattern: `@j0kz/{tool-name}-mcp`
## Quick Start: Create New Package
```bash
# 1. Create structure
cd packages
mkdir -p your-tool/src/{constants,helpers,utils}
mkdir your-tool/tests
# 2. Initialize package.json (copy template below)
# 3. Create thin mcp-server.ts (<150 LOC)
# 4. Implement main-logic.ts with @j0kz/shared
# 5. Register in tools.json
# 6. Sync version: npm run version:sync
# 7. Build and test
```
## Package Structure (Modular Architecture)
```
your-tool/
├── src/
│ ├── mcp-server.ts # Thin MCP layer (<150 LOC)
│ ├── main-logic.ts # Core functionality
│ ├── types.ts # TypeScript interfaces
│ ├── constants/ # Thresholds, patterns
│ ├── helpers/ # Complex logic (30+ LOC)
│ └── utils/ # Cross-cutting utilities
├── tests/ # Vitest tests
├── package.json # With "type": "module"
└── tsconfig.json
```
**Target:** All files <300 LOC (extract when exceeded)
**For detailed structure guide:**
```bash
cat .claude/skills/monorepo-package-workflow/references/package-structure-guide.md
```
## Critical package.json Template
```json
{
"name": "@j0kz/your-tool-mcp",
"version": "1.1.0", // From version.json
"type": "module", // CRITICAL: ES modules
"main": "./dist/index.js",
"bin": {
"your-tool-mcp": "dist/mcp-server.js"
},
"scripts": {
"build": "tsc",
"test": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@j0kz/shared": "^1.1.0", // Must match version
"@modelcontextprotocol/sdk": "^1.19.1"
}
}
```
## MCP Server Pattern (Thin Orchestration)
```typescript
// mcp-server.ts - ONLY protocol handling
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { handleYourTool } from './main-logic.js'; // .js extension!
// Setup server (thin, delegates all logic)
// Target: <150 LOC
```
**For complete MCP patterns:**
```bash
cat .claude/skills/monorepo-package-workflow/references/mcp-server-patterns.md
```
## Using @j0kz/shared Utilities
```typescript
import {
FileSystemManager, // File ops with caching
AnalysisCache, // LRU cache (30min TTL)
PerformanceMonitor, // Performance tracking
MCPPipeline // Tool chaining
} from '@j0kz/shared';
```
**For shared utilities guide:**
```bash
cat .claude/skills/monorepo-package-workflow/references/shared-utilities-guide.md
```
## Registration & Version Sync
### 1. Register in tools.json
```json
{
"id": "your-tool",
"name": "Your Tool Name",
"package": "@j0kz/your-tool-mcp",
"category": "analysis",
"features": ["Feature 1", "Feature 2", "Feature 3"]
}
```
### 2. Sync Version (CRITICAL!)
```bash
# Never manually edit version in package.json!
npm run version:sync # Updates all packages
npm run version:check-shared # Verify consistency
```
## Testing with Vitest
```typescript
// tests/main-logic.test.ts
import { describe, it, expect } from 'vitest';
import { handleYourTool } from '../src/main-logic.js';
describe('YourTool', () => {
it('should handle valid input', async () => {
const result = await handleYourTool({ filePath: 'test.ts' });
expect(result.success).toBe(true);
});
});
```
**Target:** >70% coverage
**For testing setup guide:**
```bash
cat .claude/skills/monorepo-package-workflow/references/testing-setup-guide.md
```
## Import Pattern (ES Modules)
```typescript
// ✅ CORRECT - Always use .js
import { foo } from './bar.js';
import { helper } from './helpers/my-helper.js';
// ❌ WRONG - Will fail
import { foo } from './bar';
import { foo } from './bar.ts';
```
## Build & Validation
```bash
# Build TypeScript
npm run build -w packages/your-tool
# Verify structure
ls dist/ # Should have .js files
# Run tests
npm test -w packages/your-tool
# Check file sizes
find src -name "*.ts" -exec wc -l {} \; | sort -n
# All should be <300 LOC
```
## Complete Registration Checklist
**For detailed checklist with all steps:**
```bash
cat .claude/skills/monorepo-package-workflow/references/registration-checklist.md
```
Quick validation:
- [ ] Package name: `@j0kz/{tool}-mcp`
- [ ] Registered in tools.json
- [ ] Version synced from version.json
- [ ] mcp-server.ts <150 LOC
- [ ] All files <300 LOC
- [ ] Tests >70% coverage
- [ ] Imports use .js extension
- [ ] "type": "module" in package.json
## Common Mistakes to Avoid
| Mistake | Fix |
|---------|-----|
| Manually set version | Use `npm run version:sync` |
| Forget tools.json | Register before publishing |
| Fat mcp-server.ts | Keep <150 LOC, delegate to main-logic |
| Missing .js extension | Add to all relative imports |
| Files >300 LOC | Extract to constants/helpers/utils |
## Reference Examples
Study these well-structured packages:
1. **security-scanner** - Best modular refactoring (395→209 LOC)
2. **smart-reviewer** - AST analysis with fixers/
3. **orchestrator-mcp** - MCPPipeline usage
4. **test-generator** - Code generation patterns
## Publishing Workflow
```bash
# 1. Build all
npm run build
# 2. Publish
npm run publish-all
# 3. Git operations
git add . && git commit -m "feat: add your-tool"
git tag v1.1.0 && git push --tags
```
## Related Skills
- **project-standardization:** Version management and automation
- **modular-refactoring-pattern:** Reducing file complexity
- **code-quality-pipeline:** Ensuring code quality
## Quick Commands
```bash
npm run version:sync # Sync versions
npm run build # Build all packages
npm test # Run tests
npm run publish-all # Publish to npm
```
---
**For modular refactoring:** `.claude/skills/modular-refactoring-pattern/SKILL.md`
**For project standards:** `.claude/skills/project-standardization/SKILL.md`Related Skills
workflow-status
Display project workflow progress by reading handoff documents in .docs/ directory. This skill should be used when users want to check their workflow status, see what phase they're in, or when other workflow skills need to verify prerequisites. Provides reusable prerequisite-checking templates for integration with other workflow skills.
workflow-new-plugin
Guided workflow for creating a new Volon plugin — ideation, requirements, spec, plan, tasks.
workflow-integration-git
Git commit workflow with conventional commits, artifact cleanup, and optional push/PR creation
workflow-guide
Provides guidance on Cursor ↔ Claude Code 2-agent workflow. Use when user mentions ワークフローについて, Cursorとの連携, 作業の流れ, 2-agent workflow, collaboration. Do NOT load for: 実装作業, ワークフロー設定, ハンドオフ実行.
workflow-creator
Create complete Claude Code workflow directories with curated skills. Use when user wants to (1) create a new workflow for specific use case (media creator, developer, marketer, etc.), (2) set up a Claude Code project with pre-configured skills, (3) download and organize skills from GitHub repositories, or (4) generate README.md and AGENTS.md documentation for workflows. Triggers on phrases like "create workflow", "new workflow", "set up workflow", "build a xxx-workflow".
use-skills-npm-package
CLI tool for discovering, installing, and managing reusable agent skills across multiple coding agents. Enables efficient skill discovery from repositories, local sources, and community repositories. Essential resource for discovering new Flutter/Dart skills.
testing-workflow
Integrated testing workflow combining all testing tools and MCPs. Use when deciding which testing tools to use, planning testing strategy, or executing tests in different environments and phases. Tags official skills: wallaby-testing, web-browser, agent-browser. Triggers on "testing workflow", "which test tool", "testing strategy", "run tests", "test combination".
spec-workflow-orchestrator
Orchestrate comprehensive planning phase from ideation to development-ready specifications using 4 specialized agents
setup-workflow
Initial setup workflow for claude-pilot plugin - directory creation, statusline configuration, documentation sync, GitHub star request
rollback-workflow-builder
Creates safe rollback procedures for deployments with automated workflows, rollback runbooks, version management, and incident response. Use for "rollback automation", "deployment recovery", "incident response", or "production rollback".
raw-workflow-creator
Create and run RAW workflows. Use this skill when the user asks to create a workflow, automate a task, build a data pipeline, generate reports, or asks "How do I build X with RAW?".
presentation-workflow
A skill for creating, updating, and managing slide presentations. Use for tasks involving slide decks, speaker notes, and integrating presentation materials with Git.