code-completion-semantic-constraints

Solid

Automatically complete partial code snippets while satisfying semantic constraints including variable types, invariants, pre/post-conditions, interface contracts, and expected input/output behavior. Use when users provide incomplete code with specific requirements like "complete this function that takes a list and returns sorted unique elements" or "fill in this method body that must maintain the invariant that x stays positive" or "implement this interface method with these type constraints." Produces compilable, executable code with tests and a constraint satisfaction report.

AI & Automation 160 stars 17 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Code Completion with Semantic Constraints ## Overview Complete partial code snippets while satisfying specified semantic constraints. Produces compilable code, verification tests, and a detailed report explaining how each constraint was satisfied. ## Workflow ### 1. Parse Input Extract and categorize the provided information: **Partial Code**: Identify the incomplete code structure (function signature, class skeleton, method stub, etc.) **Semantic Constraints**: Categorize constraints by type: - **Type constraints**: Variable types, return types, generic bounds - **Invariants**: Pre-conditions, post-conditions, loop invariants - **Behavioral constraints**: Expected input/output pairs, edge case handling - **Interface contracts**: Method signatures, protocol conformance - **Performance constraints**: Time/space complexity requirements ### 2. Analyze Constraints For each constraint: - Determine if it's satisfiable - Identify dependencies between constraints - Note any conflicts or ambiguities - If constraints are unclear or conflicting, ask for clarification before proceeding ### 3. Complete the Code Generate code that: - Compiles without errors in the target language - Satisfies all specified constraints - Follows language idioms and best practices - Includes necessary imports, type annotations, and error handling - Uses minimal complexity (avoid over-engineering) ### 4. Generate Verification Tests Create minimal test cases that verify: - Type constraints are re...

Details

Author
ArabelaTso
Repository
ArabelaTso/Skills-4-SE
Created
6 months ago
Last Updated
today
Language
Python
License
Apache-2.0

Similar Skills

Semantically similar based on skill content — not just same category