ai-engineering-kit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +33 -0
  3. package/README.md +65 -0
  4. package/dist/cli.js +675 -0
  5. package/package.json +56 -0
  6. package/template/agents/claude-code.CLAUDE.md +88 -0
  7. package/template/agents/codex.AGENTS.md +82 -0
  8. package/template/ai-workspace/brainstorms/.gitkeep +0 -0
  9. package/template/ai-workspace/plans/.gitkeep +0 -0
  10. package/template/ai-workspace/prds/.gitkeep +0 -0
  11. package/template/ai-workspace/research/.gitkeep +0 -0
  12. package/template/ai-workspace/reviews/.gitkeep +0 -0
  13. package/template/ai-workspace/runbooks/.gitkeep +0 -0
  14. package/template/ai-workspace/templates/.gitkeep +0 -0
  15. package/template/docs/foundations/product-vision.md +21 -0
  16. package/template/docs/foundations/project-guidelines.md +19 -0
  17. package/template/docs/foundations/technical-decisions.md +50 -0
  18. package/template/docs/foundations/testing-principles.md +13 -0
  19. package/template/skills/core-workflow/audit-architecture/REFERENCE.md +78 -0
  20. package/template/skills/core-workflow/audit-architecture/SKILL.md +76 -0
  21. package/template/skills/core-workflow/explore-design/SKILL.md +94 -0
  22. package/template/skills/core-workflow/implement/SKILL.md +107 -0
  23. package/template/skills/core-workflow/implement/deep-modules.md +33 -0
  24. package/template/skills/core-workflow/implement/interface-design.md +31 -0
  25. package/template/skills/core-workflow/implement/mocking.md +59 -0
  26. package/template/skills/core-workflow/implement/refactoring.md +10 -0
  27. package/template/skills/core-workflow/implement/tests.md +61 -0
  28. package/template/skills/core-workflow/investigate-bug/SKILL.md +104 -0
  29. package/template/skills/core-workflow/kickoff/SKILL.md +10 -0
  30. package/template/skills/core-workflow/load-context/SKILL.md +26 -0
  31. package/template/skills/core-workflow/plan-feature/SKILL.md +107 -0
  32. package/template/skills/core-workflow/plan-refactor/SKILL.md +68 -0
  33. package/template/skills/core-workflow/review/SKILL.md +127 -0
  34. package/template/skills/core-workflow/setup-foundations/SKILL.md +58 -0
  35. package/template/skills/core-workflow/verify-completion/SKILL.md +20 -0
  36. package/template/skills/core-workflow/write-prd/SKILL.md +74 -0
  37. package/template/skills/core-workflow/write-skill/SKILL.md +117 -0
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: implement
3
+ description: Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
4
+ ---
5
+
6
+ # Test-Driven Development
7
+
8
+ ## Philosophy
9
+
10
+ **Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
11
+
12
+ **Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
13
+
14
+ **Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
15
+
16
+ See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
17
+
18
+ ## Anti-Pattern: Horizontal Slices
19
+
20
+ **DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
21
+
22
+ This produces **crap tests**:
23
+
24
+ - Tests written in bulk test _imagined_ behavior, not _actual_ behavior
25
+ - You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
26
+ - Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
27
+ - You outrun your headlights, committing to test structure before understanding the implementation
28
+
29
+ **Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
30
+
31
+ ```
32
+ WRONG (horizontal):
33
+ RED: test1, test2, test3, test4, test5
34
+ GREEN: impl1, impl2, impl3, impl4, impl5
35
+
36
+ RIGHT (vertical):
37
+ RED→GREEN: test1→impl1
38
+ RED→GREEN: test2→impl2
39
+ RED→GREEN: test3→impl3
40
+ ...
41
+ ```
42
+
43
+ ## Workflow
44
+
45
+ ### 1. Planning
46
+
47
+ Before writing any code:
48
+
49
+ - [ ] Confirm with user what interface changes are needed
50
+ - [ ] Confirm with user which behaviors to test (prioritize)
51
+ - [ ] Identify opportunities for [deep modules](deep-modules.md) (small interface, deep implementation)
52
+ - [ ] Design interfaces for [testability](interface-design.md)
53
+ - [ ] List the behaviors to test (not implementation steps)
54
+ - [ ] Get user approval on the plan
55
+
56
+ Ask: "What should the public interface look like? Which behaviors are most important to test?"
57
+
58
+ **You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
59
+
60
+ ### 2. Tracer Bullet
61
+
62
+ Write ONE test that confirms ONE thing about the system:
63
+
64
+ ```
65
+ RED: Write test for first behavior → test fails
66
+ GREEN: Write minimal code to pass → test passes
67
+ ```
68
+
69
+ This is your tracer bullet - proves the path works end-to-end.
70
+
71
+ ### 3. Incremental Loop
72
+
73
+ For each remaining behavior:
74
+
75
+ ```
76
+ RED: Write next test → fails
77
+ GREEN: Minimal code to pass → passes
78
+ ```
79
+
80
+ Rules:
81
+
82
+ - One test at a time
83
+ - Only enough code to pass current test
84
+ - Don't anticipate future tests
85
+ - Keep tests focused on observable behavior
86
+
87
+ ### 4. Refactor
88
+
89
+ After all tests pass, look for [refactor candidates](refactoring.md):
90
+
91
+ - [ ] Extract duplication
92
+ - [ ] Deepen modules (move complexity behind simple interfaces)
93
+ - [ ] Apply SOLID principles where natural
94
+ - [ ] Consider what new code reveals about existing code
95
+ - [ ] Run tests after each refactor step
96
+
97
+ **Never refactor while RED.** Get to GREEN first.
98
+
99
+ ## Checklist Per Cycle
100
+
101
+ ```
102
+ [ ] Test describes behavior, not implementation
103
+ [ ] Test uses public interface only
104
+ [ ] Test would survive internal refactor
105
+ [ ] Code is minimal for this test
106
+ [ ] No speculative features added
107
+ ```
@@ -0,0 +1,33 @@
1
+ # Deep Modules
2
+
3
+ From "A Philosophy of Software Design":
4
+
5
+ **Deep module** = small interface + lots of implementation
6
+
7
+ ```
8
+ ┌─────────────────────┐
9
+ │ Small Interface │ ← Few methods, simple params
10
+ ├─────────────────────┤
11
+ │ │
12
+ │ │
13
+ │ Deep Implementation│ ← Complex logic hidden
14
+ │ │
15
+ │ │
16
+ └─────────────────────┘
17
+ ```
18
+
19
+ **Shallow module** = large interface + little implementation (avoid)
20
+
21
+ ```
22
+ ┌─────────────────────────────────┐
23
+ │ Large Interface │ ← Many methods, complex params
24
+ ├─────────────────────────────────┤
25
+ │ Thin Implementation │ ← Just passes through
26
+ └─────────────────────────────────┘
27
+ ```
28
+
29
+ When designing interfaces, ask:
30
+
31
+ - Can I reduce the number of methods?
32
+ - Can I simplify the parameters?
33
+ - Can I hide more complexity inside?
@@ -0,0 +1,31 @@
1
+ # Interface Design for Testability
2
+
3
+ Good interfaces make testing natural:
4
+
5
+ 1. **Accept dependencies, don't create them**
6
+
7
+ ```typescript
8
+ // Testable
9
+ function processOrder(order, paymentGateway) {}
10
+
11
+ // Hard to test
12
+ function processOrder(order) {
13
+ const gateway = new StripeGateway();
14
+ }
15
+ ```
16
+
17
+ 2. **Return results, don't produce side effects**
18
+
19
+ ```typescript
20
+ // Testable
21
+ function calculateDiscount(cart): Discount {}
22
+
23
+ // Hard to test
24
+ function applyDiscount(cart): void {
25
+ cart.total -= discount;
26
+ }
27
+ ```
28
+
29
+ 3. **Small surface area**
30
+ - Fewer methods = fewer tests needed
31
+ - Fewer params = simpler test setup
@@ -0,0 +1,59 @@
1
+ # When to Mock
2
+
3
+ Mock at **system boundaries** only:
4
+
5
+ - External APIs (payment, email, etc.)
6
+ - Databases (sometimes - prefer test DB)
7
+ - Time/randomness
8
+ - File system (sometimes)
9
+
10
+ Don't mock:
11
+
12
+ - Your own classes/modules
13
+ - Internal collaborators
14
+ - Anything you control
15
+
16
+ ## Designing for Mockability
17
+
18
+ At system boundaries, design interfaces that are easy to mock:
19
+
20
+ **1. Use dependency injection**
21
+
22
+ Pass external dependencies in rather than creating them internally:
23
+
24
+ ```typescript
25
+ // Easy to mock
26
+ function processPayment(order, paymentClient) {
27
+ return paymentClient.charge(order.total);
28
+ }
29
+
30
+ // Hard to mock
31
+ function processPayment(order) {
32
+ const client = new StripeClient(process.env.STRIPE_KEY);
33
+ return client.charge(order.total);
34
+ }
35
+ ```
36
+
37
+ **2. Prefer SDK-style interfaces over generic fetchers**
38
+
39
+ Create specific functions for each external operation instead of one generic function with conditional logic:
40
+
41
+ ```typescript
42
+ // GOOD: Each function is independently mockable
43
+ const api = {
44
+ getUser: (id) => fetch(`/users/${id}`),
45
+ getOrders: (userId) => fetch(`/users/${userId}/orders`),
46
+ createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
47
+ };
48
+
49
+ // BAD: Mocking requires conditional logic inside the mock
50
+ const api = {
51
+ fetch: (endpoint, options) => fetch(endpoint, options),
52
+ };
53
+ ```
54
+
55
+ The SDK approach means:
56
+ - Each mock returns one specific shape
57
+ - No conditional logic in test setup
58
+ - Easier to see which endpoints a test exercises
59
+ - Type safety per endpoint
@@ -0,0 +1,10 @@
1
+ # Refactor Candidates
2
+
3
+ After TDD cycle, look for:
4
+
5
+ - **Duplication** → Extract function/class
6
+ - **Long methods** → Break into private helpers (keep tests on public interface)
7
+ - **Shallow modules** → Combine or deepen
8
+ - **Feature envy** → Move logic to where data lives
9
+ - **Primitive obsession** → Introduce value objects
10
+ - **Existing code** the new code reveals as problematic
@@ -0,0 +1,61 @@
1
+ # Good and Bad Tests
2
+
3
+ ## Good Tests
4
+
5
+ **Integration-style**: Test through real interfaces, not mocks of internal parts.
6
+
7
+ ```typescript
8
+ // GOOD: Tests observable behavior
9
+ test("user can checkout with valid cart", async () => {
10
+ const cart = createCart();
11
+ cart.add(product);
12
+ const result = await checkout(cart, paymentMethod);
13
+ expect(result.status).toBe("confirmed");
14
+ });
15
+ ```
16
+
17
+ Characteristics:
18
+
19
+ - Tests behavior users/callers care about
20
+ - Uses public API only
21
+ - Survives internal refactors
22
+ - Describes WHAT, not HOW
23
+ - One logical assertion per test
24
+
25
+ ## Bad Tests
26
+
27
+ **Implementation-detail tests**: Coupled to internal structure.
28
+
29
+ ```typescript
30
+ // BAD: Tests implementation details
31
+ test("checkout calls paymentService.process", async () => {
32
+ const mockPayment = jest.mock(paymentService);
33
+ await checkout(cart, payment);
34
+ expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
35
+ });
36
+ ```
37
+
38
+ Red flags:
39
+
40
+ - Mocking internal collaborators
41
+ - Testing private methods
42
+ - Asserting on call counts/order
43
+ - Test breaks when refactoring without behavior change
44
+ - Test name describes HOW not WHAT
45
+ - Verifying through external means instead of interface
46
+
47
+ ```typescript
48
+ // BAD: Bypasses interface to verify
49
+ test("createUser saves to database", async () => {
50
+ await createUser({ name: "Alice" });
51
+ const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
52
+ expect(row).toBeDefined();
53
+ });
54
+
55
+ // GOOD: Verifies through interface
56
+ test("createUser makes user retrievable", async () => {
57
+ const user = await createUser({ name: "Alice" });
58
+ const retrieved = await getUser(user.id);
59
+ expect(retrieved.name).toBe("Alice");
60
+ });
61
+ ```
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: investigate-bug
3
+ description: Triage a bug or issue by exploring the codebase to find root cause, then write a local markdown report with a TDD-based fix plan. Use when user reports a bug, wants to investigate a problem, mentions "triage", or wants to plan a fix.
4
+ ---
5
+
6
+ # Triage Issue
7
+
8
+ Investigate a reported problem, find its root cause, and write a local markdown report in `ai/bugs/` with a TDD fix plan. This is a mostly hands-off workflow - minimize questions to the user.
9
+
10
+ To track externally, run `gh issue create` (or your tracker's equivalent) on the resulting file after.
11
+
12
+ ## Process
13
+
14
+ ### 1. Capture the problem
15
+
16
+ Get a brief description of the issue from the user. If they haven't provided one, ask ONE question: "What's the problem you're seeing?"
17
+
18
+ Do NOT ask follow-up questions yet. Start investigating immediately.
19
+
20
+ ### 2. Explore and diagnose
21
+
22
+ Use the Agent tool with subagent_type=Explore to deeply investigate the codebase. Your goal is to find:
23
+
24
+ - **Where** the bug manifests (entry points, UI, API responses)
25
+ - **What** code path is involved (trace the flow)
26
+ - **Why** it fails (the root cause, not just the symptom)
27
+ - **What** related code exists (similar patterns, tests, adjacent modules)
28
+
29
+ Look at:
30
+ - Related source files and their dependencies
31
+ - Existing tests (what's tested, what's missing)
32
+ - Recent changes to affected files (`git log` on relevant files)
33
+ - Error handling in the code path
34
+ - Similar patterns elsewhere in the codebase that work correctly
35
+
36
+ ### 3. Identify the fix approach
37
+
38
+ Based on your investigation, determine:
39
+
40
+ - The minimal change needed to fix the root cause
41
+ - Which modules/interfaces are affected
42
+ - What behaviors need to be verified via tests
43
+ - Whether this is a regression, missing feature, or design flaw
44
+
45
+ ### 4. Design TDD fix plan
46
+
47
+ Create a concrete, ordered list of RED-GREEN cycles. Each cycle is one vertical slice:
48
+
49
+ - **RED**: Describe a specific test that captures the broken/missing behavior
50
+ - **GREEN**: Describe the minimal code change to make that test pass
51
+
52
+ Rules:
53
+ - Tests verify behavior through public interfaces, not implementation details
54
+ - One test at a time, vertical slices (NOT all tests first, then all code)
55
+ - Each test should survive internal refactors
56
+ - Include a final refactor step if needed
57
+ - **Durability**: Only suggest fixes that would survive radical codebase changes. Describe behaviors and contracts, not internal structure. Tests assert on observable outcomes (API responses, UI state, user-visible effects), not internal state. A good suggestion reads like a spec; a bad one reads like a diff.
58
+
59
+ ### 5. Write the bug report
60
+
61
+ Create `ai/bugs/` if it doesn't exist. Write the report to `ai/bugs/<YYYY-MM-DD>-<slug>.md` using the template below. Do NOT ask the user to review before writing — just write it and share the path.
62
+
63
+ <issue-template>
64
+
65
+ ## Problem
66
+
67
+ A clear description of the bug or issue, including:
68
+ - What happens (actual behavior)
69
+ - What should happen (expected behavior)
70
+ - How to reproduce (if applicable)
71
+
72
+ ## Root Cause Analysis
73
+
74
+ Describe what you found during investigation:
75
+ - The code path involved
76
+ - Why the current code fails
77
+ - Any contributing factors
78
+
79
+ Do NOT include specific file paths, line numbers, or implementation details that couple to current code layout. Describe modules, behaviors, and contracts instead. The issue should remain useful even after major refactors.
80
+
81
+ ## TDD Fix Plan
82
+
83
+ A numbered list of RED-GREEN cycles:
84
+
85
+ 1. **RED**: Write a test that [describes expected behavior]
86
+ **GREEN**: [Minimal change to make it pass]
87
+
88
+ 2. **RED**: Write a test that [describes next behavior]
89
+ **GREEN**: [Minimal change to make it pass]
90
+
91
+ ...
92
+
93
+ **REFACTOR**: [Any cleanup needed after all tests pass]
94
+
95
+ ## Acceptance Criteria
96
+
97
+ - [ ] Criterion 1
98
+ - [ ] Criterion 2
99
+ - [ ] All new tests pass
100
+ - [ ] Existing tests still pass
101
+
102
+ </issue-template>
103
+
104
+ After writing the file, print the file path and a one-line summary of the root cause.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: kickoff
3
+ description: Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree. Use when user wants to start a plan, kick off a feature or refactor, stress-test a design, or mentions "grill me".
4
+ ---
5
+
6
+ Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
7
+
8
+ Ask the questions one at a time.
9
+
10
+ If a question can be answered by exploring the codebase, explore the codebase instead.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: load-context
3
+ description: Load relevant project context at the start of a session or when picking up in-flight work. Use when starting a new conversation, resuming a feature, or when the user mentions continuity — read the relevant PRD in ai/prds/ and the active plan in ai/plans/.
4
+ ---
5
+
6
+ # Load Context
7
+
8
+ Run at session start or when the user asks to pick up previous work.
9
+
10
+ ## Steps
11
+
12
+ 1. Identify the in-flight initiative from the user's prompt or the current branch name.
13
+ 2. List `ai/prds/` and read the matching PRD (if any).
14
+ 3. List `ai/plans/` and read the matching plan. Plans carry status via checkboxes — that is the authoritative source for "what is done and what is next."
15
+ 4. Skim `ai/brainstorms/` only if the PRD references one and the rationale is unclear without it.
16
+ 5. Confirm with the user what to focus on before starting work.
17
+
18
+ ## When to trigger
19
+
20
+ - User opens a new session mentioning ongoing work
21
+ - User says "pick up where we left off", "continue", or references a feature by name
22
+ - CLAUDE.md instructs: "When picking up in-flight work or the user mentions continuity"
23
+
24
+ ## What NOT to do
25
+
26
+ Do not invent a session doc to record this conversation's state. Plans-with-checkboxes are the durable status record. If something genuinely needs to survive into the next conversation and does not fit in the plan, add it to the plan itself or save it to memory.
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: plan-feature
3
+ description: Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in ./plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".
4
+ ---
5
+
6
+ # PRD to Plan
7
+
8
+ Break a PRD into a phased implementation plan using vertical slices (tracer bullets). Output is a Markdown file in `./plans/`.
9
+
10
+ ## Process
11
+
12
+ ### 1. Confirm the PRD is in context
13
+
14
+ The PRD should already be in the conversation. If it isn't, ask the user to paste it or point you to the file.
15
+
16
+ ### 2. Explore the codebase
17
+
18
+ If you have not already explored the codebase, do so to understand the current architecture, existing patterns, and integration layers.
19
+
20
+ ### 3. Identify durable architectural decisions
21
+
22
+ Before slicing, identify high-level decisions that are unlikely to change throughout implementation:
23
+
24
+ - Route structures / URL patterns
25
+ - Database schema shape
26
+ - Key data models
27
+ - Authentication / authorization approach
28
+ - Third-party service boundaries
29
+
30
+ These go in the plan header so every phase can reference them.
31
+
32
+ ### 4. Draft vertical slices
33
+
34
+ Break the PRD into **tracer bullet** phases. Each phase is a thin vertical slice that cuts through ALL integration layers end-to-end, NOT a horizontal slice of one layer.
35
+
36
+ <vertical-slice-rules>
37
+ - Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)
38
+ - A completed slice is demoable or verifiable on its own
39
+ - Prefer many thin slices over few thick ones
40
+ - Do NOT include specific file names, function names, or implementation details that are likely to change as later phases are built
41
+ - DO include durable decisions: route paths, schema shapes, data model names
42
+ </vertical-slice-rules>
43
+
44
+ ### 5. Quiz the user
45
+
46
+ Present the proposed breakdown as a numbered list. For each phase show:
47
+
48
+ - **Title**: short descriptive name
49
+ - **User stories covered**: which user stories from the PRD this addresses
50
+
51
+ Ask the user:
52
+
53
+ - Does the granularity feel right? (too coarse / too fine)
54
+ - Should any phases be merged or split further?
55
+
56
+ Iterate until the user approves the breakdown.
57
+
58
+ ### 6. Write the plan file
59
+
60
+ Create `./plans/` if it doesn't exist. Write the plan as a Markdown file named after the feature (e.g. `./plans/user-onboarding.md`). Use the template below.
61
+
62
+ <plan-template>
63
+ # Plan: <Feature Name>
64
+
65
+ > Source PRD: <brief identifier or link>
66
+
67
+ ## Architectural decisions
68
+
69
+ Durable decisions that apply across all phases:
70
+
71
+ - **Routes**: ...
72
+ - **Schema**: ...
73
+ - **Key models**: ...
74
+ - (add/remove sections as appropriate)
75
+
76
+ ---
77
+
78
+ ## Phase 1: <Title>
79
+
80
+ **User stories**: <list from PRD>
81
+
82
+ ### What to build
83
+
84
+ A concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.
85
+
86
+ ### Acceptance criteria
87
+
88
+ - [ ] Criterion 1
89
+ - [ ] Criterion 2
90
+ - [ ] Criterion 3
91
+
92
+ ---
93
+
94
+ ## Phase 2: <Title>
95
+
96
+ **User stories**: <list from PRD>
97
+
98
+ ### What to build
99
+
100
+ ...
101
+
102
+ ### Acceptance criteria
103
+
104
+ - [ ] ...
105
+
106
+ <!-- Repeat for each phase -->
107
+ </plan-template>
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: plan-refactor
3
+ description: Create a detailed refactor plan with tiny commits via user interview, then file it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.
4
+ ---
5
+
6
+ This skill will be invoked when the user wants to create a refactor request. You should go through the steps below. You may skip steps if you don't consider them necessary.
7
+
8
+ 1. Ask the user for a long, detailed description of the problem they want to solve and any potential ideas for solutions.
9
+
10
+ 2. Explore the repo to verify their assertions and understand the current state of the codebase.
11
+
12
+ 3. Ask whether they have considered other options, and present other options to them.
13
+
14
+ 4. Interview the user about the implementation. Be extremely detailed and thorough.
15
+
16
+ 5. Hammer out the exact scope of the implementation. Work out what you plan to change and what you plan not to change.
17
+
18
+ 6. Look in the codebase to check for test coverage of this area of the codebase. If there is insufficient test coverage, ask the user what their plans for testing are.
19
+
20
+ 7. Break the implementation into a plan of tiny commits. Remember Martin Fowler's advice to "make each refactoring step as small as possible, so that you can always see the program working."
21
+
22
+ 8. Create a GitHub issue with the refactor plan. Use the following template for the issue description:
23
+
24
+ <refactor-plan-template>
25
+
26
+ ## Problem Statement
27
+
28
+ The problem that the developer is facing, from the developer's perspective.
29
+
30
+ ## Solution
31
+
32
+ The solution to the problem, from the developer's perspective.
33
+
34
+ ## Commits
35
+
36
+ A LONG, detailed implementation plan. Write the plan in plain English, breaking down the implementation into the tiniest commits possible. Each commit should leave the codebase in a working state.
37
+
38
+ ## Decision Document
39
+
40
+ A list of implementation decisions that were made. This can include:
41
+
42
+ - The modules that will be built/modified
43
+ - The interfaces of those modules that will be modified
44
+ - Technical clarifications from the developer
45
+ - Architectural decisions
46
+ - Schema changes
47
+ - API contracts
48
+ - Specific interactions
49
+
50
+ Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
51
+
52
+ ## Testing Decisions
53
+
54
+ A list of testing decisions that were made. Include:
55
+
56
+ - A description of what makes a good test (only test external behavior, not implementation details)
57
+ - Which modules will be tested
58
+ - Prior art for the tests (i.e. similar types of tests in the codebase)
59
+
60
+ ## Out of Scope
61
+
62
+ A description of the things that are out of scope for this refactor.
63
+
64
+ ## Further Notes (optional)
65
+
66
+ Any further notes about the refactor.
67
+
68
+ </refactor-plan-template>