Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .agents/skills/HopCode/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
```markdown
# HopCode Development Patterns

> Auto-generated skill from repository analysis

## Overview

This skill teaches the core development patterns, coding conventions, and collaborative workflows used in the HopCode TypeScript codebase. It covers how to structure features, manage configuration, handle merges, and write effective tests. The repository is organized into packages, uses conventional commits, and emphasizes modular, well-tested code.

## Coding Conventions

- **File Naming:**
Use camelCase for file and folder names.
_Example:_
```
packages/core/src/sharedTypes.ts
packages/webui/src/userProfile.tsx
```

- **Import Style:**
Use relative imports within packages.
_Example:_
```typescript
import { getUser } from './userService'
import { SharedType } from '../types/sharedTypes'
```

- **Export Style:**
Use named exports for all modules.
_Example:_
```typescript
// userService.ts
export function getUser(id: string) { ... }

// sharedTypes.ts
export type SharedType = { ... }
```

- **Commit Messages:**
Follow [Conventional Commits](https://www.conventionalcommits.org/) with prefixes like `feat`, `fix`, `perf`, `ci`, and `merge`.
_Example:_
```
feat: add user profile component and shared types
fix: correct import path in auth service
```

## Workflows

### Feature Development with Tests and Shared Components
**Trigger:** When adding a new feature or capability, especially spanning backend, frontend, and shared code
**Command:** `/new-feature`

1. Design or update the feature plan or documentation in `docs/plans/*.md`.
2. Implement backend logic or services in `packages/*/src/**/*.ts`.
3. Update or create shared types/interfaces in `packages/*/src/types/**/*.ts`.
4. Implement or update frontend/UI components in `packages/*/src/webview/components/**/*.tsx` or `packages/webui/src/components/**/*.tsx`.
5. Write or update corresponding tests in `*.test.ts` or `*.test.tsx` files.
6. Wire up the feature in main entry points, such as `packages/webui/src/index.ts`.

_Example:_
```typescript
// packages/core/src/userService.ts
export function getUser(id: string) { ... }

// packages/core/src/types/userTypes.ts
export type User = { id: string; name: string }

// packages/core/src/userService.test.ts
import { getUser } from './userService'
import { describe, it, expect } from 'vitest'

describe('getUser', () => {
it('returns a user object', () => {
expect(getUser('123')).toHaveProperty('id', '123')
})
})
```

---

### Infrastructure or Configuration Update
**Trigger:** When updating build scripts, CI/CD workflows, or project configuration
**Command:** `/update-config`

1. Edit configuration or workflow files, such as `package.json` or `.github/workflows/*.yml`.
2. Test changes locally or in CI.
3. Document the rationale in the commit message.

_Example:_
```yaml
# .github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm test
```

---

### Merge Upstream with Conflict Resolution
**Trigger:** When syncing the fork with upstream changes while preserving local modifications
**Command:** `/merge-upstream`

1. Fetch and merge the upstream branch.
2. Resolve file conflicts, especially in shared or heavily modified files.
3. Preserve local branding, architecture, and configuration.
4. Summarize merged features and conflict resolutions in the commit message.

_Example:_
```bash
git fetch upstream main
git merge upstream/main
# Resolve conflicts in packages/core/src/sharedTypes.ts, etc.
git commit -m "merge: sync with upstream and resolve shared type conflicts"
```

## Testing Patterns

- **Framework:** [Vitest](https://vitest.dev/)
- **Test File Pattern:** Files ending with `.test.ts` or `.test.tsx`
- **Placement:** Tests are located alongside implementation files or in dedicated test directories.

_Example:_
```typescript
// packages/webui/src/components/button.test.tsx
import { render } from '@testing-library/react'
import { Button } from './button'

describe('Button', () => {
it('renders with label', () => {
const { getByText } = render(<Button label="Click me" />)
expect(getByText('Click me')).toBeDefined()
})
})
```

## Commands

| Command | Purpose |
|-----------------|----------------------------------------------------------------|
| /new-feature | Start a new feature with backend, shared types, UI, and tests |
| /update-config | Update configuration, build scripts, or CI/CD workflows |
| /merge-upstream | Merge upstream changes and resolve conflicts |
```
6 changes: 6 additions & 0 deletions .agents/skills/HopCode/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface:
display_name: "HopCode"
short_description: "Repo-specific patterns and workflows for HopCode"
default_prompt: "Use the HopCode repo skill to follow existing architecture, testing, and workflow conventions."
policy:
allow_implicit_invocation: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: feature-development-with-tests-and-shared-components
description: Workflow command scaffold for feature-development-with-tests-and-shared-components in HopCode.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /feature-development-with-tests-and-shared-components

Use this workflow when working on **feature-development-with-tests-and-shared-components** in `HopCode`.

## Goal

Implements a new feature or capability, including backend logic, UI components, shared types, and corresponding tests. Frequently involves updating both implementation and test files, as well as shared type definitions and documentation/design plans.

## Common Files

- `docs/plans/*.md`
- `packages/*/src/**/*.ts`
- `packages/*/src/**/*.tsx`
- `packages/*/src/**/*.test.ts`
- `packages/*/src/**/*.test.tsx`
- `packages/*/src/types/**/*.ts`

## Suggested Sequence

1. Understand the current state and failure mode before editing.
2. Make the smallest coherent change that satisfies the workflow goal.
3. Run the most relevant verification for touched files.
4. Summarize what changed and what still needs review.

## Typical Commit Signals

- Design or update feature plan or documentation
- Implement backend logic or service
- Update or create shared types/interfaces
- Implement or update frontend/UI components
- Write or update corresponding tests

## Notes

- Treat this as a scaffold, not a hard-coded script.
- Update the command if the workflow evolves materially.
36 changes: 36 additions & 0 deletions .claude/commands/infrastructure-or-configuration-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: infrastructure-or-configuration-update
description: Workflow command scaffold for infrastructure-or-configuration-update in HopCode.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /infrastructure-or-configuration-update

Use this workflow when working on **infrastructure-or-configuration-update** in `HopCode`.

## Goal

Updates build scripts, CI/CD workflows, or project configuration to improve build reliability, compatibility, or automation (e.g., updating how scripts are invoked, changing workflow policies).

## Common Files

- `package.json`
- `.github/workflows/*.yml`

## Suggested Sequence

1. Understand the current state and failure mode before editing.
2. Make the smallest coherent change that satisfies the workflow goal.
3. Run the most relevant verification for touched files.
4. Summarize what changed and what still needs review.

## Typical Commit Signals

- Edit configuration or workflow files (e.g., package.json, .github/workflows/*.yml)
- Test changes locally or in CI
- Document rationale in commit message

## Notes

- Treat this as a scaffold, not a hard-coded script.
- Update the command if the workflow evolves materially.
41 changes: 41 additions & 0 deletions .claude/commands/merge-upstream-with-conflict-resolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: merge-upstream-with-conflict-resolution
description: Workflow command scaffold for merge-upstream-with-conflict-resolution in HopCode.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /merge-upstream-with-conflict-resolution

Use this workflow when working on **merge-upstream-with-conflict-resolution** in `HopCode`.

## Goal

Merges upstream changes into the current fork, applies conflict resolution, and ensures project-specific customizations (such as branding or architecture) are preserved.

## Common Files

- `.github/workflows/*.yml`
- `docs/plans/*.md`
- `package.json`
- `packages/*/src/**/*.ts`
- `packages/*/src/**/*.tsx`
- `packages/*/src/**/*.test.ts`

## Suggested Sequence

1. Understand the current state and failure mode before editing.
2. Make the smallest coherent change that satisfies the workflow goal.
3. Run the most relevant verification for touched files.
4. Summarize what changed and what still needs review.

## Typical Commit Signals

- Fetch and merge upstream branch
- Resolve file conflicts, especially in shared or heavily modified files
- Preserve local branding, architecture, and configuration
- Summarize merged features and conflict resolutions in commit message

## Notes

- Treat this as a scaffold, not a hard-coded script.
- Update the command if the workflow evolves materially.
Loading
Loading