Skip to content
Closed
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
162 changes: 162 additions & 0 deletions .agents/skills/periscope/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
```markdown
# periscope Development Patterns

> Auto-generated skill from repository analysis

## Overview

This skill teaches you the core development patterns, coding conventions, and workflows used in the `periscope` Go codebase. You'll learn how to add new database features, implement new parsers/providers, and develop features with proper tests and documentation. The guide covers file organization, code style, and step-by-step instructions for common contribution workflows.

---

## Coding Conventions

**File Naming**
- Use `snake_case` for file names.
- Example: `session_parser.go`, `db_utils.go`

**Imports**
- Use absolute import paths.
- Example:
```go
import "github.com/yourorg/periscope/internal/db"
```

**Exports**
- Use named exports for functions, types, and variables.
- Example:
```go
// Exported function
func NewSessionParser() *SessionParser {
// ...
}
```

**Commit Messages**
- Prefix with `fix:` or `feat:`
- Keep messages concise (~54 characters on average)
- Example: `feat: add support for new agent provider`

---

## Workflows

### Add or Update Database Feature
**Trigger:** When adding a new database-backed feature or modifying database structure/logic
**Command:** `/new-table`

1. Edit or add SQL schema files (e.g., `internal/db/schema.sql`).
2. Update Go code for database access and logic (e.g., `internal/db/*.go`).
3. Add or update trigger DDL and migration logic in Go (e.g., `internal/db/db.go`).
4. Write or update tests for new/changed database logic (e.g., `internal/db/*_test.go`, `cmd/agentsview/*_test.go`).
5. Update or add documentation/specs if the feature is significant (e.g., `docs/superpowers/specs/...`).

**Example:**
```sql
-- internal/db/schema.sql
ALTER TABLE sessions ADD COLUMN agent_version TEXT;
```
```go
// internal/db/session.go
func (db *DB) AddAgentVersion(sessionID int, version string) error {
// implementation
}
```
```go
// internal/db/session_test.go
func TestAddAgentVersion(t *testing.T) {
// test logic
}
```

---

### Add New Parser or Provider
**Trigger:** When supporting a new agent or data format
**Command:** `/add-parser`

1. Add new parser/provider Go files (e.g., `internal/parser/<provider>_provider.go`, `internal/parser/<provider>.go`).
2. Update provider registry or discovery (e.g., `internal/parser/provider.go`).
3. Add or update test data and test cases (e.g., `internal/parser/testdata/<provider>/*.json`, `internal/parser/<provider>_test.go`).
4. Integrate with sync engine if needed (e.g., `internal/sync/engine.go`).
5. Update documentation and format sources (e.g., `docs/internal/session-format-sources.md`, `docs/configuration.md`).
6. Update frontend agent lists if surfaced (e.g., `frontend/src/lib/utils/agents.ts`).

**Example:**
```go
// internal/parser/myagent_provider.go
type MyAgentProvider struct { /* ... */ }
func (p *MyAgentProvider) Parse(data []byte) (*Session, error) { /* ... */ }
```
```go
// internal/parser/provider.go
func init() {
RegisterProvider("myagent", &MyAgentProvider{})
}
```
```json
// internal/parser/testdata/myagent/sample.json
{ "session_id": 123, "agent": "myagent", ... }
```

---

### Feature Development with Tests and Docs
**Trigger:** When developing a new feature or major enhancement
**Command:** `/feature`

1. Implement feature in Go (e.g., `internal/<area>/*.go`).
2. Write or update tests (e.g., `internal/<area>/*_test.go`, `cmd/agentsview/*_test.go`).
3. Update or add documentation/specs (e.g., `docs/superpowers/specs/*.md`, `docs/configuration.md`).
4. Update frontend if feature is user-facing (e.g., `frontend/src/lib/utils/agents.ts`).

**Example:**
```go
// internal/feature/awesome.go
func EnableAwesomeFeature() error {
// feature logic
}
```
```go
// internal/feature/awesome_test.go
func TestEnableAwesomeFeature(t *testing.T) {
// test logic
}
```
```markdown
<!-- docs/superpowers/specs/awesome_feature.md -->
# Awesome Feature Spec
...
```

---

## Testing Patterns

- Test files use the pattern `*_test.go`.
- Tests are written using Go's standard `testing` package.
- Test data may be stored in `testdata` directories, often as JSON files for parsers.
- Example test file:
```go
// internal/parser/myagent_test.go
func TestMyAgentParser(t *testing.T) {
// Arrange
data, _ := ioutil.ReadFile("testdata/myagent/sample.json")
// Act
session, err := MyAgentProvider{}.Parse(data)
// Assert
if err != nil { t.Fatal(err) }
// Additional assertions...
}
```

---

## Commands

| Command | Purpose |
|--------------|----------------------------------------------------------------|
| /new-table | Add or update a database-backed feature or schema |
| /add-parser | Add support for a new agent/provider/parser |
| /feature | Implement a new feature or significant enhancement with tests |
```
6 changes: 6 additions & 0 deletions .agents/skills/periscope/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface:
display_name: "Periscope"
short_description: "Repo-specific patterns and workflows for periscope"
default_prompt: "Use the periscope repo skill to follow existing architecture, testing, and workflow conventions."
policy:
allow_implicit_invocation: true
42 changes: 42 additions & 0 deletions .claude/commands/add-new-parser-or-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: add-new-parser-or-provider
description: Workflow command scaffold for add-new-parser-or-provider in periscope.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /add-new-parser-or-provider

Use this workflow when working on **add-new-parser-or-provider** in `periscope`.

## Goal

Adds support for a new agent/provider/parser, including implementation, integration, and test coverage.

## Common Files

- `internal/parser/*_provider.go`
- `internal/parser/*.go`
- `internal/parser/testdata/*/*.json`
- `internal/parser/*_test.go`
- `internal/parser/provider.go`
- `internal/sync/engine.go`

## 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

- Add new parser/provider Go files (e.g., internal/parser/<provider>_provider.go, internal/parser/<provider>.go).
- Update provider registry or discovery (e.g., internal/parser/provider.go).
- Add or update test data and test cases (e.g., internal/parser/testdata/<provider>/*.json, internal/parser/<provider>_test.go).
- Integrate with sync engine if needed (e.g., internal/sync/engine.go).
- Update documentation and format sources (e.g., docs/internal/session-format-sources.md, docs/configuration.md).

## 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/add-or-update-database-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: add-or-update-database-feature
description: Workflow command scaffold for add-or-update-database-feature in periscope.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /add-or-update-database-feature

Use this workflow when working on **add-or-update-database-feature** in `periscope`.

## Goal

Implements a new database-backed feature or updates existing database logic, including schema changes, new tables, triggers, and related Go logic.

## Common Files

- `internal/db/schema.sql`
- `internal/db/*.go`
- `internal/db/*_test.go`
- `cmd/agentsview/*_test.go`
- `docs/superpowers/specs/*.md`

## 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 or add SQL schema files (e.g., internal/db/schema.sql).
- Update Go code for database access and logic (e.g., internal/db/*.go).
- Add or update trigger DDL and migration logic in Go (e.g., internal/db/db.go).
- Write or update tests for new/changed database logic (e.g., internal/db/*_test.go, cmd/agentsview/*_test.go).
- Update or add documentation/specs if the feature is significant (e.g., docs/superpowers/specs/...).

## 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/feature-development-with-tests-and-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: feature-development-with-tests-and-docs
description: Workflow command scaffold for feature-development-with-tests-and-docs in periscope.
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
---

# /feature-development-with-tests-and-docs

Use this workflow when working on **feature-development-with-tests-and-docs** in `periscope`.

## Goal

Implements a new feature or significant enhancement, accompanied by tests and documentation/specs.

## Common Files

- `internal/*/*.go`
- `internal/*/*_test.go`
- `cmd/agentsview/*_test.go`
- `docs/superpowers/specs/*.md`
- `docs/configuration.md`
- `frontend/src/lib/utils/agents.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

- Implement feature in Go (e.g., internal/<area>/*.go).
- Write or update tests (e.g., internal/<area>/*_test.go, cmd/agentsview/*_test.go).
- Update or add documentation/specs (e.g., docs/superpowers/specs/*.md, docs/configuration.md).
- Update frontend if feature is user-facing (e.g., frontend/src/lib/utils/agents.ts).

## Notes

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