$npx -y skills add Varnan-Tech/opendirectory --skill reddit-post-engineWrites and optionally posts a Reddit post for any subreddit, following that subreddit's specific culture and rules. Drafts a title, body, and first comment using the 90/10 rule. Uses Composio Reddit MCP for optional direct posting. Use when asked to post on Reddit, draft a Reddit
| 1 | # Reddit Post Engine |
| 2 | |
| 3 | Draft a Reddit post that fits the subreddit's culture. Optionally post it via Composio. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | **Critical rule:** Never post without confirming subreddit rules. Never include product links in the body: put them in the first comment only if appropriate. Follow the 90/10 rule: your post should add value independent of any product mention. |
| 8 | |
| 9 | **Anti-spam rule:** Posts that are primarily promotional will be removed and may get the account banned. The goal is to contribute to the community first. Product mentions go in the first comment, and only if the subreddit allows self-promotion. |
| 10 | |
| 11 | --- |
| 12 | |
| 13 | ## Step 1: Setup Check |
| 14 | |
| 15 | ```bash |
| 16 | echo "GEMINI_API_KEY: ${GEMINI_API_KEY:+set}" |
| 17 | # Check if Composio Reddit MCP is connected |
| 18 | claude mcp list 2>/dev/null | grep -i reddit || echo "Composio Reddit MCP: not connected" |
| 19 | ``` |
| 20 | |
| 21 | **If GEMINI_API_KEY is missing:** |
| 22 | Stop. Tell the user: "GEMINI_API_KEY is required. Get it at aistudio.google.com. Add it to your .env file." |
| 23 | |
| 24 | **If Composio Reddit MCP is not connected:** |
| 25 | Continue. The skill will draft posts but skip the posting step. Inform the user: "Composio Reddit MCP not connected: I'll draft your post for manual submission. To enable direct posting, see the setup instructions in README.md." |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## Step 2: Gather Context |
| 30 | |
| 31 | You need: |
| 32 | - Target subreddit (e.g., r/devops, r/startups, r/SideProject) |
| 33 | - What you are sharing (project, article, question, discussion, tool) |
| 34 | - One-sentence description of what it does |
| 35 | - Why it's relevant to this specific subreddit's community |
| 36 | - Whether you want a self-post (text) or link post |
| 37 | |
| 38 | If any of these are missing, ask in one message: |
| 39 | |
| 40 | "To draft your Reddit post, I need: |
| 41 | 1. Which subreddit? (e.g., r/devops, r/startups) |
| 42 | 2. What are you sharing? (project, article, tool, question) |
| 43 | 3. What does it do? (one sentence, technical) |
| 44 | 4. Why does this subreddit care about it specifically?" |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | ## Step 3: Fetch Subreddit Rules and Culture |
| 49 | |
| 50 | **Fetch the subreddit's rules:** |
| 51 | ```bash |
| 52 | curl -s \ |
| 53 | -H "User-Agent: varnan-skills/1.0" \ |
| 54 | "https://www.reddit.com/r/{SUBREDDIT}/about/rules.json" \ |
| 55 | | python3 -c " |
| 56 | import sys, json |
| 57 | d = json.load(sys.stdin) |
| 58 | rules = d.get('rules', []) |
| 59 | for r in rules: |
| 60 | print(f'Rule: {r.get(\"short_name\", \"\")}') |
| 61 | print(f'Detail: {r.get(\"description\", \"\")[:200]}') |
| 62 | print() |
| 63 | " |
| 64 | ``` |
| 65 | |
| 66 | **Fetch recent top posts to understand tone and style:** |
| 67 | ```bash |
| 68 | curl -s \ |
| 69 | -H "User-Agent: varnan-skills/1.0" \ |
| 70 | "https://www.reddit.com/r/{SUBREDDIT}/top.json?t=week&limit=10" \ |
| 71 | | python3 -c " |
| 72 | import sys, json |
| 73 | d = json.load(sys.stdin) |
| 74 | for p in d['data']['children'][:10]: |
| 75 | pd = p['data'] |
| 76 | print(f'Score: {pd[\"score\"]} | Title: {pd[\"title\"][:100]}') |
| 77 | " |
| 78 | ``` |
| 79 | |
| 80 | Note patterns in the top posts: |
| 81 | - Are titles questions or statements? |
| 82 | - Do they lead with the technology or the outcome? |
| 83 | - Are they personal ("I built...") or impersonal ("Tool for...")? |
| 84 | - What format gets the most engagement in this subreddit? |
| 85 | |
| 86 | **Check subreddit sidebar for posting rules:** |
| 87 | ```bash |
| 88 | curl -s \ |
| 89 | -H "User-Agent: varnan-skills/1.0" \ |
| 90 | "https://www.reddit.com/r/{SUBREDDIT}/about.json" \ |
| 91 | | python3 -c " |
| 92 | import sys, json |
| 93 | d = json.load(sys.stdin) |
| 94 | data = d.get('data', {}) |
| 95 | print('Public description:', data.get('public_description', '')[:300]) |
| 96 | print('Subscribers:', data.get('subscribers', 0)) |
| 97 | " |
| 98 | ``` |
| 99 | |
| 100 | **Identify the subreddit type:** |
| 101 | |
| 102 | | Type | Examples | Post style | |
| 103 | |------|----------|-----------| |
| 104 | | Technical practitioner | r/devops, r/sysadmin, r/ExperiencedDevs | Technical specifics, no fluff, "I did X and learned Y" | |
| 105 | | Startup/builder | r/startups, r/SideProject, r/indiehackers | Personal story, metrics, lessons learned | |
| 106 | | General tech | r/programming, r/technology | News angle, discussion hook, controversial take | |
| 107 | | Career | r/cscareerquestions, r/ITCareerQuestions | Question format, specific scenario, ask for experience | |
| 108 | | Niche tool | r/vim, r/rust, r/golang | Deep technical content, code examples, benchmarks | |
| 109 | |
| 110 | Use the fetched rules and top posts to determine which style applies. |
| 111 | |
| 112 | --- |
| 113 | |
| 114 | ## Step 4: Draft the Post with Gemini |
| 115 | |
| 116 | Write the post content to a temp file and call Gemini: |
| 117 | |
| 118 | ```bash |
| 119 | cat > /tmp/reddit-post-request.json << 'ENDJSON' |
| 120 | { |
| 121 | "system_instruction": { |
| 122 | "parts": [{ |
| 123 | "text": "You are a developer who is active in the {SUBREDDIT} community. Write a Reddi |