Create Source Spec
Use this skill when the task is to author or repair a Coral source spec.
Goal
Produce a valid, queryable Coral source spec that works with:
coral source add --file <path>
- and
- for source variables and secrets
Default Mode
Default to standalone source authoring for external developers.
That means:
- create a YAML source spec file
- lint it early with
- add it to Coral with
coral source add --file <path>
when you need to exercise it as a source
- validate by querying it
- iterate until the shape is correct
Only switch to repo-bundled layout when the user is explicitly editing the Coral repo.
Output Modes
- External authoring:
- create a standalone source spec such as
- validate structure with
coral source lint ./my-source.yaml
- load it with
coral source add --file ./my-source.yaml
when you need to query it through Coral
- Coral repo contribution:
- write the source spec to
sources/<name>/manifest.yaml
- add representative for a basic smoke/connection check of the source
- validate with and repo checks
Workflow
- Read the provider API docs or inspect the local dataset.
- Start with one small table and a few columns.
- Define:
- source metadata
- backend
- base URL or file location
- auth
- variables and secrets
- tables
- filters
- response extraction
- pagination
- typed columns
- Lint the source spec:
- Validate the source in the right mode:
- standalone specs:
coral source add --file <path>
and inspect with
- is non-interactive by default: each input is read from the matching environment variable. Export required variables and secrets before running, or pass to be prompted.
- named or repo-bundled sources:
- Inspect the exposed shape:
- inspect
- inspect
- inspect to verify variables, secrets, defaults, hints, and required flags
- Query representative tables with .
- If you are relying on , make sure gives you a basic smoke/connection check for the source.
- Refine the spec and repeat.
Authoring Rules
- Start small and expand table coverage incrementally.
- Use the source manifest schema as both inspiration for authoring and validation of structure: https://github.com/withcoral/coral/blob/main/crates/coral-spec/src/schema/source_manifest.schema.json
- Use source variables for non-secret configuration.
- Use source secrets for credentials.
- Keep table names stable and SQL-friendly.
- Mark filters as required only when the API truly requires them.
- Prefer explicit pagination when the API shape is known.
- Verify pagination with actual row fetches, not only .
- Add or update when you want to perform a basic smoke/connection check.
Metadata UX Rules
Use these rules for top-level source metadata so source discovery and setup are consistent.
- Start with .
- Make the first sentence capability-first: list the key entities users can query.
- Preferred template:
Query <entities> from <Provider> (<Cloud or self-hosted when relevant>).
- Keep focused on data coverage, not setup steps.
- Do not use vague phrasing such as:
- Move auth/setup/permission details to input hints, not description text.
Input hints ()
Each hint should tell the user:
- what value is expected
- how to obtain it
- minimum scope/permission guidance
- one concrete format/example when useful
Specific guidance:
- For URL/base inputs:
- say what the default means
- include at least one concrete example
- include self-hosted guidance when supported
- For secrets:
- name the exact credential type (API key, PAT, application key, etc.)
- include format constraints when relevant (for example, token prefixes)
- include least-privilege scope guidance
- For derived secrets (for example Basic auth blobs):
- include a short shell example (for example a Base64 command)
- Prefer stable documentation links.
- Use official docs links and stable settings pages.
- Avoid brittle click-path instructions as the primary guidance.
Keep hints concise and directly actionable.
Validation Loop
Use this loop during authoring:
sh
# Export any required inputs first (key matches the input `key` in the spec),
# or pass --interactive to be prompted.
coral source lint ./my-source.yaml
coral source add --file ./my-source.yaml
coral sql "SELECT * FROM coral.tables WHERE schema_name = 'my_source'"
coral sql "SELECT * FROM coral.columns WHERE schema_name = 'my_source'"
coral sql "SELECT key, kind, value, default_value, hint, required, is_set FROM coral.inputs WHERE schema_name = 'my_source' ORDER BY key"
For repo-bundled or already-named sources, add
for a basic smoke/connection check and run:
sh
coral source test my_source
Then run targeted table queries until the source behaves correctly.
HTTP Sources
For HTTP-backed sources:
- define
- define
- define auth headers
- define request path, query, and body only where needed
- define response
- define pagination explicitly when the provider pattern is known
- define typed columns
- add once you know which simple query or queries should confirm the source basically works
Read
references/http-source-checklist.md
when you need table-shape and pagination guidance.
If your HTTP source uses an Authorization header with a prefix (e.g.
Authorization: Bearer <token>
), you can use a secret input for the token and define the header as a template:
yaml
auth:
headers:
- name: Authorization
from: template
template: Bearer {{input.FOOBAR_API_KEY}}
Local Data Sources
For local file-backed sources:
- define the file backend
- define the source location
- define file selection patterns if applicable
- define typed columns
Deliverable
Report:
- source spec path
- lint / add / test commands used
- validation commands run
- assumptions made
- blocked or unverified endpoints