// Provides intelligent project setup and management with agent-based architecture to minimize token usage. Auto-activates when user mentions project setup, "add project", "configure project", "monorepo", "subdirectories", "switch project", or "project info". Uses three specialized agents internally: project-detector (detect active), project-config-loader (load settings with validation), project-context-manager (manage active project). Guides through four workflows: Add New Project (setup + templates), Configure Monorepo (pattern matching + subdirectories), Switch Between Projects (auto or manual), View Project Information. Provides templates for common architectures (fullstack-with-jira, fullstack-linear-only, mobile-app, monorepo). Validates configuration and suggests fixes for errors. Handles context-aware error handling with specific fix suggestions.
| name | project-operations |
| description | Provides intelligent project setup and management with agent-based architecture to minimize token usage. Auto-activates when user mentions project setup, "add project", "configure project", "monorepo", "subdirectories", "switch project", or "project info". Uses three specialized agents internally: project-detector (detect active), project-config-loader (load settings with validation), project-context-manager (manage active project). Guides through four workflows: Add New Project (setup + templates), Configure Monorepo (pattern matching + subdirectories), Switch Between Projects (auto or manual), View Project Information. Provides templates for common architectures (fullstack-with-jira, fullstack-linear-only, mobile-app, monorepo). Validates configuration and suggests fixes for errors. Handles context-aware error handling with specific fix suggestions. |
This skill handles all project-related operations in CCPM, including setup, configuration, detection, and multi-project management. It automatically invokes specialized agents to optimize performance and reduce token usage.
This skill activates when user mentions:
When: Command needs to know active project
Implementation:
// Always start with detection
const detection = Task(project-detector): `
Detect active project for current environment
Current directory: ${cwd}
Git remote: ${gitRemote}
`
// Then load full config
const context = Task(project-context-manager): `
Get full context for detected project
Project ID: ${detection.project_id}
Subproject: ${detection.subproject}
Include config: true
Format: standard
`
// Use context for operations
console.log(`📋 Project: ${context.display.title}`)
Benefits:
When: Command needs project settings (Linear, Jira, tech stack)
Implementation:
const config = Task(project-config-loader): `
Load configuration for project: ${projectId}
Include subproject: ${subprojectName}
Validate: true
`
if (!config.validation.valid) {
console.error("Configuration errors:", config.validation.errors)
return
}
// Use config
const linearTeam = config.linear.team
const techStack = config.tech_stack.languages
Benefits:
When: Setting active project, enabling auto-detection
Implementation:
// Set active project
const result = Task(project-context-manager): `
Set active project: ${projectId}
Mode: manual
Disable auto-detection: false
`
console.log(`✅ ${result.message}`)
// Or enable auto-detection
const result = Task(project-context-manager): `
Enable auto-detection
`
console.log(`✅ Auto-detection enabled`)
console.log(`Methods: ${result.methods.join(', ')}`)
Trigger phrases:
Command: /ccpm:project:add <project-id> [--template TEMPLATE]
Guidance:
Let's set up your new project!
Quick templates available:
1. fullstack-with-jira - Full-stack app with Jira integration
2. fullstack-linear-only - Full-stack app, Linear-only
3. mobile-app - React Native / Expo mobile app
4. monorepo - Multi-project repository with subdirectories
Or create custom configuration interactively.
Example:
/ccpm:project:add my-app --template fullstack-with-jira
Trigger phrases:
Guidance:
For monorepos with subdirectories (like Nx, Turborepo):
1. Add the project:
/ccpm:project:add my-monorepo
2. Configure subdirectory detection:
Edit ~/.claude/ccpm-config.yaml:
```yaml
my-monorepo:
repository:
local_path: /Users/dev/monorepo
context:
detection:
subdirectories:
- subproject: frontend
match_pattern: "*/apps/frontend/*"
priority: 10
- subproject: backend
match_pattern: "*/apps/backend/*"
priority: 10
code_repository:
subprojects:
- name: frontend
path: apps/frontend
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, nextjs]
Enable auto-detection: /ccpm:project:set auto
Test detection: cd /Users/dev/monorepo/apps/frontend /ccpm:project:list # Should show "frontend" subproject active
#### Workflow 3: Switch Between Projects
**Trigger phrases**:
- "switch project"
- "change active project"
- "work on different project"
**Commands**:
- `/ccpm:project:set <project-id>` - Set specific project
- `/ccpm:project:set auto` - Enable auto-detection
- `/ccpm:project:list` - See all projects with active marker
**Agent usage**:
```javascript
// Commands internally use:
Task(project-context-manager): `
Set active project: ${projectId}
Mode: manual
`
// Then display with:
Task(project-context-manager): `
Get context
Format: standard
`
Trigger phrases:
Commands:
/ccpm:project:show <project-id> - Detailed project info/ccpm:project:list - List all projects/ccpm:utils:status <issue-id> - Task with project contextAgent usage:
Task(project-context-manager): `
Get context for project: ${projectId}
Format: detailed
Include all sections: true
`
// Returns full display-ready output
CCPM provides first-class monorepo support with automatic subdirectory detection, pattern-based matching, and intelligent context switching.
Monorepos contain multiple projects/packages in a single repository (e.g., Nx, Turborepo, Lerna). CCPM automatically detects which subproject you're working in and applies the correct configuration.
Key Features:
cdPriority-Based Resolution (highest to lowest):
/ccpm:project:setDetection Flow Example:
Working in: /Users/dev/repeat/jarvis/src
Detection flow:
1. Check manual override → None set
2. Check git remote → matches "repeat" project ✓
3. Check subdirectory patterns:
- "*/xygaming_symfony/*" (priority: 10) → ❌
- "*/jarvis/*" (priority: 10) → ✅ Match!
4. Return: project="repeat", subproject="jarvis"
Result:
📋 Project: Repeat › jarvis
🛠️ Tech Stack: TypeScript, Next.js, NestJS
Performance:
Use these commands to manage subdirectories in monorepos:
/ccpm:project:subdir:add <project-id> <subproject-name> <path> [--pattern <pattern>] [--priority <priority>]
Example:
# Add frontend subproject
/ccpm:project:subdir:add my-monorepo frontend apps/frontend \
--pattern "*/apps/frontend/*" \
--priority 10
# Add backend with higher priority
/ccpm:project:subdir:add my-monorepo backend apps/backend \
--pattern "*/apps/backend/*" \
--priority 15
/ccpm:project:subdir:list <project-id>
Shows all configured subdirectories with patterns and priorities.
/ccpm:project:subdir:update <project-id> <subproject-name> [--field <field>]
Examples:
# Update pattern
/ccpm:project:subdir:update my-monorepo frontend --field pattern="*/web/*"
# Update priority
/ccpm:project:subdir:update my-monorepo backend --field priority=20
# Update tech stack
/ccpm:project:subdir:update my-monorepo mobile --field tech_stack.languages=["typescript", "swift"]
/ccpm:project:subdir:remove <project-id> <subproject-name>
Glob Pattern Syntax:
* - Matches any characters within a directory level** - Matches any number of directory levels? - Matches single character[abc] - Matches any character in setPattern Examples:
# Exact subdirectory match
match_pattern: "*/apps/frontend/*"
# Matches: /any/path/apps/frontend/src/file.ts
# Multi-level wildcard
match_pattern: "**/packages/ui/**"
# Matches: /any/path/packages/ui/src/components/Button.tsx
# Multiple alternatives (use separate rules)
# For apps/web or web/
- match_pattern: "*/apps/web/*"
priority: 10
- match_pattern: "*/web/*"
priority: 5 # Lower priority (less specific)
Priority Weighting:
Conflict Resolution Example:
subdirectories:
# Specific match wins
- subproject: admin-frontend
match_pattern: "*/apps/admin/*"
priority: 15
# General match (fallback)
- subproject: frontend
match_pattern: "*/apps/*"
priority: 5
# Working in: /apps/admin/src
# Result: admin-frontend (priority 15 > 5)
Auto-Detection Mode (recommended for monorepos):
# Enable auto-detection
/ccpm:project:set auto
# Now just cd to switch context
cd /Users/dev/monorepo/apps/frontend
# → Auto-detects: my-monorepo › frontend
cd /Users/dev/monorepo/apps/backend
# → Auto-detects: my-monorepo › backend
Manual Mode (stable across sessions):
# Set specific project
/ccpm:project:set my-monorepo
# Context stays stable even if you cd
cd /Users/dev/other-repo
# → Still: my-monorepo (no auto-detection)
When to Use Each:
projects:
my-monorepo:
repository:
local_path: /Users/dev/monorepo
git_remote: github.com/org/monorepo
# Subdirectory detection rules
context:
detection:
subdirectories:
- subproject: frontend
match_pattern: "*/apps/frontend/*"
priority: 10
- subproject: backend
match_pattern: "*/apps/backend/*"
priority: 10
- subproject: mobile
match_pattern: "*/apps/mobile/*"
priority: 10
# Subproject metadata (optional but recommended)
code_repository:
subprojects:
- name: frontend
path: apps/frontend
description: Next.js web application
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, nextjs, tailwindcss]
- name: backend
path: apps/backend
description: NestJS API server
tech_stack:
languages: [typescript]
frameworks:
backend: [nestjs, prisma]
- name: mobile
path: apps/mobile
description: React Native mobile app
tech_stack:
languages: [typescript]
frameworks:
mobile: [react-native, expo]
# Project structure:
# monorepo/
# apps/
# web/ - Next.js
# api/ - Express
# packages/
# shared/ - Shared utilities
my-monorepo:
repository:
local_path: /Users/dev/monorepo
context:
detection:
subdirectories:
- subproject: web
match_pattern: "*/apps/web/*"
priority: 10
- subproject: api
match_pattern: "*/apps/api/*"
priority: 10
- subproject: shared
match_pattern: "*/packages/shared/*"
priority: 5 # Lower priority (fallback)
code_repository:
subprojects:
- name: web
path: apps/web
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, nextjs]
- name: api
path: apps/api
tech_stack:
languages: [typescript]
frameworks:
backend: [express, prisma]
# Project structure:
# monorepo/
# packages/
# ui/ - Component library
# api-client/ - API SDK
# utils/ - Utilities
# config/ - Shared config
my-packages:
repository:
local_path: /Users/dev/packages
context:
detection:
subdirectories:
# Use wildcard for all packages
- subproject: ui
match_pattern: "**/packages/ui/**"
priority: 10
- subproject: api-client
match_pattern: "**/packages/api-client/**"
priority: 10
- subproject: utils
match_pattern: "**/packages/utils/**"
priority: 8
# Fallback for other packages
- subproject: core
match_pattern: "**/packages/**"
priority: 3
code_repository:
subprojects:
- name: ui
path: packages/ui
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, tailwindcss]
- name: api-client
path: packages/api-client
tech_stack:
languages: [typescript]
# Project structure:
# enterprise/
# teams/
# commerce/ - E-commerce team
# web/
# api/
# marketing/ - Marketing team
# landing/
# cms/
enterprise:
repository:
local_path: /Users/dev/enterprise
context:
detection:
subdirectories:
# Commerce team
- subproject: commerce-web
match_pattern: "*/teams/commerce/web/*"
priority: 15
- subproject: commerce-api
match_pattern: "*/teams/commerce/api/*"
priority: 15
# Marketing team
- subproject: marketing-landing
match_pattern: "*/teams/marketing/landing/*"
priority: 15
- subproject: marketing-cms
match_pattern: "*/teams/marketing/cms/*"
priority: 15
# Fallback by team
- subproject: commerce
match_pattern: "*/teams/commerce/*"
priority: 8
- subproject: marketing
match_pattern: "*/teams/marketing/*"
priority: 8
code_repository:
subprojects:
- name: commerce-web
path: teams/commerce/web
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, nextjs]
- name: commerce-api
path: teams/commerce/api
tech_stack:
languages: [typescript]
frameworks:
backend: [nestjs, graphql]
DO:
DON'T:
*/*)Recommended Priority Scheme:
Example:
- match_pattern: "*/apps/admin/dashboard/*" # Very specific
priority: 20
- match_pattern: "*/apps/admin/*" # Specific
priority: 15
- match_pattern: "*/apps/*" # General
priority: 5
Naming:
commerce-web, marketing-apiteam-commerce, team-marketingStructure:
Cache Friendly:
Detection Speed:
# Good: 3 patterns, clear priorities
subdirectories:
- subproject: frontend
match_pattern: "*/apps/web/*"
priority: 10
- subproject: backend
match_pattern: "*/apps/api/*"
priority: 10
- subproject: shared
match_pattern: "*/packages/*"
priority: 5
# Avoid: Too many overlapping patterns
subdirectories:
- subproject: web
match_pattern: "*/apps/web/*"
priority: 10
- subproject: web
match_pattern: "*/web/*"
priority: 9
- subproject: web
match_pattern: "**/web/**"
priority: 8
# ... (redundant patterns slow detection)
Per-Subproject Stacks:
subprojects:
- name: web
tech_stack:
languages: [typescript]
frameworks:
frontend: [react, nextjs]
tools: [tailwindcss, vitest]
- name: api
tech_stack:
languages: [typescript]
frameworks:
backend: [nestjs, prisma]
tools: [jest, swagger]
Benefits:
Verify Detection:
# Test each subproject
cd /path/to/monorepo/apps/frontend
/ccpm:project:list # Should show correct subproject
cd /path/to/monorepo/apps/backend
/ccpm:project:list # Should switch automatically
Test Pattern Conflicts:
# Create conflicting patterns intentionally
# Verify highest priority wins
cd /path/to/ambiguous/directory
/ccpm:project:list # Should match highest priority pattern
Steps:
Before (single project):
my-app:
repository:
local_path: /Users/dev/my-app
After (monorepo):
my-app:
repository:
local_path: /Users/dev/my-app
context:
detection:
subdirectories:
- subproject: web
match_pattern: "*/apps/web/*"
priority: 10
- subproject: api
match_pattern: "*/apps/api/*"
priority: 10
code_repository:
subprojects:
- name: web
path: apps/web
- name: api
path: apps/api
Error:
❌ Could not detect active project
Suggestions:
- Set active project: /ccpm:project:set <project-id>
- Enable auto-detection: /ccpm:project:set auto
- Check you're in a configured project directory
Solution with agents:
const detection = Task(project-detector): "Detect active project"
if (detection.error) {
console.log(detection.error.message)
console.log("\nSuggestions:")
detection.error.suggestions.forEach(s => console.log(`- ${s}`))
}
Error:
❌ Project configuration invalid
Project 'my-app' missing required field: linear.team
Fix with: /ccpm:project:update my-app --field linear.team
Solution with agents:
const config = Task(project-config-loader): `
Load project: ${projectId}
Validate: true
`
if (!config.validation.valid) {
config.validation.errors.forEach(err => {
console.error(`❌ ${err.message}`)
err.actions?.forEach(action => console.log(` Fix: ${action}`))
})
}
# In /ccpm:planning:create
Task(project-context-manager): `
Get active project context
Include: detection + config
Format: compact
`
# Display: 📋 Project: My Monorepo › frontend
# Use context for Linear:
linear_create_issue({
team: context.config.linear.team,
project: context.config.linear.project,
labels: context.display.labels
})
# In /ccpm:implementation:start
const context = Task(project-context-manager): "Get context"
console.log(`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🚀 Starting Implementation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Project: ${context.config.project_name}
Subproject: ${context.config.subproject?.name || 'N/A'}
Tech Stack: ${context.display.subtitle}
Location: ${context.display.location}
`)
# Agent selection uses tech stack:
const agents = selectAgents(context.config.subproject?.tech_stack || context.config.tech_stack)
Test with these scenarios:
From inline logic to agents:
Before:
# Read config file
# Parse YAML
# Validate project
# Extract settings
# 50+ lines of logic
After:
Task(project-config-loader): `Load project: ${projectId}`
# 1 line, agent handles everything
Token savings: ~80% reduction in command size
Project Management:
/ccpm:project:add - Add new project/ccpm:project:list - List all projects/ccpm:project:show - Show project details/ccpm:project:set - Set active project/ccpm:project:update - Update project config/ccpm:project:delete - Delete projectMonorepo Subdirectories:
/ccpm:project:subdir:add - Add subdirectory to project/ccpm:project:subdir:list - List project subdirectories/ccpm:project:subdir:update - Update subdirectory config/ccpm:project:subdir:remove - Remove subdirectoryWhen to update this skill:
Update locations: