This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a TypeScript-based social media automation system featuring multi-platform social commands with Claude Code slash commands and natural language interface. The system uses Claude Code SDK with platform-specific slash commands for AI-driven operations.
Key Principle: Natural language commands are processed by the AI using Claude Code slash commands with platform-specific system prompts, providing intelligent intent detection and model-driven workflows without predetermined limitations.
npm run build # Compile TypeScript to JavaScript
npm run type-check # TypeScript type checking without compilation
npm run lint # ESLint code quality checknpm run twitter -- "create viral content about TypeScript" --dry-run # Generate content (preview mode)
npm run twitter -- "find AWS discussions and engage thoughtfully" # Search and engagement
npm run twitter -- "analyze trending topics and create relevant content" --verbose # Mixed operations
npm run twitter -- "continue with follow-up thread" --resume <session-id> # Resume previous session
npm run twitter -- --help # Show command help and examplesnpm run reddit -- "post insights about React in r/webdev" --dry-run # Community posting (preview mode)
npm run reddit -- "find JavaScript discussions to join with helpful comments" # Community engagement
npm run reddit -- "analyze popular programming posts for content ideas" --verbose # Research and analysis
npm run reddit -- "refine the post based on community feedback" --resume <session-id> # Resume previous session
npm run reddit -- --help # Show command help and examplesnpm run linkedin -- "share cloud architecture best practices" --dry-run # Professional content (preview mode)
npm run linkedin -- "connect with DevOps professionals in my industry" # Professional networking
npm run linkedin -- "create thought leadership content about AI trends" --verbose # Industry leadership
npm run linkedin -- "expand on the previous insights" --resume <session-id> # Resume previous session
npm run linkedin -- --help # Show command help and examplesnpm run social -- twitter "your prompt here" --dry-run # Generic Twitter command
npm run social -- reddit "your prompt here" --verbose # Generic Reddit command
npm run social -- linkedin "your prompt here" # Generic LinkedIn command
npm run social -- twitter "continue conversation" --resume <session-id> # Resume with generic interface- Test with
--dry-runand--verboseflags - Natural language testing via
npm run [platform]commands - Type checking via
npm run type-check - Cross-platform testing with
npm run social [platform] "prompt" - Session continuity testing with
--resume <session-id>parameter
The project uses Claude Code slash commands with platform-specific prompts:
- Platform Entry Points (
twitter.ts,reddit.ts,linkedin.ts) accept user commands in plain English - Generic Social Executor (
src/social-sdk-executor.ts) uses Claude Code SDK with slash commands - Platform-Specific Prompts (
.claude/commands/*.md) contain specialized system prompts for each platform - AI-Driven Workflows - no predetermined operations, model determines appropriate actions based on platform context
src/types.ts: Comprehensive Zod schemas and TypeScript interfaces for all platformssrc/env-loader.ts: Environment configuration with.env.localprioritysrc/social-sdk-executor.ts: Generic MCP integration executor with streaming supporttwitter.ts,reddit.ts,linkedin.ts: Platform-specific command interfaces with natural language processingsocial.ts: Generic command interface for all platforms.claude/commands/: Platform-specific slash command files with specialized system prompts_archive/: Archived files from previous subagent-based architecture
- RUBE MCP Server: Provides access to 500+ apps including Reddit, Twitter, LinkedIn, etc.
- Configuration:
mcp.json - Slash Commands:
.claude/commands/twitter.md,.claude/commands/reddit.md,.claude/commands/linkedin.md
// Twitter operations - viral content and engagement
await SocialSDKExecutor.execute(
'twitter',
"create viral content about TypeScript best practices",
{ dryRun: false, verbose: true }
);
// Resume previous Twitter session with new content
await SocialSDKExecutor.execute(
'twitter',
"create a follow-up thread based on engagement",
{ dryRun: false, verbose: true, resume: "77552924-a31c-4c1a-a07c-990855aa95a3" }
);
// Reddit operations - community engagement
await SocialSDKExecutor.execute(
'reddit',
"post insights about React best practices in r/webdev",
{ dryRun: true, verbose: false }
);
// LinkedIn operations - professional content
await SocialSDKExecutor.execute(
'linkedin',
"share cloud architecture insights with my network",
{ dryRun: false, verbose: true }
);// Claude Code SDK with platform-specific slash commands
const slashCommand = `/${platform} ${prompt} ${options}`;
const response = query({
prompt: slashCommand, // e.g., "/twitter create viral content --dry-run"
options: {
mcpServers: loadMCPServers(),
// Session management - resume previous conversation if provided
...(options.resume && { resume: options.resume }),
// Allow all MCP tools - permission system handles access control
// If needed, can restrict to specific RUBE tools:
// allowedTools: [
// 'mcp__rube__RUBE_SEARCH_TOOLS',
// 'mcp__rube__RUBE_MULTI_EXECUTE_TOOL',
// 'mcp__rube__RUBE_CREATE_PLAN'
// ],
cwd: process.cwd()
}
});
// Session ID is captured from system messages during execution
// Example: π Session ID: 77552924-a31c-4c1a-a07c-990855aa95a3All configurations use Zod schemas:
TwitterPostConfigSchema.parse(config); // Twitter-specific validation
RedditPostConfigSchema.parse(config); // Reddit-specific validation
LinkedInPostConfigSchema.parse(config); // LinkedIn-specific validationLoad environment with .env.local priority:
// Automatic environment loading with priority chain
const env = loadEnvironment(); // .env.local β environment variables
const expandedConfig = expandEnvironmentVariables(configContent, env);- NEVER run
pkill claude,killall claude, or any commands that terminate Claude processes - The current Claude Code session runs within a Claude process - killing it will terminate your active session
- Use
Ctrl+Cto interrupt individual commands, but avoid process termination commands
- β Correct: Use Claude Code SDK with slash commands and platform-specific prompts
- β Incorrect: Hardcode system prompts or use outdated subagent patterns
- The slash command approach provides intelligent workflows with customizable platform-specific optimization
- Source Code: All main logic in
src/directory - Platform Commands:
twitter.ts,reddit.ts,linkedin.ts- platform-specific command interfaces - Generic Command:
social.ts- unified command interface for all platforms - Slash Commands:
.claude/commands/directory with platform-specific system prompts - Configuration:
mcp.jsonand environment files (.env.local,.env.example) - Archive:
_archive/directory for legacy subagent-based files - Build Output:
dist/directory (generated, not committed)
- All platform configurations have corresponding Zod schemas
- Use schema validation before generating commands
- TypeScript types are inferred from Zod schemas using
z.infer<>
- RUBE MCP provides Reddit (
REDDIT_*), Twitter (TWITTER_*), and LinkedIn (LINKEDIN_*) operations - Integration via Claude Code SDK with platform-specific slash commands
- Permission-based access with graceful fallback handling
- Platform-agnostic executor works with any RUBE-supported social platform
Prerequisites: Sign up for a RUBE account at https://rube.app/ to get your API token
- Install dependencies:
npm install - Copy environment template:
cp .env.example .env.local - Configure your RUBE_API_TOKEN from https://rube.app/ in
.env.local - Test with:
npm run twitter -- --helpornpm run reddit -- --helpornpm run linkedin -- --help
When adding new features:
- Extend types in
src/types.tswith Zod schemas for the relevant platform - Update platform-specific slash commands in
.claude/commands/[platform].mdif needed - Test with natural language commands using
--dry-runflag - Add examples to platform-specific help documentation
- Run type checking before commits:
npm run type-check
When adding a new platform:
- Create
.claude/commands/[platform].mdwith platform-specific system prompts - Create
[platform].tsentry point following existing patterns - Add scripts to
package.json:"[platform]": "tsx [platform].ts" - Add platform validation to
src/social-sdk-executor.ts - Test with
npm run [platform] -- --help
When debugging:
- Use
--verboseflag for detailed execution logs - Test with
--dry-runto preview actions without execution - Check environment configuration in
.env.local - Validate MCP server connectivity and permissions
- Use
npm run [platform] -- --helpfor platform-specific command options - Use
npm run social -- [platform] "prompt"for generic command interface - Review session transcripts in
~/.claude/projects/<project-name>/<session-id>.jsonl - Use
--resume <session-id>to continue problematic sessions for iterative debugging
- Viral content optimization with engagement triggers
- Thread creation and audience engagement strategies
- Trending topic analysis and timely content creation
- Strategic hashtag research and algorithm optimization
- Subreddit culture awareness and community guidelines
- Content optimization for specific subreddit audiences
- Authentic engagement and discussion participation
- Timing optimization for maximum visibility
- Professional networking and relationship building
- B2B content creation and thought leadership
- Industry-specific targeting and engagement
- Professional brand building and authority establishment
- Platform-Native Formatting: LinkedIn does NOT support markdown (
**bold**,_italic_, headers, code blocks) - Unicode Bold Text: Use Mathematical Bold Unicode (πππ) for emphasis instead of markdown
- Professional Structure: Template-based with emojis, spacing, and Unicode for visual hierarchy
- Character Reference: See
docs/linkedin-unicode-formatting.mdfor complete Unicode mappings - LinkedIn Algorithm Optimization: Business hours posting, native content prioritization
Do what has been asked; nothing more, nothing less. NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.