Skip to content

Commit 537a4d0

Browse files
authored
chore: Update claude.md, feat spec skill (#636)
* docs: Update CLAUDE.md and SKILL.md with guidelines on scope discipline and public/internal repo separation * docs: Add feature_spec.yml template for internal feature specifications * docs: Update CLAUDE.md and SKILL.md with scope discipline guidelines; modify feature_spec.yml title and placeholder * docs: Add guidelines for handling refactoring in CLAUDE.md and SKILL.md
1 parent 428bae9 commit 537a4d0

3 files changed

Lines changed: 102 additions & 46 deletions

File tree

.claude/skills/feature-spec/SKILL.md

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ You might have access to these resources during planning (paths marked "if avail
5858
Follow these when designing:
5959

6060
- **Simple > complex, ruthlessly minimal** — only what's explicitly in scope
61+
- **Reuse before creating.** Search for existing helpers, patterns, and utilities that already handle similar cases. Extend what exists rather than adding new abstractions.
62+
- **Smallest possible feature.** Design the minimal version that solves the problem. If you're adding new parameters, methods, or abstractions, ask: is there a simpler way using what's already there?
6163
- **Zod** for input validation, **HelperTools enum** for tool names
6264
- Integration tests go in `tests/integration/suite.ts`
6365
- Changes may affect `apify-mcp-server-internal` — always assess impact
@@ -75,65 +77,56 @@ During planning, explore:
7577
5. **MCP Apps spec/SDK** if the feature involves widgets or interactive UIs — check both the spec and `node_modules/@modelcontextprotocol/ext-apps`
7678
6. Use `mcp__apify-dev__*` and `mcp__apify-dev-ui__*` tools to test current behavior if the dev servers are running
7779

78-
Ask clarifying questions if the feature description is ambiguous. Prefer narrowing scope over guessing intent.
79-
80-
## Step 5: Produce the GitHub issue
81-
82-
When planning is complete, exit planning mode with `ExitPlanMode`, then create a GitHub issue using `gh issue create` with this structure:
80+
**Public/internal repo separation**: See `CLAUDE.md § Public/internal repo separation`.
8381

84-
```markdown
85-
## Context and motivation
86-
[Why this feature is needed]
87-
88-
## Scope
82+
Ask clarifying questions if the feature description is ambiguous. Prefer narrowing scope over guessing intent.
8983

90-
### In scope
91-
- [bullet list]
84+
## Step 5: Check existing issues
9285

93-
### Out of scope
94-
- [bullet list]
86+
Before creating anything, search for duplicates and related issues across all three repos:
9587

96-
## Technical design
88+
```
89+
gh issue list -R apify/apify-mcp-server --search "<feature keywords>" --json number,title,state
90+
gh issue list -R apify/ai-team --search "<feature keywords>" --json number,title,state
91+
gh issue list -R apify/apify-mcp-server-internal --search "<feature keywords>" --json number,title,state
92+
```
9793

98-
### Overview
99-
[High-level approach]
94+
If a matching issue exists, update it with `gh issue edit` instead of creating a new one. Reference related issues from other repos in the description.
10095

101-
### Detailed design
102-
[Implementation details, referencing existing code by file path]
96+
## Step 6: Produce GitHub issues
10397

104-
### Files to modify
105-
| File | Change |
106-
|------|--------|
107-
| `src/...` | Description |
98+
When planning is complete, exit planning mode with `ExitPlanMode`, then create issues.
10899

109-
### New files (if any)
110-
| File | Purpose |
111-
|------|---------|
112-
| `src/...` | Description |
100+
**One issue per implementation phase.** A phase ≈ one PR-sized unit of work (roughly 50–200 lines changed). Example: phase 1 = add the new Zod schema + types, phase 2 = wire up the tool handler + tests. If the feature has multiple phases, create a separate issue for each. Each issue should be independently implementable.
113101

114-
## Internal repo impact
115-
[Does apify-mcp-server-internal need changes? Check imports/usage.]
102+
Use the repo's `feature_spec.yml` template (not `feature_request.yml` — that one is for external users). Write **concrete, concise, no empty sections** issues. Only include sections that have real content for this specific issue.
116103

117-
## Testing strategy
104+
```markdown
105+
## Problem
106+
[Be concrete — numbers, error messages, user reports, Slack/issue links. "Users are confused" is weak; "3 users reported X in #channel" is strong.]
118107

119-
### Unit tests
120-
- [Key test cases, target files]
108+
## Proposed solution
109+
[Short explanation of the approach. Reference existing code paths. If files need changing, list them here inline — don't make a separate table unless there are 5+ files.]
121110

122-
### Integration tests
123-
- [Cases to add to tests/integration/suite.ts]
111+
## Plan
112+
- [ ] Step 1 (with PR links or assignees if known)
113+
- [ ] Step 2
114+
- [ ] ...
124115

125-
### Manual testing
126-
- [Steps using local dev servers, MCPJam, or ChatGPT]
116+
## Alternatives considered
117+
[Only if you actually evaluated other approaches. Skip if there's one obvious solution.]
118+
```
127119

128-
## Verification checklist
129-
- [ ] `npm run type-check` passes
130-
- [ ] `npm run lint` passes
131-
- [ ] `npm run test:unit` passes
132-
- [ ] Internal repo impact assessed
133-
- [ ] No breaking changes (or coordinated)
120+
**Style rules:**
121+
- Skip any section that would be empty or generic
122+
- Lead with real evidence (data, links, screenshots), not abstract motivation
123+
- Keep it short — the best issues are 10-30 lines, not 100
124+
- A checklist plan with concrete steps beats a wall of prose
134125

135-
## Open questions
136-
- [Anything needing human decision]
137-
```
126+
**Before presenting the issues**, self-review the design:
127+
- Is this the minimal design? Could the scope be smaller?
128+
- Am I reusing existing patterns or reinventing?
129+
- Could this be done by adjusting existing code rather than adding new code?
130+
- Does the feature require refactoring first? If so, split into a separate refactoring PR that must merge before the feature work begins. Never mix refactoring with feature changes — the combined diff is hard to review and easy to break.
138131

139-
Present the issue content to the user for review before creating it. Use `gh issue create` with appropriate title and labels.
132+
Present the issue content to the user for review before creating. Use `gh issue create` with appropriate title and `t-ai` labels.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Feature spec
2+
description: Internal feature specification with technical design and implementation plan
3+
title: "[spec] "
4+
labels: ["t-ai"]
5+
body:
6+
- type: textarea
7+
id: problem
8+
attributes:
9+
label: Problem
10+
description: >-
11+
Be concrete — include numbers, error messages, user reports, or
12+
Slack/issue links. "Users are confused" is weak; "3 users reported X in
13+
#channel" is strong.
14+
validations:
15+
required: true
16+
17+
- type: textarea
18+
id: solution
19+
attributes:
20+
label: Proposed solution
21+
description: >-
22+
Short explanation of the approach. Reference existing code paths and
23+
patterns. If files need changing, list them inline.
24+
validations:
25+
required: true
26+
27+
- type: textarea
28+
id: plan
29+
attributes:
30+
label: Plan
31+
description: >-
32+
Concrete steps as checkboxes. Include assignees and PR links if known.
33+
Skip for trivial changes.
34+
placeholder: |
35+
- [ ] Step 1
36+
- [ ] Step 2
37+
validations:
38+
required: false
39+
40+
- type: textarea
41+
id: alternatives
42+
attributes:
43+
label: Alternatives considered
44+
description: Other approaches evaluated and why they were rejected. Skip if there's one obvious solution.
45+
validations:
46+
required: false

CLAUDE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ The server can run in multiple modes:
1818
- **No over-engineering**: Solve the current problem, not hypothetical future ones
1919
- **No unsolicited features**: Don't add anything not explicitly requested by the human operator
2020

21+
## Scope discipline
22+
23+
- **Bug fix = bug fix.** When fixing a bug, fix only the bug. Don't refactor surrounding code, don't improve naming, don't add comments, don't "clean up while you're here."
24+
- **One thing per change.** Each change should do exactly one thing: fix a bug, add a feature, or refactor. Never combine. If you spot something unrelated that needs fixing, mention it — don't fix it.
25+
- **Test first.** For bug fixes, write a failing test that reproduces the bug before touching source code. Run it to confirm it fails. Then fix.
26+
- **Fix by adjusting, not adding.** Prefer a 1-line fix over a 10-line fix. Prefer adjusting existing code over adding new branches. Search for existing helpers and patterns that already handle similar cases. Ask: "Am I adding code, or fixing the code that's already there?"
27+
- **Self-review your diff.** Before declaring done, review: Is this the minimal fix? Am I reusing existing patterns? Did I leave any debug artifacts?
28+
- **Refactoring is a separate PR.** If a feature requires refactoring, do the refactoring first in its own PR, get it merged, then implement the feature. Never mix refactoring with feature work — the combined diff is hard to review and easy to break.
29+
2130
## ⚠️ MANDATORY: Verification after every implementation
2231

2332
**THIS IS NON-NEGOTIABLE. DO NOT SKIP.**
@@ -100,6 +109,14 @@ it('should do something awesome', async () => {
100109

101110
**IMPORTANT**: This package (`@apify/actors-mcp-server`) is used in the private `apify-mcp-server-internal` repository for the hosted server. Changes here may affect that server. Breaking changes must be coordinated; check whether updates are needed in `apify-mcp-server-internal` before submitting a PR. See README.md for canary (`beta`) releases via `pkg.pr.new`.
102111

112+
### Public/internal repo separation (see [internal#419](https://github.com/apify/apify-mcp-server-internal/issues/419))
113+
114+
- **Public repo** = core MCP server logic, interfaces, types (with generic/plain data types only)
115+
- **Internal repo** = backend/DB/proprietary logic (Redis, MongoDB, IAM auth, multi-node)
116+
- **Never** import private Apify libraries or internal DB schemas into the public repo — external users can't install them
117+
- **Expose methods on `ActorsMcpServer`**, not raw data exports via `./internals` — minimize the coupling surface
118+
- When designing a new feature, ask: can this land in one repo? Prefer exposing a method or interface over exporting internals that the other repo re-implements
119+
103120
## Further reading
104121

105122
- **[CONTRIBUTING.md](./CONTRIBUTING.md)** — coding standards, patterns, anti-patterns, commit format, PR guidelines, design system rules

0 commit comments

Comments
 (0)