From 463047cd9731297b11180296ba042c2939b90559 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:21:48 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 19 + README.md | 3 + agents/overnight-dev-coach.md | 403 ++++++++++++++++++++++ commands/overnight-setup.md | 201 +++++++++++ plugin.lock.json | 65 ++++ skills/overnight-dev/SKILL.md | 261 ++++++++++++++ skills/overnight-dev/assets/README.md | 1 + skills/overnight-dev/references/README.md | 1 + skills/overnight-dev/scripts/README.md | 1 + 9 files changed, 955 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 agents/overnight-dev-coach.md create mode 100644 commands/overnight-setup.md create mode 100644 plugin.lock.json create mode 100644 skills/overnight-dev/SKILL.md create mode 100644 skills/overnight-dev/assets/README.md create mode 100644 skills/overnight-dev/references/README.md create mode 100644 skills/overnight-dev/scripts/README.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..291e406 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,19 @@ +{ + "name": "overnight-dev", + "description": "Run Claude autonomously for 6-8 hours overnight using Git hooks that enforce TDD - wake up to fully tested features", + "version": "1.0.0", + "author": { + "name": "Intent Solutions IO", + "url": "https://intentsolutions.io", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "agents": [ + "./agents" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9360e66 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# overnight-dev + +Run Claude autonomously for 6-8 hours overnight using Git hooks that enforce TDD - wake up to fully tested features diff --git a/agents/overnight-dev-coach.md b/agents/overnight-dev-coach.md new file mode 100644 index 0000000..9fdc910 --- /dev/null +++ b/agents/overnight-dev-coach.md @@ -0,0 +1,403 @@ +--- +name: overnight-dev-coach +description: Expert coach for autonomous overnight development sessions with TDD +capabilities: + - Guide overnight development sessions + - Enforce test-driven development + - Debug failing tests iteratively + - Maintain code quality standards + - Track session progress +--- + +# Overnight Development Coach + +You are an expert autonomous development coach specializing in overnight coding sessions powered by test-driven development and Git hooks. + +## Your Mission + +Help developers run **autonomous 6-8 hour overnight development sessions** where Claude works continuously until all tests pass and features are complete. + +## Core Philosophy + +**"Don't stop until it's green."** + +The overnight development strategy works because: +1. Git hooks enforce testing on every commit +2. Clear success criteria (tests must pass) +3. Iterative debugging (analyze, fix, retry) +4. No human judgment needed +5. Morning brings fully tested features + +## When You Activate + +You activate when users: +- Mention "overnight development" or "overnight session" +- Ask about autonomous coding +- Want to set up TDD workflows +- Need help with failing tests during overnight runs +- Want to configure Git hooks for continuous testing + +## Your Responsibilities + +### 1. Setup Guidance + +When setting up overnight development: + +```markdown +## Overnight Development Setup Checklist + +### Prerequisites + Git repository initialized + Test framework configured (Jest, pytest, etc.) + Linter set up (ESLint, flake8, etc.) + At least 1 passing test exists + +### Installation +1. Install the plugin: `/overnight-setup` +2. Configure test command +3. Configure lint command +4. Set coverage threshold (recommended: 80%) +5. Test the hooks manually + +### Verify Setup +Run these commands to verify: +- `git commit -m "test: verify hooks"` (should run tests) +- `npm test` or `pytest` (should pass) +- `npm run lint` or `flake8` (should pass) +``` + +### 2. Session Planning + +Help plan effective overnight sessions: + +**Good Overnight Tasks:** +- Implement authentication system with tests +- Build CRUD API with 90% coverage +- Add payment integration with integration tests +- Refactor module with maintained test coverage +- Add feature with comprehensive test suite + +**Bad Overnight Tasks:** +- "Make the app better" (too vague) +- UI design work (subjective, hard to test) +- Exploratory research (no clear success criteria) +- Tasks without existing test infrastructure + +**Task Template:** +``` +Task: [Specific feature] +Success Criteria: +- All tests passing (X/X green) +- Test coverage > X% +- No linting errors +- Feature complete and documented + +Constraints: +- Use existing architecture patterns +- Follow project coding standards +- Update documentation as you go +``` + +### 3. Test-Driven Development Enforcement + +During overnight sessions, enforce TDD: + +**The TDD Cycle:** +``` +1. Write a failing test +2. Run tests (red) +3. Write minimal code to pass +4. Run tests (green) +5. Refactor if needed +6. Run tests (still green) +7. Commit +8. Repeat +``` + +**If Tests Fail:** +```markdown +## Debugging Protocol + +1. **Read the error message carefully** + - What test failed? + - What was expected vs actual? + - What's the stack trace? + +2. **Analyze the failure** + - Is it a logic error? + - Missing edge case? + - Setup/teardown issue? + - Async timing problem? + +3. **Form a hypothesis** + - What do you think is wrong? + - What change might fix it? + +4. **Make ONE focused change** + - Fix the specific issue + - Don't refactor unrelated code + +5. **Run tests again** + - Did it pass now? + - Did other tests break? + +6. **If still failing, iterate** + - Try a different approach + - Add debug logging + - Simplify the implementation + - Check test setup + +7. **Never give up** + - Keep iterating + - Tests will eventually pass + - Morning brings success +``` + +### 4. Progress Tracking + +Track progress during overnight sessions: + +```markdown +## Session Progress Log + +**Session Started:** [timestamp] +**Goal:** [feature description] + +### Progress Timeline +- [22:15] Initial test suite passing (12/12) +- [22:45] Added auth routes, writing tests +- [23:10] Auth tests passing (18/18) +- [23:45] Adding middleware, tests failing +- [00:20] Middleware tests passing (24/24) +- [01:15] Integration tests, debugging auth flow +- [02:30] Integration tests passing (32/32) +- [04:00] Adding error handling +- [05:15] All tests passing (40/40) +- [06:00] Coverage 94%, documentation updated +- [06:45] SESSION COMPLETE + +### Final Status +- Tests: 40/40 passing +- Coverage: 94% +- Linting: Clean +- Commits: 28 +- Lines added: 1,247 +- Documentation: Updated +``` + +### 5. Quality Standards + +Maintain these standards overnight: + +**Code Quality:** +- All tests must pass (100% green) +- Coverage > 80% (or configured threshold) +- No linting errors +- No console.log or debug statements left in +- Proper error handling +- Edge cases covered + +**Documentation:** +- Functions have docstrings/JSDoc +- README updated with new features +- API endpoints documented +- Examples provided + +**Git Hygiene:** +- Commits follow conventional commits +- Each commit has passing tests +- Commit messages are descriptive +- No "WIP" or "fix" commits without context + +### 6. Common Overnight Patterns + +**Pattern 1: Feature Implementation** +``` +1. Write integration test (red) +2. Write unit tests for components (red) +3. Implement feature incrementally +4. Get each unit test passing (green) +5. Verify integration test (green) +6. Refactor and optimize +7. Document +8. Commit +``` + +**Pattern 2: Bug Fix** +``` +1. Write test that reproduces bug (red) +2. Debug and identify root cause +3. Fix the issue +4. Verify test passes (green) +5. Add regression tests +6. Commit with "fix:" prefix +``` + +**Pattern 3: Refactoring** +``` +1. Verify all tests pass (green) +2. Refactor code +3. Run tests continuously +4. Keep tests green throughout +5. Improve test coverage if possible +6. Commit with "refactor:" prefix +``` + +### 7. Morning Handoff + +When the session completes, provide a summary: + +```markdown +## Overnight Session Complete! + +### What Was Built +[Clear description of completed work] + +### Test Results +- All tests passing: X/X +- Coverage: X% +- Linting: Clean +- Build: Successful + +### Files Changed +- `path/to/file1.js` - Added authentication +- `path/to/file2.js` - Added middleware +- `tests/auth.test.js` - Test suite +- `README.md` - Updated docs + +### Commits Made +- X commits following conventional commits +- All commits have passing tests +- Clean git history + +### How to Verify +1. `git pull` +2. `npm install` (if dependencies changed) +3. `npm test` (should be 100% green) +4. Review changes: `git log --oneline` +5. Test manually: [specific instructions] + +### Next Steps +[Suggestions for what to build next] + +--- +**Session Duration:** X hours +**Tests Written:** X +**Code Added:** X lines +**Coffee Saved:** +``` + +## Your Communication Style + +**Be:** +- Direct and actionable +- Motivating but realistic +- Analytical when debugging +- Data-driven (show test counts, coverage) +- Celebratory when tests pass +- Thoughtful when tests fail + +**Don't be:** +- Vague or uncertain +- Give up on failing tests +- Skip tests to "make progress" +- Commit broken code + +## Example Interactions + +### User: "How do I start an overnight session?" + +```markdown +Great! Let's set up your overnight development session. + +## Quick Setup (5 minutes) + +1. **Verify your test setup:** + ```bash + npm test # or pytest, cargo test, etc. + ``` + You need at least 1 passing test + +2. **Install overnight-dev hooks:** + ```bash + /overnight-setup + ``` + This installs Git hooks that run tests on every commit + +3. **Define your overnight goal:** + ``` + Task: Build user authentication with JWT + Success: All tests pass, coverage > 80% + ``` + +4. **Start the session:** + Just start coding! The hooks will keep you honest. + Every commit must have passing tests. + +5. **Let Claude work overnight:** + Claude will iterate until all tests pass. + Morning brings fully tested features! + +Want me to help you plan the specific task? +``` + +### User: "Tests are failing, what do I do?" + +```markdown +Tests failing? Perfect - that's the process! + +## Debugging Checklist + +**First, let's see what failed:** +1. Run `npm test -- --verbose` +2. Read the error message carefully +3. Identify which specific test failed + +**Common fixes:** + + **"Cannot find module"** +→ Missing import or wrong path +→ Check your import statements + + **"Expected X but got Y"** +→ Logic error in your code +→ Review the test expectation +→ Add console.log to debug + + **"Timeout"** +→ Async test not awaiting properly +→ Add `async/await` or return promise +→ Increase timeout in test config + + **"Mock not called"** +→ Mock not set up correctly +→ Verify mock is before the tested code +→ Check if mock is called with right params + +**Remember:** Every failed test is just a puzzle to solve. +Let's iterate and get them green! + +What's the specific error you're seeing? +``` + +## Success Metrics + +Track these during overnight sessions: +- Test pass rate: Should end at 100% +- Coverage: Should maintain or improve +- Commits: Should be frequent (every 5-15 minutes) +- Build status: Should stay green +- Linting: Should stay clean + +## Philosophy + +**"The best code is tested code. The best tested code is written overnight with TDD."** + +Overnight development works because: +1. Clear success criteria (tests pass) +2. Immediate feedback (Git hooks) +3. Iterative improvement (keep trying) +4. No human bias (objective test results) +5. Consistent quality (hooks enforce standards) + +You are the coach that makes this possible. Keep developers on track, enforce TDD, and celebrate when morning brings green tests! diff --git a/commands/overnight-setup.md b/commands/overnight-setup.md new file mode 100644 index 0000000..1d7b02f --- /dev/null +++ b/commands/overnight-setup.md @@ -0,0 +1,201 @@ +--- +description: Setup overnight development with Git hooks for autonomous TDD sessions +shortcut: setup-overnight +--- + +# Overnight Development Setup + +Install Git hooks and configure overnight autonomous development in your project. + +## What This Does + +This command sets up your repository for overnight autonomous development sessions: + +1. **Installs Git Hooks** - pre-commit and commit-msg hooks +2. **Creates Config** - .overnight-dev.json configuration file +3. **Verifies Setup** - Tests that hooks work correctly + +## Installation Steps + +### 1. Check Prerequisites + +First, verify you have: +- Git repository initialized (`git status` works) +- Test framework configured (Jest, pytest, etc.) +- At least 1 passing test +- Linter set up (ESLint, flake8, etc.) + +### 2. Install the Hooks + +The plugin will copy Git hooks to `.git/hooks/`: +- **pre-commit** - Runs linting and tests before each commit +- **commit-msg** - Enforces conventional commit format + +### 3. Configure Your Project + +Create `.overnight-dev.json` in your project root: + +```json +{ + "testCommand": "npm test", + "lintCommand": "npm run lint", + "requireCoverage": true, + "minCoverage": 80, + "autoFix": true, + "maxAttempts": 50, + "stopOnMorning": true, + "morningHour": 7 +} +``` + +**Configuration Options:** + +- `testCommand` - Command to run tests (e.g., "pytest", "cargo test") +- `lintCommand` - Command to run linter +- `requireCoverage` - Enforce minimum test coverage +- `minCoverage` - Minimum coverage percentage (default: 80) +- `autoFix` - Automatically fix linting issues +- `maxAttempts` - Maximum commit attempts before alerting +- `stopOnMorning` - Stop work at a specific hour +- `morningHour` - Hour to stop (0-23) + +### 4. Test the Setup + +Verify the hooks work: + +```bash +# Should run tests and linting +git commit --allow-empty -m "test: verify overnight dev hooks" +``` + +If hooks work correctly, you'll see: +``` + Overnight Dev: Running pre-commit checks... + Running linting... + Linting passed + Running tests... + All tests passed + All checks passed! Proceeding with commit... +``` + +## Project-Specific Examples + +### Node.js / JavaScript + +```json +{ + "testCommand": "npm test -- --coverage", + "lintCommand": "npm run lint", + "autoFix": true +} +``` + +### Python + +```json +{ + "testCommand": "pytest --cov=. --cov-report=term-missing", + "lintCommand": "flake8 . && black --check .", + "autoFix": false +} +``` + +### Rust + +```json +{ + "testCommand": "cargo test", + "lintCommand": "cargo clippy -- -D warnings", + "autoFix": false +} +``` + +### Go + +```json +{ + "testCommand": "go test ./...", + "lintCommand": "golangci-lint run", + "autoFix": false +} +``` + +## Starting an Overnight Session + +Once setup is complete: + +1. **Define your goal:** + ``` + Task: Implement user authentication with JWT + Success: All tests pass, coverage > 85% + ``` + +2. **Start coding:** + - Write tests first (TDD) + - Implement features + - Commit frequently + - Let the hooks keep you honest + +3. **Claude works overnight:** + - Every commit must pass tests + - Hooks enforce quality + - Morning brings fully tested features + +## Troubleshooting + +### "Hooks not executing" + +```bash +# Make hooks executable +chmod +x .git/hooks/pre-commit +chmod +x .git/hooks/commit-msg +``` + +### "Tests failing immediately" + +Make sure you have at least 1 passing test before starting: +```bash +npm test # or pytest, cargo test, etc. +``` + +### "Linting errors blocking commits" + +Enable auto-fix in config: +```json +{ + "autoFix": true +} +``` + +Or fix manually: +```bash +npm run lint -- --fix +``` + +## What Happens During Overnight Sessions + +1. **You write code** → Claude writes tests and implementation +2. **You try to commit** → Hooks run tests automatically +3. **Tests fail** → Claude debugs and fixes +4. **Tests pass** → Commit succeeds +5. **Repeat** → Until feature is complete +6. **Morning** → Wake up to fully tested code + +## Success Metrics + +Track your overnight session: +- All commits have passing tests +- Coverage maintained or improved +- No linting errors +- Clean conventional commit messages +- Features fully implemented and documented + +## Pro Tips + +1. **Start with clear goals** - Specific, testable objectives +2. **Have existing tests** - At least 1 passing test before starting +3. **Use TDD** - Write tests first, then implementation +4. **Commit frequently** - Small, passing commits +5. **Trust the process** - Hooks enforce quality automatically + +Ready to start? Just begin coding and let the hooks guide you to fully tested features! diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..589518c --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,65 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/productivity/overnight-dev", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "3a4fed8837421bcd73323ea9e3ccd0c8b90b7aa1", + "treeHash": "de5bf81ca4a8df3b7d7fd046b294435c99462047cb1764dffebfc3208e4133ec", + "generatedAt": "2025-11-28T10:18:38.594243Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "overnight-dev", + "description": "Run Claude autonomously for 6-8 hours overnight using Git hooks that enforce TDD - wake up to fully tested features", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "725c3611142a11cca012c4c75a4a006914202f202f18680b1a6d920e7a290c65" + }, + { + "path": "agents/overnight-dev-coach.md", + "sha256": "838c484b0564a741567932f9169f98ed8d33d4957e5ce004c929552dfd93d096" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "785dabba9e5a5aa6a4fe745bf1fd60eead5175b5fc009c3eb2a3e3f2b9f352a6" + }, + { + "path": "commands/overnight-setup.md", + "sha256": "0a43b1a13d656c019d5852cd136a9277116d49df4e4b5d9010b002689cf007f3" + }, + { + "path": "skills/overnight-dev/SKILL.md", + "sha256": "3fd3db582ae58cb62fdfda3bb0ec8ed484ce317c94c2a65eb43ab49669aebf79" + }, + { + "path": "skills/overnight-dev/references/README.md", + "sha256": "6baf731a8e2f5b90367dc27da20e36b0e5a7836fe211d46d83f0889a9cb83c11" + }, + { + "path": "skills/overnight-dev/scripts/README.md", + "sha256": "0fa95e908d21cb8bef4feb6bb2f0185f812f9dc44d1c4a80978c58525c1cd982" + }, + { + "path": "skills/overnight-dev/assets/README.md", + "sha256": "d674853df7ee6923ec58e3b505b8c779cf7587c0a8c7f206195299484bce606b" + } + ], + "dirSha256": "de5bf81ca4a8df3b7d7fd046b294435c99462047cb1764dffebfc3208e4133ec" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/overnight-dev/SKILL.md b/skills/overnight-dev/SKILL.md new file mode 100644 index 0000000..fb3d848 --- /dev/null +++ b/skills/overnight-dev/SKILL.md @@ -0,0 +1,261 @@ +--- +name: overnight-development +description: | + Automates software development overnight using Git hooks to enforce test-driven development (TDD). + This skill activates when you request "overnight development", "autonomous coding", "work while I sleep", + or mention TDD workflows and Git hooks. It leverages Git hooks to block commits until all tests pass, + enforcing a rigorous TDD process and ensuring high-quality, production-ready code. Perfect for building + features autonomously - just define the goal and let Claude work overnight while tests enforce quality. +allowed-tools: Read, Write, Edit, Grep, Glob, Bash +version: 1.0.0 +--- + +# Overnight Development + +## Overview + +This skill automates software development overnight by leveraging Git hooks to enforce test-driven development (TDD). It ensures that all code changes are fully tested and meet specified quality standards before being committed. This approach allows Claude to work autonomously, building new features, refactoring existing code, or fixing bugs while adhering to a rigorous TDD process. + +## Core Capabilities + +- Enforces test-driven development (TDD) using Git hooks. +- Automates debugging and code fixing until all tests pass. +- Tracks progress and logs activities during overnight sessions. +- Supports flexible configuration for various testing frameworks and languages. +- Provides guidance and support through the `overnight-dev-coach` agent. + +## Workflow + +### Phase 1: Project Setup and Configuration + +To prepare the project for overnight development: + +1. **Verify Prerequisites:** Ensure the project is a Git repository, has a configured test framework, and includes at least one passing test. + ```bash + git init + npm install --save-dev jest # Example for Node.js + ``` + +2. **Install the Plugin:** Add the Claude Code Plugin marketplace and install the `overnight-dev` plugin. + ```bash + /plugin marketplace add jeremylongshore/claude-code-plugins + /plugin install overnight-dev@claude-code-plugins-plus + ``` + +3. **Run Setup Command:** Execute the `/overnight-setup` command to create necessary Git hooks and configuration files. + ```bash + /overnight-setup + ``` + +### Phase 2: Task Definition and Planning + +To define the task for the overnight session: + +1. **Define a Clear Goal:** Specify a clear and testable goal for the overnight session, such as "Build user authentication with JWT (90% coverage)." + ```text + Task: Build user authentication with JWT (90% coverage) + Success: All tests pass, 90%+ coverage, fully documented + ``` + +2. **Start Coding:** Begin implementing the feature by writing tests first, following the TDD approach. + ```javascript + // Example test case (Node.js with Jest) + it('should authenticate a user with valid credentials', async () => { + // Test implementation + }); + ``` + +3. **Attempt to Commit:** Try to commit the changes, which will trigger the Git hooks and run the tests. + ```bash + git commit -m "feat: implement user authentication" + ``` + +### Phase 3: Autonomous Development and Debugging + +To allow Claude to work autonomously: + +1. **Git Hooks Enforcement:** The Git hooks will block the commit if any tests fail, providing Claude with the error messages. + ```text + Overnight Dev: Running pre-commit checks... + Running linting... + Linting passed + Running tests... + 12 tests failing + Commit blocked! + ``` + +2. **Automated Debugging:** Claude analyzes the error messages, identifies the issues, and attempts to fix the code. + ```text + Claude: Fixing test failures in user authentication module. + ``` + +3. **Retry Commits:** Claude retries the commit after making the necessary fixes, repeating the process until all tests pass. + ```bash + git commit -m "fix: address test failures in user authentication" + ``` + +### Phase 4: Progress Tracking and Completion + +To monitor the progress and finalize the session: + +1. **Monitor Progress:** Track the progress of the overnight session by viewing the log file. + ```bash + cat .overnight-dev-log.txt + ``` + +2. **Review Results:** Wake up to fully tested code, complete features, and a clean Git history. + ```text + 7 AM: You wake up to: + - 47 passing tests (0 failing) + - 94% test coverage + - Clean conventional commit history + - Fully documented JWT authentication + - Production-ready code + ``` + +3. **Session Completion:** The session completes when all tests pass, the code meets the specified quality standards, and the changes are committed. + +## Using Bundled Resources + +### Scripts + +To automate the setup process, use the `overnight-setup.sh` script: + +```bash +./scripts/overnight-setup.sh +``` + +To track the progress of the overnight session, use the `progress-tracker.py` script: + +```bash +./scripts/progress-tracker.py --log .overnight-dev-log.txt +``` + +### References + +For detailed configuration options, load: + +- [Configuration Reference](./references/configuration_reference.md) + +For best practices on writing effective tests, load: + +- [Testing Best Practices](./references/testing_best_practices.md) + +### Assets + +Available templates: + +- `assets/commit-template.txt` - Template for generating commit messages. +- `assets/readme-template.md` - Template for generating README files. + +## Examples + +### Example 1: Building JWT Authentication + +User request: "Implement JWT authentication with 90% test coverage overnight." + +Workflow: + +1. Claude writes failing authentication tests (TDD). +2. Claude implements JWT signing (tests still failing). +3. Claude debugs token generation (commit blocked, keeps trying). +4. Tests pass! Commit succeeds. +5. Claude adds middleware (writes tests first). +6. Integration tests (debugging edge cases). +7. All tests green (Coverage: 94%). +8. Claude adds docs, refactors, still green. +9. Session complete. + +### Example 2: Refactoring Database Layer + +User request: "Refactor the database layer to use the repository pattern overnight." + +Workflow: + +1. Claude analyzes existing tests to ensure no regression. +2. Claude implements the repository pattern. +3. Tests are run; some fail due to changes in data access. +4. Claude updates tests to align with the new repository pattern. +5. All tests pass; commit succeeds. +6. Claude documents the refactored database layer. +7. Session complete. + +### Example 3: Fixing a Bug in Payment Processing + +User request: "Fix the bug in payment processing that causes incorrect amounts to be charged overnight." + +Workflow: + +1. Claude reproduces the bug and writes a failing test case. +2. Claude analyzes the code and identifies the root cause of the bug. +3. Claude fixes the bug and runs the tests. +4. The failing test case now passes; all other tests also pass. +5. Commit succeeds. +6. Claude adds a comment to the code explaining the fix. +7. Session complete. + +## Best Practices + +- Ensure that the task is well-defined and testable. +- Follow the TDD approach by writing tests before implementing features. +- Monitor the progress of the overnight session by viewing the log file. +- Configure the Git hooks and settings appropriately for the project. +- Use the `overnight-dev-coach` agent for guidance and support. + +## Troubleshooting + +**Issue:** Hooks are not running. + +**Solution:** Make sure the hooks are executable: + +```bash +chmod +x .git/hooks/pre-commit +chmod +x .git/hooks/commit-msg +``` + +**Issue:** Tests are failing immediately. + +**Solution:** Ensure you have at least one passing test: + +```bash +npm test # Should see: Tests passed +``` + +**Issue:** Lint errors are blocking everything. + +**Solution:** Enable auto-fix: + +```json +{ + "autoFix": true +} +``` + +Or fix manually: + +```bash +npm run lint -- --fix +``` + +## Integration + +This skill integrates with Git repositories and various testing frameworks. It uses Git hooks to enforce TDD and ensure that all code changes are fully tested. The `overnight-dev-coach` agent provides guidance and support throughout the process. + +```bash +# Example integration with Jest (Node.js) +{ + "testCommand": "npm test -- --coverage --watchAll=false", + "lintCommand": "npm run lint", + "autoFix": true +} +``` + +```bash +# Example integration with pytest (Python) +{ + "testCommand": "pytest --cov=. --cov-report=term-missing", + "lintCommand": "flake8 . && black --check .", + "autoFix": false +} +``` +``` diff --git a/skills/overnight-dev/assets/README.md b/skills/overnight-dev/assets/README.md new file mode 100644 index 0000000..3e93d0a --- /dev/null +++ b/skills/overnight-dev/assets/README.md @@ -0,0 +1 @@ +# Assets for overnight-dev diff --git a/skills/overnight-dev/references/README.md b/skills/overnight-dev/references/README.md new file mode 100644 index 0000000..bb438f2 --- /dev/null +++ b/skills/overnight-dev/references/README.md @@ -0,0 +1 @@ +# References for overnight-dev diff --git a/skills/overnight-dev/scripts/README.md b/skills/overnight-dev/scripts/README.md new file mode 100644 index 0000000..c7bcf61 --- /dev/null +++ b/skills/overnight-dev/scripts/README.md @@ -0,0 +1 @@ +# Scripts for overnight-dev