This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the Claude Code Sub-Agent Collective - an NPX-distributed framework that installs specialized AI agents, hooks, and behavioral systems for TDD-focused development workflows. The system enforces test-driven development through automated handoff validation and provides intelligent task routing through a hub-and-spoke architecture.
Git Remote URL: https://github.com/vanzan01/claude-code-sub-agent-collective.git NEVER CHANGE THIS URL - Always use this exact repository URL for all git operations.
- Hub-and-spoke architecture with
@routing-agentas central coordinator - Behavioral Operating System defined in
CLAUDE.mdwith prime directives - Test-Driven Handoffs with contract validation between agents
- Just-in-time context loading to minimize memory usage
- NPX Package:
claude-code-collective- Installable vianpx claude-code-collective init - Agent System: 30+ specialized agents in
templates/agents/ - Hook System: TDD enforcement hooks in
templates/hooks/ - Command System: Natural language + structured commands in
lib/command-*.js - Metrics Framework: Research hypotheses tracking in
lib/metrics/ - Template System: Installation templates in
templates/
# Run tests (primary test suite)
npm test # Vitest tests
npm run test:jest # Jest tests (comprehensive)
npm run test:coverage # Coverage reports
# Run specific test suites
npm run test:contracts # Contract validation tests
npm run test:handoffs # Agent handoff tests
npm run test:agents # Agent system tests
# Package management
npm run install-collective # Install to current directory
npm run validate # Validate installation
npm run metrics:report # View metrics dataFor testing changes before publishing (see ai-docs/Simple-Local-Testing-Workflow.md):
# Automated testing (does everything automatically)
./scripts/test-local.sh
# This script automatically:
# - Creates package (.tgz file)
# - Creates test directory ../npm-tests/ccc-testing-vN (auto-numbered)
# - Installs the package in test directory
# - Runs basic validation tests
# - Leaves you in the test directory ready for more testing
# Additional manual testing (you're already in test directory after script)
npx claude-code-collective init # Interactive mode
npx claude-code-collective init --minimal # Minimal installation
npx claude-code-collective --help # Help information
# Return to main directory and cleanup when done
cd ../taskmaster-agent-claude-code
./scripts/cleanup-tests.sh # Removes test directories and tarballsscripts/test-local.sh- Automated package testing in dedicated../npm-tests/directoryscripts/cleanup-tests.sh- Clean up test artifacts and directories (removes npm-tests when empty)
MANDATORY NAMING CONVENTION: All npm testing directories MUST follow the established pattern:
- Manual testing:
ccc-manual-v[N](e.g.,ccc-manual-v1,ccc-manual-v2) - Automated testing:
ccc-automated-v[N](e.g.,ccc-automated-v1,ccc-automated-v2) - Feature-specific testing:
ccc-[feature]-v[N](e.g.,ccc-backup-test-v1,ccc-hooks-test-v1)
DO NOT use arbitrary names like test-backup-validation or any other format. Always use the ccc-* prefix followed by descriptive name and version number.
# Test the NPX package locally (quick testing)
npx . init # Test installation from current directory
npx . status # Test status command
npx . validate # Test validationlib/index.js- Main entry point and ClaudeCodeCollective classlib/installer.js- NPX installation logiclib/command-system.js- Natural language command processinglib/AgentRegistry.js- Agent management and lifecyclebin/claude-code-collective.js- CLI interface
jest.config.js- Jest configuration for comprehensive testingvitest.config.js- Vitest configuration for fast iterationtests/setup.js- Test environment setuptests/contracts/- Contract validation teststests/handoffs/- Agent handoff tests
templates/- All installation templates (agents, hooks, configs)templates/CLAUDE.md- Behavioral system templatetemplates/settings.json- Claude Code configuration templatelib/file-mapping.js- Template to destination mapping
Standard process for testing changes before merging:
-
Create Feature Branch
git checkout -b feature/your-feature-name # Make changes... git add . && git commit -m "feat: your changes"
-
Test Locally
./scripts/test-local.sh # This creates ccc-testing-vN directory and tests your changes # Script shows version number to confirm you're testing your branch
-
Manual Testing (you'll be in test directory)
# Non-interactive testing (for validation/CI) npx claude-code-collective init --yes --force npx claude-code-collective status npx claude-code-collective validate # Interactive testing (for development) npx claude-code-collective init # Test all functionality you changed
-
Fix Issues (if any)
cd ../taskmaster-agent-claude-code # Make fixes... git add . && git commit -m "fix: issue description" # Repeat from step 2
-
Clean Up & Merge
./scripts/cleanup-tests.sh # Remove test artifacts git push -u origin feature/your-feature-name # Create PR, merge when approved
Key Benefits:
- Tests exact user installation experience
- Catches template/file mapping issues
- Verifies version changes work correctly
- No need to push to test (works locally)
- Create agent definition in
templates/agents/agent-name.md - Update
lib/file-mapping.jsto include in installation - Add contract tests in
tests/agents/ - Test via
npm run test:agents
- Edit hook scripts in
templates/hooks/ - Update
templates/settings.jsonif needed - Test hook behavior with
npm run test:handoffs - Validate with
npm run test:contracts
- Make changes to templates or core logic
- Test locally:
npx . init --force - Validate:
npx . validate - Run full test suite:
npm test
- Agent Registry: Centralized agent tracking and lifecycle management
- Template System: Handlebars-based template rendering for dynamic agent creation
- Spawning System: Dynamic agent instantiation with proper context loading
- Test-Driven Handoffs: Automated validation of agent transitions
- Behavioral Enforcement: Hooks enforce TDD and routing requirements
- Metrics Collection: Automated data gathering for research hypotheses
- Natural Language Processing: Converts user intent to structured commands
- Namespace Routing:
/collective,/agent,/gate,/vancommand spaces - Auto-completion: Context-aware command suggestions
- Unit Tests (
tests/*.test.js) - Core functionality - Contract Tests (
tests/contracts/) - Agent handoff validation - Integration Tests (
tests/handoffs/) - End-to-end workflows - Installation Tests - NPX package validation
- Vitest: Fast iteration during development (
npm test) - Jest: Comprehensive validation (
npm run test:jest) - Coverage: Track test coverage (
npm run test:coverage)
- All tests must pass before releases
- Contract validation ensures agent compatibility
- Installation tests verify NPX package integrity
- Node.js: >= 16.0.0 required
- Dependencies: Use
npm installnotyarn - Testing: Both Vitest and Jest configured for different use cases
- Update version in
package.json - Run full test suite:
npm run test:jest - Test NPX installation:
npx . init --force - Update
CHANGELOG.mdwith changes - Commit and tag release
- Never manually edit generated files in
.claude/or.claude-collective/ - Template changes must be tested through full installation cycle
- Agent definitions follow strict markdown format requirements
- All new functionality must have tests first
- Agent handoffs must include contract validation
- Behavioral changes require integration test updates
CRITICAL: Do not modify established standards without explicit permission. This includes:
- Naming conventions (testing directories, file patterns, etc.)
- Code formatting standards
- Testing procedures and workflows
- Documentation structure
- Git workflow patterns
- Release processes
When in doubt, follow existing patterns exactly. Ask for clarification before deviating from any established standard.
When user says "npm version [patch|minor|major]":
- Always use a proper commit message based on recent changes
- Check git log for recent features/fixes to craft meaningful message
- Use format:
npm version patch -m "chore: release v%s - [summary of changes]" - Example:
npm version patch -m "chore: release v%s - fix CI race conditions and add comprehensive testing" - Never use the default "2.0.7" commit message
This codebase implements a sophisticated agent collective system with strong TDD enforcement and intelligent routing capabilities.