Skip to content

frontkom/night-shift

Repository files navigation

Night Shift

Night Shift

While you sleep, an AI agent works across your repositories. You wake up to fresh PRs and you decide what you want to keep.

Get started

Install (run in your shell, not in Claude):

npx skills add -g frontkom/night-shift

The -g flag installs globally to ~/.claude/skills/ so the skill is available in every Claude Code session. Without it, npx skills defaults to a project-local install when run inside a git repo, which only loads the skill for sessions opened in that specific project.

Or fetch the single file directly — no CLI required:

mkdir -p ~/.claude/skills/night-shift && \
  curl -fsSL https://raw.githubusercontent.com/frontkom/night-shift/main/skills/night-shift/SKILL.md \
  -o ~/.claude/skills/night-shift/SKILL.md

Use:

In any Claude Code session, type:

/night-shift

Claude will walk you through setup interactively — pick repos, choose tasks, confirm before anything is created.

Night Shift supports two backends:

Backend How it runs Requirements
Claude Routine Claude Code routines (runs on your account) Claude subscription — no API key needed
GitHub Actions GitHub-hosted runners via a reusable workflow ANTHROPIC_API_KEY in org/repo secrets + gh CLI

During setup, /night-shift runs a per-repo task picker — for each repo you add, you choose which of the tasks should run nightly. Defaults are all-on. To change a repo's selection later, re-run /night-shift and pick Change tasks for a repo.

What you'll find in your repo tomorrow morning

  • Implemented plans — picks the next phase from a docs/*-PLAN.md file and opens a PR
  • Updated docs — changelog entries, user guide pages, decision records
  • New test coverage — fills coverage gaps following your existing test patterns
  • Fixed accessibility issues — WCAG AA violations on key pages
  • Translated UI strings — moves hardcoded text into your i18n system
  • Audit PRs — security, bug, SEO, performance, and dependency-vulnerability issues
  • Lint-baseline shrink — picks one entry from your project's PHPStan/Psalm/ESLint/mypy/RuboCop baseline, fixes the underlying violation, and removes the suppression
  • Auto-fix on red CI and review comments — every routine has Claude's built-in autofix_on_pr_create enabled, so when CI fails or a reviewer comments on a Night Shift PR the routine wakes up, investigates, and pushes a fix

Every Night Shift run leaves a labelled PR per task (night-shift), so gh pr list --label night-shift is the audit trail — no per-repo log file is written. The bundle is recoverable from the PR title prefix (night-shift/plan:, night-shift/bug:, night-shift/a11y:, etc.).

The bundles

Bundle What it does Mode
plans Implements the next phase of a planning document One PR per plan
docs Updates changelog, user guide, decision records, suggestions One PR per task
code-fixes Adds tests, fixes accessibility, completes translations One PR per task
audits Finds security / bug / SEO / performance / dependency issues One PR per area
shopify (opt-in) Vendor cherry-picks (Horizon/Dawn/Skeleton) + pre-flight migration-risk audits One PR per vendor-update concern; issue-only for risk audit

manifest.yml is the single source of truth for what tasks exist, what they do, what bundle they belong to, and what order they run in. Edit one file to add, rename, reorder, or move tasks.

The shopify bundle is opt-in for Shopify projects only. To enable: add bundles: [shopify] (alongside any other bundles) in the project's CLAUDE.md Night Shift Config block. The tasks expect the project to be running on claude-shopify-boilerplate conventions (specifically scripts/tasks/diff_vendor_update.py, scripts/tasks/audit_migration_risk.py, and a .vendor-baseline file at repo root).

GitHub Actions

To use the GitHub Actions backend, an org admin needs to add ANTHROPIC_API_KEY as an organization secret:

  1. Go to your org's Settings → Secrets and variables → Actions
  2. Click New organization secret
  3. Name: ANTHROPIC_API_KEY, Value: your Anthropic API key
  4. Repository access: select the repos Night Shift will manage (or "All repositories")

This is a one-time setup. Once the secret exists, any repo member can run /night-shift, choose GitHub Actions, and the skill will create PRs with the workflow file — no local clone needed.

You also need the GitHub CLI (gh) installed and authenticated on your machine for the setup process.

Jira integration (optional)

Night Shift can pick up Jira issues labelled night-shift and turn them into PRs — same shape as the GitHub Issues path, just sourced from a Jira Cloud project. Auth is handled via the Atlassian Rovo MCP connector that Claude maintains via OAuth — no API tokens, no env vars, no secret storage on Night Shift's side.

Per-developer setup (one time, ~3 minutes)

Each developer who wants to use Jira with Night Shift does this checklist on their own Claude account:

1. Connect Atlassian Rovo. Open https://claude.ai/customize/connectors → find Atlassian Rovo in the directory → Connect → complete the Atlassian OAuth prompt. Verify with claude mcp list (you should see claude.ai Atlassian Rovo: ✓ Connected).

2. Set tool permissions to "Always allow". Still on the Atlassian Rovo page in the connectors UI, you'll see three permission groups: Interactive (5 tools), Read-only (11 tools), Write/delete (3 tools). Each defaults to Needs approval. Flip all three to Always allow (the ✓ icon). Routines run at 3 AM with no human to click "approve" — without this, every Rovo tool call hangs the routine.

The five tools the task actually calls — Search with JQL, Get issue, Get transitions, Transition issue, and the comment-adding tool — straddle Interactive and Read-only, so flipping all three groups is the simplest "set it and forget it" choice. (Write/delete is needed if the comment tool lives there.)

3. Run /night-shift in Claude Code. When the task picker asks, tick work-on-jira-issues for each repo where you want this active. The skill prompts for the Jira project key per repo and prints the snippet to paste into that repo's CLAUDE.md.

4. Add the Jira project key to each opted-in repo. Under ## Night Shift Config in CLAUDE.md:

## Night Shift Config
- Jira project key: FGPW
- Jira label: night-shift   # optional; omit to default to night-shift

Commit + merge.

5. Label issues. Tag any open Jira issue with night-shift. The next nightly build picks up the three oldest, opens one GitHub PR per issue, comments back with the PR link, and best-effort transitions each issue to In Progress.

The task self-skips silently when the project key is missing or the Rovo connector isn't attached to the routine, so partial setup is safe — you can opt a repo in via the picker first and finish the OAuth flow later without seeing failure noise.

Bootstrap caveat (first developer only)

The skill auto-attaches Rovo to the build routine using the connector's account-scoped UUID. To read that UUID via the API, at least one routine on the account must already have Rovo attached. The very first developer enabling Jira on a fresh account hits one extra step:

Open https://claude.ai/code/routines → edit any routine (the build routine works) → toggle Atlassian Rovo on in the connectors panel → save. After that, re-run /night-shift. The skill discovers the UUID from the populated routine and propagates it everywhere.

Subsequent developers (and subsequent routine creates on the same account) skip this step entirely — the UUID is already discoverable.

Stopping Night Shift on a project

Add either:

  • An empty file .nightshift-skip at the repo root
  • A line Night Shift: skip in CLAUDE.md, AGENTS.md, or README.md

The wrapper reports opted-out for that repo and moves on.

Customising per project

Add a ## Night Shift Config section to the project's CLAUDE.md. All fields are optional — anything unset uses sensible defaults autodetected from your manifest (package.json, composer.json, pyproject.toml, Cargo.toml, Gemfile, go.mod) and repo layout.

## Night Shift Config
- Doc language: Norwegian (nb)
- Test command: npm test
- Build command: npm run build
- Push: git push mirror main && git push origin main
- Key pages: /dashboard, /surveys, /people

The same shape works for non-JS stacks — Night Shift dispatches the commands you write here, regardless of language:

## Night Shift Config
- Test command: vendor/bin/phpunit
- Build command: composer install --no-dev --no-progress
- Audit scope: web/modules/custom, web/themes/custom
- Exclude: web/modules/contrib, web/core, vendor
- Key pages: web/themes/custom/viken/templates/page.html.twig

Audit scope and Exclude are useful for vendored-heavy projects (Drupal, WordPress, Rails monoliths, monorepos with vendored packages) — see HOW-TO.md for details.

Recommended target-repo setup (optional)

These are hints, not requirements — your org may already have its own standards.

Enable a merge queue on main. Night Shift opens several PRs in parallel at night. Without a queue, every PR sits on its original tree all day. As siblings land, each remaining PR goes stale — missing modules, merge conflicts, stale CI aggregators — and you spend your morning rebasing instead of reviewing. A merge queue rebases each PR onto fresh main and re-runs required checks at merge time, so freshness is guaranteed.

Suggested settings (GitHub → Settings → Rules → ruleset for main):

  • Add a merge_queue rule: method SQUASH, grouping ALLGREEN.
  • Keep required status checks; the queue re-runs them on the rebased commit.
  • Allow merge method: squash only (keeps history linear).

Selective human review for Night Shift PRs only. If you don't want blanket "require 1 approval" on every human PR, but do want human approval before Night Shift PRs land, add a small workflow that gates on the night-shift label. Then mark nightshift-review-gate as a required status check. Human PRs skip it automatically; Night Shift PRs block on it until approved.

Aggregator checks should treat cancelled as neutral, not failure. If you use an aggregator job (one that waits on needs: and succeeds only if children pass — common for multi-app monorepos), make sure it only fails on failure. Otherwise, when concurrency cancels an older run (a common, desirable thing), the aggregator latches to red and the PR stays BLOCKED even though every real test passed. We got bitten by this three times in one night before fixing it.

How to add a project, add a task, or run something now

See HOW-TO.md — five copy-paste recipes covering the common operations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors