Skip to content

Add Copilot instructions for repository-specific code generation#19

Merged
groupthinking merged 2 commits intomainfrom
copilot/setup-copilot-instructions
Feb 6, 2026
Merged

Add Copilot instructions for repository-specific code generation#19
groupthinking merged 2 commits intomainfrom
copilot/setup-copilot-instructions

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

GitHub Copilot generates better suggestions when provided project-specific context. Added comprehensive instructions covering this repository's patterns.

Changes

  • Created .github/copilot-instructions.md (336 lines)
    • TypeScript patterns: strict mode, ES modules, async/await conventions
    • Architecture: X API client, Grok AI service, MCP server, autonomous agent orchestrator
    • API integration patterns: simulation mode support, error handling, rate limiting
    • Security: credential management, input validation, no-log policies
    • Conventions: emoji-based logging (✅❌⚠️📬🤖), naming standards, file organization
    • Agent development principles: context awareness, explainability, graceful degradation

Key Patterns Documented

API Client Pattern:

async newFeature(param: string): Promise<Result> {
  if (this.config.simulation) {
    return this.mockResult();  // Always support simulation
  }
  
  try {
    const response = await fetch(/* API call */);
    if (!response.ok) throw new Error(`API error: ${response.status}`);
    return await response.json();
  } catch (error) {
    console.error('❌ Error:', error);
    throw error;
  }
}

Copilot will now suggest code that follows established patterns for error handling, simulation support, and logging conventions specific to this autonomous AI agent system.

Original prompt

This section details on the original issue you should resolve

<issue_title>✨ Set up Copilot instructions</issue_title>
<issue_description>Configure instructions for this repository as documented in Best practices for Copilot coding agent in your repository. [ [curl -fsSL https://openclaw.ai/install.sh | bash Learn more → (https://svelte.dev/packages) support for end-to-end API and service workflows across development, testing, and production.

Title: Prompt API
Shortname: prompt
Level: None
Status: CG-DRAFT
Group: webml
Repository: webmachinelearning/prompt-api
URL: https://webmachinelearning.github.io/prompt-api
Abstract: The prompt API gives web pages the ability to directly prompt a language model
Markup Shorthands: markdown yes, css no
Complain About: accidental-2119 yes, missing-example-ids yes
Assume Explicit For: yes
Default Biblio Status: current
Boilerplate: omit conformance
Indent: 2
Die On: warning

Introduction

TODO

Dependencies

This specification depends on the Infra Standard. [[!INFRA]]

As with the rest of the web platform, human languages are identified in these APIs by BCP 47 language tags, such as "ja", "en-US", "sr-Cyrl", or "de-CH-1901-x-phonebk-extended". The specific algorithms used for validation, canonicalization, and language tag matching are those from the ECMAScript Internationalization API Specification, which in turn defers some of its processing to Unicode Locale Data Markup Language (LDML). [[BCP47]] [[!ECMA-402]] [[UTS35]].

These APIs are part of a family of APIs expected to be powered by machine learning models, which share common API surface idioms and specification patterns. Currently, the specification text for these shared parts lives in [[WRITING-ASSISTANCE-APIS#supporting]], and the common privacy and security considerations are discussed in [[WRITING-ASSISTANCE-APIS#privacy]] and [[WRITING-ASSISTANCE-APIS#security]]. Implementing these APIs requires implementing that shared infrastructure, and conforming to those privacy and security considerations. But it does not require implementing or exposing the actual writing assistance APIs. [[!WRITING-ASSISTANCE-APIS]]

The API

<xmp class="idl"> [Exposed=Window, SecureContext] interface LanguageModel : EventTarget { static Promise create(optional LanguageModelCreateOptions options = {}); static Promise availability(optional LanguageModelCreateCoreOptions options = {}); static Promise params();

// These will throw "NotSupportedError" DOMExceptions if role = "system"
Promise prompt(
LanguageModelPrompt input,
optional LanguageModelPromptOptions options = {}
);
ReadableStream promptStreaming(
LanguageModelPrompt input,
optional LanguageModelPromptOptions options = {}
);
Promise append(
LanguageModelPrompt input,
optional LanguageModelAppendOptions options = {}
);

Promise measureInputUsage(
LanguageModelPrompt input,
optional LanguageModelPromptOptions options = {}
);
readonly attribute double inputUsage;
readonly attribute unrestricted double inputQuota;
attribute EventHandler onquotaoverflow;

readonly attribute unsigned long topK;
readonly attribute float temperature;

Promise clone(optional LanguageModelCloneOptions options = {});
undefined destroy();
};

[Exposed=Window, SecureContext]
interface LanguageModelParams {
readonly attribute unsigned long defaultTopK;
readonly attribute unsigned long maxTopK;
readonly attribute float defaultTemperature;
readonly attribute float maxTemperature;
};

callback LanguageModelToolFunction = Promise (any... arguments);

// A description of a tool call that a language model can invoke.
dictionary LanguageModelTool {
required DOMString name;
required DOMString description;
// JSON schema for the input parameters.
required object inputSchema;
// The function to be invoked by user agent on behalf of language model.
required LanguageModelToolFunction execute;
};

dictionary LanguageModelCreateCoreOptions {
// Note: these two have custom out-of-range handling behavior, not in the IDL layer.
// They are unrestricted double so as to allow +Infinity without failing.
unrestricted double topK;
unrestricted double temperature;

sequence expectedInputs;
sequence expectedOutputs;
sequence tools;
};

dictionary LanguageModelCreateOptions : LanguageModelCreateCoreOptions {
AbortSignal signal;
CreateMonitorCallback monitor;

sequence initialPrompts;
};

dictionary LanguageModelPromptOptions {
object responseConstraint;
boolean omitResponseConstraintInput = false;
AbortSignal signal;
};
...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: groupthinking <154503486+groupthinking@users.noreply.github.com>
Copilot AI changed the title [WIP] Set up Copilot instructions for repository Add Copilot instructions for repository-specific code generation Feb 5, 2026
Copilot AI requested a review from groupthinking February 5, 2026 12:41
@groupthinking groupthinking marked this pull request as ready for review February 6, 2026 09:34
Copilot AI review requested due to automatic review settings February 6, 2026 09:34
@groupthinking groupthinking merged commit 2904dff into main Feb 6, 2026
4 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Required environment variables (see `.env.example`):
- `X_USERNAME`: X account username to monitor
- `X_BEARER_TOKEN`: X API bearer token for read operations
- `X_CONSUMER_KEY`, `X_CONSUMER_SECRET`: OAuth 1.0a credentials
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect environment variable names. The codebase uses X_API_KEY and X_API_SECRET, not X_CONSUMER_KEY and X_CONSUMER_SECRET. These should be updated to match the actual variables used in src/services/config.ts and .env.example.

Suggested change
- `X_CONSUMER_KEY`, `X_CONSUMER_SECRET`: OAuth 1.0a credentials
- `X_API_KEY`, `X_API_SECRET`: OAuth 1.0a credentials

Copilot uses AI. Check for mistakes.

### Adding New Action Types

1. Add to `AgentActionType` enum in `types/index.ts`
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference to non-existent enum. The instructions mention adding to AgentActionType enum in types/index.ts, but this enum doesn't exist in the codebase. The action types are currently defined as a union type in the AgentAction interface: type: 'reply' | 'search' | 'generate' | 'analyze'. This guidance should be updated to reflect the actual type definition approach used.

Suggested change
1. Add to `AgentActionType` enum in `types/index.ts`
1. Update the `AgentAction['type']` union in `types/index.ts`

Copilot uses AI. Check for mistakes.
- **Interfaces/Types**: PascalCase (e.g., `AgentConfig`, `XApiResponse`)
- **Functions/Methods**: camelCase (e.g., `fetchMentions`, `analyzeAndDecide`)
- **Constants**: UPPER_SNAKE_CASE (e.g., `DEFAULT_POLLING_INTERVAL`)
- **Files**: kebab-case for multi-word (e.g., `x-api.ts`) or camelCase for single word
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent file naming convention description. The instructions state files should use "kebab-case for multi-word (e.g., x-api.ts) or camelCase for single word", but the actual codebase uses camelCase for all multi-word filenames: xapi.ts (not x-api.ts), grok.ts, agent.ts, config.ts, examples.ts, server.ts. The file naming convention should be corrected to reflect that the codebase uses camelCase consistently for TypeScript files.

Suggested change
- **Files**: kebab-case for multi-word (e.g., `x-api.ts`) or camelCase for single word
- **Files**: camelCase for all TypeScript files (including multi-word, e.g., `xapi.ts`, `grok.ts`, `agent.ts`)

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,336 @@
# GitHub Copilot Instructions for MyXstack
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description contains a large block of unrelated content about "Prompt API" and Web ML specifications that appears to be accidentally included. This content (starting with the <pre class='metadata'> section and the W3C-style specification) is completely unrelated to the GitHub Copilot instructions being added and should be removed from the PR description for clarity.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Set up Copilot instructions

2 participants