Claude AI Background Tasks — SKILL.md
Raw skill file that agents receive when using this skill
---
name: "Claude AI Background Tasks"
description: "Start Claude Code sessions on claude.ai/code to run long tasks in the background — code generation, research, builds — while you keep working locally."
version: "1.0.0"
author: "skynet"
category: "dev"
agents: ["claude-code"]
tags: ["claude", "background", "browser-automation", "ai", "code"]
tools_required: ["chrome-mcp"]
---
# Claude AI Background Tasks
# Claude AI Background Tasks
Start Claude Code sessions on claude.ai/code to run long-running tasks in the background while you keep working locally in the terminal.
## Prerequisites
- Chrome MCP browser tools available (mcp__claude-in-chrome__*)
- Logged in to claude.ai (James's account is pre-authenticated, Max plan)
## When to Use This
- Tasks that take 5+ minutes (large refactors, multi-file generation)
- Research or analysis you don't need results for immediately
- Running builds, tests, or deployments that you want to monitor later
- Parallel workstreams — work on one thing locally while Claude handles another
- Tasks that need Claude Code's full tool access (file editing, terminal, etc.)
## Step 1: Open Claude Code
```
1. Create a new tab: mcp__claude-in-chrome__tabs_create_mcp
2. Navigate to: https://claude.ai/code
3. Read page to confirm — look for "New session" link and session list
```
The Claude Code page shows:
- Sidebar with "New session", "Scheduled", project filter, and session history
- Main area with prompt input, plan mode toggle, model selector, and repo selector
## Step 2: Configure the Session
Before submitting your prompt, configure the session:
### Select a Repository (if needed)
```
1. Look for the "Select a repository" button at the bottom
2. Click it to open the repo picker
3. Search for or select the GitHub repo you want Claude to work on
4. This gives Claude Code access to the repo's files
```
### Toggle Plan Mode (optional)
```
1. Find the "Toggle plan mode" button (labeled "Plan mode")
2. Click to enable if you want Claude to plan before executing
3. Plan mode is good for complex tasks where you want to review the approach
```
### Select Model
```
1. The model selector button shows the current model (e.g., "Opus 4.6")
2. Click to change if needed — options include Opus, Sonnet, Haiku
3. Opus is best for complex tasks; Sonnet for faster, simpler work
```
## Step 3: Submit Your Task
```
1. Find the prompt input area (the main text area)
2. Use form_input to type your task description
3. Click the "Submit" button
```
**Writing good background task prompts:**
- Be extremely specific — this session runs without your input
- Include the full context: what repo, what files, what the goal is
- Specify the expected output (PR, files, report)
- Include success criteria so Claude knows when it's done
**Examples:**
- "In the skynet/factory-orchestrator repo, add comprehensive tests for all API routes. Cover happy paths, error cases, and edge cases. Create a PR when done."
- "Research the current state of MCP server implementations across GitHub. Find the top 20 most-starred repos, analyze their patterns, and write a summary to /tmp/mcp-research.md"
- "In the blogsV2 repo, audit all API routes for missing error handling. Fix any issues found and create a PR with the changes."
## Step 4: Monitor Progress (Optional)
```
1. The session will show real-time progress in the browser
2. You can check back anytime by reading the page
3. Use get_page_text to get the current output
4. The session continues running even if you switch tabs
```
## Step 5: Collect Results
When the task is complete:
```
1. Navigate back to the Claude Code tab
2. Read the page to see the final output
3. Use get_page_text to extract the full conversation/results
4. If a PR was created, the PR URL will be in the output
5. Save the session URL: claude.ai/code/<session-id>
```
## Working with Multiple Background Sessions
You can run multiple sessions in parallel:
```
1. Start first session (Steps 1-3)
2. Create another new tab
3. Navigate to claude.ai/code again
4. Start a new session with a different task
5. Each session runs independently
```
## Checking Session History
```
1. Navigate to: https://claude.ai/code
2. The sidebar shows all previous sessions
3. Sessions are listed with their title and status
4. Click on a session to view its full output
```
## Scheduled Sessions
Claude Code supports scheduled/recurring sessions:
```
1. Click "Scheduled" in the sidebar
2. Set up recurring tasks (daily builds, weekly audits, etc.)
3. These run automatically on the configured schedule
```
## Tips
- Claude Code on claude.ai has full access to connected GitHub repos
- Sessions persist — you can return to any session later
- The Max plan allows long-running sessions with high usage limits
- Use plan mode for critical tasks so Claude explains its approach before executing
- Background sessions are great for tasks that need internet access (research, API calls)
- You can have the browser session open while working in your terminal — they're independent
- If you need to upload files, use the file upload button before submitting your prompt
## Browser Automation Tips
### Prompt Input
The prompt input is a contentEditable div that does NOT appear in the accessibility tree. You must use JavaScript:
```
// Focus and set the prompt text
const editable = document.querySelector('[contenteditable="true"]');
editable.focus();
editable.textContent = 'Your prompt here';
editable.dispatchEvent(new Event('input', { bubbles: true }));
```
### Repository Selection
Claude Code requires selecting a GitHub repo before submitting. If no repo is selected, the submit button opens the repo picker instead:
```
1. Click the "Select a repository" button at the bottom of the form
2. The repo picker opens with a search combobox
3. Type the repo name in the search field
4. Click on the matching repo in the dropdown (use find to locate it)
5. The picker closes and the repo name appears in the button
```
### Submitting
After setting the prompt and selecting a repo, submit via JavaScript:
```
// Submit the form
document.querySelector('form').dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
```
Or click the Submit button:
```
document.querySelector('button[type="submit"]').click();
```
### Notifications Dialog
On first session submission, Claude Code shows an "Enable Notifications" dialog. Dismiss with:
```
1. Use find to locate "Not Now" button
2. Click it
```
### Session URL
After submission, the URL changes from a draft to a session:
- Draft: claude.ai/code/draft_xxx
- Active: claude.ai/code/session_xxx
Save the session URL for later reference.
## Running on Mac Minis
These instructions can also be executed on the Mac Minis (bots, vault, jarvis) using the mac-control MCP server instead of chrome-in-chrome.
### Via mac-control MCP Server (Port 8200)
The mac-control server on each Mac exposes the same GUI automation primitives:
```bash
# Take a screenshot to see the screen
curl -s http://bots.local:8200/tools/screenshot
# Open a URL in Chrome
curl -s http://bots.local:8200/tools/open_url -d '{"url": "https://claude.ai"}'
# Click at screen coordinates
curl -s http://bots.local:8200/tools/click -d '{"x": 500, "y": 300}'
# Type text
curl -s http://bots.local:8200/tools/type_text -d '{"text": "Analyze this codebase and..."}'
# Press keyboard shortcut
curl -s http://bots.local:8200/tools/key_press -d '{"keys": "return"}'
# Run AppleScript
curl -s http://bots.local:8200/tools/applescript -d '{"script": "tell app \\"Google Chrome\\" to activate"}'
# Find text on screen (OCR)
curl -s http://bots.local:8200/tools/find_on_screen -d '{"text": "Submit"}'
```
### Via Chrome DevTools Protocol (Port 9222)
For direct browser control without GUI coordinates:
```bash
# List open tabs
curl -s http://bots.local:9222/json
# Navigate a tab to a URL
curl -s http://bots.local:9222/json/new?https://claude.ai
# Execute JavaScript in a tab (via WebSocket — use a CDP client)
```
### Via SSH + cliclick (Simple Fallback)
```bash
# Open URL
ssh bots 'open https://claude.ai'
# Wait for page load
sleep 3
# Screenshot + analyze
ssh bots 'screencapture /tmp/screen.png'
scp bots:/tmp/screen.png ./screen.png
# Click at coordinates
ssh bots '/opt/homebrew/bin/cliclick c:500,300'
# Type text
ssh bots '/opt/homebrew/bin/cliclick t:"Analyze this codebase and..."'
# Submit
ssh bots '/opt/homebrew/bin/cliclick kp:return'
```
### Recommended Machine
Use **bots** (192.168.86.50) for browser automation — it has full GUI support, screencapture works, and Chrome with remote debugging is running.
curl -s https://skills.skynet.ceo/api/skills/claude-ai-background-tasks/skill.md